use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project OpenOLAT by OpenOLAT.
the class RunMainController 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 (needsRebuildAfter) {
currentCourseNode = updateAfterChanges(currentCourseNode);
needsRebuildAfter = false;
}
if (source == currentNodeController) {
if (event instanceof OlatCmdEvent) {
OlatCmdEvent oe = (OlatCmdEvent) event;
String cmd = oe.getCommand();
if (OlatCmdEvent.GOTONODE_CMD.equals(cmd)) {
// "69680861018558/node-specific-data";
String subcmd = oe.getSubcommand();
CourseNode identNode;
String nodecmd = null;
int slPos = subcmd.indexOf('/');
if (slPos != -1) {
nodecmd = subcmd.substring(slPos + 1);
identNode = course.getRunStructure().getNode(subcmd.substring(0, slPos));
} else {
identNode = course.getRunStructure().getNode(subcmd);
}
if (identNode == null) {
showWarning("msg.nodenotavailableanymore");
} else {
addLoggingResourceable(LoggingResourceable.wrap(identNode));
currentCourseNode = identNode;
updateTreeAndContent(ureq, identNode, nodecmd);
oe.accept();
}
}
} else if (event == Event.DONE_EVENT) {
// preconditions may have changed
if (needsRebuildAfterRunDone) {
needsRebuildAfterRunDone = false;
updateTreeAndContent(ureq, currentCourseNode, null);
}
} else if (REBUILD.equals(event.getCommand())) {
needsRebuildAfterRunDone = false;
updateTreeAndContent(ureq, currentCourseNode, null);
} else if (event instanceof TreeNodeEvent) {
TreeNodeEvent tne = (TreeNodeEvent) event;
TreeNode newCpTreeNode = tne.getChosenTreeNode();
luTree.setSelectedNodeId(newCpTreeNode.getIdent());
} else if (event == Event.CHANGED_EVENT) {
updateTreeAndContent(ureq, currentCourseNode, null);
} else if (event instanceof BusinessGroupModifiedEvent) {
fireEvent(ureq, event);
updateTreeAndContent(ureq, currentCourseNode, null);
}
}
}
use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project OpenOLAT by OpenOLAT.
the class STCourseNodeRunController method event.
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (event instanceof OlatCmdEvent) {
OlatCmdEvent gotoNodeEvent = (OlatCmdEvent) event;
String subcommand = gotoNodeEvent.getSubcommand();
// subcommand consists of node id and path
int slashpos = subcommand.indexOf("/");
String nodeId = subcommand;
String path = "";
if (slashpos != -1) {
nodeId = subcommand.substring(0, slashpos);
path = subcommand.substring(slashpos);
}
ThreadLocalUserActivityLogger.log(CourseLoggingAction.ST_GOTO_NODE, getClass(), LoggingResourceable.wrapNonOlatResource(StringResourceableType.nodeId, nodeId, path));
// forward to my listeners
fireEvent(ureq, event);
}
}
use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project OpenOLAT by OpenOLAT.
the class STPeekViewController 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
protected void event(UserRequest ureq, Component source, Event event) {
if (source instanceof Link) {
Link nodeLink = (Link) source;
// get node ID and fire activation event
String nodeId = (String) nodeLink.getUserObject();
fireEvent(ureq, new OlatCmdEvent(OlatCmdEvent.GOTONODE_CMD, nodeId));
}
}
use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project OpenOLAT by OpenOLAT.
the class BCPeekviewController 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
protected void event(UserRequest ureq, Component source, Event event) {
if (source instanceof Link) {
Link nodeLink = (Link) source;
String relPath = (String) nodeLink.getUserObject();
if (relPath == null) {
fireEvent(ureq, new OlatCmdEvent(OlatCmdEvent.GOTONODE_CMD, nodeId));
} else {
fireEvent(ureq, new OlatCmdEvent(OlatCmdEvent.GOTONODE_CMD, nodeId + "/" + relPath));
}
}
}
use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project OpenOLAT by OpenOLAT.
the class ProjectBrokerPeekViewRunController 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
protected void event(UserRequest ureq, Component source, Event event) {
if (source instanceof Link) {
Link projectLink = (Link) source;
String projectId = (String) projectLink.getUserObject();
if (projectId == null) {
fireEvent(ureq, new OlatCmdEvent(OlatCmdEvent.GOTONODE_CMD, courseNodeIdent));
} else {
fireEvent(ureq, new OlatCmdEvent(OlatCmdEvent.GOTONODE_CMD, courseNodeIdent + "/" + projectId));
}
}
}
Aggregations