Search in sources :

Example 81 with Condition

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

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 82 with Condition

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

the class GTAEditController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == accessibilityCondCtrl) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = accessibilityCondCtrl.getCondition();
            gtaNode.setPreConditionAccess(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (workflowCtrl == source) {
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
            updateEnabledDisabledTabs();
        } else if (event == Event.CANCELLED_EVENT) {
            removeAsListenerAndDispose(workflowCtrl);
            workflowCtrl = new GTAWorkflowEditController(ureq, getWindowControl(), gtaNode, euce.getCourseEditorEnv());
            listenTo(workflowCtrl);
            myTabbedPane.replaceTab(workflowPos, workflowCtrl.getInitialComponent());
        }
    } else if (assignmentCtrl == source) {
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        } else if (event == Event.CANCELLED_EVENT) {
            removeAsListenerAndDispose(assignmentCtrl);
            assignmentCtrl = new GTAAssignmentEditController(ureq, getWindowControl(), gtaNode, config, courseEnv, false);
            listenTo(assignmentCtrl);
            myTabbedPane.replaceTab(assignmentPos, assignmentCtrl.getInitialComponent());
        }
    } else if (submissionCtrl == source) {
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
            if (revisionCtrl != null) {
                revisionCtrl.updateDefaultMaximumNumberOfDocuments();
            }
        } else if (event == Event.CANCELLED_EVENT) {
            removeAsListenerAndDispose(submissionCtrl);
            submissionCtrl = new GTASubmissionEditController(ureq, getWindowControl(), config);
            listenTo(submissionCtrl);
            myTabbedPane.replaceTab(submissionPos, submissionCtrl.getInitialComponent());
        }
    } else if (revisionCtrl == source) {
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        } else if (event == Event.CANCELLED_EVENT) {
            removeAsListenerAndDispose(revisionCtrl);
            revisionCtrl = new GTARevisionAndCorrectionEditController(ureq, getWindowControl(), config);
            listenTo(revisionCtrl);
            myTabbedPane.replaceTab(revisionPos, revisionCtrl.getInitialComponent());
        }
    } else if (manualAssessmentCtrl == source) {
        if (event == Event.DONE_EVENT) {
            manualAssessmentCtrl.updateModuleConfiguration(config);
            updateEnabledDisabledTabs();
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        } else if (event == Event.CANCELLED_EVENT) {
            removeAsListenerAndDispose(manualAssessmentCtrl);
            manualAssessmentCtrl = new MSEditFormController(ureq, getWindowControl(), config);
            listenTo(manualAssessmentCtrl);
            myTabbedPane.replaceTab(gradingPos, manualAssessmentCtrl.getInitialComponent());
        }
    } else if (solutionsCtrl == source) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == highScoreNodeConfigController) {
        if (event == Event.DONE_EVENT) {
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
    super.event(ureq, source, event);
}
Also used : Condition(org.olat.course.condition.Condition) MSEditFormController(org.olat.course.nodes.ms.MSEditFormController)

Example 83 with Condition

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

the class IQEditController method init.

private void init(UserRequest ureq) {
    configurationCtrl = new IQConfigurationController(ureq, getWindowControl(), stackPanel, course, courseNode, type);
    listenTo(configurationCtrl);
    layoutConfigurationCtrl = new IQLayoutConfigurationController(ureq, getWindowControl(), course, courseNode, type);
    listenTo(layoutConfigurationCtrl);
    if (AssessmentInstance.QMD_ENTRY_TYPE_ASSESS.equals(type)) {
        highScoreNodeConfigController = new HighScoreEditController(ureq, getWindowControl(), moduleConfiguration);
        listenTo(highScoreNodeConfigController);
    }
    Condition accessCondition = courseNode.getPreConditionAccess();
    accessibilityCondContr = new ConditionEditController(ureq, getWindowControl(), euce, accessCondition, AssessmentHelper.getAssessableNodes(course.getEditorTreeModel(), courseNode));
    listenTo(accessibilityCondContr);
}
Also used : Condition(org.olat.course.condition.Condition) HighScoreEditController(org.olat.course.highscore.ui.HighScoreEditController) ConditionEditController(org.olat.course.condition.ConditionEditController)

Example 84 with Condition

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

the class InfoCourseNodeEditController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == infoConfigForm) {
        if (event == Event.DONE_EVENT) {
            infoConfigForm.getUpdatedConfig();
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == accessCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = accessCondContr.getCondition();
            courseNode.setPreConditionAccess(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == editCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = editCondContr.getCondition();
            courseNode.setPreConditionEdit(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    } else if (source == adminCondContr) {
        if (event == Event.CHANGED_EVENT) {
            Condition cond = adminCondContr.getCondition();
            courseNode.setPreConditionAdmin(cond);
            fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
        }
    }
}
Also used : Condition(org.olat.course.condition.Condition)

Example 85 with Condition

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

the class STCourseNode method getScoreCalculator.

/**
 * @return Returns the scoreCalculator.
 */
@Override
public ScoreCalculator getScoreCalculator() {
    if (scoreCalculator == null) {
        scoreCalculator = new ScoreCalculator();
        scoreCalculator.setFailedType(FailedEvaluationType.failedAsNotPassedAfterEndDate);
    }
    passedExpression = new Condition();
    passedExpression.setConditionId("passed");
    if (scoreCalculator.getPassedExpression() != null) {
        passedExpression.setConditionExpression(scoreCalculator.getPassedExpression());
        passedExpression.setExpertMode(true);
    }
    scoreExpression = new Condition();
    scoreExpression.setConditionId("score");
    if (scoreCalculator.getScoreExpression() != null) {
        scoreExpression.setConditionExpression(scoreCalculator.getScoreExpression());
        scoreExpression.setExpertMode(true);
    }
    failedExpression = new Condition();
    failedExpression.setConditionId("failed");
    if (scoreCalculator.getFailedExpression() != null) {
        failedExpression.setConditionExpression(scoreCalculator.getFailedExpression());
        failedExpression.setExpertMode(true);
    }
    return scoreCalculator;
}
Also used : Condition(org.olat.course.condition.Condition) ScoreCalculator(org.olat.course.run.scoring.ScoreCalculator)

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