Search in sources :

Example 26 with Panel

use of org.olat.core.gui.components.panel.Panel in project openolat by klemens.

the class BaseFullWebappController method lockGUI.

private void lockGUI() {
    if (topnavCtr != null) {
        topnavCtr.lock();
    }
    if (footerCtr != null) {
        footerCtr.lock();
    }
    if (userToolsMenuCtrl != null) {
        userToolsMenuCtrl.lock();
    }
    if (dtabsControllers != null) {
        for (int i = dtabsControllers.size(); i-- > 0; ) {
            DTab tab = dtabs.get(i);
            if (lockResource == null || !lockResource.getResourceableId().equals(tab.getOLATResourceable().getResourceableId())) {
                removeDTab(null, tab);
            } else if (lockResource != null && lockResource.getResourceableId().equals(tab.getOLATResourceable().getResourceableId()) && lockStatus != LockStatus.locked) {
                removeDTab(null, tab);
            }
        }
    }
    navSitesVc.contextPut("visible", Boolean.FALSE);
    navSitesVc.setDirty(true);
    navTabsVc.setDirty(true);
    main.setContent(new Panel("empty-mode"));
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) OncePanel(org.olat.core.gui.components.panel.OncePanel) Panel(org.olat.core.gui.components.panel.Panel) StackedPanel(org.olat.core.gui.components.panel.StackedPanel) HistoryPoint(org.olat.core.id.context.HistoryPoint)

Example 27 with Panel

use of org.olat.core.gui.components.panel.Panel in project openolat by klemens.

the class BaseFullWebappController method initializeBase.

private void initializeBase(UserRequest ureq, WindowManager winman, ComponentCollection mainPanel) {
    // component-id of mainPanel for the window id
    mainVc.contextPut("o_winid", mainPanel.getDispatchID());
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    mainVc.contextPut("enforceTopFrame", securityModule.isForceTopFrame());
    // add optional css classes
    mainVc.contextPut("bodyCssClasses", bodyCssClasses);
    Window w = wbo.getWindow();
    mainVc.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader());
    // control part for ajax-communication. returns an empty panel if ajax
    // is not enabled, so that ajax can be turned on on the fly for
    // development mode
    jsServerC = wbo.createAJAXController(ureq);
    mainVc.put("jsServer", jsServerC.getInitialComponent());
    // init with no bookmark (=empty bc)
    mainVc.contextPut("o_bc", "");
    mainVc.contextPut("o_serverUri", Settings.createServerURI());
    // the current language; used e.g. by screenreaders
    mainVc.contextPut("lang", ureq.getLocale().toString());
    // some user properties
    if (ureq.getUserSession().isAuthenticated()) {
        Identity ident = ureq.getIdentity();
        StringBuilder sb = new StringBuilder();
        sb.append("{ identity : ").append(ident.getKey());
        User user = ident.getUser();
        List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_PROPS_ID, ureq.getUserSession().getRoles().isOLATAdmin());
        for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
            String escapedValue = StringHelper.escapeJavaScript(userPropertyHandler.getUserProperty(user, getLocale()));
            sb.append(", ").append(userPropertyHandler.getName()).append(" : \"").append(escapedValue).append("\"");
        }
        sb.append("}");
        mainVc.contextPut("userJSON", sb);
    }
    // the current GUI theme and the global settings that contains the
    // font-size. both are pushed as objects so that window.dirty always reads
    // out the correct value
    mainVc.contextPut("theme", w.getGuiTheme());
    mainVc.contextPut("globalSettings", winman.getGlobalSettings());
    // also add the optional theme javascript
    addThemeJS();
    // Add JS analytics code, e.g. for google analytics
    if (analyticsModule.isAnalyticsEnabled()) {
        AnalyticsSPI analyticsSPI = analyticsModule.getAnalyticsProvider();
        mainVc.contextPut("analytics", analyticsSPI.analyticsInitPageJavaScript());
    }
    // content panel
    contentPanel = new Panel("olatContentPanel");
    mainVc.put("olatContentPanel", contentPanel);
    mainVc.contextPut("o_winid", w.getDispatchID());
    mainVc.contextPut("buildversion", Settings.getVersion());
    if (wbo.isDebuging()) {
        debugC = wbo.createDebugDispatcherController(ureq, getWindowControl());
        mainVc.put("guidebug", debugC.getInitialComponent());
    }
    // Inline translation interceptor. when the translation tool is enabled it
    // will start the translation tool in translation mode, if the overlay
    // feature is enabled it will start in customizing mode
    // fxdiff: allow user-managers to use the inline translation also.
    UserSession usess = ureq.getUserSession();
    if (usess.isAuthenticated() && (usess.getRoles().isOLATAdmin() || usess.getRoles().isUserManager()) && (i18nModule.isTransToolEnabled() || i18nModule.isOverlayEnabled())) {
        inlineTranslationC = wbo.createInlineTranslationDispatcherController(ureq, getWindowControl());
        Preferences guiPrefs = usess.getGuiPreferences();
        Boolean isInlineTranslationEnabled = (Boolean) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_INLINE_TRANSLATION_ENABLED, Boolean.FALSE);
        i18nManager.setMarkLocalizedStringsEnabled(usess, isInlineTranslationEnabled);
        mainVc.put("inlineTranslation", inlineTranslationC.getInitialComponent());
    }
    // debug info if debugging
    if (wbo.isDebuging()) {
        developmentC = wbo.createDevelopmentController(ureq, getWindowControl());
        mainVc.put("development", developmentC.getInitialComponent());
    }
    // put the global js translator mapper path into the main window
    mainVc.contextPut("jsTranslationMapperPath", BaseChiefController.jsTranslationMapperPath);
    // master window
    // w.addListener(this); // to be able to report "browser reload" to the user
    w.setContentPane(mainPanel);
}
Also used : Window(org.olat.core.gui.components.Window) I18nModule(org.olat.core.util.i18n.I18nModule) User(org.olat.core.id.User) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) AnalyticsSPI(org.olat.core.commons.services.analytics.AnalyticsSPI) OncePanel(org.olat.core.gui.components.panel.OncePanel) Panel(org.olat.core.gui.components.panel.Panel) StackedPanel(org.olat.core.gui.components.panel.StackedPanel) UserSession(org.olat.core.util.UserSession) Identity(org.olat.core.id.Identity) Preferences(org.olat.core.util.prefs.Preferences) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 28 with Panel

