Search in sources :

Example 41 with ControllerCreator

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

the class AuthBFWCParts method createTopNavController.

/**
 * @see org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts#createTopNavController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
 */
@Override
public LockableController createTopNavController(UserRequest ureq, WindowControl wControl) {
    Controller topnavCtr = null;
    // ----------- topnav, optional (e.g. for imprint, logout) ------------------
    if (CoreSpringFactory.containsBean("fullWebApp.TopNavControllerCreator")) {
        ControllerCreator topnavControllerCreator = (ControllerCreator) CoreSpringFactory.getBean("fullWebApp.TopNavControllerCreator");
        topnavCtr = topnavControllerCreator.createController(ureq, wControl);
    }
    return (LockableController) topnavCtr;
}
Also used : LockableController(org.olat.core.commons.fullWebApp.LockableController) LockableController(org.olat.core.commons.fullWebApp.LockableController) Controller(org.olat.core.gui.control.Controller) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator)

Example 42 with ControllerCreator

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

the class CourseRuntimeController method launchGlossary.

private void launchGlossary(UserRequest ureq) {
    // start glossary in window
    ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
    // do not cache cc, not save
    final CourseConfig cc = course.getCourseConfig();
    final boolean allowGlossaryEditing = reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_GLOSSARY);
    // if glossary had been opened from LR as Tab before, warn user:
    DTabs dts = Windows.getWindows(ureq).getWindow(ureq).getDTabs();
    RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false);
    DTab dt = dts.getDTab(repoEntry.getOlatResource());
    if (dt != null) {
        List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType(allowGlossaryEditing ? "true" : "false");
        dts.activate(ureq, dt, entries);
    } else {
        ControllerCreator ctrlCreator = new ControllerCreator() {

            public Controller createController(UserRequest lureq, WindowControl lwControl) {
                GlossaryMainController glossaryController = CourseGlossaryFactory.createCourseGlossaryMainRunController(lwControl, lureq, cc, allowGlossaryEditing);
                listenTo(glossaryController);
                if (glossaryController == null) {
                    // happens in the unlikely event of a user who is in a course and
                    // now
                    // tries to access the glossary
                    String text = translate("error.noglossary");
                    return MessageUIFactory.createInfoMessage(lureq, lwControl, null, text);
                } else {
                    // use a one-column main layout
                    LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, glossaryController);
                    // dispose glossary on layout dispose
                    layoutCtr.addDisposableChildController(glossaryController);
                    return layoutCtr;
                }
            }
        };
        ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
        // open in new browser window
        openInNewBrowserWindow(ureq, layoutCtrlr);
        // immediate return after opening new browser window!
        return;
    }
}
Also used : GlossaryMainController(org.olat.core.commons.modules.glossary.GlossaryMainController) DTabs(org.olat.core.gui.control.generic.dtabs.DTabs) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) CourseConfig(org.olat.course.config.CourseConfig) DTab(org.olat.core.gui.control.generic.dtabs.DTab) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) UserRequest(org.olat.core.gui.UserRequest)

Example 43 with ControllerCreator

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

the class CourseRuntimeController method launchPersonalNotes.

