Search in sources :

Example 36 with Condition

use of org.olat.course.condition.Condition in project openolat by klemens.

the class PortfolioCourseNode method getPreConditionEdit.

/**
 * Default set the write privileges to coaches and admin only
 * @return
 */
public Condition getPreConditionEdit() {
    if (preConditionEdit == null) {
        preConditionEdit = new Condition();
        preConditionEdit.setEasyModeCoachesAndAdmins(true);
        preConditionEdit.setConditionExpression(preConditionEdit.getConditionFromEasyModeConfiguration());
        preConditionEdit.setExpertMode(false);
    }
    preConditionEdit.setConditionId(EDIT_CONDITION_ID);
    return preConditionEdit;
}
Also used : Condition(org.olat.course.condition.Condition)

Example 37 with Condition

use of org.olat.course.condition.Condition in project openolat by klemens.

the class DialogCourseNode method getPreConditionModerator.

/**
 * @return Returns the preConditionModerator.
 */
public Condition getPreConditionModerator() {
    if (this.preConditionModerator == null) {
        this.preConditionModerator = new Condition();
        // learner should not be able to delete files by default
        this.preConditionModerator.setEasyModeCoachesAndAdmins(true);
        this.preConditionModerator.setEasyModeAlwaysAllowCoachesAndAdmins(true);
        this.preConditionModerator.setConditionExpression("(  ( isCourseCoach(0) | isCourseAdministrator(0) ) )");
    }
    this.preConditionModerator.setConditionId("moderator");
    return this.preConditionModerator;
}
Also used : Condition(org.olat.course.condition.Condition)

Example 38 with Condition

use of org.olat.course.condition.Condition in project openolat by klemens.

the class WikiCourseNode method getConditionExpressions.

@Override
public List<ConditionExpression> getConditionExpressions() {
    List<ConditionExpression> parentConditions = super.getConditionExpressions();
    List<ConditionExpression> conditions = new ArrayList<>();
    if (parentConditions != null && parentConditions.size() > 0) {
        conditions.addAll(parentConditions);
    }
    Condition editCondition = getPreConditionEdit();
    if (editCondition != null && StringHelper.containsNonWhitespace(editCondition.getConditionExpression())) {
        ConditionExpression ce = new ConditionExpression(editCondition.getConditionId());
        ce.setExpressionString(editCondition.getConditionExpression());
        conditions.add(ce);
    }
    return conditions;
}
Also used : Condition(org.olat.course.condition.Condition) ConditionExpression(org.olat.course.condition.interpreter.ConditionExpression) ArrayList(java.util.ArrayList)

Example 39 with Condition

use of org.olat.course.condition.Condition in project openolat by klemens.

the class LTIEditController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == accessibilityCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = accessibilityCondContr.getCondition();
            courseNode.setPreConditionAccess(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == ltConfigForm) {
        if (event == Event.CANCELLED_EVENT) {
        // do nothing
        } else if (event == Event.DONE_EVENT) {
            config = ltConfigForm.getUpdatedConfig();
            updateHighscoreTab();
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
            // form valid -> node config valid -> show preview button
            myContent.contextPut("showPreviewButton", Boolean.TRUE);
        }
    } else if (source == highScoreNodeConfigController) {
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == previewLayoutCtr) {
        removeAsListenerAndDispose(previewLayoutCtr);
    }
}
Also used : Condition(org.olat.course.condition.Condition)

Example 40 with Condition

use of org.olat.course.condition.Condition in project openolat by klemens.

the class PreviewRunController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
 */
@Override
public void event(UserRequest ureq, Component source, Event event) {
    if (source == luTree) {
        if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
            TreeEvent tev = (TreeEvent) event;
            // goto node:
            // after a click in the tree, evaluate the model anew, set the tree
            // model anew, and set the selection of the tree again
            NodeClickedRef nclr = navHandler.evaluateJumpToTreeNode(ureq, getWindowControl(), treeModel, tev, this, null, currentNodeController);
            if (!nclr.isVisible()) {
                getWindowControl().setWarning(translate("warn.notvisible"));
                return;
            }
            if (nclr.isHandledBySubTreeModelListener()) {
                // not used:
                return;
            }
            // set the new treemodel
            treeModel = nclr.getTreeModel();
            luTree.setTreeModel(treeModel);
            // set the new tree selection
            luTree.setSelectedNodeId(nclr.getSelectedNodeId());
            luTree.setOpenNodeIds(nclr.getOpenNodeIds());
            // get the controller (in this case it is a preview controller). Dispose only if not already disposed in navHandler.evaluateJumpToTreeNode()
            if (nclr.getRunController() != null) {
                if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
                    currentNodeController.dispose();
                }
                currentNodeController = nclr.getRunController();
            }
            CourseNode cn = nclr.getCalledCourseNode();
            if (cn != null) {
                Condition c = cn.getPreConditionVisibility();
                String visibilityExpr = (c.getConditionExpression() == null ? translate("details.visibility.none") : c.getConditionExpression());
                detail.contextPut("visibilityExpr", visibilityExpr);
                detail.contextPut("coursenode", cn);
                currentCourseNode = cn;
            }
            Component nodeComp = currentNodeController.getInitialComponent();
            content.setContent(nodeComp);
        }
    } else if (source == configButton) {
        fireEvent(ureq, new Event("command.config"));
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) Condition(org.olat.course.condition.Condition) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) Event(org.olat.core.gui.control.Event) OlatCmdEvent(org.olat.core.gui.components.htmlsite.OlatCmdEvent) CourseNode(org.olat.course.nodes.CourseNode) NodeClickedRef(org.olat.course.run.navigation.NodeClickedRef) Component(org.olat.core.gui.components.Component)

Aggregations

Condition (org.olat.course.condition.Condition)94 ModuleConfiguration (org.olat.modules.ModuleConfiguration)10 ArrayList (java.util.ArrayList)8 CourseNode (org.olat.course.nodes.CourseNode)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 ConditionExpression (org.olat.course.condition.interpreter.ConditionExpression)6 Checklist (de.bps.olat.modules.cl.Checklist)4 DeliveryOptions (org.olat.core.gui.control.generic.iframe.DeliveryOptions)4 ICourse (org.olat.course.ICourse)4 ConditionEditController (org.olat.course.condition.ConditionEditController)4 NodeEditController (org.olat.course.editor.NodeEditController)4 StatusDescription (org.olat.course.editor.StatusDescription)4 AbstractAccessableCourseNode (org.olat.course.nodes.AbstractAccessableCourseNode)4 ScoreCalculator (org.olat.course.run.scoring.ScoreCalculator)4 CourseEditorTreeNode (org.olat.course.tree.CourseEditorTreeNode)4 CourseNodeVO (org.olat.restapi.support.vo.CourseNodeVO)4 ChecklistEditController (de.bps.course.nodes.cl.ChecklistEditController)2 Checkpoint (de.bps.olat.modules.cl.Checkpoint)2 Date (java.util.Date)2 List (java.util.List)2