Search in sources :

Example 61 with Condition

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

the class CheckListEditController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == accessibilityCondCtrl) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            Condition cond = accessibilityCondCtrl.getCondition();
            courseNode.setPreConditionAccess(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == configurationCtrl) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
            checkboxListEditCtrl.dispatchEvent(ureq, configurationCtrl, event);
            updateHighscoreTab();
        }
    } else if (source == checkboxListEditCtrl) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
            configurationCtrl.dispatchEvent(ureq, checkboxListEditCtrl, event);
        }
    } else if (source == highScoreNodeConfigController) {
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition)

Example 62 with Condition

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

the class COEditController 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 == configForm) {
        // those must be links
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition)

Example 63 with Condition

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

the class CompMenuForm 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)
 */
public void event(UserRequest urequest, Controller source, Event event) {
    if (source == searchController) {
        if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
            // search controller done
            // -> close closeable modal controller
            cmc.deactivate();
            RepositoryEntry re = searchController.getSelectedEntry();
            if (re != null) {
                setCPReference(re, config);
                cpConfigurationVc.contextPut("showPreviewButton", Boolean.TRUE);
                String displayname = StringHelper.escapeHtml(re.getDisplayname());
                previewLink = LinkFactory.createCustomLink("command.preview", "command.preview", displayname, Link.NONTRANSLATED, cpConfigurationVc, this);
                previewLink.setCustomEnabledLinkCSS("o_preview");
                previewLink.setTitle(getTranslator().translate("command.preview"));
                // remove existing edit link, add new one if user is allowed to edit this CP
                if (editLink != null) {
                    cpConfigurationVc.remove(editLink);
                    editLink = null;
                }
                if (isEditable(urequest.getIdentity(), urequest.getUserSession().getRoles(), re)) {
                    editLink = LinkFactory.createButtonSmall("edit", cpConfigurationVc, this);
                }
                // fire event so the updated config is saved by the editormaincontroller
                fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
                CPPackageConfig cpConfig = CPManager.getInstance().getCPPackageConfig(re.getOlatResource());
                if (cpConfig != null && cpConfig.getDeliveryOptions() != null) {
                    deliveryOptionsCtrl.setParentDeliveryOptions(cpConfig.getDeliveryOptions());
                }
            }
        }
    // else cancelled repo search
    } else if (source == accessibilityCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = accessibilityCondContr.getCondition();
            cpNode.setPreConditionAccess(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == cpMenuForm) {
        if (event == Event.DONE_EVENT) {
            config.setBooleanEntry(NodeEditController.CONFIG_COMPONENT_MENU, cpMenuForm.isCpMenu());
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == deliveryOptionsCtrl) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            config.set(CPEditController.CONFIG_DELIVERYOPTIONS, deliveryOptionsCtrl.getDeliveryOptions());
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition) CPPackageConfig(org.olat.ims.cp.ui.CPPackageConfig) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 64 with Condition

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

the class STCourseNodeEditController 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)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    if (source instanceof NodeEditController) {
        if (combiLinkCtr != null && combiLinkCtr.isDoProposal()) {
            combiLinkCtr.setRelFilePath(CourseEditorHelper.createUniqueRelFilePathFromShortTitle(stNode, courseFolderContainer));
        }
    } else if (source == accessibilityCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = accessibilityCondContr.getCondition();
            stNode.setPreConditionAccess(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == deliveryOptionsCtrl) {
        deliveryOptions = deliveryOptionsCtrl.getDeliveryOptions();
        stNode.getModuleConfiguration().set(CONFIG_KEY_DELIVERYOPTIONS, deliveryOptions);
        fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
    } else if (source == combiLinkCtr) {
        if (event == Event.DONE_EVENT) {
            chosenFile = VFSManager.getRelativeItemPath(combiLinkCtr.getFile(), courseFolderContainer, null);
            stNode.getModuleConfiguration().set(CONFIG_KEY_FILE, chosenFile);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
            if (!myTabbedPane.containsTab(deliveryOptionsCtrl.getInitialComponent())) {
                myTabbedPane.addTab(translate(PANE_TAB_DELIVERYOPTIONS), deliveryOptionsCtrl.getInitialComponent());
            }
            configvc.contextPut("editorEnabled", combiLinkCtr.isEditorEnabled());
        }
    } else if (source == securitySettingForm) {
        if (event == Event.DONE_EVENT) {
            boolean allowRelativeLinks = securitySettingForm.getAllowRelativeLinksConfig();
            stNode.getModuleConfiguration().set(CONFIG_KEY_ALLOW_RELATIVE_LINKS, allowRelativeLinks);
            stNode.getModuleConfiguration().set(CONFIG_KEY_ALLOW_COACH_EDIT, securitySettingForm.getAllowCoachEditConfig());
            combiLinkCtr.setAllowEditorRelativeLinks(allowRelativeLinks);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == nodeDisplayConfigFormController) {
        if (event == Event.DONE_EVENT) {
            // update the module configuration
            ModuleConfiguration moduleConfig = stNode.getModuleConfiguration();
            nodeDisplayConfigFormController.updateModuleConfiguration(moduleConfig);
            allowRelativeLinks = moduleConfig.getBooleanSafe(CONFIG_KEY_ALLOW_RELATIVE_LINKS);
            // update some class vars
            if (CONFIG_VALUE_DISPLAY_FILE.equals(moduleConfig.getStringValue(CONFIG_KEY_DISPLAY_TYPE))) {
                editorEnabled = true;
                addCustomFileConfigToView(ureq);
            } else {
                // user generated overview
                editorEnabled = false;
                removeCustomFileConfigFromView();
            }
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == scoreEasyForm) {
        if (event == Event.DONE_EVENT) {
            // show warning if the score might be wrong because of the invalid nodes used for calculation
            List<String> testElemWithNoResource = scoreEasyForm.getInvalidNodeDescriptions();
            String msg = getWarningMessage(testElemWithNoResource);
            if (msg != null) {
                showWarning(msg);
            }
            ScoreCalculator sc = scoreEasyForm.getScoreCalulator();
            /*
				 * OLAT-1144 bug fix if Calculation Score -> NO and Calculate passing
				 * score -> NO we get a ScoreCalculator == NULL !
				 */
            if (sc != null) {
                sc.setPassedExpression(sc.getPassedExpressionFromEasyModeConfiguration());
                sc.setScoreExpression(sc.getScoreExpressionFromEasyModeConfiguration());
            }
            // ..setScoreCalculator(sc) can handle NULL values!
            stNode.setScoreCalculator(sc);
            // reload form, remove deleted nodes
            initScoreEasyForm(ureq);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
            updateHighscoreTab();
        } else if (event == Event.CANCELLED_EVENT) {
            // reload form
            initScoreEasyForm(ureq);
        }
    } else if (source == scoreExpertForm) {
        if (event == Event.DONE_EVENT) {
            // show warning if the score might be wrong because of the invalid nodes used for calculation
            List<String> testElemWithNoResource = scoreExpertForm.getInvalidNodeDescriptions();
            String msg = getWarningMessage(testElemWithNoResource);
            if (msg != null) {
                getWindowControl().setWarning(msg);
            }
            ScoreCalculator sc = scoreExpertForm.getScoreCalulator();
            /*
				 * OLAT-1144 bug fix if a ScoreCalculator == NULL !
				 */
            if (sc != null) {
                sc.clearEasyMode();
            }
            // ..setScoreCalculator(sc) can handle NULL values!
            stNode.setScoreCalculator(sc);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
            updateHighscoreTab();
        } else if (event == Event.CANCELLED_EVENT) {
            // reload form
            initScoreExpertForm(ureq);
        }
    } else if (source == highScoreNodeConfigController) {
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition) NodeEditController(org.olat.course.editor.NodeEditController) ModuleConfiguration(org.olat.modules.ModuleConfiguration) ScoreCalculator(org.olat.course.run.scoring.ScoreCalculator) List(java.util.List)

Example 65 with Condition

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

the class TUEditController 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)
 */
public void event(UserRequest urequest, Controller source, Event event) {
    if (source == accessibilityCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = accessibilityCondContr.getCondition();
            courseNode.setPreConditionAccess(cond);
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == tuConfigForm) {
        if (event == Event.CANCELLED_EVENT) {
        // do nothing
        } else if (event == Event.DONE_EVENT) {
            config = tuConfigForm.getUpdatedConfig();
            fireEvent(urequest, NodeEditController.NODECONFIG_CHANGED_EVENT);
            // form valid -> node config valid -> show preview button
            myContent.contextPut("showPreviewButton", Boolean.TRUE);
        }
    }
}
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