Search in sources :

Example 71 with Controller

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

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 72 with Controller

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

the class UserAdminController method initTabbedPane.

/**
 * Initialize the tabbed pane according to the users rights and the system
 * configuration
 * @param identity
 * @param ureq
 */
private void initTabbedPane(Identity identity, UserRequest ureq) {
    // first Initialize the user details tabbed pane
    userTabP = new TabbedPane("userTabP", ureq.getLocale());
    userTabP.addListener(this);
    /**
     *  Determine, whether the user admin is or is not able to edit all fields in user
     *  profile form. The system admin is always able to do so.
     */
    Boolean canEditAllFields = BaseSecurityModule.USERMANAGER_CAN_EDIT_ALL_PROFILE_FIELDS;
    if (securityManager.isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_ADMIN)) {
        canEditAllFields = Boolean.TRUE;
    }
    userProfileCtr = new ProfileAndHomePageEditController(ureq, getWindowControl(), identity, canEditAllFields.booleanValue());
    listenTo(userProfileCtr);
    userTabP.addTab(translate(NLS_EDIT_UPROFILE), userProfileCtr.getInitialComponent());
    userTabP.addTab(translate(NLS_EDIT_UPREFS), new TabCreator() {

        @Override
        public Component create(UserRequest uureq) {
            prefsCtr = new ChangePrefsController(uureq, getWindowControl(), identity);
            listenTo(prefsCtr);
            return prefsCtr.getInitialComponent();
        }
    });
    if (isPasswordChangesAllowed(identity)) {
        userTabP.addTab(translate(NLS_EDIT_UPWD), new TabCreator() {

            @Override
            public Component create(UserRequest uureq) {
                pwdCtr = new UserChangePasswordController(uureq, getWindowControl(), identity);
                listenTo(pwdCtr);
                return pwdCtr.getInitialComponent();
            }
        });
    }
    Boolean canAuth = BaseSecurityModule.USERMANAGER_ACCESS_TO_AUTH;
    if (canAuth.booleanValue() || isOlatAdmin) {
        userTabP.addTab(translate(NLS_EDIT_UAUTH), new TabCreator() {

            @Override
            public Component create(UserRequest uureq) {
                authenticationsCtr = new UserAuthenticationsEditorController(uureq, getWindowControl(), identity);
                listenTo(authenticationsCtr);
                return authenticationsCtr.getInitialComponent();
            }
        });
    }
    Boolean canProp = BaseSecurityModule.USERMANAGER_ACCESS_TO_PROP;
    if (canProp.booleanValue() || isOlatAdmin) {
        userTabP.addTab(translate(NLS_EDIT_UPROP), new TabCreator() {

            @Override
            public Component create(UserRequest uureq) {
                propertiesCtr = new UserPropertiesController(uureq, getWindowControl(), identity);
                listenTo(propertiesCtr);
                return propertiesCtr.getInitialComponent();
            }
        });
    }
    Boolean canStartGroups = BaseSecurityModule.USERMANAGER_CAN_START_GROUPS;
    userTabP.addTab(translate(NLS_VIEW_GROUPS), new TabCreator() {

        @Override
        public Component create(UserRequest uureq) {
            grpCtr = new GroupOverviewController(uureq, getWindowControl(), identity, canStartGroups);
            listenTo(grpCtr);
            return grpCtr.getInitialComponent();
        }
    });
    userTabP.addTab(translate(NLS_VIEW_COURSES), new TabCreator() {

        @Override
        public Component create(UserRequest uureq) {
            courseCtr = new CourseOverviewController(uureq, getWindowControl(), identity);
            listenTo(courseCtr);
            return courseCtr.getInitialComponent();
        }
    });
    if (isOlatAdmin) {
        userTabP.addTab(translate(NLS_VIEW_ACCESS), new TabCreator() {

            @Override
            public Component create(UserRequest uureq) {
                Controller accessCtr = new UserOrderController(uureq, getWindowControl(), identity);
                listenTo(accessCtr);
                return accessCtr.getInitialComponent();
            }
        });
    }
    if (isOlatAdmin) {
        userTabP.addTab(translate(NLS_VIEW_EFF_STATEMENTS), new TabCreator() {

            @Override
            public Component create(UserRequest uureq) {
                efficicencyCtrl = new CertificateAndEfficiencyStatementListController(uureq, getWindowControl(), identity, true);
                listenTo(efficicencyCtrl);
                BreadcrumbedStackedPanel stackPanel = new BreadcrumbedStackedPanel("statements", getTranslator(), efficicencyCtrl);
                stackPanel.pushController(translate(NLS_VIEW_EFF_STATEMENTS), efficicencyCtrl);
                efficicencyCtrl.setBreadcrumbPanel(stackPanel);
                stackPanel.setInvisibleCrumb(1);
                return stackPanel;
            }
        });
    }
    Boolean canSubscriptions = BaseSecurityModule.USERMANAGER_CAN_MODIFY_SUBSCRIPTIONS;
    if (canSubscriptions.booleanValue() || isOlatAdmin) {
        userTabP.addTab(translate(NLS_VIEW_SUBSCRIPTIONS), new TabCreator() {

            @Override
            public Component create(UserRequest uureq) {
                Controller subscriptionsCtr = new NotificationSubscriptionController(uureq, getWindowControl(), identity, true);
                listenTo(subscriptionsCtr);
                return subscriptionsCtr.getInitialComponent();
            }
        });
    }
    userTabP.addTab(translate(NLS_EDIT_UROLES), new TabCreator() {

        @Override
        public Component create(UserRequest uureq) {
            rolesCtr = new SystemRolesAndRightsController(getWindowControl(), uureq, identity);
            listenTo(rolesCtr);
            return rolesCtr.getInitialComponent();
        }
    });
    Boolean canQuota = BaseSecurityModule.USERMANAGER_ACCESS_TO_QUOTA;
    if (canQuota.booleanValue() || isOlatAdmin) {
        userTabP.addTab(translate(NLS_EDIT_UQUOTA), new TabCreator() {

            @Override
            public Component create(UserRequest uureq) {
                String relPath = FolderConfig.getUserHomes() + "/" + identity.getName();
                quotaCtr = QuotaManager.getInstance().getQuotaEditorInstance(uureq, getWindowControl(), relPath);
                return quotaCtr.getInitialComponent();
            }
        });
    }
    if (lectureModule.isEnabled()) {
        userTabP.addTab(translate(NLS_VIEW_LECTURES), new TabCreator() {

            @Override
            public Component create(UserRequest uureq) {
                lecturesCtrl = new ParticipantLecturesOverviewController(uureq, getWindowControl(), identity, true, true, true, true);
                listenTo(lecturesCtrl);
                BreadcrumbedStackedPanel stackPanel = new BreadcrumbedStackedPanel("lectures", getTranslator(), lecturesCtrl);
                stackPanel.pushController(translate(NLS_VIEW_LECTURES), lecturesCtrl);
                lecturesCtrl.setBreadcrumbPanel(stackPanel);
                stackPanel.setInvisibleCrumb(1);
                return stackPanel;
            }
        });
    }
    if (taxonomyModule.isEnabled()) {
        userTabP.addTab(translate(NLS_VIEW_COMPETENCES), new TabCreator() {

            @Override
            public Component create(UserRequest uureq) {
                competencesCtrl = new IdentityCompetencesController(uureq, getWindowControl(), identity);
                listenTo(competencesCtrl);
                BreadcrumbedStackedPanel stackPanel = new BreadcrumbedStackedPanel("competences", getTranslator(), competencesCtrl);
                stackPanel.pushController(translate(NLS_VIEW_COMPETENCES), competencesCtrl);
                competencesCtrl.setBreadcrumbPanel(stackPanel);
                stackPanel.setInvisibleCrumb(1);
                return stackPanel;
            }
        });
    }
    // now push to velocity
    myContent.put("userTabP", userTabP);
}
Also used : CourseOverviewController(org.olat.admin.user.course.CourseOverviewController) UserOrderController(org.olat.resource.accesscontrol.ui.UserOrderController) UserPropertiesController(org.olat.user.UserPropertiesController) TabbedPane(org.olat.core.gui.components.tabbedpane.TabbedPane) ParticipantLecturesOverviewController(org.olat.modules.lecture.ui.ParticipantLecturesOverviewController) NotificationSubscriptionController(org.olat.core.commons.services.notifications.ui.NotificationSubscriptionController) IdentityCompetencesController(org.olat.modules.taxonomy.ui.IdentityCompetencesController) DisplayPortraitController(org.olat.user.DisplayPortraitController) CourseOverviewController(org.olat.admin.user.course.CourseOverviewController) ProfileAndHomePageEditController(org.olat.user.ProfileAndHomePageEditController) GroupOverviewController(org.olat.admin.user.groups.GroupOverviewController) UserPropertiesController(org.olat.user.UserPropertiesController) NotificationSubscriptionController(org.olat.core.commons.services.notifications.ui.NotificationSubscriptionController) ChangePrefsController(org.olat.user.ChangePrefsController) UserOrderController(org.olat.resource.accesscontrol.ui.UserOrderController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) CertificateAndEfficiencyStatementListController(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListController) ParticipantLecturesOverviewController(org.olat.modules.lecture.ui.ParticipantLecturesOverviewController) IdentityCompetencesController(org.olat.modules.taxonomy.ui.IdentityCompetencesController) ProfileAndHomePageEditController(org.olat.user.ProfileAndHomePageEditController) TabCreator(org.olat.core.gui.components.tabbedpane.TabCreator) GroupOverviewController(org.olat.admin.user.groups.GroupOverviewController) ChangePrefsController(org.olat.user.ChangePrefsController) Component(org.olat.core.gui.components.Component) BreadcrumbedStackedPanel(org.olat.core.gui.components.stack.BreadcrumbedStackedPanel) CertificateAndEfficiencyStatementListController(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementListController) UserRequest(org.olat.core.gui.UserRequest)

