Search in sources :

Example 41 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

the class BaseFullWebappController method back.

protected void back(UserRequest ureq, HistoryPoint cstate) {
    List<ContextEntry> entries = cstate.getEntries();
    if (entries.isEmpty())
        return;
    entries = new ArrayList<ContextEntry>(entries);
    ContextEntry state = entries.remove(0);
    // no red screen for this
    if (state == null)
        return;
    OLATResourceable ores = state.getOLATResourceable();
    if (ores != null && "HomeSite".equals(ores.getResourceableTypeName())) {
        activateSite(userTools, ureq, entries, false);
    } else {
        DTab dt = getDTab(ores);
        if (dt != null) {
            doActivateDTab(dt);
            if (dt.getController() instanceof Activateable2) {
                ((Activateable2) dt.getController()).activate(ureq, entries, null);
            }
            updateBusinessPath(ureq, dt);
        } else {
            StateEntry s = state.getTransientState();
            if (s instanceof StateSite && ((StateSite) s).getSite() != null && sites != null) {
                SiteInstance site = ((StateSite) s).getSite();
                for (SiteInstance savedSite : sites) {
                    if (savedSite != null && site.getClass().equals(savedSite.getClass())) {
                        activateSite(savedSite, ureq, entries, false);
                    }
                }
            }
        }
    }
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) StateEntry(org.olat.core.id.context.StateEntry) BornSiteInstance(org.olat.core.gui.control.navigation.BornSiteInstance) SiteInstance(org.olat.core.gui.control.navigation.SiteInstance) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) OLATResourceable(org.olat.core.id.OLATResourceable) StateSite(org.olat.core.id.context.StateSite) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 42 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

the class BaseFullWebappController method activateSite.

/**
 * Activate a site if not locked
 *
 * @param s
 * @param ureq
 * @param entries
 * @param forceReload
 */
private void activateSite(SiteInstance s, UserRequest ureq, List<ContextEntry> entries, boolean forceReload) {
    if (lockResource != null)
        return;
    BornSiteInstance bs = siteToBornSite.get(s);
    GuiStack gs;
    Controller resC;
    // PB//WindowControl site_wControl;
    if (bs != null && s != curSite) {
        // single - click -> fetch guistack from cache
        gs = bs.getGuiStackHandle();
        resC = bs.getController();
    } else if (bs != null && s == curSite && !forceReload) {
        // via activate, don't force the reload
        gs = bs.getGuiStackHandle();
        resC = bs.getController();
    } else {
        // dispose old controller
        if (bs != null) {
            // already in cache -> dispose old
            bs.getController().dispose();
        }
        // reset site and create new controller
        s.reset();
        resC = s.createController(ureq, getWindowControl());
        gs = getWindowControl().getWindowBackOffice().createGuiStack(resC.getInitialComponent());
        // PB//site_wControl = bwControl;
        // PB//siteToBornSite.put(s, new BornSiteInstance(gs, resC, bwControl));
        siteToBornSite.put(s, new BornSiteInstance(gs, resC));
    }
    doActivateSite(s, gs);
    if (resC instanceof Activateable2) {
        ((Activateable2) resC).activate(ureq, entries, null);
    }
    // perhaps has activation changed the gui stack and it need to be updated
    setGuiStack(gs);
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) BornSiteInstance(org.olat.core.gui.control.navigation.BornSiteInstance) GuiStack(org.olat.core.gui.control.guistack.GuiStack) ResumeSessionController(org.olat.core.commons.controllers.resume.ResumeSessionController) AssessmentModeGuardController(org.olat.course.assessment.ui.mode.AssessmentModeGuardController) BasicController(org.olat.core.gui.control.controller.BasicController) ChiefController(org.olat.core.gui.control.ChiefController) BaseChiefController(org.olat.core.commons.chiefcontrollers.BaseChiefController) VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) Controller(org.olat.core.gui.control.Controller) UserToolsMenuController(org.olat.gui.control.UserToolsMenuController)

Example 43 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

