Search in sources :

Example 6 with WindowBackOffice

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

the class DefaultMinimalTopNavController 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)
 */
@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == closeLink) {
        // close window (a html page which calls Window.close onLoad
        ureq.getDispatchResult().setResultingMediaResource(new RedirectMediaResource(StaticMediaDispatcher.createStaticURIFor("closewindow.html")));
        // release all resources and close window
        WindowBackOffice wbo = getWindowControl().getWindowBackOffice();
        Window w = wbo.getWindow();
        Windows.getWindows(ureq).deregisterWindow(w);
        wbo.dispose();
    }
}
Also used : Window(org.olat.core.gui.components.Window) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) WindowBackOffice(org.olat.core.gui.control.WindowBackOffice)

Example 7 with WindowBackOffice

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

the class AjaxController method createJSON.

private JSONObject createJSON(WindowCommand wc) {
    Command c = wc.getCommand();
    WindowBackOffice wbo = wc.getWindowBackOffice();
    String winId = wbo.getWindow().getDispatchID();
    JSONObject jo = new JSONObject();
    try {
        jo.put("cmd", c.getCommand());
        jo.put("w", winId);
        jo.put("cda", c.getSubJSON());
        return jo;
    } catch (JSONException e) {
        throw new AssertException("json exception:", e);
    }
}
Also used : AssertException(org.olat.core.logging.AssertException) JSONObject(org.json.JSONObject) WindowCommand(org.olat.core.gui.control.pushpoll.WindowCommand) WindowBackOffice(org.olat.core.gui.control.WindowBackOffice) JSONException(org.json.JSONException)

Example 8 with WindowBackOffice

use of org.olat.core.gui.control.WindowBackOffice 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)

Example 9 with WindowBackOffice

use of org.olat.core.gui.control.WindowBackOffice in project openolat by klemens.

the class BaseFullWebappController method doDispose.

@Override
protected void doDispose() {
    // deregister for chief global sticky messages events
    GlobalStickyMessage.deregisterForGlobalStickyMessage(this);
    if (dtabs != null) {
        for (DTab tab : dtabs) {
            tab.dispose();
        }
        for (BornSiteInstance bornSite : siteToBornSite.values()) {
            bornSite.dispose();
        }
        dtabs = null;
        dtabsControllers = null;
        sites = null;
        siteToBornSite = null;
        siteToBusinessPath = null;
        dtabToBusinessPath = null;
    }
    // clear the DTabs Service
    WindowBackOffice wbackOffice = getWindowControl().getWindowBackOffice();
    wbackOffice.getWindow().setDTabs(null);
    wbackOffice.removeCycleListener(this);
    if (jsServerC != null) {
        jsServerC.dispose();
        jsServerC = null;
    }
    if (debugC != null) {
        debugC.dispose();
        debugC = null;
    }
    if (inlineTranslationC != null) {
        inlineTranslationC.dispose();
        inlineTranslationC = null;
    }
    if (developmentC != null) {
        developmentC.dispose();
        developmentC = null;
    }
    // deregister for assessment mode
    CoordinatorManager.getInstance().getCoordinator().getEventBus().deregisterFor(this, AssessmentModeNotificationEvent.ASSESSMENT_MODE_NOTIFICATION);
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) BornSiteInstance(org.olat.core.gui.control.navigation.BornSiteInstance) WindowBackOffice(org.olat.core.gui.control.WindowBackOffice)

Example 10 with WindowBackOffice

use of org.olat.core.gui.control.WindowBackOffice in project openolat by klemens.

the class DefaultMinimalTopNavController 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)
 */
@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == closeLink) {
        // close window (a html page which calls Window.close onLoad
        ureq.getDispatchResult().setResultingMediaResource(new RedirectMediaResource(StaticMediaDispatcher.createStaticURIFor("closewindow.html")));
        // release all resources and close window
        WindowBackOffice wbo = getWindowControl().getWindowBackOffice();
        Window w = wbo.getWindow();
        Windows.getWindows(ureq).deregisterWindow(w);
        wbo.dispose();
    }
}
Also used : Window(org.olat.core.gui.components.Window) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) WindowBackOffice(org.olat.core.gui.control.WindowBackOffice)

Aggregations

WindowBackOffice (org.olat.core.gui.control.WindowBackOffice)12 Window (org.olat.core.gui.components.Window)6 RedirectMediaResource (org.olat.core.gui.media.RedirectMediaResource)4 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 WindowSettings (org.olat.core.gui.WindowSettings)2 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)2 InvalidRequestParameterException (org.olat.core.gui.components.form.flexible.impl.InvalidRequestParameterException)2 RichTextElementImpl (org.olat.core.gui.components.form.flexible.impl.elements.richText.RichTextElementImpl)2 ChiefController (org.olat.core.gui.control.ChiefController)2 WindowControl (org.olat.core.gui.control.WindowControl)2 DTab (org.olat.core.gui.control.generic.dtabs.DTab)2 BornSiteInstance (org.olat.core.gui.control.navigation.BornSiteInstance)2 WindowCommand (org.olat.core.gui.control.pushpoll.WindowCommand)2 Theme (org.olat.core.gui.themes.Theme)2 BusinessControl (org.olat.core.id.context.BusinessControl)2 HistoryPoint (org.olat.core.id.context.HistoryPoint)2 AssertException (org.olat.core.logging.AssertException)2