Examples of ChiefController


Examples of org.olat.core.gui.control.ChiefController

        // disabled context help - redirect immediately
        DispatcherAction.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);
      }
View Full Code Here

Examples of org.olat.core.gui.control.ChiefController

            // create the error window
            try {
              Tracing.logDebug("Error in Window, rollback", getClass());
              DBFactory.getInstance().rollback();
           
              ChiefController msgcc = MsgFactory.createMessageChiefController(ureq, th);
              Window errWindow = msgcc.getWindow();
              // register window
              Windows.getWindows(ureq).registerWindow(errWindow);
              // redirect to the error window
              String newWinUri = buildRenderOnlyURIFor(errWindow);
              Command rmrcom = CommandFactory.createParentRedirectTo(newWinUri);
View Full Code Here

Examples of org.olat.core.gui.control.ChiefController

        return;
      }
      String businessPath = (String) usess.removeEntryFromNonClearedStore(AUTHDISPATCHER_BUSINESSPATH);
      if (businessPath != null) {
        BusinessControl bc = BusinessControlFactory.getInstance().createFromString(businessPath);
        ChiefController cc = (ChiefController) Windows.getWindows(usess).getAttribute("AUTHCHIEFCONTROLLER");

        WindowControl wControl = cc.getWindowControl();
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, wControl);
        NewControllerFactory.getInstance().launch(ureq, bwControl)
        // render the window
        Window w = cc.getWindow();
        w.dispatchRequest(ureq, true); // renderOnly
        return;
      }
     
      // 1. check for direct launch urls, see org.olat.core.dispatcher.jumpin.JumpinConfig
      if (!ureq.isValidDispatchURI()) {
        JumpInReceptionist jh = JumpInManager.getInstance().getJumpInReceptionist(ureq);
        if (jh == null) {
          // found no JumpInManager => try with new 5.1 JumpIn-Resource URL
          String uri = ureq.getNonParsedUri();
          if (uri.startsWith(JumpInManager.CONST_EXTLINK)) {
            String resourceUrl = ureq.getParameter(JumpInManager.CONST_RESOURCE_URL);
            if (resourceUrl != null) {
              // attach the launcher data
              BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
              try {
                // get main window and dynamic tabs
                // brasato:: ChiefController cc = Windows.getWindows(usess).getWindowManager().getMainChiefController();
                ChiefController cc = (ChiefController) Windows.getWindows(usess).getAttribute(AUTHCHIEFCONTROLLER);

                // brasato:: todo: cc = Windows.getWindows(usess).getRegisteredJumpChiefController();
                WindowControl wControl = cc.getWindowControl();
                WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, wControl);
                NewControllerFactory.getInstance().launch(ureq, bwControl)
                // render the window
                Window w = cc.getWindow();
                w.dispatchRequest(ureq, true); // renderOnly
                return;
              } catch (Exception ex) {
                // sendNotFound         
              }
            }
          }
          DispatcherAction.sendNotFound(request.getRequestURI(), response);
          return;
        }
       
        // handler found e.g. for repo/go or cata/go or alike
        OLATResourceable ores = jh.getOLATResourceable();     
        String title = jh.getTitle();

        // get main window and dynamic tabs
        // brasato:: ChiefController cc = Windows.getWindows(usess).getMainOlatChiefController();
        ChiefController cc = (ChiefController) Windows.getWindows(usess).getAttribute(AUTHCHIEFCONTROLLER);

        if (cc == null) throw new AssertException("logged in, but no window/Chiefcontroller 'olatmain' found!");
        WindowControl wControl = cc.getWindowControl();

        // add to tabs
        DTabs dts = (DTabs)wControl.getWindowBackOffice().getWindow().getAttribute(D_TABS);
        synchronized (dts) { //o_clusterok per:fj user session
          DTab dt = dts.getDTab(ores);
          if (dt == null) {
            // no dynamic tab found, lets see if the ores implements the SiteInstance interface.
            boolean isSiteInstance;
            try {
              // try to load class from ores resource type name and try to cast it to SiteInstance
              Class site = ores.getClass().getClassLoader().loadClass(ores.getResourceableTypeName());
              site.asSubclass(SiteInstance.class);
              // ok, casting did not fail, must be a site then
              isSiteInstance = true;
            } catch (Exception e) {
              // casting failed, not a site
              isSiteInstance = false;
            }
           
            if (isSiteInstance) {
              // case A) is a site: create view identifyer for this jump in to the site
              JumpInResult jres = jh.createJumpInResult(ureq, cc.getWindowControl());
              dts.activateStatic(ureq, ores.getResourceableTypeName(), jres.getInitialViewIdentifier());             
            } else {
              // case B) no site and no opened tab -> create and add
              dt = dts.createDTab(ores, title);
              if (dt == null) { // tabs are full
                //create dtabs already issues a warning message 
              } else {
                JumpInResult jres = jh.createJumpInResult(ureq, dt.getWindowControl());
                Controller resC = jres.getController();
                if (resC == null) { // the resource was not found or user is not
                  // allowed to start the resource
                  DispatcherAction.sendNotFound(request.getRequestURI(), response);
                  return;
                }
                dt.setController(resC);
                dts.addDTab(dt);
                dts.activate(ureq, dt, null); // null: do not activate controller
              }             
            }
          } else {
            // case C) opened dyn tab found, activate the dyn tab
            dts.activate(ureq, dt, jh.extractActiveViewId(ureq));
          }
        }
        // render the window
        Window w = cc.getWindow();
        w.dispatchRequest(ureq, true); // renderOnly
      } else { // valid uri for dispatching (has timestamp, componentid and
        // windowid)
        Windows ws = Windows.getWindows(ureq);
        Window window = ws.getWindow(ureq);
        if (window == null) {
          // If no window, this is probably a stale link. send not
          // found
          // note: do not redirect to login since this wastes a new
          // window each time since we are in an authenticated session
          // -> a content packaging with wrong links e.g. /css/my.css
          // wastes all the windows
          DispatcherAction.sendNotFound(request.getRequestURI(), response);
          return;
        }
        window.dispatchRequest(ureq);
      }
    } catch (Throwable th) {
      // Do not log as Warn or Error here, log as ERROR in MsgFactory => ExceptionWindowController throws an OLATRuntimeException
      Tracing.logDebug("handleError in AuthenticatedDispatcher throwable=" + th, getClass());
      DispatcherAction.handleError();
      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.
    } finally {
      GUIInterna.setLoadPerformanceMode(null);
      UserBasedLogLevelManager.deactivateUsernameBasedLogLevel();
View Full Code Here

Examples of org.olat.core.gui.control.ChiefController

      }
    }
  }
 
  private String getRedirectToURL(UserSession usess) {
    ChiefController cc = (ChiefController) Windows.getWindows(usess).getAttribute("AUTHCHIEFCONTROLLER");
    Window w = cc.getWindow();
   
    URLBuilder ubu = new URLBuilder("", w.getInstanceId(), String.valueOf(w.getTimestamp()), null);
    StringOutput sout = new StringOutput(30);
    ubu.buildURI(sout, null, null);
   
View Full Code Here

Examples of org.olat.core.gui.control.ChiefController

        BaseFullWebappControllerParts authSitesAndNav = new AuthBFWCParts();
        return new BaseFullWebappController(lureq, lwControl, authSitesAndNav );
      }
    });

    ChiefController cc = bbc.createChiefController(ureq);
    return cc;
  }