the class UserAdminMainController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    GenericTreeModel tm = (GenericTreeModel) olatMenuTree.getTreeModel();
    ContextEntry entry = entries.get(0);
    String entryPoint = entry.getOLATResourceable().getResourceableTypeName();
    if (entryPoint.startsWith("notifications") || entryPoint.startsWith("NewIdentityCreated")) {
        TreeNode node = tm.findNodeByUserObject("created.newUsersNotification");
        selectNode(ureq, node);
    } else if (entryPoint.startsWith("AE")) {
        TreeNode node = tm.findNodeByUserObject("menuqueries");
        int pos = entries.get(0).getOLATResourceable().getResourceableId().intValue();
        if (pos >= 0 && pos < node.getChildCount()) {
            TreeNode childNode = (TreeNode) node.getChildAt(pos);
            selectNode(ureq, childNode);
        }
    } else {
        TreeNode node = tm.findNodeByUserObject(entryPoint);
        if (node != null) {
            selectNode(ureq, node);
            entries = entries.subList(1, entries.size());
            if (contentCtr instanceof Activateable2) {
                ((Activateable2) contentCtr).activate(ureq, entries, entry.getTransientState());
            }
            if (!entries.isEmpty() && userAdminCtr != null) {
                userAdminCtr.activate(ureq, entries, null);
            }
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 44 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

the class RunMainController method updateTreeAndContent.

private CourseNode updateTreeAndContent(UserRequest ureq, CourseNode calledCourseNode, String nodecmd, List<ContextEntry> entries, StateEntry state) {
    // might be used in both controllers with the same ID (e.g. the course folder)
    if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
        currentNodeController.dispose();
    }
    NodeClickedRef nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), calledCourseNode, this, nodecmd);
    if (!nclr.isVisible()) {
        // if not root -> fallback to root. e.g. when a direct node jump fails
        if (calledCourseNode != null) {
            nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), null, this, null);
        }
        if (!nclr.isVisible()) {
            MessageController msgController = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translate("course.noaccess.title"), translate("course.noaccess.text"));
            contentP.setContent(msgController.getInitialComponent());
            luTree.setTreeModel(new GenericTreeModel());
            return null;
        }
    }
    treeModel = nclr.getTreeModel();
    luTree.setTreeModel(treeModel);
    String selNodeId = nclr.getSelectedNodeId();
    luTree.setSelectedNodeId(selNodeId);
    luTree.setOpenNodeIds(nclr.getOpenNodeIds());
    // get new run controller.
    currentNodeController = nclr.getRunController();
    addToHistory(ureq, currentNodeController);
    if (currentNodeController instanceof TitledWrapperController) {
        Controller contentcontroller = ((TitledWrapperController) currentNodeController).getContentController();
        addToHistory(ureq, contentcontroller);
        if (contentcontroller instanceof Activateable2) {
            ((Activateable2) contentcontroller).activate(ureq, entries, state);
        }
    } else if (currentNodeController instanceof Activateable2) {
        ((Activateable2) currentNodeController).activate(ureq, entries, state);
    }
    if (currentNodeController != null) {
        contentP.setContent(currentNodeController.getInitialComponent());
    } else {
        MessageController msgCtrl = MessageUIFactory.createWarnMessage(ureq, getWindowControl(), null, translate("msg.nodenotavailableanymore"));
        listenTo(msgCtrl);
        contentP.setContent(msgCtrl.getInitialComponent());
    }
    updateNextPrevious();
    updateCourseDataAttributes(nclr.getCalledCourseNode());
    updateLastUsage(nclr.getCalledCourseNode());
    return nclr.getCalledCourseNode();
}
Also used : MessageController(org.olat.core.gui.control.generic.messages.MessageController) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) TitledWrapperController(org.olat.core.gui.control.generic.title.TitledWrapperController) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) NodeClickedRef(org.olat.course.run.navigation.NodeClickedRef) DisposedCourseRestartController(org.olat.course.DisposedCourseRestartController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) MessageController(org.olat.core.gui.control.generic.messages.MessageController) CourseGlossaryToolLinkController(org.olat.course.run.glossary.CourseGlossaryToolLinkController) TitledWrapperController(org.olat.core.gui.control.generic.title.TitledWrapperController) Controller(org.olat.core.gui.control.Controller) GlossaryMarkupItemController(org.olat.core.gui.control.generic.textmarker.GlossaryMarkupItemController) MainLayoutBasicController(org.olat.core.gui.control.controller.MainLayoutBasicController)

Example 45 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

the class RunMainController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) {
        if (currentNodeController != null) {
            addToHistory(ureq, currentNodeController);
        } else {
            addToHistory(ureq, this);
        }
        return;
    }
    ContextEntry firstEntry = entries.get(0);
    String type = firstEntry.getOLATResourceable().getResourceableTypeName();
    if ("CourseNode".equalsIgnoreCase(type) || "Part".equalsIgnoreCase(type)) {
        CourseNode cn = course.getRunStructure().getNode(firstEntry.getOLATResourceable().getResourceableId().toString());
        if (currentCourseNode == null || !currentCourseNode.equals(cn)) {
            getWindowControl().makeFlat();
            // add logging information for case course gets started via jump-in
            // link/search
            addLoggingResourceable(LoggingResourceable.wrap(course));
            if (cn != null) {
                addLoggingResourceable(LoggingResourceable.wrap(cn));
            }
            // consume our entry
            if (entries.size() > 1) {
                entries = entries.subList(1, entries.size());
            }
            updateTreeAndContent(ureq, cn, null, entries, firstEntry.getTransientState());
        } else if (currentCourseNode.equals(cn)) {
            // consume our entry
            if (entries.size() > 1) {
                entries = entries.subList(1, entries.size());
            }
            // the node to be activated is the one that is already on the screen
            if (currentNodeController instanceof Activateable2) {
                Activateable2 activateable = (Activateable2) currentNodeController;
                activateable.activate(ureq, entries, state);
            }
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) CourseNode(org.olat.course.nodes.CourseNode) ContextEntry(org.olat.core.id.context.ContextEntry)

Aggregations

Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)78 ContextEntry (org.olat.core.id.context.ContextEntry)44 Controller (org.olat.core.gui.control.Controller)28 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)22 TreeNode (org.olat.core.gui.components.tree.TreeNode)16 WindowControl (org.olat.core.gui.control.WindowControl)16 BasicController (org.olat.core.gui.control.controller.BasicController)14 CourseNode (org.olat.course.nodes.CourseNode)12 CollaborationTools (org.olat.collaboration.CollaborationTools)10 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)10 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)10 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)10 GTACourseNode (org.olat.course.nodes.GTACourseNode)10 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)8 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)8 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)6 ChiefController (org.olat.core.gui.control.ChiefController)6 VetoableCloseController (org.olat.core.gui.control.VetoableCloseController)6 BornSiteInstance (org.olat.core.gui.control.navigation.BornSiteInstance)6 OLATResourceable (org.olat.core.id.OLATResourceable)5