Search in sources :

Example 1 with Condition

use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.

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)

Example 2 with Condition

use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.

the class ViteroEditController method event.

@Override
protected 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 == editForm) {
    // nothing to do
    }
}
Also used : Condition(org.olat.course.condition.Condition)

Example 3 with Condition

use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.

the class FeedNodeEditController method event.

@Override
public void event(UserRequest urequest, Controller source, Event event) {
    if (source == moderatroCtr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = moderatroCtr.getCondition();
            node.setPreConditionModerator(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == posterCtr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = posterCtr.getCondition();
            node.setPreConditionPoster(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == readerCtr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = readerCtr.getCondition();
            node.setPreConditionReader(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == searchController) {
        cmc.deactivate();
        // repository search controller done
        if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
            RepositoryEntry re = searchController.getSelectedEntry();
            if (re != null) {
                config.set(AbstractFeedCourseNode.CONFIG_KEY_REPOSITORY_SOFTKEY, re.getSoftkey());
                contentVC.contextPut("showPreviewLink", Boolean.TRUE);
                String displayname = StringHelper.escapeHtml(re.getDisplayname());
                previewLink = LinkFactory.createCustomLink("command.preview", "command.preview", displayname, Link.NONTRANSLATED, contentVC, this);
                previewLink.setIconLeftCSS("o_icon o_icon-fw o_icon_preview");
                previewLink.setCustomEnabledLinkCSS("o_preview");
                previewLink.setTitle(getTranslator().translate("command.preview"));
                // no securitycheck on feeds, editable by everybody
                editLink = LinkFactory.createButtonSmall("edit", contentVC, this);
                // fire event so the updated config is saved by the
                // editormaincontroller
                fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
            }
        }
    // else cancelled repo search
    } else if (source == cmcFeedCtr) {
        if (event == CloseableModalController.CLOSE_MODAL_EVENT) {
            cmcFeedCtr.dispose();
            feedController.dispose();
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 4 with Condition

use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.

the class FOCourseNodeEditController 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 urequest, Controller source, Event event) {
    if (source == readerCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = readerCondContr.getCondition();
            foNode.setPreConditionReader(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == posterCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = posterCondContr.getCondition();
            foNode.setPreConditionPoster(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == moderatorCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = moderatorCondContr.getCondition();
            foNode.setPreConditionModerator(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == settingsCtrl) {
        if (event == Event.CHANGED_EVENT) {
            String pseudoAllowed = settingsCtrl.isPseudonymPostAllowed() ? "true" : "false";
            foNode.getModuleConfiguration().setStringValue(PSEUDONYM_POST_ALLOWED, pseudoAllowed);
            String defaultPseudo = settingsCtrl.isDefaultPseudonym() ? "true" : "false";
            foNode.getModuleConfiguration().setStringValue(PSEUDONYM_POST_DEFAULT, defaultPseudo);
            String guestAllowed = settingsCtrl.isGuestPostAllowed() ? "true" : "false";
            foNode.getModuleConfiguration().setStringValue(GUEST_POST_ALLOWED, guestAllowed);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition)

Example 5 with Condition

use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.

the class DialogCourseNodeEditController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == elementsEditCtrl) {
        if (event == Event.CHANGED_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == readerCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = readerCondContr.getCondition();
            courseNode.setPreConditionReader(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == posterCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = posterCondContr.getCondition();
            courseNode.setPreConditionPoster(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == moderatorCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = moderatorCondContr.getCondition();
            courseNode.setPreConditionModerator(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition)

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