Skip to content
Snippets Groups Projects
Commit 184fb869 authored by srosse's avatar srosse
Browse files

OO-4867: reload the page if freezed

parent c7e7b3c8
No related branches found
No related tags found
No related merge requests found
...@@ -82,6 +82,8 @@ import org.olat.core.gui.control.navigation.BornSiteInstance; ...@@ -82,6 +82,8 @@ import org.olat.core.gui.control.navigation.BornSiteInstance;
import org.olat.core.gui.control.navigation.NavElement; import org.olat.core.gui.control.navigation.NavElement;
import org.olat.core.gui.control.navigation.SiteInstance; import org.olat.core.gui.control.navigation.SiteInstance;
import org.olat.core.gui.control.util.ZIndexWrapper; import org.olat.core.gui.control.util.ZIndexWrapper;
import org.olat.core.gui.control.winmgr.Command;
import org.olat.core.gui.control.winmgr.CommandFactory;
import org.olat.core.gui.control.winmgr.JSCommand; import org.olat.core.gui.control.winmgr.JSCommand;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.helpers.Settings; import org.olat.core.helpers.Settings;
...@@ -94,8 +96,6 @@ import org.olat.core.id.context.BusinessControlFactory; ...@@ -94,8 +96,6 @@ import org.olat.core.id.context.BusinessControlFactory;
import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.ContextEntry;
import org.olat.core.id.context.HistoryPoint; import org.olat.core.id.context.HistoryPoint;
import org.olat.core.id.context.HistoryPointImpl; import org.olat.core.id.context.HistoryPointImpl;
import org.olat.core.id.context.StateEntry;
import org.olat.core.id.context.StateSite;
import org.olat.core.logging.AssertException; import org.olat.core.logging.AssertException;
import org.olat.core.util.CodeHelper; import org.olat.core.util.CodeHelper;
import org.olat.core.util.Formatter; import org.olat.core.util.Formatter;
...@@ -667,7 +667,8 @@ public class BaseFullWebappController extends BasicController implements DTabs, ...@@ -667,7 +667,8 @@ public class BaseFullWebappController extends BasicController implements DTabs,
HistoryPoint point = ureq.getUserSession().popLastHistoryEntry(); HistoryPoint point = ureq.getUserSession().popLastHistoryEntry();
if(point != null) { if(point != null) {
back(ureq, point); Command reloadCmd = CommandFactory.reloadWindow();
getWindow().getWindowBackOffice().sendCommandTo(reloadCmd);
} }
} }
} else if (source == mainVc) { } else if (source == mainVc) {
...@@ -684,40 +685,6 @@ public class BaseFullWebappController extends BasicController implements DTabs, ...@@ -684,40 +685,6 @@ public class BaseFullWebappController extends BasicController implements DTabs,
} }
} }
} }
protected void back(UserRequest ureq, HistoryPoint cstate) {
List<ContextEntry> entries = cstate.getEntries();
if(entries.isEmpty()) return;
entries = new ArrayList<>(entries);
ContextEntry state = entries.remove(0);
if(state == null) return;//no red screen for this
OLATResourceable ores = state.getOLATResourceable();
if(ores != null && "HomeSite".equals(ores.getResourceableTypeName())) {
activateSite(userTools, ureq, entries, false);
} else {
DTab dt = getDTab(ores);
if(dt != null) {
doActivateDTab(dt);
if(dt.getController() instanceof Activateable2) {
((Activateable2)dt.getController()).activate(ureq, entries, null);
}
updateBusinessPath(ureq, dt);
} else {
StateEntry s = state.getTransientState();
if(s instanceof StateSite && ((StateSite)s).getSite() != null && sites != null) {
SiteInstance site = ((StateSite)s).getSite();
for(SiteInstance savedSite:sites) {
if(savedSite != null && site.getClass().equals(savedSite.getClass())) {
activateSite(savedSite, ureq, entries, false);
}
}
}
}
}
}
@Override @Override
protected void event(UserRequest ureq, Controller source, Event event) { protected void event(UserRequest ureq, Controller source, Event event) {
......
...@@ -126,7 +126,12 @@ public class CommandFactory { ...@@ -126,7 +126,12 @@ public class CommandFactory {
Command c = new Command(5); Command c = new Command(5);
c.setSubJSON(root); c.setSubJSON(root);
return c; return c;
} }
public static Command reloadWindow() {
String script = "try { window.location.reload(); } catch(e) { if(window.console) console.log(e) }";
return new JSCommand(script);
}
} }
......
...@@ -214,7 +214,7 @@ public class DMZDispatcher implements Dispatcher { ...@@ -214,7 +214,7 @@ public class DMZDispatcher implements Dispatcher {
// when a previous user logged off, and 30min later (when the httpsession is invalidated), the next user clicks e.g. on // when a previous user logged off, and 30min later (when the httpsession is invalidated), the next user clicks e.g. on
// the log-in link in the -same- browser window -> // the log-in link in the -same- browser window ->
// -> there is no window -> create a new one // -> there is no window -> create a new one
if(ignoreMisssingWindow(request)) { if(ignoreMissingWindow(request)) {
DispatcherModule.setNotContent(request.getPathInfo(), response); DispatcherModule.setNotContent(request.getPathInfo(), response);
return; return;
} }
...@@ -291,7 +291,7 @@ public class DMZDispatcher implements Dispatcher { ...@@ -291,7 +291,7 @@ public class DMZDispatcher implements Dispatcher {
} }
} }
private boolean ignoreMisssingWindow(HttpServletRequest request) { private boolean ignoreMissingWindow(HttpServletRequest request) {
String pathInfo = request.getPathInfo(); String pathInfo = request.getPathInfo();
if(pathInfo.contains("cid:close-window")) { if(pathInfo.contains("cid:close-window")) {
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment