Search in sources :

Example 41 with LayoutMain3ColsController

use of org.olat.core.commons.fullWebApp.LayoutMain3ColsController in project OpenOLAT by OpenOLAT.

the class CourseRuntimeController method launchCalendar.

private void launchCalendar(UserRequest ureq) {
    ControllerCreator ctrlCreator = new ControllerCreator() {

        @Override
        public Controller createController(UserRequest lureq, WindowControl lwControl) {
            ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
            ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(getRepositoryEntry());
            WindowControl llwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, lwControl);
            CourseCalendarController calendarController = new CourseCalendarController(lureq, llwControl, getUserCourseEnvironment());
            // use a one-column main layout
            LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, llwControl, calendarController);
            layoutCtr.setCustomCSS(CourseFactory.getCustomCourseCss(lureq.getUserSession(), course.getCourseEnvironment()));
            // dispose calendar on layout dispose
            layoutCtr.addDisposableChildController(calendarController);
            return layoutCtr;
        }
    };
    // wrap the content controller into a full header layout
    ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator);
    // open in new browser window
    PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
    pbw.open(ureq);
}
Also used : PopupBrowserWindow(org.olat.core.gui.control.generic.popup.PopupBrowserWindow) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) ICourse(org.olat.course.ICourse) WindowControl(org.olat.core.gui.control.WindowControl) CourseCalendarController(org.olat.course.run.calendar.CourseCalendarController) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) UserRequest(org.olat.core.gui.UserRequest) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 42 with LayoutMain3ColsController

use of org.olat.core.commons.fullWebApp.LayoutMain3ColsController in project OpenOLAT by OpenOLAT.

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 LayoutMain3ColsController

use of org.olat.core.commons.fullWebApp.LayoutMain3ColsController in project OpenOLAT by OpenOLAT.

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 LayoutMain3ColsController

use of org.olat.core.commons.fullWebApp.LayoutMain3ColsController in project OpenOLAT by OpenOLAT.

the class IQRunController 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)
 */
