Search in sources :

Example 21 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class CollaborationTools method createPortfolioController.

/**
 * @param ureq
 * @param wControl
 * @param mapProperty The property is mandatory!
 * @return
 */
private Controller createPortfolioController(UserRequest ureq, WindowControl wControl, TooledStackedPanel stackPanel, Property mapProperty) {
    Long key = mapProperty.getLongValue();
    String version = mapProperty.getStringValue();
    Controller ctrl;
    if ("2".equals(version)) {
        PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
        Binder binder = portfolioService.getBinderByKey(key);
        portfolioService.updateBinderUserInformations(binder, ureq.getIdentity());
        BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForBusinessGroup();
        BinderController binderCtrl = new BinderController(ureq, wControl, stackPanel, secCallback, binder, BinderConfiguration.createBusinessGroupConfig());
        ctrl = binderCtrl;
    } else {
        PortfolioStructureMap map = (PortfolioStructureMap) CoreSpringFactory.getImpl(EPFrontendManager.class).loadPortfolioStructureByKey(key);
        EPSecurityCallback secCallback = new EPSecurityCallbackImpl(true, true);
        ctrl = EPUIFactory.createMapViewController(ureq, wControl, map, secCallback);
    }
    return ctrl;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) Binder(org.olat.modules.portfolio.Binder) PortfolioService(org.olat.modules.portfolio.PortfolioService) BinderController(org.olat.modules.portfolio.ui.BinderController) EPSecurityCallback(org.olat.portfolio.EPSecurityCallback) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) WeeklyCalendarController(org.olat.commons.calendar.ui.WeeklyCalendarController) EPCreateMapController(org.olat.portfolio.ui.structel.EPCreateMapController) OpenMeetingsRunController(org.olat.modules.openmeetings.ui.OpenMeetingsRunController) ChatToolController(org.olat.instantMessaging.ui.ChatToolController) CourseLinkProviderController(org.olat.course.run.calendar.CourseLinkProviderController) BinderController(org.olat.modules.portfolio.ui.BinderController) FolderRunController(org.olat.core.commons.modules.bc.FolderRunController) ContactFormController(org.olat.modules.co.ContactFormController) Controller(org.olat.core.gui.control.Controller) CalendarController(org.olat.commons.calendar.ui.CalendarController) InfoGroupRunController(org.olat.group.ui.run.InfoGroupRunController) EPSecurityCallbackImpl(org.olat.portfolio.EPSecurityCallbackImpl)

Example 22 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class CollaborationTools method createPortfolioController.

/**
 * return an controller for the wiki tool
 * @param ureq
 * @param wControl
 * @return
 */
public Controller createPortfolioController(final UserRequest ureq, final WindowControl wControl, final TooledStackedPanel stackPanel, final BusinessGroup group) {
    final NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores);
    Property mapProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO);
    if (mapProperty != null) {
        return createPortfolioController(ureq, wControl, stackPanel, mapProperty);
    } else {
        return coordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerCallback<Controller>() {

            @Override
            public Controller execute() {
                Controller ctrl;
                Property mapKeyProperty = npm.findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO);
                if (mapKeyProperty == null) {
                    PortfolioV2Module moduleV2 = CoreSpringFactory.getImpl(PortfolioV2Module.class);
                    if (moduleV2.isEnabled()) {
                        PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
                        Binder binder = portfolioService.createNewBinder(group.getName(), group.getDescription(), null, null);
                        CoreSpringFactory.getImpl(BinderUserInformationsDAO.class).updateBinderUserInformationsInSync(binder, ureq.getIdentity());
                        mapKeyProperty = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO, null, binder.getKey(), "2", null);
                        BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForBusinessGroup();
                        BinderController binderCtrl = new BinderController(ureq, wControl, stackPanel, secCallback, binder, BinderConfiguration.createBusinessGroupConfig());
                        List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType("Toc");
                        binderCtrl.activate(ureq, entries, null);
                        ctrl = binderCtrl;
                        ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(binder));
                        ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_BINDER_CREATED, getClass());
                    } else {
                        EPFrontendManager ePFMgr = CoreSpringFactory.getImpl(EPFrontendManager.class);
                        PortfolioStructureMap map = ePFMgr.createAndPersistPortfolioDefaultMap(group.getName(), group.getDescription());
                        Translator pT = Util.createPackageTranslator(EPCreateMapController.class, ureq.getLocale());
                        // add a page, as each map should have at least one per default!
                        ePFMgr.createAndPersistPortfolioPage(map, pT.translate("new.page.title"), pT.translate("new.page.desc"));
                        mapKeyProperty = npm.createPropertyInstance(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_PORTFOLIO, null, map.getKey(), null, null);
                        EPSecurityCallback secCallback = new EPSecurityCallbackImpl(true, true);
                        ctrl = EPUIFactory.createMapViewController(ureq, wControl, map, secCallback);
                    }
                    npm.saveProperty(mapKeyProperty);
                } else {
                    ctrl = createPortfolioController(ureq, wControl, stackPanel, mapProperty);
                }
                return ctrl;
            }
        });
    }
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) PortfolioV2Module(org.olat.modules.portfolio.PortfolioV2Module) BinderSecurityCallback(org.olat.modules.portfolio.BinderSecurityCallback) WeeklyCalendarController(org.olat.commons.calendar.ui.WeeklyCalendarController) EPCreateMapController(org.olat.portfolio.ui.structel.EPCreateMapController) OpenMeetingsRunController(org.olat.modules.openmeetings.ui.OpenMeetingsRunController) ChatToolController(org.olat.instantMessaging.ui.ChatToolController) CourseLinkProviderController(org.olat.course.run.calendar.CourseLinkProviderController) BinderController(org.olat.modules.portfolio.ui.BinderController) FolderRunController(org.olat.core.commons.modules.bc.FolderRunController) ContactFormController(org.olat.modules.co.ContactFormController) Controller(org.olat.core.gui.control.Controller) CalendarController(org.olat.commons.calendar.ui.CalendarController) InfoGroupRunController(org.olat.group.ui.run.InfoGroupRunController) EPSecurityCallbackImpl(org.olat.portfolio.EPSecurityCallbackImpl) EPFrontendManager(org.olat.portfolio.manager.EPFrontendManager) Binder(org.olat.modules.portfolio.Binder) PortfolioService(org.olat.modules.portfolio.PortfolioService) BinderController(org.olat.modules.portfolio.ui.BinderController) Translator(org.olat.core.gui.translator.Translator) EPCreateMapController(org.olat.portfolio.ui.structel.EPCreateMapController) EPSecurityCallback(org.olat.portfolio.EPSecurityCallback) ArrayList(java.util.ArrayList) List(java.util.List) NarrowedPropertyManager(org.olat.properties.NarrowedPropertyManager) Property(org.olat.properties.Property)

Example 23 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class CollaborationTools method createForumController.

/**
 * @param ureq
 * @param wControl
 * @param isAdmin
 * @param subsContext the subscriptioncontext if subscriptions to this forum
 *          should be possible
 * @return a forum controller
 */
public Controller createForumController(UserRequest ureq, WindowControl wControl, boolean isAdmin, boolean isGuestOnly, final SubscriptionContext subsContext) {
    final boolean isAdm = isAdmin;
    final boolean isGuest = isGuestOnly;
    Forum forum = getForum();
    Translator trans = Util.createPackageTranslator(this.getClass(), ureq.getLocale());
    TitleInfo titleInfo = new TitleInfo(null, trans.translate("collabtools.named.hasForum"));
    titleInfo.setSeparatorEnabled(true);
    Controller forumController = ForumUIFactory.getTitledForumController(ureq, wControl, forum, new ForumCallback() {

        @Override
        public boolean mayUsePseudonym() {
            return false;
        }

        @Override
        public boolean mayOpenNewThread() {
            return true;
        }

        @Override
        public boolean mayReplyMessage() {
            return true;
        }

        @Override
        public boolean mayEditOwnMessage() {
            return true;
        }

        @Override
        public boolean mayDeleteOwnMessage() {
            return true;
        }

        @Override
        public boolean mayEditMessageAsModerator() {
            return isAdm;
        }

        @Override
        public boolean mayDeleteMessageAsModerator() {
            return isAdm;
        }

        @Override
        public boolean mayArchiveForum() {
            return !isGuest;
        }

        @Override
        public boolean mayFilterForUser() {
            return isAdm;
        }

        @Override
        public SubscriptionContext getSubscriptionContext() {
            return subsContext;
        }
    }, titleInfo);
    return forumController;
}
Also used : Translator(org.olat.core.gui.translator.Translator) TitleInfo(org.olat.core.gui.control.generic.title.TitleInfo) ForumCallback(org.olat.modules.fo.ForumCallback) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) WeeklyCalendarController(org.olat.commons.calendar.ui.WeeklyCalendarController) EPCreateMapController(org.olat.portfolio.ui.structel.EPCreateMapController) OpenMeetingsRunController(org.olat.modules.openmeetings.ui.OpenMeetingsRunController) ChatToolController(org.olat.instantMessaging.ui.ChatToolController) CourseLinkProviderController(org.olat.course.run.calendar.CourseLinkProviderController) BinderController(org.olat.modules.portfolio.ui.BinderController) FolderRunController(org.olat.core.commons.modules.bc.FolderRunController) ContactFormController(org.olat.modules.co.ContactFormController) Controller(org.olat.core.gui.control.Controller) CalendarController(org.olat.commons.calendar.ui.CalendarController) InfoGroupRunController(org.olat.group.ui.run.InfoGroupRunController) Forum(org.olat.modules.fo.Forum)

