Search in sources :

Example 36 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class CourseRuntimeController method addCustomCSS.

private void addCustomCSS(UserRequest ureq) {
    ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
    CustomCSS customCSS = CourseFactory.getCustomCourseCss(ureq.getUserSession(), course.getCourseEnvironment());
    ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController();
    if (cc != null) {
        if (customCSS == null) {
            cc.removeCurrentCustomCSSFromView();
        } else {
            cc.addCurrentCustomCSSToView(customCSS);
        }
    }
    setCustomCSS(customCSS);
}
Also used : CustomCSS(org.olat.core.gui.components.htmlheader.jscss.CustomCSS) ICourse(org.olat.course.ICourse) ChiefController(org.olat.core.gui.control.ChiefController)

Example 37 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class OAuthDispatcher method redirectImplicitWorkflow.

private void redirectImplicitWorkflow(UserRequest ureq) {
    ChiefController msgcc = new JSRedirectWindowController(ureq);
    msgcc.getWindow().dispatchRequest(ureq, true);
}
Also used : JSRedirectWindowController(org.olat.login.oauth.ui.JSRedirectWindowController) ChiefController(org.olat.core.gui.control.ChiefController)

Example 38 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class LayoutMain3ColsController method setAsFullscreen.

public void setAsFullscreen(UserRequest ureq) {
    ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController();
    if (cc != null) {
        thebaseChief = cc;
        thebaseChief.getScreenMode().setMode(Mode.full);
    } else {
        Windows.getWindows(ureq).setFullScreen(Boolean.TRUE);
    }
    fullScreen = true;
}
Also used : ChiefController(org.olat.core.gui.control.ChiefController)

Example 39 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class ValidatingVisitor method doDispatchToComponent.

/**
 * @param ureq
 * @return true if the event was indeed dispatched to the component, false
 *         otherwise (reasons: no component found with given id, or component
 *         disabled)
 */
private DispatchResult doDispatchToComponent(UserRequest ureq, StringBuilder debugMsg) {
    String s_compID = ureq.getComponentID();
    if (s_compID == null) {
        return NO_DISPATCHRESULT;
    }
    List<Component> foundPath = new ArrayList<Component>(10);
    // OLAT-1973
    Component target = ComponentHelper.findDescendantOrSelfByID(getContentPane(), s_compID, foundPath);
    if (target == null) {
        // there was a component id given, but no matching target could be found
        fireEvent(ureq, COMPONENTNOTFOUND);
        return NO_DISPATCHRESULT;
    // do not dispatch; which means just rerender later; good if
    // the
    // gui tree was changed by another thread in the meantime.
    // do not throw an exception here, because this can happen if the gui
    // tree was changed by another thread in the meantime
    }
    if (!target.isVisible()) {
        throw new OLATRuntimeException(Window.class, "target with name: '" + target.getComponentName() + "', was invisible, but called to dispatch", null);
    }
    boolean toDispatch = true;
    boolean incTimestamp = false;
    for (Iterator<Component> iter = foundPath.iterator(); iter.hasNext(); ) {
        Component curComp = iter.next();
        if (!curComp.isEnabled()) {
            toDispatch = false;
            break;
        }
    }
    if (toDispatch) {
        latestDispatchComponentInfo = target.getComponentName() + " :" + target.getExtendedDebugInfo();
        latestDispatchedComp = target;
        // dispatch
        wbackofficeImpl.fireCycleEvent(Window.ABOUT_TO_DISPATCH);
        target.dispatchRequest(ureq);
        List<Component> ancestors = ComponentHelper.findAncestorsOrSelfByID(getContentPane(), target);
        for (Component ancestor : ancestors) {
            incTimestamp |= ancestor.isSilentlyDynamicalCmp();
        }
        // after dispatching, commit (docu)
        DBFactory.getInstance().commit();
        // add the new URL to the browser history, but not if the klick resulted in a new browser window (a href .. target=...) or in a download (excel or such)
        wbackofficeImpl.fireCycleEvent(END_OF_DISPATCH_CYCLE);
        // if loglevel is set accordingly, collect anonymous controller usage statistics.
        if (debugMsg != null) {
            appendDispatchDebugInfos(target, debugMsg);
        } else {
            // no debug level, consume the left over event (for minor memory reasons)
            target.getAndClearLatestFiredEvent();
        }
        // we do not want to keep a reference which could be old.
        // in case we do not reach the next line because of an exception in dispatch(), we clear the value in the exceptionwindowcontroller's error handling
        latestDispatchedComp = null;
    }
    ChiefController chief = wbackofficeImpl.getChiefController();
    boolean reload = chief == null ? false : chief.wishReload(ureq, true);
    return new DispatchResult(toDispatch, incTimestamp, reload);
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) ArrayList(java.util.ArrayList) ChiefController(org.olat.core.gui.control.ChiefController)

