diff --git a/src/main/java/de/bps/olat/registration/DMZEMChangeContentControllerCreator.java b/src/main/java/de/bps/olat/registration/DMZEMChangeContentControllerCreator.java index 3909d89e4471cc0fd3e2b6e0ff0e8ece21b5cb0e..a0e03e996371697e53305ce20e73a66fe2edd639 100644 --- a/src/main/java/de/bps/olat/registration/DMZEMChangeContentControllerCreator.java +++ b/src/main/java/de/bps/olat/registration/DMZEMChangeContentControllerCreator.java @@ -40,13 +40,13 @@ import de.bps.olat.user.ChangeEMailController; */ public class DMZEMChangeContentControllerCreator implements ControllerCreator { + @Override public Controller createController(UserRequest lureq, WindowControl lwControl) { DmzBFWCParts dmzSitesAndNav = new DmzBFWCParts(); dmzSitesAndNav.showTopNav(false); AutoCreator contentControllerCreator = new AutoCreator(); contentControllerCreator.setClassName(ChangeEMailController.class.getName()); dmzSitesAndNav.setContentControllerCreator(contentControllerCreator); - return new BaseFullWebappController(lureq, dmzSitesAndNav ); + return new BaseFullWebappController(lureq, dmzSitesAndNav); } - -} +} \ No newline at end of file diff --git a/src/main/java/org/olat/basesecurity/AuthHelper.java b/src/main/java/org/olat/basesecurity/AuthHelper.java index a4fb1649fd07155f1293a8ed03f38f7d951083fd..746edf397b893907b0718f8d2c60cbefc33a0f68 100644 --- a/src/main/java/org/olat/basesecurity/AuthHelper.java +++ b/src/main/java/org/olat/basesecurity/AuthHelper.java @@ -179,7 +179,7 @@ public class AuthHelper { if (!ureq.getUserSession().isAuthenticated()) throw new AssertException("not authenticated!"); BaseFullWebappControllerParts guestSitesAndNav = new GuestBFWCParts(); - ChiefController cc = new BaseFullWebappController(ureq, guestSitesAndNav ); + ChiefController cc = new BaseFullWebappController(ureq, guestSitesAndNav); Windows.getWindows(ureq.getUserSession()).setChiefController(cc); log.debug("set session-attribute 'AUTHCHIEFCONTROLLER'"); return cc; diff --git a/src/main/java/org/olat/core/commons/controllers/resume/ResumeController.java b/src/main/java/org/olat/core/commons/controllers/resume/ResumeController.java index a854f79bf64e8e5ad67b8454fa50f72e6b0beb1a..952f018ec0abf9a095c36599a5dd631a038f5197 100644 --- a/src/main/java/org/olat/core/commons/controllers/resume/ResumeController.java +++ b/src/main/java/org/olat/core/commons/controllers/resume/ResumeController.java @@ -121,8 +121,6 @@ public class ResumeController extends FormBasicController implements SupportsAft return interception; } - - @Override protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { if(source.equals(noButton)){ diff --git a/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappController.java b/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappController.java index 01cd8ac9821e526dc03aa5ea1e985486ce9b290f..ff6acf6357a044e50390af21742c2220f91d39cb 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappController.java @@ -61,9 +61,11 @@ import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.ChiefController; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; +import org.olat.core.gui.control.ScreenMode; import org.olat.core.gui.control.VetoableCloseController; import org.olat.core.gui.control.WindowBackOffice; import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.ScreenMode.Mode; import org.olat.core.gui.control.controller.BasicController; import org.olat.core.gui.control.creator.ControllerCreator; import org.olat.core.gui.control.generic.dtabs.Activateable2; @@ -118,6 +120,7 @@ public class BaseFullWebappController extends BasicController implements ChiefCo private Controller jsLoggerC; private List<String> bodyCssClasses = new ArrayList<>(3); + private final ScreenMode screenMode = new ScreenMode(); private WindowBackOffice wbo; // STARTED @@ -163,12 +166,6 @@ public class BaseFullWebappController extends BasicController implements ChiefCo super(ureq, null); this.baseFullWebappControllerParts = baseFullWebappControllerParts; - - Object fullScreen = Windows.getWindows(ureq).getAttribute("FULL_SCREEN"); - if(Boolean.TRUE.equals(fullScreen)) { - addBodyCssClass("b_full_screen"); - Windows.getWindows(ureq).setAttribute("FULL_SCREEN", null); - } guiMessage = new GUIMessage(); guimsgPanel = new OncePanel("guimsgPanel"); @@ -182,7 +179,6 @@ public class BaseFullWebappController extends BasicController implements ChiefCo WindowControl myWControl = new BaseFullWebappWindowControl(this, wbo); overrideWindowControl(myWControl); - /* * BaseFullWebappController provides access to Dynamic Tabs * on the same window and not on all Windows! @@ -213,30 +209,31 @@ public class BaseFullWebappController extends BasicController implements ChiefCo initializeBase(ureq, winman, initialPanel); if (CoreSpringFactory.containsBean("fullWebApp.AfterLoginInterceptionControllerCreator")){ - // present an overlay with configured afterlogin-controllers or nothing if none configured. + // present an overlay with configured afterlogin-controllers or nothing if none configured. // presented only once per session. - Boolean alreadySeen = ((Boolean)ureq.getUserSession().getEntry(PRESENTED_AFTER_LOGIN_WORKFLOW)); - if (ureq.getUserSession().isAuthenticated() && alreadySeen == null) { - Controller aftLHookCtr = ((ControllerCreator) CoreSpringFactory.getBean("fullWebApp.AfterLoginInterceptionControllerCreator")).createController(ureq, getWindowControl()); - listenTo(aftLHookCtr); - aftLHookCtr.getInitialComponent(); - ureq.getUserSession().putEntry(PRESENTED_AFTER_LOGIN_WORKFLOW, Boolean.TRUE); - } + Boolean alreadySeen = ((Boolean)ureq.getUserSession().getEntry(PRESENTED_AFTER_LOGIN_WORKFLOW)); + if (ureq.getUserSession().isAuthenticated() && alreadySeen == null) { + Controller aftLHookCtr = ((ControllerCreator) CoreSpringFactory.getBean("fullWebApp.AfterLoginInterceptionControllerCreator")) + .createController(ureq, getWindowControl()); + listenTo(aftLHookCtr); + aftLHookCtr.getInitialComponent(); + ureq.getUserSession().putEntry(PRESENTED_AFTER_LOGIN_WORKFLOW, Boolean.TRUE); + } + } + + Object fullScreen = Windows.getWindows(ureq).getAttribute("FULL_SCREEN"); + if(Boolean.TRUE.equals(fullScreen)) { + Windows.getWindows(ureq).setAttribute("FULL_SCREEN", null); + screenMode.setMode(Mode.full); } - /* - * register for cycle event to be able to adjust the guimessage place - */ + // register for cycle event to be able to adjust the guimessage place getWindowControl().getWindowBackOffice().addCycleListener(this); - /* - * register for locale change events -> - */ + // register for locale change events -> //move to a i18nModule? languageManger? languageChooserController? OLATResourceable wrappedLocale = OresHelper.createOLATResourceableType(Locale.class); ureq.getUserSession().getSingleUserEventCenter().registerFor(this, getIdentity(), wrappedLocale); - /* - * register for global sticky message changed events - */ + // register for global sticky message changed events GlobalStickyMessage.registerForGlobalStickyMessage(this, ureq.getIdentity()); } @@ -333,6 +330,8 @@ public class BaseFullWebappController extends BasicController implements ChiefCo private void initialize(UserRequest ureq) { mainVc = createVelocityContainer("fullwebapplayout"); + mainVc.contextPut("screenMode", screenMode); + // use separate container for navigation to prevent full page refresh in ajax mode on site change // nav is not a controller part because it is a fundamental part of the BaseFullWebAppConroller. navSitesVc = createVelocityContainer("nav_sites"); @@ -666,7 +665,6 @@ public class BaseFullWebappController extends BasicController implements ChiefCo } // FROM FULLCHIEFCONTROLLER - //fxdiff BAKS-7 Resume function private void activateSite(SiteInstance s, UserRequest ureq, List<ContextEntry> entries, boolean forceReload) { BornSiteInstance bs = siteToBornSite.get(s); @@ -698,11 +696,10 @@ public class BaseFullWebappController extends BasicController implements ChiefCo siteToBornSite.put(s, new BornSiteInstance(gs, resC)); } doActivateSite(s, gs); - //fxdiff BAKS-7 Resume function if(resC instanceof Activateable2) { ((Activateable2)resC).activate(ureq, entries, null); } - //fxdiff perhaps has activation changed the gui stack and it need to be updated + //perhaps has activation changed the gui stack and it need to be updated setGuiStack(gs); } @@ -778,17 +775,23 @@ public class BaseFullWebappController extends BasicController implements ChiefCo Window myWindow = getWindowControl().getWindowBackOffice().getWindow(); myWindow.setCustomCSS(customCSS); // add css component to view - mainVc.put("jsAndCss", customCSS.getJSAndCSSComponent()); + mainVc.put("jsAndCss", customCSS.getJSAndCSSComponent()); addCustomThemeJS(); } - + + @Override + public ScreenMode getScreenMode() { + return screenMode; + } + /** * adds a css-Classname to the OLAT body-tag * * @param cssClass * the name of a css-Class */ + @Override public void addBodyCssClass(String cssClass) { // sets class for full page refreshes bodyCssClasses.add(cssClass); @@ -796,7 +799,6 @@ public class BaseFullWebappController extends BasicController implements ChiefCo // only relevant in AJAX mode JSCommand jsc = new JSCommand("try { jQuery('#b_body').addClass('" + cssClass + "'); } catch(e){if(o_info.debug) console.log(e) }"); getWindowControl().getWindowBackOffice().sendCommandTo(jsc); - } /** @@ -805,6 +807,7 @@ public class BaseFullWebappController extends BasicController implements ChiefCo * @param cssClass * the name of a css-Class */ + @Override public void removeBodyCssClass(String cssClass) { // sets class for full page refreshes bodyCssClasses.remove(cssClass); diff --git a/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsBackController.java b/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsBackController.java index 7390d5ab7fd0779be428ef682602beb324328074..68c2585bbebbade81cea0fe9d3b2de08148ce35c 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsBackController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsBackController.java @@ -29,6 +29,7 @@ import org.olat.core.gui.control.ChiefController; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.ScreenMode.Mode; import org.olat.core.gui.control.controller.MainLayoutBasicController; import org.olat.core.gui.control.generic.layout.MainLayout3ColumnsController; @@ -110,10 +111,7 @@ public class LayoutMain3ColsBackController extends MainLayoutBasicController imp * Activate this back workflow */ public void activate() { - if(fullScreen) - getWindowControl().pushAsModalDialog(backVC); - else - getWindowControl().pushToMainArea(backVC); + getWindowControl().pushToMainArea(backVC); } public boolean isFullScreen() { @@ -124,7 +122,7 @@ public class LayoutMain3ColsBackController extends MainLayoutBasicController imp ChiefController cc = Windows.getWindows(ureq).getChiefController(); if (cc != null) { thebaseChief = cc; - thebaseChief.addBodyCssClass("b_full_screen"); + thebaseChief.getScreenMode().setMode(Mode.full); } fullScreen = true; } @@ -135,9 +133,8 @@ public class LayoutMain3ColsBackController extends MainLayoutBasicController imp */ public void deactivate() { getWindowControl().pop(); - // fxdiff FXOLAT-116: SCORM improvements if (fullScreen && thebaseChief != null) { - thebaseChief.removeBodyCssClass("b_full_screen"); + thebaseChief.getScreenMode().setMode(Mode.standard); } } @@ -150,10 +147,12 @@ public class LayoutMain3ColsBackController extends MainLayoutBasicController imp // // Methods from the 3 col layout: // + @Override public void hideCol1(boolean hide) { this.layoutCtr.hideCol1(hide); } + @Override public void hideCol2(boolean hide) { this.layoutCtr.hideCol2(hide); } diff --git a/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsController.java b/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsController.java index a2f3e8d4ff5da16af76e269f1d02f25a44859b66..69cbb4d558300978fab60f7ee9c71b3362247142 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsController.java @@ -34,6 +34,7 @@ import org.olat.core.gui.control.ChiefController; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.ScreenMode.Mode; import org.olat.core.gui.control.controller.MainLayoutBasicController; import org.olat.core.gui.control.generic.dtabs.Activateable2; import org.olat.core.gui.control.generic.layout.MainLayout3ColumnsController; @@ -187,7 +188,7 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme ChiefController cc = Windows.getWindows(ureq).getChiefController(); if (cc != null) { thebaseChief = cc; - thebaseChief.addBodyCssClass("b_full_screen"); + thebaseChief.getScreenMode().setMode(Mode.full); } else { Windows.getWindows(ureq).setAttribute("FULL_SCREEN", Boolean.TRUE); } @@ -195,26 +196,21 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme } public void activate() { - if(fullScreen) - getWindowControl().pushAsModalDialog(layoutMainVC); - else - getWindowControl().pushToMainArea(layoutMainVC); + getWindowControl().pushToMainArea(layoutMainVC); } public void deactivate(UserRequest ureq) { getWindowControl().pop(); - // fxdiff FXOLAT-116: SCORM improvements if (fullScreen) { if(thebaseChief != null) { - thebaseChief.removeBodyCssClass("b_full_screen"); + thebaseChief.getScreenMode().setMode(Mode.standard); } else if (ureq != null){ ChiefController cc = Windows.getWindows(ureq).getChiefController(); if (cc != null) { thebaseChief = cc; - thebaseChief.removeBodyCssClass("b_full_screen"); + thebaseChief.getScreenMode().setMode(Mode.standard); } } - } } diff --git a/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsPreviewController.java b/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsPreviewController.java index 2b7af21b71dce32c37973a94bb1f4cf3d8273bdc..aa0bbac26416b167b9c2325766e58fafc553000e 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsPreviewController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsPreviewController.java @@ -29,6 +29,7 @@ import org.olat.core.gui.control.ChiefController; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.ScreenMode.Mode; import org.olat.core.gui.control.controller.MainLayoutBasicController; import org.olat.core.gui.control.generic.layout.MainLayout3ColumnsController; @@ -106,18 +107,15 @@ public class LayoutMain3ColsPreviewController extends MainLayoutBasicController * Activate this preview workflow */ public void activate() { - if(fullScreen) - getWindowControl().pushAsModalDialog(previewVC); - else - getWindowControl().pushToMainArea(previewVC); + getWindowControl().pushToMainArea(previewVC); } - //fxdiff FXOLAT-116: SCORM improvements + public void setAsFullscreen(UserRequest ureq) { ChiefController cc = Windows.getWindows(ureq).getChiefController(); if (cc != null) { thebaseChief = cc; - thebaseChief.addBodyCssClass("b_full_screen"); + thebaseChief.getScreenMode().setMode(Mode.full); } fullScreen = true; } @@ -127,9 +125,8 @@ public class LayoutMain3ColsPreviewController extends MainLayoutBasicController */ public void deactivate() { getWindowControl().pop(); - // fxdiff FXOLAT-116: SCORM improvements if (fullScreen) { - thebaseChief.removeBodyCssClass("b_full_screen"); + thebaseChief.getScreenMode().setMode(Mode.standard); } } diff --git a/src/main/java/org/olat/core/commons/fullWebApp/_content/fullwebapplayout.html b/src/main/java/org/olat/core/commons/fullWebApp/_content/fullwebapplayout.html index 16f89b54d6ebd776a8ef8924289e08ed8f533bc7..e1225eeb3f852882b5af063cea08bd3a381b2007 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/_content/fullwebapplayout.html +++ b/src/main/java/org/olat/core/commons/fullWebApp/_content/fullwebapplayout.html @@ -161,7 +161,9 @@ $r.renderForce("development") <!-- START olatContentPanel --> <a href="#o_main_container" class="sr-only">$r.translate("access.skip.to.content")</a> -<div id="o_beta_logo"></div> +#if($screenMode.standardScreen) + <div id="o_beta_logo"></div> +#end ## ---- START #o_messages ## Messages are absolute positioned using EXT, thus it's ok to have them at the end of the page. @@ -171,6 +173,7 @@ $r.renderForce("development") ## ---- END #o_messages --- ## ---- START #o_header --- +#if($screenMode.standardScreen) <div id="o_header_wrapper"> <div id="o_header_container" class="o_container_offcanvas container-fluid"> <div id="o_logo"></div> @@ -182,9 +185,11 @@ $r.renderForce("development") #end </div> </div> +#end ## ---- END #o_header --- ## ---- START #o_navbar --- +#if($screenMode.standardScreen) <div id="o_offcanvas_right" class="o_navbar o_navbar-offcanvas o_navbar-inverse " role="navigation"> <a href="#" class="o_offcanvas_close" title="$r.translate("close")"><i class='o_icon o_icon_close o_icon-lg'></i></a> <div id="o_offcanvas_container" class="o_navbar-collapse"> @@ -214,7 +219,7 @@ $r.renderForce("development") </div> </div> </div> - +#end ## ---- END #o_navbar --- #if($hasStickyMessage) @@ -238,7 +243,7 @@ $r.renderForce("development") ## END #o_main ----- ## ----- START #b_footer ---------- -#if($r.available("footerComponent")) +#if($screenMode.standardScreen && $r.available("footerComponent")) <div id="o_footer_wrapper"> <div id="o_footer_container" class="o_container_offcanvas container-fluid"> $r.render("footerComponent") @@ -247,31 +252,22 @@ $r.renderForce("development") #end ## ---- END #b_footer --- - - ## ---- START #b_modal ## Modal dialog is absolute positioned, thus it's ok to have it at the end of the page. ## This prevents an ugly IE bug that appears when the modal dialog is at the top of the page. ## IE can't render empty div's properly which results in an ugly white bar. - $r.render("modalpanel") +$r.render("modalpanel") ## ---- END #b_nav --- - - -<!-- END olatContentPanel --> ## the div for the busy-wait animated-gif <div id="b_ajax_busy" class=""></div> ## hidden div for EM-PX factor readout <div id="b_width_1em" style="width:1em; position: absolute; left: -1000px;"></div> -<div> -<script type="text/javascript"> +<div><script type="text/javascript"> /* <![CDATA[ */ // init size and listen to text resize events jQuery(function() { b_initEmPxFactor(); }); /* ]]> */ -</script> -</div> -</body></html> - +</script></div></body></html> \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/components/Window.java b/src/main/java/org/olat/core/gui/components/Window.java index 7d10e52efd778452f1d8fd88ee4b0893d2e17d2b..cd5a7afd970d9600f95deb8428e09c5b84421c8c 100644 --- a/src/main/java/org/olat/core/gui/components/Window.java +++ b/src/main/java/org/olat/core/gui/components/Window.java @@ -96,6 +96,7 @@ import org.olat.testutils.codepoints.server.Codepoint; public class Window extends AbstractComponent { private static final OLog log = Tracing.createLoggerFor(Window.class); + private static final DispatchResult NO_DISPATCHRESULT = new DispatchResult(false, false, false); private static final String LOG_SEPARATOR = "^$^"; /** @@ -292,7 +293,6 @@ public class Window extends AbstractComponent { GlobalSettings gsettings = wbackofficeImpl.getGlobalSettings(); boolean bgEnab = gsettings.getAjaxFlags().isIframePostEnabled(); - //System.out.println("in window:"); // ------------------------- // ----- ajax mode --------- // ------------------------- @@ -310,7 +310,9 @@ public class Window extends AbstractComponent { //--> boolean inlineAfterBackForward = false; // FIXME:fj:b avoid double traversal to find component again below String s_compID = ureq.getComponentID(); - if (s_compID == null) throw new AssertException("no component id found in req:" + ureq.toString()); + if (s_compID == null) { + throw new AssertException("no component id found in req:" + ureq.toString()); + } // throws NumberFormatException if not a number //long compID = Long.parseLong(s_compID); List<Component> foundPath = new ArrayList<Component>(10); @@ -333,10 +335,12 @@ public class Window extends AbstractComponent { // 2.) collect dirty components (top-down, return from sub-path when first dirty node met) // 3.) return to sender... boolean didDispatch = false; + boolean switchScreenMode = false; if (validForDispatching) { DispatchResult dispatchResult = doDispatchToComponent(ureq, null); // FIXME:fj:c enable time stats for ajax-mode didDispatch = dispatchResult.isDispatch(); incTimestamp = dispatchResult.isIncTimestamp(); + switchScreenMode = dispatchResult.isSwitchScreenMode(); if (isDebugLog) { long durationAfterDoDispatchToComponent = System.currentTimeMillis() - debug_start; log.debug("Perf-Test: Window durationAfterDoDispatchToComponent=" + durationAfterDoDispatchToComponent); @@ -346,7 +350,12 @@ public class Window extends AbstractComponent { MediaResource mmr = null; //REVIEW:PB: this will be the code allowing back forward navigation //-----> if (didDispatch || inlineAfterBackForward) { - if (didDispatch || !validForDispatching) { + if (switchScreenMode) { + //force RELOAD with a redirect to itself + String reRenderUri = buildURIFor(this, timestampID, null); + Command rmrcom = CommandFactory.createParentRedirectTo(reRenderUri); + wbackofficeImpl.sendCommandTo(rmrcom); + } else if (didDispatch || !validForDispatching) { if (validForDispatching) { Window ww = ureq.getDispatchResult().getResultingWindow(); if (ww != null) { @@ -1063,12 +1072,12 @@ public class Window extends AbstractComponent { */ private DispatchResult doDispatchToComponent(UserRequest ureq, StringBuilder debugMsg) { String s_compID = ureq.getComponentID(); - if (s_compID == null) return new DispatchResult(false, false); //throw new AssertException("no component id found in req:" + ureq.toString()); - - + if (s_compID == null) { + return NO_DISPATCHRESULT; + } + Component target; List<Component> foundPath = new ArrayList<Component>(10); - // OLAT-1973 if (GUIInterna.isLoadPerformanceMode()) { String compPath = ureq.getParameter("e"); @@ -1120,16 +1129,18 @@ public class Window extends AbstractComponent { if (target == null) { // there was a component id given, but no matching target could be found fireEvent(ureq, COMPONENTNOTFOUND); - return new DispatchResult(false, false); + 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; //TODO:fj:c is foundpath needed for something else than the enabled-check. if no -> one boolean is enough + 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(); @@ -1138,6 +1149,7 @@ public class Window extends AbstractComponent { break; } } + if (toDispatch) { latestDispatchComponentInfo = target.getComponentName() + " :" + target.getExtendedDebugInfo(); latestDispatchedComp = target; @@ -1150,9 +1162,7 @@ public class Window extends AbstractComponent { List<Component> ancestors = ComponentHelper.findAncestorsOrSelfByID(getContentPane(), target); for(Component ancestor:ancestors) { incTimestamp |= ancestor.isSilentlyDynamicalCmp(); - //System.out.println("Ancestor -> " + ancestor.getComponentName() + " :: " + ancestor); } - //System.out.println("Target -> " + highDynamical + " :: " + target); // after dispatching, commit (docu) DBFactory.getInstance().commit(); @@ -1160,43 +1170,9 @@ public class Window extends AbstractComponent { // 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) { - Controller c = target.getLatestDispatchedController(); - if (c != null) { - WindowControl wCo = null; - try { - wCo = c.getWindowControlForDebug(); - } catch (Exception e) { - // getWindowControl throw an Assertion if wControl = null - } - if (wCo != null) { - String coInfo = ""; - WindowControlInfo wci = wCo.getWindowControlInfo(); - while (wci != null) { - String cName = wci.getControllerClassName(); - coInfo = cName + ":" + coInfo; - wci = wci.getParentWindowControlInfo(); - } - - BusinessControl bc = wCo.getBusinessControl(); - String businessPath = bc == null? "n/a":bc.getAsString(); - String compName = target.getComponentName(); - String msg = "wci:"+coInfo+"%%"+compName+"%%"+businessPath+"%%"; - // allowed for debugging, dispatching is already over - Event ev = target.getAndClearLatestFiredEvent(); - if (ev != null) { - msg += ev.getClass().getName()+":"+ev.getCommand()+"%%"; - } - String targetInfo = target.getExtendedDebugInfo(); - msg += targetInfo+"%%"; - debugMsg.append(msg).append(LOG_SEPARATOR); - //Tracing.logDebug(msg, WindowStats.class); - } else { - // no windowcontrol -> ignore - } - } // else: a component with -no- controller as listener, makes no sense in 99.99% of the cases; ignore in those rare cases + appendDispatchDebugInfos(target, debugMsg); } else { // no debug level, consume the left over event (for minor memory reasons) target.getAndClearLatestFiredEvent(); @@ -1204,9 +1180,50 @@ public class Window extends AbstractComponent { // 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; + latestDispatchedComp = null; } - return new DispatchResult(toDispatch, incTimestamp); + + ChiefController chief = Windows.getWindows(ureq).getChiefController(); + boolean switchScreenMode = chief == null ? + false : chief.getScreenMode().wishScreenModeSwitch(true); + return new DispatchResult(toDispatch, incTimestamp, switchScreenMode); + } + + private void appendDispatchDebugInfos(Component target, StringBuilder debugMsg) { + Controller c = target.getLatestDispatchedController(); + if (c != null) { + WindowControl wCo = null; + try { + wCo = c.getWindowControlForDebug(); + } catch (Exception e) { + // getWindowControl throw an Assertion if wControl = null + } + if (wCo != null) { + String coInfo = ""; + WindowControlInfo wci = wCo.getWindowControlInfo(); + while (wci != null) { + String cName = wci.getControllerClassName(); + coInfo = cName + ":" + coInfo; + wci = wci.getParentWindowControlInfo(); + } + + BusinessControl bc = wCo.getBusinessControl(); + String businessPath = bc == null? "n/a":bc.getAsString(); + String compName = target.getComponentName(); + String msg = "wci:"+coInfo+"%%"+compName+"%%"+businessPath+"%%"; + // allowed for debugging, dispatching is already over + Event ev = target.getAndClearLatestFiredEvent(); + if (ev != null) { + msg += ev.getClass().getName()+":"+ev.getCommand()+"%%"; + } + String targetInfo = target.getExtendedDebugInfo(); + msg += targetInfo+"%%"; + debugMsg.append(msg).append(LOG_SEPARATOR); + //Tracing.logDebug(msg, WindowStats.class); + } else { + // no windowcontrol -> ignore + } + } // else: a component with -no- controller as listener, makes no sense in 99.99% of the cases; ignore in those rare cases } private List<Component> findComponentsWithChildName(final String childName, Component searchRoot) { @@ -1297,16 +1314,22 @@ public class Window extends AbstractComponent { class DispatchResult { private final boolean dispatch; private final boolean incTimestamp; + private final boolean switchScreenMode; - public DispatchResult(boolean dispatch, boolean incTimestamp) { + public DispatchResult(boolean dispatch, boolean incTimestamp, boolean switchScreenMode) { this.dispatch = dispatch; this.incTimestamp = incTimestamp; + this.switchScreenMode = switchScreenMode; } public boolean isDispatch() { return dispatch; } + public boolean isSwitchScreenMode() { + return switchScreenMode; + } + public boolean isIncTimestamp() { return incTimestamp; } diff --git a/src/main/java/org/olat/core/gui/control/ChiefController.java b/src/main/java/org/olat/core/gui/control/ChiefController.java index d2d2af5a95bdddbcce56148e03f237dceb243e50..93793d2f0779a900ee8fa15018116ee6c69466de 100644 --- a/src/main/java/org/olat/core/gui/control/ChiefController.java +++ b/src/main/java/org/olat/core/gui/control/ChiefController.java @@ -43,6 +43,8 @@ public interface ChiefController extends Controller { */ public WindowControl getWindowControl(); + public ScreenMode getScreenMode(); + /** * Set a class to the <body> * @param cssClass diff --git a/src/main/java/org/olat/core/gui/control/DefaultChiefController.java b/src/main/java/org/olat/core/gui/control/DefaultChiefController.java index fc79b02e2873861421b9bd0b4c6ee3cb9a683bb3..89c4522f49f538eb7cac94889cd7472e763c00a0 100644 --- a/src/main/java/org/olat/core/gui/control/DefaultChiefController.java +++ b/src/main/java/org/olat/core/gui/control/DefaultChiefController.java @@ -39,10 +39,8 @@ import org.olat.core.logging.AssertException; public abstract class DefaultChiefController extends DefaultController implements ChiefController { private Window window; private WindowControl windowControl; - - /** - * - */ + private final ScreenMode screenMode = new ScreenMode(); + public DefaultChiefController() { super(null); // nothing to do @@ -65,6 +63,11 @@ public abstract class DefaultChiefController extends DefaultController implement this.window = window; } + @Override + public ScreenMode getScreenMode() { + return screenMode; + } + /** * @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) */ @@ -99,5 +102,4 @@ public abstract class DefaultChiefController extends DefaultController implement protected void setWindowControl(WindowControl windowControl) { this.windowControl = windowControl; } - } \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/control/ScreenMode.java b/src/main/java/org/olat/core/gui/control/ScreenMode.java new file mode 100644 index 0000000000000000000000000000000000000000..c2c63160715125a426e7bac9201c7a0521a0acf8 --- /dev/null +++ b/src/main/java/org/olat/core/gui/control/ScreenMode.java @@ -0,0 +1,86 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.core.gui.control; + +/** + * + * Initial date: 20.05.2014<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class ScreenMode { + private Mode wish; + private boolean fullScreen; + + public boolean isFullScreen() { + return fullScreen; + } + + public boolean isStandardScreen() { + return !fullScreen; + } + + public void setMode(Mode mode) { + fullScreen = Mode.full.equals(mode); + this.wish = mode; + } + + public boolean isWishFullScreen() { + return wish != null && wish.equals(Mode.full); + } + + public boolean isWishStandardScreen() { + return wish != null && wish.equals(Mode.standard); + } + + /** + * + * @param erase If true, erase the wish because it probably come true + * @return + */ + public boolean wishScreenModeSwitch(boolean erase) { + Mode w = wish; + if(erase) { + wish = null; + } + return w != null; + } + + public boolean wishFullScreen(boolean erase) { + Mode w = wish; + if(erase) { + wish = null; + } + return w != null && w.equals(Mode.full); + } + + public boolean wishStandardScreen(boolean erase) { + Mode w = wish; + if(erase) { + wish = null; + } + return w != null && w.equals(Mode.standard); + } + + public enum Mode { + standard, + full + } +} diff --git a/src/main/java/org/olat/course/nodes/iq/IQRunController.java b/src/main/java/org/olat/course/nodes/iq/IQRunController.java index 99fc37c8077a095d32503ce20f51ddaba32cfde5..346615e3922fe148bc8e6278f39d4e13311ba500 100644 --- a/src/main/java/org/olat/course/nodes/iq/IQRunController.java +++ b/src/main/java/org/olat/course/nodes/iq/IQRunController.java @@ -686,7 +686,6 @@ public class IQRunController extends BasicController implements GenericEventList } @Override - //fxdiff BAKS-7 Resume function public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) { if(entries == null || entries.isEmpty()) return; diff --git a/src/main/java/org/olat/course/run/RunMainController.java b/src/main/java/org/olat/course/run/RunMainController.java index ae0618e2af36c87a6dc9b54d032cc7f647a0cb67..844269d8a3b9de2d9cf5e7e8341fd70ea8a75023 100644 --- a/src/main/java/org/olat/course/run/RunMainController.java +++ b/src/main/java/org/olat/course/run/RunMainController.java @@ -541,8 +541,11 @@ public class RunMainController extends MainLayoutBasicController implements Gene if (nodeid != null) { CourseNode identNode = course.getRunStructure().getNode(nodeid); boolean success = updateTreeAndContent(ureq, identNode, null); - if (success) currentCourseNode = identNode; - else getWindowControl().setWarning(translate("msg.nodenotavailableanymore")); + if (success) { + currentCourseNode = identNode; + } else { + getWindowControl().setWarning(translate("msg.nodenotavailableanymore")); + } } } } diff --git a/src/main/java/org/olat/login/DMZContentControllerCreator.java b/src/main/java/org/olat/login/DMZContentControllerCreator.java index 06fe382df1782ac3038ea2476ff576ff9749f3bf..4287962e9d61c427a6f7ba93a6698d9c62d5ea6a 100644 --- a/src/main/java/org/olat/login/DMZContentControllerCreator.java +++ b/src/main/java/org/olat/login/DMZContentControllerCreator.java @@ -41,15 +41,12 @@ import org.olat.core.gui.control.creator.ControllerCreator; */ public class DMZContentControllerCreator implements ControllerCreator { - /** - * @see org.olat.core.gui.control.creator.ControllerCreator#createController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl) - */ + @Override public Controller createController(UserRequest lureq, WindowControl lwControl) { DmzBFWCParts dmzSitesAndNav = new DmzBFWCParts(); AutoCreator contentControllerCreator = new AutoCreator(); contentControllerCreator.setClassName(LoginAuthprovidersController.class.getName()); dmzSitesAndNav.setContentControllerCreator(contentControllerCreator); - return new BaseFullWebappController(lureq, dmzSitesAndNav ); + return new BaseFullWebappController(lureq, dmzSitesAndNav); } - -} +} \ No newline at end of file diff --git a/src/main/java/org/olat/registration/DMZPWChangeContentControllerCreator.java b/src/main/java/org/olat/registration/DMZPWChangeContentControllerCreator.java index e0b489fbe5b75dcdba8cceae3606cccfc69389d8..06b85735efe30632d7bbbeedf2e432a397ebf780 100644 --- a/src/main/java/org/olat/registration/DMZPWChangeContentControllerCreator.java +++ b/src/main/java/org/olat/registration/DMZPWChangeContentControllerCreator.java @@ -42,9 +42,7 @@ import org.olat.login.DmzBFWCParts; */ public class DMZPWChangeContentControllerCreator implements ControllerCreator { - /** - * @see org.olat.core.gui.control.creator.ControllerCreator#createController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl) - */ + @Override public Controller createController(UserRequest lureq, WindowControl lwControl) { DmzBFWCParts dmzSitesAndNav = new DmzBFWCParts(); dmzSitesAndNav.showTopNav(false); @@ -53,5 +51,4 @@ public class DMZPWChangeContentControllerCreator implements ControllerCreator { dmzSitesAndNav.setContentControllerCreator(contentControllerCreator); return new BaseFullWebappController(lureq, dmzSitesAndNav); } - -} +} \ No newline at end of file diff --git a/src/main/java/org/olat/registration/DMZRegistrationContentControllerCreator.java b/src/main/java/org/olat/registration/DMZRegistrationContentControllerCreator.java index ef3f67635b9087baa2ce22bac763175a7c02ea3d..902707a059ef724b33e4d82ae4ed582382ce39c1 100644 --- a/src/main/java/org/olat/registration/DMZRegistrationContentControllerCreator.java +++ b/src/main/java/org/olat/registration/DMZRegistrationContentControllerCreator.java @@ -42,16 +42,13 @@ import org.olat.login.DmzBFWCParts; */ public class DMZRegistrationContentControllerCreator implements ControllerCreator { - /** - * @see org.olat.core.gui.control.creator.ControllerCreator#createController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl) - */ + @Override public Controller createController(UserRequest lureq, WindowControl lwControl) { DmzBFWCParts dmzSitesAndNav = new DmzBFWCParts(); dmzSitesAndNav.showTopNav(false); AutoCreator contentControllerCreator = new AutoCreator(); contentControllerCreator.setClassName(RegistrationController.class.getName()); dmzSitesAndNav.setContentControllerCreator(contentControllerCreator); - return new BaseFullWebappController(lureq, dmzSitesAndNav ); + return new BaseFullWebappController(lureq, dmzSitesAndNav); } - -} +} \ No newline at end of file diff --git a/src/main/java/org/olat/shibboleth/DMZShibRegistrationContentControllerCreator.java b/src/main/java/org/olat/shibboleth/DMZShibRegistrationContentControllerCreator.java index 7210e217a4825530a06aff88a232cdbc816c01ca..13ef163badf1cf9edc99a4e05a3d3e3a1d9bda31 100644 --- a/src/main/java/org/olat/shibboleth/DMZShibRegistrationContentControllerCreator.java +++ b/src/main/java/org/olat/shibboleth/DMZShibRegistrationContentControllerCreator.java @@ -42,15 +42,12 @@ import org.olat.login.DmzBFWCParts; */ public class DMZShibRegistrationContentControllerCreator implements ControllerCreator { - /** - * @see org.olat.core.gui.control.creator.ControllerCreator#createController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl) - */ + @Override public Controller createController(UserRequest lureq, WindowControl lwControl) { DmzBFWCParts dmzSitesAndNav = new DmzBFWCParts(); AutoCreator contentControllerCreator = new AutoCreator(); contentControllerCreator.setClassName(ShibbolethRegistrationController.class.getName()); dmzSitesAndNav.setContentControllerCreator(contentControllerCreator); - return new BaseFullWebappController(lureq, dmzSitesAndNav ); + return new BaseFullWebappController(lureq, dmzSitesAndNav); } - -} +} \ No newline at end of file