Example 24 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class ResumeSessionController method pushNextInterceptor.

private void pushNextInterceptor(UserRequest ureq) {
    int currentCtrlIndex = -1;
    if (currentInterceptor != null) {
        currentCtrlIndex = interceptors.indexOf(currentInterceptor);
        removeAsListenerAndDispose(currentInterceptor.getController());
    }
    if ((currentCtrlIndex + 1) < interceptors.size()) {
        int nextCtrlIndex = currentCtrlIndex + 1;
        if (interceptors.get(nextCtrlIndex) == null) {
            return;
        }
        if (wizardCtrl != null) {
            // actualCtrNr = ctrNr;
            wizardCtrl.setCurStep(nextCtrlIndex + 1);
        }
        currentInterceptor = interceptors.get(nextCtrlIndex);
        Controller currentCtrl = currentInterceptor.getController();
        if (currentCtrl != null) {
            listenTo(currentCtrl);
            if (StringHelper.containsNonWhitespace(currentInterceptor.getI18nKey())) {
                String[] introComb = currentInterceptor.getI18nKey().split(":");
                mainVC.contextPut("introPkg", introComb[0]);
                mainVC.contextPut("introKey", introComb[1]);
            } else {
                mainVC.contextRemove("introPkg");
                mainVC.contextRemove("introKey");
            }
            currentPanel.setContent(currentCtrl.getInitialComponent());
        }
    } else {
        cmc.deactivate();
        if (StringHelper.containsNonWhitespace(redirect.getRedirectUrl())) {
            String bc = redirect.getFormattedRedirectUrl();
            launch(ureq, bc);
            redirect(ureq, redirect.getRedirectUrl());
        }
        terminateInterception(ureq);
    }
}
Also used : WizardInfoController(org.olat.core.gui.control.generic.wizard.WizardInfoController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) HistoryPoint(org.olat.core.id.context.HistoryPoint)

Example 25 with Controller

use of org.olat.core.gui.control.Controller in project OpenOLAT by OpenOLAT.

the class BaseFullWebappController method addDTab.

@Override
public boolean addDTab(UserRequest ureq, DTab dt) {
    if (isDisposed()) {
        return false;
    }
    DTab old = getDTab(dt.getOLATResourceable());
    if (old != null) {
        return true;
    }
    // add to tabs list
    synchronized (dtabs) {
        // make dtabs and dtabsControllers access synchronized
        dtabs.add(dt);
        dtabsLinkNames.add(dtabCreateCounter);
        Link link = LinkFactory.createCustomLink("a" + dtabCreateCounter, "a" + dtabCreateCounter, "", Link.NONTRANSLATED, navTabsVc, this);
        link.setCustomDisplayText(StringHelper.escapeHtml(dt.getNavElement().getTitle()));
        link.setIconLeftCSS("o_icon o_icon-fw " + dt.getNavElement().getIconCSSClass());
        link.setTitle(dt.getTitle());
        link.setUserObject(dt);
        // Set accessibility access key using the 's' key. You can loop through all opened tabs by
        // pressing s repetitively (works only in IE/FF which is normally used by blind people)
        link.setAccessKey("s");
        // add close links
        Link calink = LinkFactory.createCustomLink("c" + dtabCreateCounter, "c" + dtabCreateCounter, "", Link.NONTRANSLATED, navTabsVc, this);
        calink.setCustomEnabledLinkCSS("o_navbar_tab_close");
        calink.setIconLeftCSS("o_icon o_icon_close_tab");
        calink.setTitle(translate("close"));
        calink.setUserObject(dt);
        Controller dtabCtr = dt.getController();
        dtabCtr.addControllerListener(this);
        updateBusinessPath(ureq, dt);
        // add to tabs controller lookup table for later event dispatching
        dtabsControllers.add(dtabCtr);
        // increase DTab added counter.
        dtabCreateCounter++;
    }
    return true;
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) 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) Link(org.olat.core.gui.components.link.Link)

Aggregations

Controller (org.olat.core.gui.control.Controller)372 BasicController (org.olat.core.gui.control.controller.BasicController)114 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)82 NodeEditController (org.olat.course.editor.NodeEditController)82 WindowControl (org.olat.core.gui.control.WindowControl)78 TabbableController (org.olat.core.gui.control.generic.tabbable.TabbableController)74 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)62 RepositoryEntry (org.olat.repository.RepositoryEntry)60 Translator (org.olat.core.gui.translator.Translator)54 UserRequest (org.olat.core.gui.UserRequest)52 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)50 OLATResourceable (org.olat.core.id.OLATResourceable)46 ArrayList (java.util.ArrayList)40 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)40 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)36 Component (org.olat.core.gui.components.Component)34 Roles (org.olat.core.id.Roles)34 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)32 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)30 ContextEntry (org.olat.core.id.context.ContextEntry)30