Search in sources :

Example 51 with NodeRunConstructionResult

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

the class IQSURVCourseNode 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) {
    Controller controller;
    // Do not allow guests to start questionnaires
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
        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 trans = Util.createPackageTranslator(IQEditController.class, ureq.getLocale());
            controller = MessageUIFactory.createInfoMessage(ureq, wControl, "", trans.translate("error.onyx"));
        } else {
            RepositoryEntry repositoryEntry = getReferencedRepositoryEntry();
            OLATResourceable ores = repositoryEntry.getOlatResource();
            Long resId = ores.getResourceableId();
            SurveyFileResource fr = new SurveyFileResource();
            fr.overrideResourceableId(resId);
            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);
            } else {
                Translator trans = Util.createPackageTranslator(IQSURVCourseNode.class, ureq.getLocale());
                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_iqsurv_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : ModuleConfiguration(org.olat.modules.ModuleConfiguration) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback) IQRunController(org.olat.course.nodes.iq.IQRunController) OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentManager(org.olat.course.assessment.AssessmentManager) Roles(org.olat.core.id.Roles) RepositoryEntry(org.olat.repository.RepositoryEntry) IQEditController(org.olat.course.nodes.iq.IQEditController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) Controller(org.olat.core.gui.control.Controller) IQRunController(org.olat.course.nodes.iq.IQRunController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) SurveyFileResource(org.olat.ims.qti.fileresource.SurveyFileResource) Translator(org.olat.core.gui.translator.Translator) PackageTranslator(org.olat.core.gui.translator.PackageTranslator) IQSecurityCallback(org.olat.modules.iq.IQSecurityCallback) CourseIQSecurityCallback(org.olat.course.nodes.iq.CourseIQSecurityCallback)

Example 52 with NodeRunConstructionResult

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

the class BCCourseNode 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);
    BCCourseNodeRunController bcCtrl = new BCCourseNodeRunController(ureq, wControl, userCourseEnv, this, ne);
    if (StringHelper.containsNonWhitespace(nodecmd)) {
        bcCtrl.activatePath(ureq, nodecmd);
    }
    Controller titledCtrl = TitledWrapperHelper.getWrapper(ureq, wControl, bcCtrl, this, "o_bc_icon");
    return new NodeRunConstructionResult(titledCtrl);
}
Also used : BCCourseNodeRunController(org.olat.course.nodes.bc.BCCourseNodeRunController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) BCPreviewController(org.olat.course.nodes.bc.BCPreviewController) BCPeekviewController(org.olat.course.nodes.bc.BCPeekviewController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) BCCourseNodeRunController(org.olat.course.nodes.bc.BCCourseNodeRunController) BCCourseNodeEditController(org.olat.course.nodes.bc.BCCourseNodeEditController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 53 with NodeRunConstructionResult

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

the class BlogCourseNode method createNodeRunConstructionResult.

/**
 * @see org.olat.course.nodes.AbstractAccessableCourseNode#createNodeRunConstructionResult(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.WindowControl,
 *      org.olat.course.run.userview.UserCourseEnvironment,
 *      org.olat.course.run.userview.NodeEvaluation, java.lang.String)
 */
@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    RepositoryEntry entry = getReferencedRepositoryEntry();
    // create business path courseID:nodeID
    // userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    // getIdent();
    Long courseId = userCourseEnv.getCourseEnvironment().getCourseResourceableId();
    String nodeId = this.getIdent();
    boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isGuest = ureq.getUserSession().getRoles().isGuestOnly();
    boolean isOwner = RepositoryManager.getInstance().isOwnerOfRepositoryEntry(ureq.getIdentity(), entry);
    FeedSecurityCallback callback;
    if (userCourseEnv.isCourseReadOnly()) {
        callback = new FeedReadOnlySecurityCallback();
    } else {
        callback = new FeedNodeSecurityCallback(ne, isAdmin, isOwner, isGuest);
    }
    SubscriptionContext subsContext = CourseModule.createSubscriptionContext(userCourseEnv.getCourseEnvironment(), this);
    callback.setSubscriptionContext(subsContext);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(this));
    FeedMainController blogCtr = BlogUIFactory.getInstance(ureq.getLocale()).createMainController(entry.getOlatResource(), ureq, wControl, callback, courseId, nodeId);
    List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType(nodecmd);
    blogCtr.activate(ureq, entries, null);
    Controller wrapperCtrl = TitledWrapperHelper.getWrapper(ureq, wControl, blogCtr, this, "o_blog_icon");
    NodeRunConstructionResult result = new NodeRunConstructionResult(wrapperCtrl);
    return result;
}
Also used : FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) FeedSecurityCallback(org.olat.modules.webFeed.FeedSecurityCallback) RepositoryEntry(org.olat.repository.RepositoryEntry) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) FeedMainController(org.olat.modules.webFeed.ui.FeedMainController) BlogNodeEditController(org.olat.course.nodes.feed.blog.BlogNodeEditController) FeedNodeEditController(org.olat.course.nodes.feed.FeedNodeEditController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) FeedPeekviewController(org.olat.course.nodes.feed.FeedPeekviewController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) ContextEntry(org.olat.core.id.context.ContextEntry) FeedNodeSecurityCallback(org.olat.course.nodes.feed.FeedNodeSecurityCallback) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) FeedReadOnlySecurityCallback(org.olat.modules.webFeed.FeedReadOnlySecurityCallback)

