Search in sources :

Example 11 with OlatCmdEvent

use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project openolat by klemens.

the class SinglePageController 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 == idc) {
        if (event instanceof OlatCmdEvent) {
            OlatCmdEvent oce = (OlatCmdEvent) event;
            String nodeId = oce.getSubcommand();
            ThreadLocalUserActivityLogger.log(CourseLoggingAction.COURSE_BROWSE_GOTO_NODE, getClass(), CoreLoggingResourceable.wrapSpUri(GOTO_NID + nodeId));
            // refire to listening controllers
            fireEvent(ureq, event);
        } else if (event instanceof NewIframeUriEvent) {
            NewIframeUriEvent iframeEvent = (NewIframeUriEvent) event;
            String newUri = iframeEvent.getNewUri();
            setCurURI(newUri);
            // log this uri change
            ThreadLocalUserActivityLogger.log(CourseLoggingAction.NODE_SINGLEPAGE_GET_FILE, getClass(), CoreLoggingResourceable.wrapSpUri(newUri));
        }
    } else if (source == htmlEditorController) {
        idc.setCurrentURI(g_curURI);
        mainPanel.setContent(myContent);
    }
}
Also used : NewIframeUriEvent(org.olat.core.gui.control.generic.iframe.NewIframeUriEvent) OlatCmdEvent(org.olat.core.gui.components.htmlsite.OlatCmdEvent)

Example 12 with OlatCmdEvent

use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project openolat by klemens.

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);
        }
    }
}
Also used : OlatCmdEvent(org.olat.core.gui.components.htmlsite.OlatCmdEvent) TreeNode(org.olat.core.gui.components.tree.TreeNode) CourseNode(org.olat.course.nodes.CourseNode) TreeNodeEvent(org.olat.modules.cp.TreeNodeEvent) BusinessGroupModifiedEvent(org.olat.group.ui.edit.BusinessGroupModifiedEvent)

Example 13 with OlatCmdEvent

use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project openolat by klemens.

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));
    }
}
Also used : OlatCmdEvent(org.olat.core.gui.components.htmlsite.OlatCmdEvent) Link(org.olat.core.gui.components.link.Link)

Example 14 with OlatCmdEvent

use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project OpenOLAT by OpenOLAT.

the class FeedPeekviewController 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 itemId = (String) nodeLink.getUserObject();
        if (itemId == null) {
            fireEvent(ureq, new OlatCmdEvent(OlatCmdEvent.GOTONODE_CMD, nodeId));
        } else {
            fireEvent(ureq, new OlatCmdEvent(OlatCmdEvent.GOTONODE_CMD, nodeId + "/" + itemId));
        }
    }
}
Also used : OlatCmdEvent(org.olat.core.gui.components.htmlsite.OlatCmdEvent) Link(org.olat.core.gui.components.link.Link)

Example 15 with OlatCmdEvent

use of org.olat.core.gui.components.htmlsite.OlatCmdEvent in project OpenOLAT by OpenOLAT.

the class PeekViewWrapperController 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 == nodeLink) {
        // get node ID and fire activation event
        String nodeID = (String) nodeLink.getUserObject();
        fireEvent(ureq, new OlatCmdEvent(OlatCmdEvent.GOTONODE_CMD, nodeID));
    }
}
Also used : OlatCmdEvent(org.olat.core.gui.components.htmlsite.OlatCmdEvent)

Aggregations

OlatCmdEvent (org.olat.core.gui.components.htmlsite.OlatCmdEvent)20 Link (org.olat.core.gui.components.link.Link)10 CourseNode (org.olat.course.nodes.CourseNode)4 TreeNode (org.olat.core.gui.components.tree.TreeNode)2 NewIframeUriEvent (org.olat.core.gui.control.generic.iframe.NewIframeUriEvent)2 BusinessGroupModifiedEvent (org.olat.group.ui.edit.BusinessGroupModifiedEvent)2 TreeNodeEvent (org.olat.modules.cp.TreeNodeEvent)2