use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
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);
}
}
}
use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
the class MSCourseNodeEditController 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();
msNode.setPreConditionAccess(cond);
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
} else if (source == modConfigController) {
if (event == Event.CANCELLED_EVENT) {
if (modConfigController != null) {
removeAsListenerAndDispose(modConfigController);
}
modConfigController = new MSEditFormController(ureq, getWindowControl(), msNode.getModuleConfiguration());
listenTo(modConfigController);
configurationVC.put("mseditform", modConfigController.getInitialComponent());
if (hasLogEntries) {
modConfigController.setDisplayOnly(true);
}
configurationVC.contextPut("isOverwriting", new Boolean(false));
return;
} else if (event == Event.DONE_EVENT) {
modConfigController.updateModuleConfiguration(msNode.getModuleConfiguration());
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
updateHighscoreTab();
} else if (source == highScoreNodeConfigController) {
if (event == Event.DONE_EVENT) {
fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
}
}
}
use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
the class AbstractCourseNodeWebService method updateCourseNode.
// fxdiff FXOLAT-122: course management
private CourseNodeVO updateCourseNode(String nodeId, String shortTitle, String longTitle, String learningObjectives, String visibilityExpertRules, String accessExpertRules, CustomConfigDelegate delegateConfig, CourseEditSession editSession) {
ICourse course = editSession.getCourse();
TreeNode updateEditorNode = course.getEditorTreeModel().getNodeById(nodeId);
CourseNode updatedNode = course.getEditorTreeModel().getCourseNode(nodeId);
if (StringHelper.containsNonWhitespace(shortTitle)) {
updatedNode.setShortTitle(shortTitle);
}
if (StringHelper.containsNonWhitespace(longTitle)) {
updatedNode.setLongTitle(longTitle);
}
if (StringHelper.containsNonWhitespace(learningObjectives)) {
updatedNode.setLearningObjectives(learningObjectives);
}
if (visibilityExpertRules != null) {
Condition cond = createExpertCondition(CONDITION_ID_VISIBILITY, visibilityExpertRules);
updatedNode.setPreConditionVisibility(cond);
}
if (StringHelper.containsNonWhitespace(accessExpertRules) && updatedNode instanceof AbstractAccessableCourseNode) {
Condition cond = createExpertCondition(CONDITION_ID_ACCESS, accessExpertRules);
((AbstractAccessableCourseNode) updatedNode).setPreConditionAccess(cond);
}
if (delegateConfig != null) {
ModuleConfiguration moduleConfig = updatedNode.getModuleConfiguration();
delegateConfig.configure(course, updatedNode, moduleConfig);
}
course.getEditorTreeModel().nodeConfigChanged(updateEditorNode);
CourseEditorTreeNode editorNode = course.getEditorTreeModel().getCourseEditorNodeContaining(updatedNode);
CourseNodeVO vo = get(updatedNode);
vo.setParentId(editorNode.getParent() == null ? null : editorNode.getParent().getIdent());
return vo;
}
use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
the class AbstractCourseNodeWebService method createCourseNode.
private CourseNodeVO createCourseNode(String type, String shortTitle, String longTitle, String learningObjectives, String visibilityExpertRules, String accessExpertRules, CustomConfigDelegate delegateConfig, CourseEditSession editSession, CourseNode parentNode, Integer position) {
CourseNodeConfiguration newNodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfiguration(type);
CourseNode insertedNode = newNodeConfig.getInstance();
insertedNode.setShortTitle(shortTitle);
insertedNode.setLongTitle(longTitle);
insertedNode.setLearningObjectives(learningObjectives);
insertedNode.setNoAccessExplanation("You don't have access");
if (StringHelper.containsNonWhitespace(visibilityExpertRules)) {
Condition cond = this.createExpertCondition(CONDITION_ID_VISIBILITY, visibilityExpertRules);
insertedNode.setPreConditionVisibility(cond);
}
if (StringHelper.containsNonWhitespace(accessExpertRules) && insertedNode instanceof AbstractAccessableCourseNode) {
Condition cond = createExpertCondition(CONDITION_ID_ACCESS, accessExpertRules);
((AbstractAccessableCourseNode) insertedNode).setPreConditionAccess(cond);
}
ICourse course = editSession.getCourse();
if (delegateConfig != null) {
ModuleConfiguration moduleConfig = insertedNode.getModuleConfiguration();
delegateConfig.configure(course, insertedNode, moduleConfig);
}
if (position == null || position.intValue() < 0) {
course.getEditorTreeModel().addCourseNode(insertedNode, parentNode);
} else {
course.getEditorTreeModel().insertCourseNodeAt(insertedNode, parentNode, position);
}
CourseEditorTreeNode editorNode = course.getEditorTreeModel().getCourseEditorNodeContaining(insertedNode);
CourseNodeVO vo = get(insertedNode);
vo.setParentId(editorNode.getParent() == null ? null : editorNode.getParent().getIdent());
return vo;
}
use of org.olat.course.condition.Condition in project OpenOLAT by OpenOLAT.
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);
}
}
Aggregations