Search in sources :

Example 26 with LayoutMain3ColsController

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

the class BinderInvitationContextEntryControllerCreator method createController.

@Override
public Controller createController(List<ContextEntry> ces, UserRequest ureq, WindowControl wControl) {
    if (!ureq.getUserSession().getRoles().isInvitee()) {
        return null;
    }
    Binder binder = getBinderFromContext(ces.get(0));
    BinderConfiguration config = BinderConfiguration.createInvitationConfig();
    List<AccessRights> rights = CoreSpringFactory.getImpl(PortfolioService.class).getAccessRights(binder, ureq.getIdentity());
    BinderSecurityCallback secCallback = BinderSecurityCallbackFactory.getCallbackForInvitation(rights);
    Controller binderCtrl = new PortfolioInvitationController(ureq, wControl, secCallback, binder, config);
    LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(ureq, wControl, binderCtrl);
    layoutCtr.addDisposableChildController(binderCtrl);
    return layoutCtr;
}
Also used : AccessRights(org.olat.modules.portfolio.model.AccessRights) PortfolioInvitationController(org.olat.modules.portfolio.ui.PortfolioInvitationController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) PortfolioInvitationController(org.olat.modules.portfolio.ui.PortfolioInvitationController) Controller(org.olat.core.gui.control.Controller) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController)

Example 27 with LayoutMain3ColsController

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

the class IQConfigurationController method doPreview.

private void doPreview(UserRequest ureq) {
    removeAsListenerAndDispose(previewLayoutCtr);
    RepositoryEntry re = getIQReference();
    if (re != null) {
        Controller previewController;
        if (OnyxModule.isOnyxTest(re.getOlatResource())) {
            showError("error.onyx");
        } else if (ImsQTI21Resource.TYPE_NAME.equals(re.getOlatResource().getResourceableTypeName())) {
            // clean up last session
            cleanUpQti21PreviewSession();
            // need to clean up the assessment test session
            QTI21DeliveryOptions deliveryOptions = qti21service.getDeliveryOptions(re);
            QTI21OverrideOptions overrideOptions = QTI21OverrideOptions.nothingOverriden();
            RepositoryEntry courseEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
            previewQTI21Ctrl = new AssessmentTestDisplayController(ureq, getWindowControl(), new InMemoryOutcomeListener(), re, courseEntry, courseNode.getIdent(), deliveryOptions, overrideOptions, true, true, true);
            listenTo(previewQTI21Ctrl);
            stackPanel.pushController(translate("preview"), previewQTI21Ctrl);
        } else {
            long courseResId = course.getResourceableId().longValue();
            previewController = iqManager.createIQDisplayController(moduleConfiguration, new IQPreviewSecurityCallback(), ureq, getWindowControl(), courseResId, courseNode.getIdent(), null);
            previewLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), previewController);
            stackPanel.pushController(translate("preview"), previewLayoutCtr);
        }
    }
}
Also used : QTI21DeliveryOptions(org.olat.ims.qti21.QTI21DeliveryOptions) InMemoryOutcomeListener(org.olat.ims.qti21.model.InMemoryOutcomeListener) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) QTI21OverrideOptions(org.olat.ims.qti21.ui.QTI21OverrideOptions) AssessmentTestDisplayController(org.olat.ims.qti21.ui.AssessmentTestDisplayController) RepositoryEntry(org.olat.repository.RepositoryEntry) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) ReferencableEntriesSearchController(org.olat.repository.controllers.ReferencableEntriesSearchController) NodeEditController(org.olat.course.editor.NodeEditController) BasicController(org.olat.core.gui.control.controller.BasicController) Controller(org.olat.core.gui.control.Controller) AssessmentTestDisplayController(org.olat.ims.qti21.ui.AssessmentTestDisplayController) IQPreviewSecurityCallback(org.olat.modules.iq.IQPreviewSecurityCallback)

Example 28 with LayoutMain3ColsController

use of org.olat.core.commons.fullWebApp.LayoutMain3ColsController 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)

Example 29 with LayoutMain3ColsController

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

the class HomeMainController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    ContextEntry entry = entries.get(0);
    String navKey = entry.getOLATResourceable().getResourceableTypeName();
    if ("HomeSite".equals(navKey)) {
        entries = entries.subList(1, entries.size());
        if (entries.size() > 0) {
            entry = entries.get(0);
            navKey = entry.getOLATResourceable().getResourceableTypeName();
        }
    }
    if (navKey.equals(currentNavKey) && currentCtr instanceof ReusableHomeController) {
        if (currentCtr instanceof Activateable2) {
            ((Activateable2) currentCtr).activate(ureq, entries, entry.getTransientState());
        }
    } else {
        GenericActionExtension gAE = ExtManager.getInstance().getActionExtensioByNavigationKey(HomeMainController.class.getName(), navKey);
        if (gAE != null) {
            currentNavKey = navKey;
            stackPanel.popUpToRootController(ureq);
            currentCtr = createController(gAE, ureq);
            contentCtr = new LayoutMain3ColsController(ureq, getWindowControl(), currentCtr);
            listenTo(contentCtr);
            if (entries.size() >= 1) {
                entries = entries.subList(1, entries.size());
            }
            String actionText = gAE.getActionText(getLocale());
            stackPanel.rootController(actionText, contentCtr);
            if (currentCtr instanceof Activateable2) {
                ((Activateable2) currentCtr).activate(ureq, entries, entry.getTransientState());
            }
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) GenericActionExtension(org.olat.core.extensions.action.GenericActionExtension) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 30 with LayoutMain3ColsController

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

the class GuiDemoPushPopController method event.

public void event(UserRequest ureq, Component source, Event event) {
    if (source == pushButton) {
        VelocityContainer container = this.createVelocityContainer("guidemo-pushpop");
        LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, container, null);
        listenTo(layoutCtr);
        windowStack.push(layoutCtr.getInitialComponent());
        container.put("guidemo.window.control.push", pushButton);
        container.put("guidemo.window.control.pop", popButton);
        container.contextPut("stack", getStackHTMLRepresentation());
        getWindowControl().pushToMainArea(container);
    } else if (source == popButton) {
        if (windowStack.isEmpty()) {
            fireEvent(ureq, Event.DONE_EVENT);
        } else {
            getWindowControl().pop();
            windowStack.pop();
        }
    }
}
Also used : LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

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