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"));
}
}
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
}
}
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();
}
}
}
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);
}
}
}
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);
}
}
}
Aggregations