public JSRedirectWindowController(UserRequest ureq) { Translator trans = Util.createPackageTranslator(JSRedirectWindowController.class, ureq.getLocale()); VelocityContainer msg = new VelocityContainer("jsredirect", VELOCITY_ROOT + "/js_redirect.html", trans, this); String callbackUrl = Settings.getServerContextPathURI() + OAuthConstants.CALLBACK_PATH; msg.contextPut("callbackUrl", callbackUrl); Windows ws = Windows.getWindows(ureq); WindowBackOffice wbo = ws.getWindowManager() .createWindowBackOffice("jsredirectwindow", this, new WindowSettings()); Window w = wbo.getWindow(); msg.contextPut("theme", w.getGuiTheme()); w.setContentPane(msg); setWindow(w); }
/** * @see org.olat.core.dispatcher.Dispatcher#execute(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse, java.lang.String) */ @Override public void execute(HttpServletRequest request, HttpServletResponse response) { UserRequest ureq = null; try { String uriPrefix = DispatcherModule.getLegacyUriPrefix(request); ureq = new UserRequestImpl(uriPrefix, request, response); if (!ContextHelpModule.isContextHelpEnabled()) { // disabled context help - redirect immediately DispatcherModule.sendNotFound(ureq.getNonParsedUri(), response); return; } ChiefController cc = (ChiefController) Windows.getWindows(ureq.getUserSession()).getAttribute(CONTEXTHELPCHIEFCONTROLLER); // reuse existing chief controller for this user if (cc != null) { Window currentWindow = cc.getWindow(); // Check if this is a start URL or a framework URL if (ureq.isValidDispatchURI()) { // A standard framework request, dispatch by component currentWindow.dispatchRequest(ureq, false); return; } else { // If path contains complete URL, dispose and start from scratch Windows.getWindows(ureq).deregisterWindow(currentWindow); cc.dispose(); } } // Creator code to create // 1) the chief controller // 2) the layout controller // 3) the context help main controller ControllerCreator cHelpPopupWindowControllerCreator = new ControllerCreator() { public Controller createController(UserRequest lureq, WindowControl lwControl) { ControllerCreator cHelpMainControllerCreator = new ControllerCreator() { public Controller createController(UserRequest lureq, WindowControl lwControl) { // create the context help controller and wrapp it using the layout controller ContextHelpMainController helpCtr = new ContextHelpMainController(lureq, lwControl); LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController( lureq, lwControl, null, null, helpCtr.getInitialComponent(), null); layoutCtr.addDisposableChildController(helpCtr); return layoutCtr; } }; ContextHelpLayoutControllerCreator cHelpPopupLayoutCreator = new ContextHelpLayoutControllerCreator(cHelpMainControllerCreator); return new BaseFullWebappPopupBrowserWindow( lureq, lwControl, cHelpPopupLayoutCreator.getFullWebappParts()); } }; BaseChiefControllerCreator bbc = new BaseChiefControllerCreator(); bbc.setContentControllerCreator(cHelpPopupWindowControllerCreator); cc = bbc.createChiefController(ureq); // add to user session for cleanup on user logout Windows.getWindows(ureq.getUserSession()).setAttribute(CONTEXTHELPCHIEFCONTROLLER, cc); Window currentWindow = cc.getWindow(); currentWindow.setUriPrefix(WebappHelper.getServletContextPath() + PATH_CHELP); Windows.getWindows(ureq).registerWindow(currentWindow); // finally dispatch the initial request currentWindow.dispatchRequest(ureq, true); } catch (Throwable th) { try { ChiefController msgcc = MsgFactory.createMessageChiefController(ureq, th); // the controller's window must be failsafe also msgcc.getWindow().dispatchRequest(ureq, true); // do not dispatch (render only), since this is a new Window created as // a result of another window's click. } catch (Throwable t) { logError("Sorry, can't handle this context help request....", t); } } }