Example 73 with Controller

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

the class NewControllerFactory method launch.

/**
 * Launch a controller in a tab or site in the given window from a user
 * request url
 *
 * @param ureq
 * @param wControl
 */
public boolean launch(UserRequest ureq, WindowControl wControl) {
    BusinessControl bc = wControl.getBusinessControl();
    ContextEntry mainCe = bc.popLauncherContextEntry();
    if (mainCe == null) {
        // nothing to launch
        return false;
    }
    OLATResourceable ores = mainCe.getOLATResourceable();
    // Check for RepositoryEntry resource
    RepositoryEntry re = null;
    if (ores.getResourceableTypeName().equals(OresHelper.calculateTypeName(RepositoryEntry.class))) {
        if (ores instanceof RepositoryEntry) {
            re = (RepositoryEntry) ores;
            ores = re.getOlatResource();
        } else {
            // It is a repository-entry => get OLATResourceable from RepositoryEntry
            RepositoryManager repom = RepositoryManager.getInstance();
            re = repom.lookupRepositoryEntry(ores.getResourceableId());
            if (re != null) {
                ores = re.getOlatResource();
                mainCe.upgradeOLATResourceable(re);
            }
        }
    }
    // was brasato:: DTabs dts = wControl.getDTabs();
    UserSession usess = ureq.getUserSession();
    Window window = Windows.getWindows(usess).getWindow(ureq);
    if (window == null) {
        log.debug("Found no window for jumpin => take WindowBackOffice", null);
        window = wControl.getWindowBackOffice().getWindow();
    }
    DTabs dts = window.getDTabs();
    String firstType = mainCe.getOLATResourceable().getResourceableTypeName();
    // String firstTypeId = ClassToId.getInstance().lookup() BusinessGroup
    ContextEntryControllerCreator typeHandler = getContextEntryControllerCreator(firstType);
    if (typeHandler == null) {
        log.warn("Cannot found an handler for context entry: " + mainCe, null);
        // simply return and don't throw a red screen
        return false;
    }
    if (!typeHandler.validateContextEntryAndShowError(mainCe, ureq, wControl)) {
        // simply return and don't throw a red screen
        return false;
    }
    List<ContextEntry> entries = new ArrayList<ContextEntry>(5);
    while (bc.hasContextEntry()) {
        entries.add(bc.popLauncherContextEntry());
    }
    List<ContextEntry> ces = new ArrayList<ContextEntry>(entries.size() + 1);
    ces.add(mainCe);
    if (entries.size() > 0) {
        ces.addAll(entries);
    }
    TabContext context = typeHandler.getTabContext(ureq, ores, mainCe, entries);
    String siteClassName = typeHandler.getSiteClassName(ces, ureq);
    // open in existing site
    boolean launched = false;
    boolean assessmentMode = usess.isInAssessmentModeProcess();
    if (siteClassName != null) {
        if (!assessmentMode) {
            dts.activateStatic(ureq, siteClassName, context.getContext());
            launched = true;
        }
    } else if (!assessmentMode || usess.matchLockResource(ores)) {
        // get current tab or create new tab
        DTab dt = dts.getDTab(ores);
        if (dt == null) {
            WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, dts.getWindowControl());
            usess.addToHistory(ureq, bc);
            Controller launchC = typeHandler.createController(ces, ureq, bwControl);
            if (launchC != null) {
                dt = dts.createDTab(context.getTabResource(), re, launchC, context.getName());
                if (dt == null) {
                    launched = false;
                } else if (dts.addDTab(ureq, dt)) {
                    dts.activate(ureq, dt, context.getContext());
                    launched = true;
                }
            }
        } else {
            dts.activate(ureq, dt, context.getContext());
            launched = true;
        }
    }
    return launched;
}
Also used : Window(org.olat.core.gui.components.Window) OLATResourceable(org.olat.core.id.OLATResourceable) ContextEntryControllerCreator(org.olat.core.id.context.ContextEntryControllerCreator) BusinessControl(org.olat.core.id.context.BusinessControl) DTabs(org.olat.core.gui.control.generic.dtabs.DTabs) ArrayList(java.util.ArrayList) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) BaseChiefController(org.olat.core.commons.chiefcontrollers.BaseChiefController) Controller(org.olat.core.gui.control.Controller) ContextEntry(org.olat.core.id.context.ContextEntry) TabContext(org.olat.core.id.context.TabContext) DTab(org.olat.core.gui.control.generic.dtabs.DTab) UserSession(org.olat.core.util.UserSession) RepositoryManager(org.olat.repository.RepositoryManager)

