Search in sources :

Example 6 with Panel

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

the class BaseFullWebappController method event.

@Override
public void event(Event event) {
    if (event == Window.AFTER_VALIDATING) {
        // now update the guimessage
        List<ZIndexWrapper> places = getWindowControl().getWindowBackOffice().getGuiMessages();
        Panel winnerP = null;
        int maxZ = -1;
        if (places != null) {
            // we have places where we can put the gui message
            for (Iterator<ZIndexWrapper> it_places = places.iterator(); it_places.hasNext(); ) {
                ZIndexWrapper ziw = it_places.next();
                int cind = ziw.getZindex();
                if (cind > maxZ) {
                    maxZ = cind;
                    winnerP = ziw.getPanel();
                }
            }
        } else {
            winnerP = guimsgHolder;
        }
        if (winnerP != null && winnerP != currentMsgHolder) {
            currentMsgHolder.setContent(null);
            winnerP.setContent(guimsgPanel);
            currentMsgHolder = winnerP;
        } else {
            currentMsgHolder = guimsgHolder;
            currentMsgHolder.setContent(guimsgPanel);
            currentMsgHolder.setDirty(guimsgPanel.isDirty());
        }
    } else if (event instanceof LanguageChangedEvent) {
        LanguageChangedEvent lce = (LanguageChangedEvent) event;
        UserRequest ureq = lce.getCurrentUreq();
        getTranslator().setLocale(lce.getNewLocale());
        initialize(ureq);
        WindowManager winman = Windows.getWindows(ureq).getWindowManager();
        initializeBase(ureq, winman, initialPanel);
        initialPanel.setContent(mainVc);
        reload = Boolean.TRUE;
    } else if (event instanceof ChiefControllerMessageEvent) {
        // msg can be set to show only on one node or on all nodes
        updateStickyMessage();
    } else if (event instanceof AssessmentModeNotificationEvent) {
        try {
            processAssessmentModeNotificationEvent((AssessmentModeNotificationEvent) event);
        } catch (Exception e) {
            logError("", e);
        }
    }
}
Also used : OncePanel(org.olat.core.gui.components.panel.OncePanel) Panel(org.olat.core.gui.components.panel.Panel) StackedPanel(org.olat.core.gui.components.panel.StackedPanel) AssessmentModeNotificationEvent(org.olat.course.assessment.AssessmentModeNotificationEvent) ZIndexWrapper(org.olat.core.gui.control.util.ZIndexWrapper) LanguageChangedEvent(org.olat.core.commons.chiefcontrollers.LanguageChangedEvent) ChiefControllerMessageEvent(org.olat.core.commons.chiefcontrollers.ChiefControllerMessageEvent) HistoryPoint(org.olat.core.id.context.HistoryPoint) UserRequest(org.olat.core.gui.UserRequest) AssertException(org.olat.core.logging.AssertException) WindowManager(org.olat.core.gui.WindowManager)

Example 7 with Panel

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

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 8 with Panel

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

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 9 with Panel

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

the class QTI12StatisticsToolController method doSelectNode.