View Full Code Here

Examples of org.olat.core.gui.control.ChiefController

        //
        Windows.getWindows(ureq).getWindowManager().setAjaxWanted(ureq, true);

        // successfull login, reregister window
        ChiefController occ = createAuthHome(ureq);
        Window currentWindow = occ.getWindow();
        currentWindow.setUriPrefix(WebappHelper.getServletContextPath() + "/temp/");
        Windows.getWindows(ureq).registerWindow(currentWindow);
        // render only
        currentWindow.dispatchRequest(ureq, true);
       
      } else {
        // auth: get window
        Windows ws = Windows.getWindows(ureq);
        Window window = ws.getWindow(ureq);
        window.dispatchRequest(ureq);       
      }


    } 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) {
        Tracing.logError("We're fucked up....", t, TemporaryAutoDispatcher.class);
      }
View Full Code Here

Examples of org.olat.core.gui.control.ChiefController

      DispatcherAction.redirectToDefaultDispatcher(response); // error, redirect to login screen
      return;
    }
     
    // brasato:: ChiefController cc = Windows.getWindows(usess).getMainOlatChiefController();
    ChiefController cc = (ChiefController) Windows.getWindows(usess).getAttribute("AUTHCHIEFCONTROLLER");
    if (cc == null) throw new AssertException("logged in, but no window/Chiefcontroller 'olatmain' found!");
    Window w = cc.getWindow();
    w.dispatchRequest(ureq, true); // renderOnly
  }
View Full Code Here

Examples of org.olat.core.gui.control.ChiefController

        }
       
        if (window == null) {
          // no window found, -> start a new WorkFlow/Controller and obtain the window
          // main controller which also implements the windowcontroller for pagestatus and modal dialogs
          ChiefController occ = chiefControllerCreator.createChiefController(ureq);
       
          // browser did not send a cookie && url has a window id with it (= we
          // are clicking a framework link or submitting a framework form)
          //if (sessionId == null && ureq.getWindowID() != null) {
            //Translator trans = new PackageTranslator("org.olat", ureq.getLocale()); // locale
            //occ.getWindowControl().setWarning(trans.translate("wayf.cookies"));
          //}

          window = occ.getWindow();
          window.setUriPrefix(uriPrefix);
          ws.registerWindow(window);
          window.dispatchRequest(ureq, true);
       
        } else {
          window.dispatchRequest(ureq);
        }
      }
    } 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) {
        Tracing.logError("An exception occured while handling the exception...",t, SessionDispatcher.class);
      }