Example 54 with NodeRunConstructionResult

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

the class CheckListCourseNode 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, final UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller ctrl;
    OLATResourceable ores = OresHelper.createOLATResourceableInstance("CourseModule", userCourseEnv.getCourseEnvironment().getCourseResourceableId());
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = Util.createPackageTranslator(CheckListCourseNode.class, ureq.getLocale());
        String title = trans.translate("guestnoaccess.title");
        String message = trans.translate("guestnoaccess.message");
        ctrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else if (userCourseEnv.isCoach() || userCourseEnv.isAdmin()) {
        ctrl = new CheckListRunForCoachController(ureq, wControl, userCourseEnv, ores, this);
    } else {
        ctrl = new CheckListRunController(ureq, wControl, userCourseEnv, ores, this);
    }
    Controller cont = TitledWrapperHelper.getWrapper(ureq, wControl, ctrl, this, ICON_CSS_CLASS);
    return new NodeRunConstructionResult(cont);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) Translator(org.olat.core.gui.translator.Translator) CheckListRunForCoachController(org.olat.course.nodes.cl.ui.CheckListRunForCoachController) Roles(org.olat.core.id.Roles) CheckListRunController(org.olat.course.nodes.cl.ui.CheckListRunController) AssessedIdentityCheckListController(org.olat.course.nodes.cl.ui.AssessedIdentityCheckListController) NodeEditController(org.olat.course.editor.NodeEditController) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) IdentityListCourseNodeController(org.olat.course.assessment.ui.tool.IdentityListCourseNodeController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) CheckListEditController(org.olat.course.nodes.cl.ui.CheckListEditController) Controller(org.olat.core.gui.control.Controller) CheckListRunController(org.olat.course.nodes.cl.ui.CheckListRunController) CheckListRunForCoachController(org.olat.course.nodes.cl.ui.CheckListRunForCoachController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

Example 55 with NodeRunConstructionResult

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

the class BasicLTICourseNode 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 runCtrl;
    if (userCourseEnv.isCourseReadOnly()) {
        Translator trans = Util.createPackageTranslator(BasicLTICourseNode.class, ureq.getLocale());
        String title = trans.translate("freezenoaccess.title");
        String message = trans.translate("freezenoaccess.message");
        runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        Roles roles = ureq.getUserSession().getRoles();
        if (roles.isGuestOnly()) {
            if (isGuestAllowed()) {
                Translator trans = Util.createPackageTranslator(BasicLTICourseNode.class, ureq.getLocale());
                String title = trans.translate("guestnoaccess.title");
                String message = trans.translate("guestnoaccess.message");
                runCtrl = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
            } else {
                runCtrl = new LTIRunController(wControl, getModuleConfiguration(), ureq, this, userCourseEnv);
            }
        } else {
            runCtrl = new LTIRunController(wControl, getModuleConfiguration(), ureq, this, userCourseEnv);
        }
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, runCtrl, this, "o_lti_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : Translator(org.olat.core.gui.translator.Translator) Roles(org.olat.core.id.Roles) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) IdentityListCourseNodeController(org.olat.course.assessment.ui.tool.IdentityListCourseNodeController) AssessmentCourseNodeController(org.olat.course.assessment.ui.tool.AssessmentCourseNodeController) LTIResultDetailsController(org.olat.ims.lti.ui.LTIResultDetailsController) LTIEditController(org.olat.course.nodes.basiclti.LTIEditController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) LTIRunController(org.olat.course.nodes.basiclti.LTIRunController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult) LTIRunController(org.olat.course.nodes.basiclti.LTIRunController)

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