use of org.olat.core.gui.components.panel.Panel in project openolat by klemens.

the class StatisticCourseNodesController method doSelectNode.

private void doSelectNode(UserRequest ureq, TreeNode selectedNode) {
    removeAsListenerAndDispose(currentCtrl);
    currentCtrl = null;
    WindowControl swControl = addToHistory(ureq, OresHelper.createOLATResourceableInstanceWithoutCheck(selectedNode.getIdent(), 0l), null);
    if (selectedNode instanceof StatisticResourceNode) {
        StatisticResourceNode node = (StatisticResourceNode) selectedNode;
        currentCtrl = node.getResult().getController(ureq, swControl, stackPanel, node);
    } else {
        StatisticResourceNode node = getStatisticNodeInParentLine(selectedNode);
        if (node != null) {
            currentCtrl = node.getResult().getController(ureq, swControl, stackPanel, selectedNode);
        }
    }
    if (currentCtrl != null) {
        listenTo(currentCtrl);
        layoutCtr.setCol3(currentCtrl.getInitialComponent());
        if (currentCtrl instanceof TooledController) {
            ((TooledController) currentCtrl).initTools();
        }
    } else {
        layoutCtr.setCol3(new Panel("empty"));
    }
    // also select in GUI
    courseTree.setSelectedNode(selectedNode);
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Panel(org.olat.core.gui.components.panel.Panel) WindowControl(org.olat.core.gui.control.WindowControl) TooledController(org.olat.core.gui.components.stack.TooledController)

Example 29 with Panel

use of org.olat.core.gui.components.panel.Panel in project openolat by klemens.

the class QTI21RuntimeStatisticsController method doSelectNode.

private void doSelectNode(UserRequest ureq, TreeNode selectedNode) {
    removeAsListenerAndDispose(currentCtrl);
    WindowControl swControl = addToHistory(ureq, OresHelper.createOLATResourceableInstance(selectedNode.getIdent(), 0l), null);
    currentCtrl = resourceResult.getController(ureq, swControl, stackPanel, selectedNode, false);
    if (currentCtrl != null) {
        listenTo(currentCtrl);
        layoutCtr.setCol3(currentCtrl.getInitialComponent());
    } else {
        layoutCtr.setCol3(new Panel("empty"));
    }
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Panel(org.olat.core.gui.components.panel.Panel) WindowControl(org.olat.core.gui.control.WindowControl)

Example 30 with Panel

use of org.olat.core.gui.components.panel.Panel in project openolat by klemens.

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)

Aggregations

Panel (org.olat.core.gui.components.panel.Panel)56 TooledStackedPanel (org.olat.core.gui.components.stack.TooledStackedPanel)18 StackedPanel (org.olat.core.gui.components.panel.StackedPanel)16 WindowControl (org.olat.core.gui.control.WindowControl)14 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)12 UserRequest (org.olat.core.gui.UserRequest)12 Component (org.olat.core.gui.components.Component)12 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)12 Controller (org.olat.core.gui.control.Controller)10 OncePanel (org.olat.core.gui.components.panel.OncePanel)8 BasicController (org.olat.core.gui.control.controller.BasicController)8 ArrayList (java.util.ArrayList)6 SimpleStackedPanel (org.olat.core.gui.components.panel.SimpleStackedPanel)6 ZIndexWrapper (org.olat.core.gui.control.util.ZIndexWrapper)6 AssertException (org.olat.core.logging.AssertException)6 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)5 HistoryPoint (org.olat.core.id.context.HistoryPoint)5 JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)4 MenuTree (org.olat.core.gui.components.tree.MenuTree)4 TreeNode (org.olat.core.gui.components.tree.TreeNode)4