Search in sources :

Example 66 with NodeRunConstructionResult

use of org.olat.course.run.navigation.NodeRunConstructionResult in project openolat by klemens.

the class IQTESTCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller controller;
    // Do not allow guests to start tests
    Roles roles = ureq.getUserSession().getRoles();
    Translator trans = Util.createPackageTranslator(IQTESTCourseNode.class, ureq.getLocale());
    if (roles.isGuestOnly()) {
        if (isGuestAllowedForQTI21(getReferencedRepositoryEntry())) {
            controller = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
        } else {
            String title = trans.translate("guestnoaccess.title");
            String message = trans.translate("guestnoaccess.message");
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
        }
    } else {
        ModuleConfiguration config = getModuleConfiguration();
        boolean onyx = IQEditController.CONFIG_VALUE_QTI2.equals(config.get(IQEditController.CONFIG_KEY_TYPE_QTI));
        if (onyx) {
            Translator transe = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", transe.translate("error.onyx"));
        } else {
            RepositoryEntry testEntry = getReferencedRepositoryEntry();
            OLATResource ores = testEntry.getOlatResource();
            if (ImsQTI21Resource.TYPE_NAME.equals(ores.getResourceableTypeName())) {
                // QTI 2.1
                controller = new QTI21AssessmentRunController(ureq, wControl, userCourseEnv, this);
            } else {
                // QTI 1.2
                TestFileResource fr = new TestFileResource();
                fr.overrideResourceableId(ores.getResourceableId());
                if (!CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(fr, null)) {
                    AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
                    IQSecurityCallback sec = new CourseIQSecurityCallback(this, am, ureq.getIdentity());
                    controller = new IQRunController(userCourseEnv, getModuleConfiguration(), sec, ureq, wControl, this, testEntry);
                } else {
                    String title = trans.translate("editor.lock.title");
                    String message = trans.translate("editor.lock.message");
                    controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
                }
            }
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_iqtest_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) AssessmentManager(org.olat.course.assessment.AssessmentManager) OLATResource(org.olat.resource.OLATResource) Roles(org.olat.core.id.Roles) RepositoryEntry(org.olat.repository.RepositoryEntry) QTI21AssessmentRunController(org.olat.course.nodes.iq.QTI21AssessmentRunController) IQIdentityListCourseNodeController(org.olat.course.nodes.iq.IQIdentityListCourseNodeController) IQRunController(org.olat.course.nodes.iq.IQRunController) QTI21AssessmentDetailsController(org.olat.ims.qti21.ui.QTI21AssessmentDetailsController) IQPreviewController(org.olat.course.nodes.iq.IQPreviewController) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) QTI12ResultDetailsController(org.olat.ims.qti.QTI12ResultDetailsController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) Controller(org.olat.core.gui.control.Controller) TestFileResource(org.olat.ims.qti.fileresource.TestFileResource) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) Translator(org.olat.core.gui.translator.Translator) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback)

Example 67 with NodeRunConstructionResult

use of org.olat.course.run.navigation.NodeRunConstructionResult in project openolat by klemens.

the class InfoCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    InfoRunController infoCtrl = new InfoRunController(ureq, wControl, userCourseEnv, ne, this);
    Controller titledCtrl = TitledWrapperHelper.getWrapper(ureq, wControl, infoCtrl, this, "o_infomsg_icon");
    return new NodeRunConstructionResult(titledCtrl);
}
Also used : InfoRunController(org.olat.course.nodes.info.InfoRunController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) InfoRunController(org.olat.course.nodes.info.InfoRunController) InfoCourseNodeEditController(org.olat.course.nodes.info.InfoCourseNodeEditController) InfoPeekViewController(org.olat.course.nodes.info.InfoPeekViewController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 68 with NodeRunConstructionResult

use of org.olat.course.run.navigation.NodeRunConstructionResult in project openolat by klemens.

the class ViteroCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller runCtr;
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = Util.createPackageTranslator(ViteroPeekViewController.class, ureq.getLocale());
        String title = trans.translate("guestnoaccess.title");
        String message = trans.translate("guestnoaccess.message");
        runCtr = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        // check if user is moderator of the virtual classroom
        boolean moderator = roles.isOLATAdmin();
        Long key = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
        if (!moderator) {
            if (roles.isInstitutionalResourceManager() | roles.isAuthor()) {
                RepositoryManager rm = RepositoryManager.getInstance();
                ICourse course = CourseFactory.loadCourse(key);
                RepositoryEntry re = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
                if (re != null) {
                    moderator = rm.isOwnerOfRepositoryEntry(ureq.getIdentity(), re);
                    if (!moderator) {
                        moderator = rm.isInstitutionalRessourceManagerFor(ureq.getIdentity(), ureq.getUserSession().getRoles(), re);
                    }
                }
            }
        }
        // create run controller
        Long resourceId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
        OLATResourceable ores = OresHelper.createOLATResourceableInstance(CourseModule.class, resourceId);
        String courseTitle = userCourseEnv.getCourseEnvironment().getCourseTitle();
        runCtr = new ViteroBookingsRunController(ureq, wControl, null, ores, getIdent(), courseTitle, moderator, userCourseEnv.isCourseReadOnly());
    }
    Controller controller = TitledWrapperHelper.getWrapper(ureq, wControl, runCtr, this, "o_vitero_icon");
    return new NodeRunConstructionResult(controller);
}
Also used : Translator(org.olat.core.gui.translator.Translator) OLATResourceable(org.olat.core.id.OLATResourceable) Roles(org.olat.core.id.Roles) RepositoryManager(org.olat.repository.RepositoryManager) ICourse(org.olat.course.ICourse) ViteroBookingsRunController(org.olat.modules.vitero.ui.ViteroBookingsRunController) RepositoryEntry(org.olat.repository.RepositoryEntry) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) ViteroBookingsRunController(org.olat.modules.vitero.ui.ViteroBookingsRunController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) ViteroEditController(org.olat.course.nodes.vitero.ViteroEditController) ViteroPeekViewController(org.olat.course.nodes.vitero.ViteroPeekViewController) ConditionEditController(org.olat.course.condition.ConditionEditController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 69 with NodeRunConstructionResult

use of org.olat.course.run.navigation.NodeRunConstructionResult in project openolat by klemens.

the class TACourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.CourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller controller;
    // Do not allow guests to access tasks
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
        String title = trans.translate(NLS_GUESTNOACCESS_TITLE);
        String message = trans.translate(NLS_GUESTNOACCESS_MESSAGE);
        controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        controller = new TACourseNodeRunController(ureq, wControl, userCourseEnv, this, ne, false);
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_ta_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : PackageTranslator(org.olat.core.gui.translator.PackageTranslator) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) TACourseNodeRunController(org.olat.course.nodes.ta.TACourseNodeRunController) Roles(org.olat.core.id.Roles) MSEditFormController(org.olat.course.nodes.ms.MSEditFormController) TACourseNodeRunController(org.olat.course.nodes.ta.TACourseNodeRunController) TAIdentityListCourseNodeController(org.olat.course.nodes.ta.TAIdentityListCourseNodeController) TACourseNodeEditController(org.olat.course.nodes.ta.TACourseNodeEditController) TaskController(org.olat.course.nodes.ta.TaskController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) DropboxController(org.olat.course.nodes.ta.DropboxController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) DropboxScoringViewController(org.olat.course.nodes.ta.DropboxScoringViewController) ReturnboxController(org.olat.course.nodes.ta.ReturnboxController) Controller(org.olat.core.gui.control.Controller) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 70 with NodeRunConstructionResult