Example 74 with Controller

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

the class UserAdminMainController method createAndLockDirectUserDeleteController.

/**
 * Creates a DirectDeleteController and acquire a 'delete-user-lock'.
 * The lock is for both direct-deletion and workflow with email.
 * @param ureq
 * @return
 */
private Component createAndLockDirectUserDeleteController(UserRequest ureq, WindowControl wControl) {
    Controller lockCtrl = acquireDeleteUserLock(ureq);
    if (lockCtrl == null) {
        // success -> create new User deletion workflow
        removeAsListenerAndDispose(contentCtr);
        contentCtr = new DirectDeleteController(ureq, wControl);
        listenTo(contentCtr);
        return contentCtr.getInitialComponent();
    } else {
        // failure -> monolog controller with message that lock failed
        return lockCtrl.getInitialComponent();
    }
}
Also used : DirectDeleteController(org.olat.admin.user.delete.DirectDeleteController) UserCreateController(org.olat.admin.user.UserCreateController) TabbedPaneController(org.olat.admin.user.delete.TabbedPaneController) NewUsersNotificationsController(org.olat.admin.user.NewUsersNotificationsController) DirectDeleteController(org.olat.admin.user.delete.DirectDeleteController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) UserAdminController(org.olat.admin.user.UserAdminController) UserImportController(org.olat.admin.user.imp.UserImportController) Controller(org.olat.core.gui.control.Controller) UsermanagerUserSearchController(org.olat.admin.user.UsermanagerUserSearchController) MainLayoutBasicController(org.olat.core.gui.control.controller.MainLayoutBasicController)

Example 75 with Controller

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

the class DENCourseNode method createNodeRunConstructionResult.

@Override
public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    Controller controller;
    // Do not allow guests to enroll to dates
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
        Translator trans = Util.createPackageTranslator(CourseNode.class, ureq.getLocale());
        String title = trans.translate("guestnoaccess.title");
        String message = trans.translate("guestnoaccess.message");
        controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
        controller = new DENRunController(ureq, wControl, getModuleConfiguration(), userCourseEnv, this);
    }
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, wControl, controller, this, "o_en_icon");
    return new NodeRunConstructionResult(ctrl);
}
Also used : Translator(org.olat.core.gui.translator.Translator) DENRunController(de.bps.course.nodes.den.DENRunController) Roles(org.olat.core.id.Roles) TabbableController(org.olat.core.gui.control.generic.tabbable.TabbableController) DENEditController(de.bps.course.nodes.den.DENEditController) DENRunController(de.bps.course.nodes.den.DENRunController) Controller(org.olat.core.gui.control.Controller) NodeEditController(org.olat.course.editor.NodeEditController) ConditionEditController(org.olat.course.condition.ConditionEditController) NodeRunConstructionResult(org.olat.course.run.navigation.NodeRunConstructionResult)

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