public void event(UserRequest ureq, Component source, Event event) {
    if (source == startButton && startButton.isEnabled() && startButton.isVisible()) {
        long courseResId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
        String courseNodeIdent = courseNode.getIdent();
        removeAsListenerAndDispose(displayController);
        OLATResourceable ores = OresHelper.createOLATResourceableTypeWithoutCheck("test");
        ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
        WindowControl bwControl = addToHistory(ureq, ores, null);
        Controller returnController = iqManager.createIQDisplayController(modConfig, secCallback, ureq, bwControl, courseResId, courseNodeIdent, this);
        /*
			 * either returnController is a MessageController or it is a IQDisplayController
			 * this should not serve as pattern to be copy&pasted.
			 * FIXME:2008-11-21:pb INTRODUCED because of read/write QTI Lock solution for scalability II, 6.1.x Release 
			 */
        if (returnController instanceof IQDisplayController) {
            displayController = (IQDisplayController) returnController;
            listenTo(displayController);
            if (displayController.isClosed()) {
            // do nothing
            } else if (displayController.isReady()) {
                // in case displayController was unable to initialize, a message was set by displayController
                // this is the case if no more attempts or security check was unsuccessfull
                displayContainerController = new LayoutMain3ColsController(ureq, getWindowControl(), displayController);
                // autodispose
                listenTo(displayContainerController);
                // need to wrap a course restart controller again, because IQDisplay
                // runs on top of GUIStack
                ICourse course = CourseFactory.loadCourse(courseResId);
                RepositoryEntry courseRepositoryEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
                // empty panel set as "menu" and "tool"
                Panel empty = new Panel("empty");
                Controller courseCloser = new DisposedCourseRestartController(ureq, getWindowControl(), courseRepositoryEntry);
                Controller disposedRestartController = new LayoutMain3ColsController(ureq, getWindowControl(), empty, courseCloser.getInitialComponent(), "disposed course whily in iqRun" + courseResId);
                displayContainerController.setDisposedMessageController(disposedRestartController);
                final boolean fullWindow = modConfig.getBooleanSafe(IQEditController.CONFIG_FULLWINDOW, true);
                if (fullWindow) {
                    displayContainerController.setAsFullscreen(ureq);
                }
                displayContainerController.activate();
                if (modConfig.get(IQEditController.CONFIG_KEY_TYPE).equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) {
                    assessmentStopped = false;
                    singleUserEventCenter.registerFor(this, getIdentity(), assessmentInstanceOres);
                    singleUserEventCenter.fireEventToListenersOf(new AssessmentEvent(AssessmentEvent.TYPE.STARTED, ureq.getUserSession()), assessmentEventOres);
                }
            }
        // endif isReady
        } else {
            // -> qti file was locked -> show info message
            // user must click again on course node to activate
            mainPanel.pushContent(returnController.getInitialComponent());
        }
    } else if (source == showResultsButton) {
        AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
        Long assessmentID = am.getAssessmentID(courseNode, ureq.getIdentity());
        if (assessmentID == null) {
            // fallback solution: if the assessmentID is not available via AssessmentManager than try to get it via IQManager
            long callingResId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue();
            String callingResDetail = courseNode.getIdent();
            assessmentID = iqManager.getLastAssessmentID(ureq.getIdentity(), callingResId, callingResDetail);
        }
        if (assessmentID != null && !assessmentID.equals("")) {
            Document doc = iqManager.getResultsReportingFromFile(ureq.getIdentity(), type, assessmentID);
            // StringBuilder resultsHTML = LocalizedXSLTransformer.getInstance(ureq.getLocale()).renderResults(doc);
            String summaryConfig = (String) modConfig.get(IQEditController.CONFIG_KEY_SUMMARY);
            int summaryType = AssessmentInstance.SUMMARY_NONE;
            try {
                summaryType = AssessmentInstance.getSummaryType(summaryConfig);
            } catch (Exception e) {
                // cannot change AssessmentInstance: fallback if the the configuration is inherited from a QTI 2.1 configuration
                if (StringHelper.containsNonWhitespace(summaryConfig)) {
                    summaryType = AssessmentInstance.SUMMARY_DETAILED;
                }
                logError("", e);
            }
            String resultsHTML = iqManager.transformResultsReporting(doc, ureq.getLocale(), summaryType);
            myContent.contextPut("displayreporting", resultsHTML);
            myContent.contextPut("resreporting", resultsHTML);
            myContent.contextPut("showResults", Boolean.TRUE);
        }
    } else if (source == hideResultsButton) {
        myContent.contextPut("showResults", Boolean.FALSE);
    } else if ("show".equals(event.getCommand())) {
        saveOpenPanel(ureq, ureq.getParameter("panel"), true);
    } else if ("hide".equals(event.getCommand())) {
        saveOpenPanel(ureq, ureq.getParameter("panel"), false);
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) AssessmentManager(org.olat.course.assessment.AssessmentManager) ICourse(org.olat.course.ICourse) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) DisposedCourseRestartController(org.olat.course.DisposedCourseRestartController) HighScoreRunController(org.olat.course.highscore.ui.HighScoreRunController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) BasicController(org.olat.core.gui.control.controller.BasicController) IQDisplayController(org.olat.modules.iq.IQDisplayController) IFrameDisplayController(org.olat.core.gui.control.generic.iframe.IFrameDisplayController) Controller(org.olat.core.gui.control.Controller) Document(org.dom4j.Document) AssertException(org.olat.core.logging.AssertException) OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) Panel(org.olat.core.gui.components.panel.Panel) StackedPanel(org.olat.core.gui.components.panel.StackedPanel) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) DisposedCourseRestartController(org.olat.course.DisposedCourseRestartController) IQDisplayController(org.olat.modules.iq.IQDisplayController)

Example 45 with LayoutMain3ColsController

use of org.olat.core.commons.fullWebApp.LayoutMain3ColsController in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method doStart.