use of org.olat.course.run.navigation.NodeRunConstructionResult in project openolat by klemens.

the class OpenMeetingsCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Roles roles = ureq.getUserSession().getRoles();
    // check if user is moderator of the virtual classroom
    boolean admin = roles.isOLATAdmin();
    boolean moderator = admin;
    RepositoryEntry re = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    if (!admin) {
        RepositoryManager rm = RepositoryManager.getInstance();
        if (re != null) {
            admin = rm.isOwnerOfRepositoryEntry(ureq.getIdentity(), re) || rm.isInstitutionalRessourceManagerFor(ureq.getIdentity(), roles, re);
            moderator = admin || rm.isIdentityInTutorSecurityGroup(ureq.getIdentity(), re) || isCoach(re, ureq.getIdentity());
        }
    }
    // create run controller
    OLATResourceable ores = OresHelper.clone(userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseResource());
    Controller runCtr = new OpenMeetingsRunController(ureq, wControl, null, ores, getIdent(), admin, moderator, userCourseEnv.isCourseReadOnly());
    Controller controller = TitledWrapperHelper.getWrapper(ureq, wControl, runCtr, this, "o_openmeetings_icon");
    return new NodeRunConstructionResult(controller);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) OpenMeetingsRunController(org.olat.modules.openmeetings.ui.OpenMeetingsRunController) Roles(org.olat.core.id.Roles) RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) OpenMeetingsEditController(org.olat.course.nodes.openmeetings.OpenMeetingsEditController) OpenMeetingsPeekViewController(org.olat.course.nodes.openmeetings.OpenMeetingsPeekViewController) OpenMeetingsRunController(org.olat.modules.openmeetings.ui.OpenMeetingsRunController) CPEditController(org.olat.course.nodes.cp.CPEditController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) OpenMeetingsRoomEditController(org.olat.modules.openmeetings.ui.OpenMeetingsRoomEditController) ConditionEditController(org.olat.course.condition.ConditionEditController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Aggregations

NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)72 Controller (org.olat.core.gui.control.Controller)62 NodeEditController (org.olat.course.editor.NodeEditController)62 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)60 Translator (org.olat.core.gui.translator.Translator)36 Roles (org.olat.core.id.Roles)36 ConditionEditController (org.olat.course.condition.ConditionEditController)22 AssessmentCourseNodeController (org.olat.course.assessment.ui.tool.AssessmentCourseNodeController)20 RepositoryEntry (org.olat.repository.RepositoryEntry)18 PackageTranslator (org.olat.core.gui.translator.PackageTranslator)12 OLATResourceable (org.olat.core.id.OLATResourceable)10 IdentityListCourseNodeController (org.olat.course.assessment.ui.tool.IdentityListCourseNodeController)8 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)6 ICourse (org.olat.course.ICourse)6 AssessmentManager (org.olat.course.assessment.AssessmentManager)6 CourseIQSecurityCallback (org.olat.course.nodes.iq.CourseIQSecurityCallback)6 IQEditController (org.olat.course.nodes.iq.IQEditController)6 RepositoryManager (org.olat.repository.RepositoryManager)6 BusinessControl (org.olat.core.id.context.BusinessControl)4 BusinessControlFactory (org.olat.core.id.context.BusinessControlFactory)4