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 548897376ad6a4d58f005da063a83e2a7eb968af..25b7a4f01a68a68024d012e1d4aa1419d784ea50 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappController.java @@ -67,7 +67,6 @@ 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.Reload; import org.olat.core.gui.control.ScreenMode; import org.olat.core.gui.control.ScreenMode.Mode; import org.olat.core.gui.control.VetoableCloseController; @@ -327,6 +326,9 @@ public class BaseFullWebappController extends BasicController implements DTabs, // add page width css. Init empty on login (full page state not persisted) mainVc.contextPut("pageSizeCss", ""); + + // business path set with a full page refresh + mainVc.contextPut("startBusinessPath", ""); Window w = wbo.getWindow(); @@ -969,20 +971,19 @@ public class BaseFullWebappController extends BasicController implements DTabs, } @Override - public Reload wishReload(UserRequest ureq, boolean erase) { + public boolean wishReload(UserRequest ureq, boolean erase) { boolean screen = getScreenMode().wishScreenModeSwitch(erase); - String screenBusinessPath = null; if(screen && StringHelper.containsNonWhitespace(getScreenMode().getBusinessPath())) { - screenBusinessPath = BusinessControlFactory.getInstance() + String businessPath = BusinessControlFactory.getInstance() .getURLFromBusinessPathString(getScreenMode().getBusinessPath()); + mainVc.getContext().put("startBusinessPath", businessPath); } boolean r = reload != null && reload.booleanValue(); if(erase && reload != null) { reload = null; } boolean l = checkAssessmentGuard(ureq, lockMode); - - return new Reload(l || r || screen, screenBusinessPath); + return l || r || screen; } @Override @@ -1356,6 +1357,9 @@ public class BaseFullWebappController extends BasicController implements DTabs, currentMsgHolder.setContent(guimsgPanel); currentMsgHolder.setDirty(guimsgPanel.isDirty()); } + } else if(event == Window.AFTER_INLINE_RENDERING) { + // don't make the panel dirty + mainVc.getContext().put("startBusinessPath", ""); } else if(event instanceof LanguageChangedEvent){ LanguageChangedEvent lce = (LanguageChangedEvent)event; UserRequest ureq = lce.getCurrentUreq(); 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 a4271b56eb545c55caa717c938e237a31bcb73c0..d44fb840498ea044cf81fd068053fb7c69224050 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 @@ -17,7 +17,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> ## <!-- IE cache --> -<script type="text/javascript"> +<script> /* <![CDATA[ */ var o_info = new Object(); o_info.initialPageLoadFinished = false; @@ -26,6 +26,7 @@ o_info.o_winid = '$o_winid'; o_info.uriprefix="$r.relWinLink()"; o_info.bc="$o_bc"; o_info.businessPath=""; +o_info.startBusinessPath="$startBusinessPath"; o_info.serverUri="$o_serverUri" ## Legacy form-dirty message displayed by o2cl() o_info.dirty_form = "$r.escapeDoubleQuotes($r.translate("form.dirty"))"; @@ -53,6 +54,7 @@ function o_start() { ## Needed to identify if call like Ext.onRead() makes any sense (often not the case in AJAX mode) o_info.initialPageLoadFinished = true; } + function o_mathjax(fct_success) { window.MathJax = { extensions: ["jsMath2jax.js"], @@ -88,6 +90,17 @@ function o_mathjax(fct_success) { $!analytics ## +/* ]]> */ +</script> +<script> +/* <![CDATA[ */ +try{ + if(o_info.startBusinessPath != null && o_info.startBusinessPath.length > 0 + && window.history && !(typeof window.history === "undefined") && window.history.pushState) { + window.history.pushState('', document.title, o_info.startBusinessPath); + o_info.startBusinessPath = null; + } +} catch(e) { } /* ]]> */ </script> ## jQuery libraries 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 239ba037cc9e13f835a0fd366b9bfe97192ec531..362c1a91ea09aa94db777127c44bdfc5fa82dba1 100644 --- a/src/main/java/org/olat/core/gui/components/Window.java +++ b/src/main/java/org/olat/core/gui/components/Window.java @@ -56,7 +56,6 @@ import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.JSAndCSSAdder; import org.olat.core.gui.control.JSAndCSSAdderImpl; -import org.olat.core.gui.control.Reload; import org.olat.core.gui.control.WindowBackOffice; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.dtabs.DTabs; @@ -104,7 +103,7 @@ import org.olat.core.util.component.ComponentVisitor; public class Window extends AbstractComponent implements CustomCSSDelegate { private static final OLog log = Tracing.createLoggerFor(Window.class); - private static final DispatchResult NO_DISPATCHRESULT = new DispatchResult(false, false, Reload.NO_RELOAD); + private static final DispatchResult NO_DISPATCHRESULT = new DispatchResult(false, false, false); private static final String LOG_SEPARATOR = "^$^"; /** @@ -395,13 +394,11 @@ public class Window extends AbstractComponent implements CustomCSSDelegate { // 3.) return to sender... boolean didDispatch = false; boolean forceReload = false; - String forceReloadBusinessPath = null; if (validForDispatching) { DispatchResult dispatchResult = doDispatchToComponent(ureq, null); didDispatch = dispatchResult.isDispatch(); incTimestamp = dispatchResult.isIncTimestamp(); forceReload = dispatchResult.isForceReload(); - forceReloadBusinessPath = dispatchResult.getReloadBusinessPath(); if (isDebugLog) { long durationAfterDoDispatchToComponent = System.currentTimeMillis() - debug_start; log.debug("Perf-Test: Window durationAfterDoDispatchToComponent=" + durationAfterDoDispatchToComponent); @@ -413,10 +410,7 @@ public class Window extends AbstractComponent implements CustomCSSDelegate { //-----> if (didDispatch || inlineAfterBackForward) { if (forceReload) { //force RELOAD with a redirect to itself - String reRenderUri = forceReloadBusinessPath; - if(reRenderUri == null) { - reRenderUri = buildURIFor(this, timestampID, null); - } + String reRenderUri = buildURIFor(this, timestampID, null); Command rmrcom = CommandFactory.createParentRedirectTo(reRenderUri); wbackofficeImpl.sendCommandTo(rmrcom); } else if (didDispatch || !validForDispatching) { @@ -1223,7 +1217,7 @@ public class Window extends AbstractComponent implements CustomCSSDelegate { } ChiefController chief = wbackofficeImpl.getChiefController(); - Reload reload = chief == null ? null : chief.wishReload(ureq, true); + boolean reload = chief == null ? null : chief.wishReload(ureq, true); return new DispatchResult(toDispatch, incTimestamp, reload); } @@ -1334,9 +1328,9 @@ public class Window extends AbstractComponent implements CustomCSSDelegate { class DispatchResult { private final boolean dispatch; private final boolean incTimestamp; - private final Reload reload; + private final boolean reload; - public DispatchResult(boolean dispatch, boolean incTimestamp, Reload reload) { + public DispatchResult(boolean dispatch, boolean incTimestamp, boolean reload) { this.dispatch = dispatch; this.incTimestamp = incTimestamp; this.reload = reload; @@ -1347,11 +1341,7 @@ class DispatchResult { } public boolean isForceReload() { - return reload != null && reload.isWishReload(); - } - - public String getReloadBusinessPath() { - return reload == null ? null : reload.getBusinessPath(); + return reload; } public boolean isIncTimestamp() { 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 a6c19ebb74f7adbe609ea9498f84f9467a76271d..7fbef0b54f3e62d66a68b978c11edd30cd5de6cf 100644 --- a/src/main/java/org/olat/core/gui/control/ChiefController.java +++ b/src/main/java/org/olat/core/gui/control/ChiefController.java @@ -66,7 +66,7 @@ public interface ChiefController extends Controller { * @param erase * @return */ - public Reload wishReload(UserRequest ureq, boolean erase); + public boolean wishReload(UserRequest ureq, boolean erase); /** * Make sure a reload will not be triggered. 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 939a3e2bfcf2cd8bbd79c1ed8ca72bbacfddd0c1..410348ae1be5742ec70bcdfae49f36b2fc978d92 100644 --- a/src/main/java/org/olat/core/gui/control/DefaultChiefController.java +++ b/src/main/java/org/olat/core/gui/control/DefaultChiefController.java @@ -51,6 +51,7 @@ public abstract class DefaultChiefController extends DefaultController implement * Gets the window. * @return the window */ + @Override public Window getWindow() { return window; } @@ -70,8 +71,8 @@ public abstract class DefaultChiefController extends DefaultController implement } @Override - public Reload wishReload(UserRequest ureq, boolean erase) { - return Reload.NO_RELOAD; + public boolean wishReload(UserRequest ureq, boolean erase) { + return false; } @Override diff --git a/src/main/java/org/olat/core/gui/control/Reload.java b/src/main/java/org/olat/core/gui/control/Reload.java deleted file mode 100644 index a2a9a1f11c26d8aa6b29c791ab2123d122ada43d..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/core/gui/control/Reload.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * <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: 12 Nov 2018<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -public class Reload { - - public static final Reload NO_RELOAD = new Reload(false, null); - - private final boolean wishReload; - private final String businessPath; - - public Reload(boolean wishReload, String businessPath) { - this.wishReload = wishReload; - this.businessPath = businessPath; - } - - public boolean isWishReload() { - return wishReload; - } - - public String getBusinessPath() { - return businessPath; - } - -} diff --git a/src/main/java/org/olat/modules/quality/ui/ExecutionController.java b/src/main/java/org/olat/modules/quality/ui/ExecutionController.java index 45a045c3d6563eb1b2c2206a3a36b576d60c7c9c..78c2452c3e3ef7e6e5731297146ed50402da77c1 100644 --- a/src/main/java/org/olat/modules/quality/ui/ExecutionController.java +++ b/src/main/java/org/olat/modules/quality/ui/ExecutionController.java @@ -62,10 +62,6 @@ public class ExecutionController extends BasicController { initVelocityContainer(ureq); putInitialPanel(mainVC); } - - public QualityExecutorParticipation getQualityParticipant() { - return qualityParticipation; - } protected void initVelocityContainer(UserRequest ureq) { back = LinkFactory.createLinkBack(mainVC, this); diff --git a/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java b/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java index e76fed4b09a56fa627889f3b95293c48fb70fc60..9383cb8d791bef45fa9a722be394b11a81708c71 100644 --- a/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java +++ b/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java @@ -200,19 +200,17 @@ public class ExecutorParticipationsListController extends FormBasicController im return; } - if(executionCtrl == null || !participation.equals(executionCtrl.getQualityParticipant())) { - OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_EXECUTION_TYPE, - participation.getParticipationRef().getKey()); - WindowControl bwControl = addToHistory(ureq, ores, null); - executionCtrl = new ExecutionController(ureq, bwControl, participation); - listenTo(executionCtrl); - - WindowControl wControl = getWindowControl(); - ChiefController cc = wControl.getWindowBackOffice().getChiefController(); - String businessPath = executionCtrl.getWindowControlForDebug().getBusinessControl().getAsString(); - cc.getScreenMode().setMode(Mode.full, businessPath); - wControl.pushToMainArea(executionCtrl.getInitialComponent()); - } + OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_EXECUTION_TYPE, + participation.getParticipationRef().getKey()); + WindowControl bwControl = addToHistory(ureq, ores, null); + executionCtrl = new ExecutionController(ureq, bwControl, participation); + listenTo(executionCtrl); + + WindowControl wControl = getWindowControl(); + ChiefController cc = wControl.getWindowBackOffice().getChiefController(); + String businessPath = executionCtrl.getWindowControlForDebug().getBusinessControl().getAsString(); + cc.getScreenMode().setMode(Mode.full, businessPath); + wControl.pushToMainArea(executionCtrl.getInitialComponent()); } @Override