View Full Code Here

Examples of org.olat.core.gui.control.ChiefController

    translator = new PackageTranslator(PACKAGE, ureq.getLocale());
    shibbolethAttributesMap = (Map<String,String>)ureq.getUserSession().getEntry(KEY_SHIBATTRIBUTES);
    shibbolethUniqueID = (String)ureq.getUserSession().getEntry(KEY_SHIBUNIQUEID);
   
    if (shibbolethUniqueID == null) {     
      ChiefController msgcc = MessageWindowController.createMessageChiefController(ureq,
          new AssertException("ShibbolethRegistrationController was unable to fetch ShibbolethUniqueID from session."), translator.translate("error.shibboleth.generic"), null);
      msgcc.getWindow().dispatchRequest(ureq, true);
      return;
    }

    if (shibbolethAttributesMap == null)
      throw new AssertException("ShibbolethRegistrationController was unable to fetch ShibbolethAttribuitesMap from session.");
View Full Code Here

Examples of org.olat.core.gui.control.ChiefController

              // attach the launcher data
              BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
              try {
                // get main window and dynamic tabs
                // brasato:: ChiefController cc = Windows.getWindows(usess).getWindowManager().getMainChiefController();
                ChiefController cc = (ChiefController) Windows.getWindows(usess).getAttribute(AUTHCHIEFCONTROLLER);

                // brasato:: todo: cc = Windows.getWindows(usess).getRegisteredJumpChiefController();
                WindowControl wControl = cc.getWindowControl();
                WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, wControl);
                NewControllerFactory.getInstance().launch(ureq, bwControl)
                // render the window
                Window w = cc.getWindow();
                w.dispatchRequest(ureq, true); // renderOnly
                return;
              } catch (Exception ex) {
                // sendNotFound         
              }
            }
          }
          DispatcherAction.sendNotFound(request.getRequestURI(), response);
          return;
        }
        // handler found e.g. for repo/go
        OLATResourceable ores = jh.getOLATResourceable();
        String title = jh.getTitle();

        // get main window and dynamic tabs
        // brasato:: ChiefController cc = Windows.getWindows(usess).getMainOlatChiefController();
        ChiefController cc = (ChiefController) Windows.getWindows(usess).getAttribute(AUTHCHIEFCONTROLLER);

        if (cc == null) throw new AssertException("logged in, but no window/Chiefcontroller 'olatmain' found!");
        WindowControl wControl = cc.getWindowControl();

        // add to tabs
        DTabs dts = (DTabs)wControl.getWindowBackOffice().getWindow().getAttribute(D_TABS);
        synchronized (dts) { //o_clusterok per user session
          DTab dt = dts.getDTab(ores);
          if (dt == null) {
            // does not yet exist -> create and add
            dt = dts.createDTab(ores, title);
            if (dt == null) { // tabs are full
            //create dtabs already issues a warning message 
            } else {
              JumpInResult jres = jh.createJumpInResult(ureq, dt.getWindowControl());
              Controller resC = jres.getController();
              if (resC == null) { // the resource was not found or user is not
                                  // allowed to start the resource
                DispatcherAction.sendNotFound(request.getRequestURI(), response);
                return;
              }
              dt.setController(resC);
              dts.addDTab(dt);
              dts.activate(ureq, dt, null); // null: do not activate controller
            }
          } else {
            dts.activate(ureq, dt, jh.extractActiveViewId(ureq)); // activate
                                                                  // controller
          }
        }
        // render the window
        Window w = cc.getWindow();
        w.dispatchRequest(ureq, true); // renderOnly
      } else { // valid uri for dispatching (has timestamp, componentid and
        // windowid)
        Windows ws = Windows.getWindows(ureq);
        Window window = ws.getWindow(ureq);
        if (window == null) {
          // If no window, this is probably a stale link. send not
          // found
          // note: do not redirect to login since this wastes a new
          // window each time since we are in an authenticated session
          // -> a content packaging with wrong links e.g. /css/my.css
          // wastes all the windows
          DispatcherAction.sendNotFound(request.getRequestURI(), response);
          return;
        }
        window.dispatchRequest(ureq);
      }
    } catch (Throwable th) {
      Tracing.logDebug("handleError in AuthenticatedDispatcher", getClass());
      DispatcherAction.handleError();
      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.
    } finally {
      GUIInterna.setLoadPerformanceMode(null);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.