private void doSelectNode(UserRequest ureq, TreeNode selectedNode) {
    removeAsListenerAndDispose(currentCtrl);
    WindowControl swControl = addToHistory(ureq, OresHelper.createOLATResourceableInstance(selectedNode.getIdent(), 0l), null);
    currentCtrl = result.getController(ureq, swControl, stackPanel, selectedNode);
    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 10 with Panel

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

the class AssessmentTestComposerController method partEditorFactory.

private void partEditorFactory(UserRequest ureq, TreeNode selectedNode) {
    // remove old one
    if (currentEditorCtrl != null) {
        mainVC.remove(currentEditorCtrl.getInitialComponent());
        removeAsListenerAndDispose(currentEditorCtrl);
        currentEditorCtrl = null;
    }
    // fill with the new
    mainVC.contextPut("cssClass", selectedNode.getIconCssClass());
    if (Settings.isDebuging()) {
        mainVC.contextPut("identifier", selectedNode.getIdent());
    }
    mainVC.contextPut("title", selectedNode.getTitle());
    mainVC.contextPut("restrictedEdit", restrictedEdit);
    Object uobject = selectedNode.getUserObject();
    if (uobject instanceof AssessmentTest) {
        AssessmentTest test = (AssessmentTest) uobject;
        URI testURI = resolvedAssessmentTest.getTestLookup().getSystemId();
        File testFile = new File(testURI);
        TestPart uniqueTestPart = test.getTestParts().size() == 1 ? test.getTestParts().get(0) : null;
        currentEditorCtrl = new AssessmentTestEditorController(ureq, getWindowControl(), assessmentTestBuilder, uniqueTestPart, unzippedDirRoot, unzippedContRoot, testFile, restrictedEdit);
    } else if (uobject instanceof TestPart) {
        currentEditorCtrl = new AssessmentTestPartEditorController(ureq, getWindowControl(), (TestPart) uobject, restrictedEdit, assessmentTestBuilder.isEditable());
    } else if (uobject instanceof AssessmentSection) {
        URI testURI = resolvedAssessmentTest.getTestLookup().getSystemId();
        File testFile = new File(testURI);
        currentEditorCtrl = new AssessmentSectionEditorController(ureq, getWindowControl(), (AssessmentSection) uobject, unzippedDirRoot, unzippedContRoot, testFile, restrictedEdit, assessmentTestBuilder.isEditable());
    } else if (uobject instanceof AssessmentItemRef) {
        AssessmentItemRef itemRef = (AssessmentItemRef) uobject;
        ResolvedAssessmentItem item = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef);
        if (item == null || item.getItemLookup() == null) {
            currentEditorCtrl = new BadResourceController(ureq, getWindowControl(), null, unzippedDirRoot, itemRef.getHref());
        } else if (item.getItemLookup().getBadResourceException() != null) {
            currentEditorCtrl = new BadResourceController(ureq, getWindowControl(), item.getItemLookup().getBadResourceException(), unzippedDirRoot, itemRef.getHref());
        } else {
            URI itemUri = resolvedAssessmentTest.getSystemIdByItemRefMap().get(itemRef);
            File itemFile = new File(itemUri);
            ManifestMetadataBuilder metadata = getMetadataBuilder(itemRef);
            currentEditorCtrl = new AssessmentItemEditorController(ureq, getWindowControl(), testEntry, item, itemRef, metadata, unzippedDirRoot, unzippedContRoot, itemFile, restrictedEdit);
        }
    }
    if (deleteLink != null) {
        if (uobject instanceof AssessmentSection || uobject instanceof AssessmentItemRef) {
            deleteLink.setEnabled(true);
        } else if (uobject instanceof TestPart) {
            TestPart testPart = (TestPart) uobject;
            deleteLink.setEnabled(testPart.getParent().getTestParts().size() > 1);
        } else {
            deleteLink.setEnabled(false);
        }
    }
    if (copyLink != null) {
        copyLink.setEnabled(uobject instanceof AssessmentItemRef);
    }
    if (currentEditorCtrl != null) {
        listenTo(currentEditorCtrl);
        mainVC.put("content", currentEditorCtrl.getInitialComponent());
    } else {
        mainVC.put("content", new Panel("empty"));
    }
}
Also used : URI(java.net.URI) ManifestMetadataBuilder(org.olat.ims.qti21.model.xml.ManifestMetadataBuilder) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) StackedPanel(org.olat.core.gui.components.panel.StackedPanel) SimpleStackedPanel(org.olat.core.gui.components.panel.SimpleStackedPanel) TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Panel(org.olat.core.gui.components.panel.Panel) ResolvedAssessmentItem(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentItem) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef) File(java.io.File)

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