Search in sources :

Example 1 with MessageController

use of org.olat.core.gui.control.generic.messages.MessageController in project OpenOLAT by OpenOLAT.

the class DisposedCourseRestartController 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 == restartLink) {
        OLATResourceable ores = OLATResourceManager.getInstance().findResourceable(courseRepositoryEntry.getOlatResource().getResourceableId(), courseRepositoryEntry.getOlatResource().getResourceableTypeName());
        if (ores == null) {
            // course was deleted!
            MessageController msgController = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translate("course.deleted.title"), translate("course.deleted.text"));
            panel.setContent(msgController.getInitialComponent());
        } else {
            OLATResourceable reOres = OresHelper.clone(courseRepositoryEntry);
            DTabs dtabs = getWindowControl().getWindowBackOffice().getWindow().getDTabs();
            if (dtabs != null) {
                DTab dt = dtabs.getDTab(reOres);
                if (dt != null) {
                    dtabs.removeDTab(ureq, dt);
                }
            }
            List<ContextEntry> entries = null;
            List<HistoryPoint> stacks = ureq.getUserSession().getHistoryStack();
            for (int i = stacks.size(); i-- > 0; ) {
                HistoryPoint point = stacks.get(i);
                if (point != null && point.getEntries() != null && point.getEntries().size() > 0) {
                    ContextEntry entry = point.getEntries().get(0);
                    if (reOres.equals(entry.getOLATResourceable())) {
                        entries = point.getEntries();
                        break;
                    }
                }
            }
            WindowControl bwControl;
            if (entries == null) {
                bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(getWindowControl(), reOres);
            } else {
                BusinessControl bc = BusinessControlFactory.getInstance().createFromContextEntries(entries);
                bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
            }
            NewControllerFactory.getInstance().launch(ureq, bwControl);
            dispose();
        }
    }
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) MessageController(org.olat.core.gui.control.generic.messages.MessageController) OLATResourceable(org.olat.core.id.OLATResourceable) DTabs(org.olat.core.gui.control.generic.dtabs.DTabs) BusinessControl(org.olat.core.id.context.BusinessControl) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry) HistoryPoint(org.olat.core.id.context.HistoryPoint) HistoryPoint(org.olat.core.id.context.HistoryPoint)

Example 2 with MessageController

use of org.olat.core.gui.control.generic.messages.MessageController in project OpenOLAT by OpenOLAT.

the class ScormRunController method doSetMissingResourcesWarning.

private void doSetMissingResourcesWarning(UserRequest ureq) {
    String text = translate("error.cprepoentrymissing.user");
    MessageController missingCtrl = MessageUIFactory.createWarnMessage(ureq, getWindowControl(), null, text);
    listenTo(missingCtrl);
    main.setContent(missingCtrl.getInitialComponent());
}
Also used : MessageController(org.olat.core.gui.control.generic.messages.MessageController)

Example 3 with MessageController

use of org.olat.core.gui.control.generic.messages.MessageController in project openolat by klemens.

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 4 with MessageController

use of org.olat.core.gui.control.generic.messages.MessageController in project OpenOLAT by OpenOLAT.

the class RepositoyUIFactory method createRepoEntryDisabledDueToSecurityMessageController.

/**
 * Create main controller that does nothing but displaying a message that
 * this resource is disabled due to security constraints
 *
 * @param ureq
 * @param wControl
 * @return
 */
public static GenericMainController createRepoEntryDisabledDueToSecurityMessageController(UserRequest ureq, WindowControl wControl) {
    // wrap simple message into mainLayout
    GenericMainController glc = new GenericMainController(ureq, wControl) {

        @Override
        public void init(UserRequest uureq) {
            Panel empty = new Panel("empty");
            setTranslator(Util.createPackageTranslator(RepositoryModule.class, uureq.getLocale()));
            MessageController contentCtr = MessageUIFactory.createInfoMessage(uureq, getWindowControl(), translate("security.disabled.title"), translate("security.disabled.info"));
            // auto dispose later
            listenTo(contentCtr);
            Component resComp = contentCtr.getInitialComponent();
            LayoutMain3ColsController columnLayoutCtr = new LayoutMain3ColsController(uureq, getWindowControl(), empty, resComp, /*do not save no prefs*/
            null);
            // auto dispose later
            listenTo(columnLayoutCtr);
            putInitialPanel(columnLayoutCtr.getInitialComponent());
        }

        @Override
        protected Controller handleOwnMenuTreeEvent(Object uobject, UserRequest uureq) {
            // no menutree means no menu events.
            return null;
        }
    };
    glc.init(ureq);
    return glc;
}
Also used : Panel(org.olat.core.gui.components.panel.Panel) MessageController(org.olat.core.gui.control.generic.messages.MessageController) GenericMainController(org.olat.core.gui.control.generic.layout.GenericMainController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Component(org.olat.core.gui.components.Component) UserRequest(org.olat.core.gui.UserRequest) RepositoryModule(org.olat.repository.RepositoryModule)

Example 5 with MessageController

use of org.olat.core.gui.control.generic.messages.MessageController 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)

Aggregations

MessageController (org.olat.core.gui.control.generic.messages.MessageController)8 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)4 UserRequest (org.olat.core.gui.UserRequest)2 Component (org.olat.core.gui.components.Component)2 Panel (org.olat.core.gui.components.panel.Panel)2 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)2 Controller (org.olat.core.gui.control.Controller)2 WindowControl (org.olat.core.gui.control.WindowControl)2 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)2 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)2 DTab (org.olat.core.gui.control.generic.dtabs.DTab)2 DTabs (org.olat.core.gui.control.generic.dtabs.DTabs)2 GenericMainController (org.olat.core.gui.control.generic.layout.GenericMainController)2 GlossaryMarkupItemController (org.olat.core.gui.control.generic.textmarker.GlossaryMarkupItemController)2 TitledWrapperController (org.olat.core.gui.control.generic.title.TitledWrapperController)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 BusinessControl (org.olat.core.id.context.BusinessControl)2 ContextEntry (org.olat.core.id.context.ContextEntry)2 HistoryPoint (org.olat.core.id.context.HistoryPoint)2 DisposedCourseRestartController (org.olat.course.DisposedCourseRestartController)2