Example 40 with ChiefController

use of org.olat.core.gui.control.ChiefController in project OpenOLAT by OpenOLAT.

the class AuthenticatedDispatcher method processBusinessPath.

private void processBusinessPath(String businessPath, UserRequest ureq, UserSession usess) {
    ChiefController chiefController = Windows.getWindows(usess).getChiefController();
    if (chiefController == null) {
        if (usess.isAuthenticated()) {
            AuthHelper.createAuthHome(ureq).getWindow();
            chiefController = Windows.getWindows(usess).getChiefController();
        } else {
            redirectToDefaultDispatcher(ureq.getHttpReq(), ureq.getHttpResp());
            return;
        }
    }
    WindowBackOffice windowBackOffice = chiefController.getWindow().getWindowBackOffice();
    if (chiefController.isLoginInterceptionInProgress()) {
        Window w = windowBackOffice.getWindow();
        // renderOnly
        w.dispatchRequest(ureq, true);
    } else {
        String wSettings = (String) usess.removeEntryFromNonClearedStore(WINDOW_SETTINGS);
        if (wSettings != null) {
            WindowSettings settings = WindowSettings.parse(wSettings);
            windowBackOffice.setWindowSettings(settings);
        }
        try {
            BusinessControl bc = null;
            String historyPointId = ureq.getHttpReq().getParameter("historyPointId");
            if (StringHelper.containsNonWhitespace(historyPointId)) {
                HistoryPoint point = ureq.getUserSession().getHistoryPoint(historyPointId);
                bc = BusinessControlFactory.getInstance().createFromContextEntries(point.getEntries());
            }
            if (bc == null) {
                bc = BusinessControlFactory.getInstance().createFromString(businessPath);
            }
            WindowControl wControl = windowBackOffice.getChiefController().getWindowControl();
            WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, wControl);
            NewControllerFactory.getInstance().launch(ureq, bwControl);
            // render the window
            Window w = windowBackOffice.getWindow();
            // renderOnly
            w.dispatchRequest(ureq, true);
        } catch (Exception e) {
            // try to render something
            try {
                Window w = windowBackOffice.getWindow();
                // renderOnly
                w.dispatchRequest(ureq, true);
            } catch (Exception e1) {
                redirectToDefaultDispatcher(ureq.getHttpReq(), ureq.getHttpResp());
            }
            log.error("", e);
        }
    }
}
Also used : Window(org.olat.core.gui.components.Window) BusinessControl(org.olat.core.id.context.BusinessControl) WindowBackOffice(org.olat.core.gui.control.WindowBackOffice) ChiefController(org.olat.core.gui.control.ChiefController) WindowControl(org.olat.core.gui.control.WindowControl) HistoryPoint(org.olat.core.id.context.HistoryPoint) IOException(java.io.IOException) InvalidRequestParameterException(org.olat.core.gui.components.form.flexible.impl.InvalidRequestParameterException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) WindowSettings(org.olat.core.gui.WindowSettings)

Aggregations

ChiefController (org.olat.core.gui.control.ChiefController)58 UserRequest (org.olat.core.gui.UserRequest)10 UserRequestImpl (org.olat.core.gui.UserRequestImpl)10 IOException (java.io.IOException)8 Window (org.olat.core.gui.components.Window)8 InvalidRequestParameterException (org.olat.core.gui.components.form.flexible.impl.InvalidRequestParameterException)8 WindowControl (org.olat.core.gui.control.WindowControl)8 OLATRuntimeException (org.olat.core.logging.OLATRuntimeException)8 ArrayList (java.util.ArrayList)6 BaseFullWebappController (org.olat.core.commons.fullWebApp.BaseFullWebappController)6 StringOutput (org.olat.core.gui.render.StringOutput)6 URLBuilder (org.olat.core.gui.render.URLBuilder)6 AssertException (org.olat.core.logging.AssertException)6 UserSession (org.olat.core.util.UserSession)6 HttpSession (javax.servlet.http.HttpSession)4 BaseFullWebappControllerParts (org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts)4 Windows (org.olat.core.gui.Windows)4 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)4 RedirectMediaResource (org.olat.core.gui.media.RedirectMediaResource)4 ContextEntry (org.olat.core.id.context.ContextEntry)4