private void launchPersonalNotes(UserRequest ureq) {
    // will not be disposed on course run dispose, pop up as new browser window
    ControllerCreator ctrlCreator = new ControllerCreator() {

        @Override
        public Controller createController(UserRequest lureq, WindowControl lwControl) {
            ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
            Controller notesCtr = new NoteController(lureq, course, course.getCourseTitle(), lwControl);
            LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, notesCtr);
            layoutCtr.setCustomCSS(CourseFactory.getCustomCourseCss(lureq.getUserSession(), course.getCourseEnvironment()));
            // dispose glossary on layout dispose
            layoutCtr.addDisposableChildController(notesCtr);
            return layoutCtr;
        }
    };
    // wrap the content controller into a full header layout
    ControllerCreator popupLayoutCtr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
    // open in new browser window
    openInNewBrowserWindow(ureq, popupLayoutCtr);
}
Also used : NoteController(org.olat.note.NoteController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) ICourse(org.olat.course.ICourse) WindowControl(org.olat.core.gui.control.WindowControl) StatisticCourseNodesController(org.olat.course.statistic.StatisticCourseNodesController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) StatisticMainController(org.olat.course.statistic.StatisticMainController) CustomDBMainController(org.olat.course.db.CustomDBMainController) SearchInputController(org.olat.search.ui.SearchInputController) LectureRepositoryAdminController(org.olat.modules.lecture.ui.LectureRepositoryAdminController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) MembersManagementMainController(org.olat.course.member.MembersManagementMainController) VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) GlossaryMainController(org.olat.core.commons.modules.glossary.GlossaryMainController) CertificateAndEfficiencyStatementController(org.olat.course.certificate.ui.CertificateAndEfficiencyStatementController) AssessmentToolController(org.olat.course.assessment.ui.tool.AssessmentToolController) TeacherOverviewController(org.olat.modules.lecture.ui.TeacherOverviewController) CourseAreasController(org.olat.course.area.CourseAreasController) CourseOptionsController(org.olat.course.config.ui.CourseOptionsController) EditorMainController(org.olat.course.editor.EditorMainController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) FolderRunController(org.olat.core.commons.modules.bc.FolderRunController) CertificatesOptionsController(org.olat.course.certificate.ui.CertificatesOptionsController) CourseGlossaryToolLinkController(org.olat.course.run.glossary.CourseGlossaryToolLinkController) NoteController(org.olat.note.NoteController) ChiefController(org.olat.core.gui.control.ChiefController) ArchiverMainController(org.olat.course.archiver.ArchiverMainController) AssessmentModeListController(org.olat.course.assessment.ui.mode.AssessmentModeListController) CourseCalendarController(org.olat.course.run.calendar.CourseCalendarController) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) RepositoryEntryLifeCycleChangeController(org.olat.repository.ui.RepositoryEntryLifeCycleChangeController) CourseRemindersController(org.olat.course.reminder.ui.CourseRemindersController) Controller(org.olat.core.gui.control.Controller) CourseLayoutGeneratorController(org.olat.course.config.ui.courselayout.CourseLayoutGeneratorController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Example 44 with ControllerCreator

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

the class TURunController method doLaunch.

private void doLaunch(UserRequest ureq) {
    boolean iniframe = config.getBooleanSafe(TUConfigForm.CONFIG_IFRAME);
    // create the possibility to float
    CloneableController controller;
    if (iniframe) {
        // Do not dispose this controller if the course is closed...
        IframeTunnelController ifC = new IframeTunnelController(ureq, getWindowControl(), config);
        controller = ifC;
    } else {
        TunnelController tuC = new TunnelController(ureq, getWindowControl(), config);
        controller = tuC;
    }
    listenTo(controller);
    // create clone wrapper layout
    CloneLayoutControllerCreatorCallback clccc = new CloneLayoutControllerCreatorCallback() {

        public ControllerCreator createLayoutControllerCreator(UserRequest ureq, final ControllerCreator contentControllerCreator) {
            return BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, new ControllerCreator() {

                @SuppressWarnings("synthetic-access")
                public Controller createController(UserRequest lureq, WindowControl lwControl) {
                    // wrapp in column layout, popup window needs a layout controller
                    Controller ctr = contentControllerCreator.createController(lureq, lwControl);
                    LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, ctr);
                    layoutCtr.setCustomCSS(CourseFactory.getCustomCourseCss(lureq.getUserSession(), courseEnv));
                    layoutCtr.addDisposableChildController(ctr);
                    return layoutCtr;
                }
            });
        }
    };
    Controller ctrl = TitledWrapperHelper.getWrapper(ureq, getWindowControl(), controller, courseNode, "o_tu_icon");
    if (ctrl instanceof CloneableController) {
        cloneC = new CloneController(ureq, getWindowControl(), (CloneableController) ctrl, clccc);
        listenTo(cloneC);
        main.setContent(cloneC.getInitialComponent());
    } else {
        throw new AssertException("Controller must be cloneable");
    }
}
Also used : AssertException(org.olat.core.logging.AssertException) CloneableController(org.olat.core.gui.control.generic.clone.CloneableController) WindowControl(org.olat.core.gui.control.WindowControl) CloneableController(org.olat.core.gui.control.generic.clone.CloneableController) TunnelController(org.olat.modules.tu.TunnelController) CloneController(org.olat.core.gui.control.generic.clone.CloneController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) IframeTunnelController(org.olat.modules.tu.IframeTunnelController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) CloneController(org.olat.core.gui.control.generic.clone.CloneController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) CloneLayoutControllerCreatorCallback(org.olat.core.gui.control.generic.clone.CloneLayoutControllerCreatorCallback) TunnelController(org.olat.modules.tu.TunnelController) IframeTunnelController(org.olat.modules.tu.IframeTunnelController) IframeTunnelController(org.olat.modules.tu.IframeTunnelController) UserRequest(org.olat.core.gui.UserRequest)

Example 45 with ControllerCreator

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

the class GoToMeetingController method doJoin.

private void doJoin(UserRequest ureq) {
    boolean join = false;
    GoToError error = new GoToError();
    if (registrant == null) {
        registrant = meetingMgr.registerTraining(meeting, getIdentity(), error);
    }
    if (registrant != null) {
        String joinUrl = registrant.getJoinUrl();
        if (joinUrl != null) {
            RedirectMediaResource redirect = new RedirectMediaResource(joinUrl);
            ureq.getDispatchResult().setResultingMediaResource(redirect);
            join = true;
        }
    }
    if (!join) {
        final String errorMessage;
        if (error.hasError()) {
            if (error.getError() != null) {
                errorMessage = translate(error.getError().i18nKey());
            } else {
                errorMessage = translate("error.code.unkown");
            }
        } else {
            errorMessage = translate("error.code.unkown");
        }
        ControllerCreator creator = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, new ControllerCreator() {

            @Override
            public Controller createController(UserRequest lureq, WindowControl lwControl) {
                // Wrap in column layout, popup window needs a layout controller
                String title = "";
                String text = errorMessage;
                Controller ctr = MessageUIFactory.createErrorMessage(lureq, lwControl, title, text);
                LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, ctr);
                layoutCtr.addDisposableChildController(ctr);
                return layoutCtr;
            }
        });
        openInNewBrowserWindow(ureq, creator);
    }
    updateButtons();
}
Also used : GoToError(org.olat.modules.gotomeeting.model.GoToError) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) WindowControl(org.olat.core.gui.control.WindowControl) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest)

Aggregations

ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)92 UserRequest (org.olat.core.gui.UserRequest)72 WindowControl (org.olat.core.gui.control.WindowControl)72 Controller (org.olat.core.gui.control.Controller)42 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)28 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)28 LockableController (org.olat.core.commons.fullWebApp.LockableController)20 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)12 Identity (org.olat.core.id.Identity)12 ArrayList (java.util.ArrayList)10 List (java.util.List)10 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)10 TableEvent (org.olat.core.gui.components.table.TableEvent)10 AssertException (org.olat.core.logging.AssertException)10 UserInfoMainController (org.olat.user.UserInfoMainController)10 OlatFooterController (org.olat.gui.control.OlatFooterController)8 HashMap (java.util.HashMap)6 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)6 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)6 Event (org.olat.core.gui.control.Event)6