private void doStart(UserRequest ureq) {
    removeAsListenerAndDispose(displayCtrl);
    OLATResourceable ores = OresHelper.createOLATResourceableTypeWithoutCheck("test");
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl bwControl = addToHistory(ureq, ores, null);
    RepositoryEntry courseRe = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
    displayCtrl = new AssessmentTestDisplayController(ureq, bwControl, this, testEntry, courseRe, courseNode.getIdent(), deliveryOptions, overrideOptions, true, false, false);
    listenTo(displayCtrl);
    if (displayCtrl.getAssessmentTest() == null) {
        logError("Test cannot be read: " + testEntry + " in course: " + courseRe + " element: " + courseNode.getIdent(), null);
        showError("error.resource.corrupted");
    } else if (displayCtrl.isEnded()) {
        if (!displayCtrl.isResultsVisible()) {
            doExitAssessment(ureq, null, true);
            initAssessment(ureq);
        }
    } else {
        // in case displayController was unable to initialize, a message was set by displayController
        // this is the case if no more attempts or security check was unsuccessfull
        displayContainerController = new QTI21AssessmentMainLayoutController(ureq, getWindowControl(), displayCtrl);
        // autodispose
        listenTo(displayContainerController);
        // empty panel set as "menu" and "tool"
        Panel empty = new Panel("empty");
        Controller courseCloser = new DisposedCourseRestartController(ureq, getWindowControl(), courseRe);
        Controller disposedRestartController = new LayoutMain3ColsController(ureq, getWindowControl(), empty, courseCloser.getInitialComponent(), "disposed");
        displayContainerController.setDisposedMessageController(disposedRestartController);
        boolean fullWindow = deliveryOptions.isHideLms();
        if (fullWindow) {
            displayContainerController.setAsFullscreen(ureq);
        }
        displayContainerController.activate();
        assessmentStopped = false;
        singleUserEventCenter.registerFor(this, getIdentity(), assessmentInstanceOres);
        singleUserEventCenter.fireEventToListenersOf(new AssessmentEvent(AssessmentEvent.TYPE.STARTED, ureq.getUserSession()), assessmentEventOres);
        ThreadLocalUserActivityLogger.log(QTI21LoggingAction.QTI_START_IN_COURSE, getClass());
    }
}
Also used : Panel(org.olat.core.gui.components.panel.Panel) OLATResourceable(org.olat.core.id.OLATResourceable) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) AssessmentTestDisplayController(org.olat.ims.qti21.ui.AssessmentTestDisplayController) RepositoryEntry(org.olat.repository.RepositoryEntry) DisposedCourseRestartController(org.olat.course.DisposedCourseRestartController) WindowControl(org.olat.core.gui.control.WindowControl) DisposedCourseRestartController(org.olat.course.DisposedCourseRestartController) HighScoreRunController(org.olat.course.highscore.ui.HighScoreRunController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) BasicController(org.olat.core.gui.control.controller.BasicController) AssessmentResultController(org.olat.ims.qti21.ui.AssessmentResultController) IFrameDisplayController(org.olat.core.gui.control.generic.iframe.IFrameDisplayController) Controller(org.olat.core.gui.control.Controller) AssessmentTestDisplayController(org.olat.ims.qti21.ui.AssessmentTestDisplayController)

Aggregations

LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)80 WindowControl (org.olat.core.gui.control.WindowControl)38 Controller (org.olat.core.gui.control.Controller)36 UserRequest (org.olat.core.gui.UserRequest)34 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)28 Panel (org.olat.core.gui.components.panel.Panel)12 BasicController (org.olat.core.gui.control.controller.BasicController)12 RepositoryEntry (org.olat.repository.RepositoryEntry)12 MainLayoutController (org.olat.core.gui.control.generic.layout.MainLayoutController)10 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)10 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 ContextEntry (org.olat.core.id.context.ContextEntry)8 AssertException (org.olat.core.logging.AssertException)8 ICourse (org.olat.course.ICourse)8 GlossaryMainController (org.olat.core.commons.modules.glossary.GlossaryMainController)6 Component (org.olat.core.gui.components.Component)6 TooledStackedPanel (org.olat.core.gui.components.stack.TooledStackedPanel)6 CloneController (org.olat.core.gui.control.generic.clone.CloneController)6 CertificateAndEfficiencyStatementController (org.olat.course.certificate.ui.CertificateAndEfficiencyStatementController)6