Skip to content
Snippets Groups Projects
Commit 71ce007a authored by srosse's avatar srosse
Browse files

OO-594: implement a mini mode option as a request parameter for REST urls, wsettings=hn12

parent 5c051411
No related branches found
No related tags found
No related merge requests found
Showing
with 199 additions and 47 deletions
...@@ -33,6 +33,7 @@ import org.olat.core.dispatcher.mapper.GlobalMapperRegistry; ...@@ -33,6 +33,7 @@ import org.olat.core.dispatcher.mapper.GlobalMapperRegistry;
import org.olat.core.dispatcher.mapper.Mapper; import org.olat.core.dispatcher.mapper.Mapper;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.WindowManager; import org.olat.core.gui.WindowManager;
import org.olat.core.gui.WindowSettings;
import org.olat.core.gui.Windows; import org.olat.core.gui.Windows;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.Window; import org.olat.core.gui.components.Window;
...@@ -61,6 +62,7 @@ import org.olat.core.util.Util; ...@@ -61,6 +62,7 @@ import org.olat.core.util.Util;
import org.olat.core.util.i18n.I18nManager; import org.olat.core.util.i18n.I18nManager;
import org.olat.core.util.i18n.I18nModule; import org.olat.core.util.i18n.I18nModule;
import org.olat.core.util.prefs.Preferences; import org.olat.core.util.prefs.Preferences;
import org.olat.dispatcher.AuthenticatedDispatcher;
/** /**
* Description: <br> * Description: <br>
...@@ -143,7 +145,9 @@ public class BaseChiefController extends DefaultChiefController implements Conte ...@@ -143,7 +145,9 @@ public class BaseChiefController extends DefaultChiefController implements Conte
mainPanel.setContent(mainvc); mainPanel.setContent(mainvc);
WindowManager winman = Windows.getWindows(ureq).getWindowManager(); WindowManager winman = Windows.getWindows(ureq).getWindowManager();
wbo = winman.createWindowBackOffice("basechiefwindow", this); String wSettings = (String)ureq.getUserSession().removeEntryFromNonClearedStore(AuthenticatedDispatcher.AUTHDISPATCHER_OPTIONS);
WindowSettings settings = WindowSettings.parse(wSettings);
wbo = winman.createWindowBackOffice("basechiefwindow", this, settings);
Window w = wbo.getWindow(); Window w = wbo.getWindow();
// part that builds the css and javascript lib includes (<script // part that builds the css and javascript lib includes (<script
......
...@@ -41,6 +41,7 @@ import org.olat.core.gui.GUIInterna; ...@@ -41,6 +41,7 @@ import org.olat.core.gui.GUIInterna;
import org.olat.core.gui.GUIMessage; import org.olat.core.gui.GUIMessage;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.WindowManager; import org.olat.core.gui.WindowManager;
import org.olat.core.gui.WindowSettings;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.Window; import org.olat.core.gui.components.Window;
import org.olat.core.gui.components.htmlheader.jscss.CustomCSS; import org.olat.core.gui.components.htmlheader.jscss.CustomCSS;
...@@ -363,44 +364,48 @@ public class BaseFullWebappController extends BasicController implements Generic ...@@ -363,44 +364,48 @@ public class BaseFullWebappController extends BasicController implements Generic
navLinkCounter++; navLinkCounter++;
} }
} }
WindowSettings wSettings = getWindowControl().getWindowBackOffice().getWindowSettings();
navVc.contextPut("sites", sites); navVc.contextPut("sites", sites);
navVc.contextPut("dtabs", dtabs); navVc.contextPut("dtabs", dtabs);
navVc.contextPut("dtabsLinkNames", dtabsLinkNames); navVc.contextPut("dtabsLinkNames", dtabsLinkNames);
navVc.contextPut("tabhelper", this); navVc.contextPut("tabhelper", this);
navVc.setVisible(!wSettings.isHideNavigation());
// ----------- header, optional (e.g. for logo, advertising ) // header, optional (e.g. for logo, advertising )
headerCtr = baseFullWebappControllerParts.createHeaderController(ureq, getWindowControl()); headerCtr = baseFullWebappControllerParts.createHeaderController(ureq, getWindowControl());
if (headerCtr != null) { if (headerCtr != null) {
listenTo(headerCtr); // cleanup on dispose listenTo(headerCtr); // cleanup on dispose
mainVc.put("headerComponent", headerCtr.getInitialComponent()); Component headerCmp = headerCtr.getInitialComponent();
mainVc.put("headerComponent", headerCmp);
headerCmp.setVisible(!wSettings.isHideHeader());
} }
// ----------- topnav, optional (e.g. for imprint, logout) // topnav, optional (e.g. for imprint, logout)
topnavCtr = baseFullWebappControllerParts.createTopNavController(ureq, getWindowControl()); topnavCtr = baseFullWebappControllerParts.createTopNavController(ureq, getWindowControl());
if (topnavCtr != null) { if (topnavCtr != null) {
listenTo(topnavCtr); // cleanup on dispose listenTo(topnavCtr); // cleanup on dispose
mainVc.put("topnavComponent", topnavCtr.getInitialComponent()); Component topNavCmp = topnavCtr.getInitialComponent();
mainVc.put("topnavComponent", topNavCmp);
topNavCmp.setVisible(!wSettings.isHideHeader());
} }
// ----------- nav, optional (e.g. site navigation with tabs)
// TODO fg: refactor to its own component // REVIEW:(pb) should then go also
// into ..Parts?!
// panel for modal overlays, placed right after the olat-header-div // panel for modal overlays, placed right after the olat-header-div
modalPanel = new Panel("ccmodalpanel"); modalPanel = new Panel("ccmodalpanel");
mainVc.put("modalpanel", modalPanel); mainVc.put("modalpanel", modalPanel);
// ----------- main, mandatory (e.g. a LayoutMain3ColsController) // main, mandatory (e.g. a LayoutMain3ColsController)
// ------------------
main = new Panel("main"); main = new Panel("main");
mainVc.put("main", main); mainVc.put("main", main);
// ----------- footer, optional (e.g. for copyright, powered by) // footer, optional (e.g. for copyright, powered by)
footerCtr = baseFullWebappControllerParts.createFooterController(ureq, getWindowControl()); footerCtr = baseFullWebappControllerParts.createFooterController(ureq, getWindowControl());
if (footerCtr != null) { if (footerCtr != null) {
listenTo(footerCtr); // cleanup on dispose listenTo(footerCtr); // cleanup on dispose
mainVc.put("footerComponent", footerCtr.getInitialComponent()); Component footerCmp = footerCtr.getInitialComponent();
mainVc.put("footerComponent", footerCmp);
footerCmp.setVisible(!wSettings.isHideFooter());
} }
......
...@@ -26,10 +26,9 @@ import java.util.Set; ...@@ -26,10 +26,9 @@ import java.util.Set;
import org.olat.core.commons.chiefcontrollers.BaseChiefController; import org.olat.core.commons.chiefcontrollers.BaseChiefController;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.WindowSettings;
import org.olat.core.gui.Windows; import org.olat.core.gui.Windows;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.panel.Panel; import org.olat.core.gui.components.panel.Panel;
import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.ChiefController; import org.olat.core.gui.control.ChiefController;
...@@ -137,16 +136,22 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme ...@@ -137,16 +136,22 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme
localLayoutConfig = getGuiPrefs(ureq, defaultConfiguration); localLayoutConfig = getGuiPrefs(ureq, defaultConfiguration);
Link back = LinkFactory.createLink("back", layoutMainVC, this); WindowSettings wSettings = wControl.getWindowBackOffice().getWindowSettings();
back.setCustomDisplayText("My course");
layoutMainVC.put("back", back);
// Push colums to velocity // Push columns to velocity
panel1 = new Panel("panel1"); panel1 = new Panel("panel1");
panel1.setVisible(!wSettings.isHideColumn1());
if(col1 != null) {
col1.setVisible(!wSettings.isHideColumn1());
}
layoutMainVC.put("col1", panel1); layoutMainVC.put("col1", panel1);
setCol1(col1); setCol1(col1);
panel2 = new Panel("panel2"); panel2 = new Panel("panel2");
panel2.setVisible(!wSettings.isHideColumn2());
if(col2 != null) {
col2.setVisible(!wSettings.isHideColumn2());
}
layoutMainVC.put("col2", panel2); layoutMainVC.put("col2", panel2);
setCol2(col2); setCol2(col2);
...@@ -394,8 +399,12 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme ...@@ -394,8 +399,12 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme
setCol(col1Component, 1); setCol(col1Component, 1);
panel1.setContent(col1Component); panel1.setContent(col1Component);
// init col width // init col width
layoutMainVC.contextPut("col1CustomCSSStyles", "width: " + localLayoutConfig.getCol1WidthEM() + "em;"); if(col1Component != null && col1Component.isVisible()) {
layoutMainVC.contextPut("col3CustomCSSStyles1", "margin-left: " + localLayoutConfig.getCol1WidthEM() + "em;"); layoutMainVC.contextPut("col1CustomCSSStyles", "width: " + localLayoutConfig.getCol1WidthEM() + "em;");
layoutMainVC.contextPut("col3CustomCSSStyles1", "margin-left: " + localLayoutConfig.getCol1WidthEM() + "em;");
} else {
layoutMainVC.contextPut("col3CustomCSSStyles1", "margin-left:0;");
}
} }
/** /**
...@@ -404,8 +413,12 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme ...@@ -404,8 +413,12 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme
public void setCol2(Component col2Component) { public void setCol2(Component col2Component) {
setCol(col2Component, 2); setCol(col2Component, 2);
panel2.setContent(col2Component); panel2.setContent(col2Component);
layoutMainVC.contextPut("col2CustomCSSStyles", "width: " + localLayoutConfig.getCol2WidthEM() + "em;"); if(col2Component != null && col2Component.isVisible()) {
layoutMainVC.contextPut("col3CustomCSSStyles2", "margin-right: " + localLayoutConfig.getCol2WidthEM() + "em;"); layoutMainVC.contextPut("col2CustomCSSStyles", "width: " + localLayoutConfig.getCol2WidthEM() + "em;");
layoutMainVC.contextPut("col3CustomCSSStyles2", "margin-right: " + localLayoutConfig.getCol2WidthEM() + "em;");
} else {
layoutMainVC.contextPut("col3CustomCSSStyles2", "margin-right: 0;");
}
} }
/** /**
......
<div id="b_main" class="$mainCssClasses"> <div id="b_main" class="$mainCssClasses">
## begin: #col1 - first float column ## begin: #col1 - first float column
#if($existsCol1) #if($existsCol1 && $r.visible("col1"))
<div id="b_col1" style="$!col1CustomCSSStyles"> <div id="b_col1" style="$!col1CustomCSSStyles">
<div id="b_col1_content" class="b_clearfix"> <div id="b_col1_content" class="b_clearfix">
<a name="b_col1"></a> <a name="b_col1"></a>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#end #end
## end: #col1 ## end: #col1
## begin: #col2 second float column ## begin: #col2 second float column
#if($existsCol2) #if($existsCol2 && $r.visible("col2"))
<div id="b_col2" style="$!col2CustomCSSStyles"> <div id="b_col2" style="$!col2CustomCSSStyles">
<div id="b_col2_content" class="b_clearfix"> <div id="b_col2_content" class="b_clearfix">
<a name="b_col2"></a> <a name="b_col2"></a>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#end #end
## end: #col2 ## end: #col2
## begin: #col3 static column ## begin: #col3 static column
#if($existsCol3) #if($existsCol3 && $r.visible("col3"))
<div id="b_col3" style="$!col3CustomCSSStyles1 $!col3CustomCSSStyles2"> <div id="b_col3" style="$!col3CustomCSSStyles1 $!col3CustomCSSStyles2">
<div id="b_col3_content" class="b_clearfix"> <div id="b_col3_content" class="b_clearfix">
## skip anchor: content ## skip anchor: content
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#end #end
## end: #col3 ## end: #col3
</div> </div>
#if(($existsCol1 && $r.visible("col1")) || ($existsCol2 && $r.visible("col2")))
<script type="text/javascript"> <script type="text/javascript">
/* <![CDATA[ */ /* <![CDATA[ */
## remove event handlers and alike from existing resizers first and clean them up ## remove event handlers and alike from existing resizers first and clean them up
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
## init method to initialize the column resizer objects ## init method to initialize the column resizer objects
init : function(){ init : function(){
#if($existsCol1) #if($existsCol1 && $r.visible("col1"))
if (B_AjaxLogger.isDebugEnabled()) B_AjaxLogger.logDebug('B_ResizableColumns.init called', "main_3cols.html"); if (B_AjaxLogger.isDebugEnabled()) B_AjaxLogger.logDebug('B_ResizableColumns.init called', "main_3cols.html");
var col1Elem = Ext.get('b_col1'); var col1Elem = Ext.get('b_col1');
var col1WidthStyle = col1Elem.getStyle('width'); var col1WidthStyle = col1Elem.getStyle('width');
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
col1Elem.clip(); col1Elem.clip();
col1Elem = null; col1Elem = null;
#end #end
#if($existsCol2) #if($existsCol2 && $r.visible("col2"))
var col2Elem = Ext.get('b_col2'); var col2Elem = Ext.get('b_col2');
var col2WidthStyle = col2Elem.getStyle('width'); var col2WidthStyle = col2Elem.getStyle('width');
this._res_col2 = new Ext.Resizable(col2Elem, { this._res_col2 = new Ext.Resizable(col2Elem, {
...@@ -102,12 +102,12 @@ ...@@ -102,12 +102,12 @@
if (B_AjaxLogger.isDebugEnabled()) B_AjaxLogger.logDebug('B_ResizableColumns.adjustHeight called', "main_3cols.html"); if (B_AjaxLogger.isDebugEnabled()) B_AjaxLogger.logDebug('B_ResizableColumns.adjustHeight called', "main_3cols.html");
try { try {
## Reset col height first ## Reset col height first
#if($existsCol1) #if($existsCol1 && $r.visible("col1"))
var col1Elem = Ext.get('b_col1_content'); var col1Elem = Ext.get('b_col1_content');
col1Elem.setHeight('auto'); col1Elem.setHeight('auto');
col1Elem = null; col1Elem = null;
#end #end
#if($existsCol2) #if($existsCol2 && $r.visible("col2"))
var col2Elem = Ext.get('b_col2_content'); var col2Elem = Ext.get('b_col2_content');
col2Elem.setHeight('auto'); col2Elem.setHeight('auto');
col2Elem = null col2Elem = null
...@@ -115,12 +115,12 @@ ...@@ -115,12 +115,12 @@
## Calculate new col height ## Calculate new col height
var contentHeight = OPOL.getMainColumnsMaxHeight(); var contentHeight = OPOL.getMainColumnsMaxHeight();
## Set new col height ## Set new col height
#if($existsCol1) #if($existsCol1 && $r.visible("col1"))
var col1Elem = Ext.get('b_col1_content'); var col1Elem = Ext.get('b_col1_content');
col1Elem.setHeight(contentHeight); col1Elem.setHeight(contentHeight);
col1Elem = null; col1Elem = null;
#end #end
#if($existsCol2) #if($existsCol2 && $r.visible("col2"))
var col2Elem = Ext.get('b_col2_content'); var col2Elem = Ext.get('b_col2_content');
col2Elem.setHeight(contentHeight); col2Elem.setHeight(contentHeight);
col2Elem = null; col2Elem = null;
...@@ -191,4 +191,5 @@ ...@@ -191,4 +191,5 @@
## initialize everything now ## initialize everything now
Ext.onReady(B_ResizableColumns.init, B_ResizableColumns, true); Ext.onReady(B_ResizableColumns.init, B_ResizableColumns, true);
/* ]]> */ /* ]]> */
</script> </script>
\ No newline at end of file #end
\ No newline at end of file
...@@ -80,7 +80,7 @@ public interface WindowManager extends Disposable { ...@@ -80,7 +80,7 @@ public interface WindowManager extends Disposable {
* @param owner * @param owner
* @return * @return
*/ */
public WindowBackOffice createWindowBackOffice(String windowName, ChiefController owner); public WindowBackOffice createWindowBackOffice(String windowName, ChiefController owner, WindowSettings settings);
public void setAjaxEnabled(boolean enabled); public void setAjaxEnabled(boolean enabled);
......
/**
* <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;
import org.olat.core.util.StringHelper;
/**
*
* Initial date: 07.05.2013<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
public class WindowSettings {
private boolean hideHeader = false;
private boolean hideNavigation = false;
private boolean hideFooter = false;
private boolean hideColumn1 = false;
private boolean hideColumn2 = false;
public WindowSettings() {
//
}
public static WindowSettings parse(String settings) {
WindowSettings wSettings = new WindowSettings();
if(StringHelper.containsNonWhitespace(settings)) {
wSettings.hideHeader = settings.indexOf('h') >= 0;
wSettings.hideNavigation = settings.indexOf('n') >= 0;
wSettings.hideFooter = settings.indexOf('f') >= 0;
wSettings.hideColumn1 = settings.indexOf('1') >= 0;
wSettings.hideColumn2 = settings.indexOf('2') >= 0;
}
return wSettings;
}
public boolean isHideHeader() {
return hideHeader;
}
public void setHideHeader(boolean hideHeader) {
this.hideHeader = hideHeader;
}
public boolean isHideNavigation() {
return hideNavigation;
}
public void setHideNavigation(boolean hideNavigation) {
this.hideNavigation = hideNavigation;
}
public boolean isHideFooter() {
return hideFooter;
}
public void setHideFooter(boolean hideFooter) {
this.hideFooter = hideFooter;
}
public boolean isHideColumn1() {
return hideColumn1;
}
public void setHideColumn1(boolean hideColumn1) {
this.hideColumn1 = hideColumn1;
}
public boolean isHideColumn2() {
return hideColumn2;
}
public void setHideColumn2(boolean hideColumn2) {
this.hideColumn2 = hideColumn2;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
if(hideHeader) sb.append('h');
if(hideNavigation) sb.append('n');
if(hideFooter) sb.append('f');
if(hideColumn1) sb.append('1');
if(hideColumn2) sb.append('2');
return sb.toString();
}
}
...@@ -30,6 +30,7 @@ import java.util.List; ...@@ -30,6 +30,7 @@ import java.util.List;
import org.olat.core.gui.GlobalSettings; import org.olat.core.gui.GlobalSettings;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.WindowManager; import org.olat.core.gui.WindowManager;
import org.olat.core.gui.WindowSettings;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.Window; import org.olat.core.gui.components.Window;
import org.olat.core.gui.control.guistack.GuiStack; import org.olat.core.gui.control.guistack.GuiStack;
...@@ -67,6 +68,12 @@ public interface WindowBackOffice extends Disposable{ ...@@ -67,6 +68,12 @@ public interface WindowBackOffice extends Disposable{
* @return * @return
*/ */
GlobalSettings getGlobalSettings(); GlobalSettings getGlobalSettings();
/**
* Some settings for the current window
* @return
*/
WindowSettings getWindowSettings();
/** /**
* @param ureq * @param ureq
......
...@@ -35,6 +35,7 @@ import org.apache.commons.io.IOUtils; ...@@ -35,6 +35,7 @@ import org.apache.commons.io.IOUtils;
import org.olat.core.gui.GlobalSettings; import org.olat.core.gui.GlobalSettings;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.WindowManager; import org.olat.core.gui.WindowManager;
import org.olat.core.gui.WindowSettings;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.ComponentRenderer; import org.olat.core.gui.components.ComponentRenderer;
import org.olat.core.gui.components.Window; import org.olat.core.gui.components.Window;
...@@ -77,6 +78,7 @@ public class WindowBackOfficeImpl implements WindowBackOffice { ...@@ -77,6 +78,7 @@ public class WindowBackOfficeImpl implements WindowBackOffice {
private final WindowManagerImpl winmgrImpl; private final WindowManagerImpl winmgrImpl;
private Window window; private Window window;
private WindowSettings settings;
private ChiefController windowOwner; private ChiefController windowOwner;
private InterceptHandler linkedInterceptHandler; private InterceptHandler linkedInterceptHandler;
...@@ -96,13 +98,13 @@ public class WindowBackOfficeImpl implements WindowBackOffice { ...@@ -96,13 +98,13 @@ public class WindowBackOfficeImpl implements WindowBackOffice {
/** /**
* *
*/ */
WindowBackOfficeImpl(final WindowManagerImpl winmgrImpl, String windowName, ChiefController windowOwner, int wboId) { WindowBackOfficeImpl(final WindowManagerImpl winmgrImpl, String windowName, ChiefController windowOwner, int wboId, WindowSettings settings) {
this.winmgrImpl = winmgrImpl; this.winmgrImpl = winmgrImpl;
this.windowOwner = windowOwner; this.windowOwner = windowOwner;
this.iframeName = "oaa"+wboId; this.iframeName = "oaa"+wboId;
window = new Window(windowName, this); window = new Window(windowName, this);
this.settings = settings;
// TODO make simpler, we do only need to support one intercept handler at a time! // TODO make simpler, we do only need to support one intercept handler at a time!
linkedInterceptHandler = new InterceptHandler() { linkedInterceptHandler = new InterceptHandler() {
public InterceptHandlerInstance createInterceptHandlerInstance() { public InterceptHandlerInstance createInterceptHandlerInstance() {
...@@ -157,6 +159,14 @@ public class WindowBackOfficeImpl implements WindowBackOffice { ...@@ -157,6 +159,14 @@ public class WindowBackOfficeImpl implements WindowBackOffice {
return winmgrImpl.getGlobalSettings(); return winmgrImpl.getGlobalSettings();
} }
@Override
public WindowSettings getWindowSettings() {
if(settings == null) {
settings = new WindowSettings();
}
return settings;
}
/** /**
* @return * @return
*/ */
......
...@@ -37,6 +37,7 @@ import org.olat.core.defaults.dispatcher.ClassPathStaticDispatcher; ...@@ -37,6 +37,7 @@ import org.olat.core.defaults.dispatcher.ClassPathStaticDispatcher;
import org.olat.core.gui.GlobalSettings; import org.olat.core.gui.GlobalSettings;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.WindowManager; import org.olat.core.gui.WindowManager;
import org.olat.core.gui.WindowSettings;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.ComponentRenderer; import org.olat.core.gui.components.ComponentRenderer;
import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.components.velocity.VelocityContainer;
...@@ -249,8 +250,8 @@ public class WindowManagerImpl extends BasicManager implements WindowManager { ...@@ -249,8 +250,8 @@ public class WindowManagerImpl extends BasicManager implements WindowManager {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.olat.core.gui.WindowManager#createWindowBackOffice(java.lang.String, org.olat.core.gui.control.ChiefController) * @see org.olat.core.gui.WindowManager#createWindowBackOffice(java.lang.String, org.olat.core.gui.control.ChiefController)
*/ */
public WindowBackOffice createWindowBackOffice(String windowName, ChiefController owner) { public WindowBackOffice createWindowBackOffice(String windowName, ChiefController owner, WindowSettings settings) {
WindowBackOfficeImpl wbo = new WindowBackOfficeImpl(this, windowName, owner, wboId++); WindowBackOfficeImpl wbo = new WindowBackOfficeImpl(this, windowName, owner, wboId++, settings);
wbos.add(wbo); wbos.add(wbo);
return wbo; return wbo;
} }
......
...@@ -30,8 +30,8 @@ package org.olat.core.gui.exception; ...@@ -30,8 +30,8 @@ package org.olat.core.gui.exception;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.velocity.context.Context;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.WindowSettings;
import org.olat.core.gui.Windows; import org.olat.core.gui.Windows;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.Window; import org.olat.core.gui.components.Window;
...@@ -57,7 +57,6 @@ import org.olat.core.util.UserSession; ...@@ -57,7 +57,6 @@ import org.olat.core.util.UserSession;
import org.olat.core.util.Util; import org.olat.core.util.Util;
import org.olat.core.util.WebappHelper; import org.olat.core.util.WebappHelper;
import org.olat.core.util.i18n.I18nManager; import org.olat.core.util.i18n.I18nManager;
import org.olat.core.util.mail.manager.MailManager;
/** /**
* Description: <br> * Description: <br>
...@@ -192,7 +191,7 @@ public class ExceptionWindowController extends DefaultChiefController { ...@@ -192,7 +191,7 @@ public class ExceptionWindowController extends DefaultChiefController {
msg.contextPut("supportaddress", WebappHelper.getMailConfig("mailError")); msg.contextPut("supportaddress", WebappHelper.getMailConfig("mailError"));
msg.contextPut("time", formatter.formatDateAndTime(new Date())); msg.contextPut("time", formatter.formatDateAndTime(new Date()));
WindowBackOffice wbo = ws.getWindowManager().createWindowBackOffice("errormessagewindow", this); WindowBackOffice wbo = ws.getWindowManager().createWindowBackOffice("errormessagewindow", this, new WindowSettings());
Window w = wbo.getWindow(); Window w = wbo.getWindow();
msg.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader()); msg.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader());
......
...@@ -66,6 +66,7 @@ public class AuthenticatedDispatcher implements Dispatcher { ...@@ -66,6 +66,7 @@ public class AuthenticatedDispatcher implements Dispatcher {
protected static final String AUTHDISPATCHER_ENTRYURL = "AuthDispatcher:entryUrl"; protected static final String AUTHDISPATCHER_ENTRYURL = "AuthDispatcher:entryUrl";
protected static final String AUTHDISPATCHER_BUSINESSPATH = "AuthDispatcher:businessPath"; protected static final String AUTHDISPATCHER_BUSINESSPATH = "AuthDispatcher:businessPath";
public static final String AUTHDISPATCHER_OPTIONS = "AuthDispatcher:options";
protected static final String QUESTIONMARK = "?"; protected static final String QUESTIONMARK = "?";
protected static final String GUEST = "guest"; protected static final String GUEST = "guest";
......
...@@ -294,6 +294,7 @@ public class DMZDispatcher implements Dispatcher { ...@@ -294,6 +294,7 @@ public class DMZDispatcher implements Dispatcher {
if (window == null) { if (window == null) {
// no window found, -> start a new WorkFlow/Controller and obtain the window // no window found, -> start a new WorkFlow/Controller and obtain the window
// main controller which also implements the windowcontroller for pagestatus and modal dialogs // main controller which also implements the windowcontroller for pagestatus and modal dialogs
Object wSettings = usess.getEntry(AuthenticatedDispatcher.AUTHDISPATCHER_OPTIONS);
ChiefController occ = chiefControllerCreator.createChiefController(ureq); ChiefController occ = chiefControllerCreator.createChiefController(ureq);
window = occ.getWindow(); window = occ.getWindow();
...@@ -306,6 +307,8 @@ public class DMZDispatcher implements Dispatcher { ...@@ -306,6 +307,8 @@ public class DMZDispatcher implements Dispatcher {
DTabs dts = window.getDTabs(); DTabs dts = window.getDTabs();
dts.activate(ureq, null, ces); dts.activate(ureq, null, ces);
} }
//apply the settings forward
usess.putEntryInNonClearedStore(AuthenticatedDispatcher.AUTHDISPATCHER_OPTIONS, wSettings);
} }
window.dispatchRequest(ureq); window.dispatchRequest(ureq);
} }
......
...@@ -205,7 +205,7 @@ public class RESTDispatcher implements Dispatcher { ...@@ -205,7 +205,7 @@ public class RESTDispatcher implements Dispatcher {
boolean auth = usess.isAuthenticated(); boolean auth = usess.isAuthenticated();
if (auth) { if (auth) {
//fxdiff FXOLAT-113: business path in DMZ //fxdiff FXOLAT-113: business path in DMZ
setBusinessPathInUserSession(usess, businessPath); setBusinessPathInUserSession(usess, businessPath, ureq.getParameter("wsettings"));
//fxdiff //fxdiff
if (Windows.getWindows(usess).getAttribute("AUTHCHIEFCONTROLLER") == null) { if (Windows.getWindows(usess).getAttribute("AUTHCHIEFCONTROLLER") == null) {
...@@ -221,7 +221,7 @@ public class RESTDispatcher implements Dispatcher { ...@@ -221,7 +221,7 @@ public class RESTDispatcher implements Dispatcher {
} else { } else {
//prepare for redirect //prepare for redirect
//fxdiff FXOLAT-113: business path in DMZ //fxdiff FXOLAT-113: business path in DMZ
setBusinessPathInUserSession(usess, businessPath); setBusinessPathInUserSession(usess, businessPath, ureq.getParameter("wsettings"));
String invitationAccess = ureq.getParameter(AuthenticatedDispatcher.INVITATION); String invitationAccess = ureq.getParameter(AuthenticatedDispatcher.INVITATION);
if (invitationAccess != null && LoginModule.isInvitationEnabled()) { if (invitationAccess != null && LoginModule.isInvitationEnabled()) {
// try to log in as anonymous // try to log in as anonymous
...@@ -272,7 +272,7 @@ public class RESTDispatcher implements Dispatcher { ...@@ -272,7 +272,7 @@ public class RESTDispatcher implements Dispatcher {
* @param businessPath * @param businessPath
*/ */
//fxdiff FXOLAT-113: business path in DMZ //fxdiff FXOLAT-113: business path in DMZ
private void setBusinessPathInUserSession(UserSession usess, String businessPath) { private void setBusinessPathInUserSession(UserSession usess, String businessPath, String options) {
if(StringHelper.containsNonWhitespace(businessPath) && usess != null) { if(StringHelper.containsNonWhitespace(businessPath) && usess != null) {
if(businessPath.startsWith("[changepw:0]") || "[registration:0]".equals(businessPath) || "[guest:0]".equals(businessPath) if(businessPath.startsWith("[changepw:0]") || "[registration:0]".equals(businessPath) || "[guest:0]".equals(businessPath)
|| "[browsercheck:0]".equals(businessPath) || "[accessibility:0]".equals(businessPath) || "[about:0]".equals(businessPath)) { || "[browsercheck:0]".equals(businessPath) || "[accessibility:0]".equals(businessPath) || "[about:0]".equals(businessPath)) {
...@@ -281,6 +281,9 @@ public class RESTDispatcher implements Dispatcher { ...@@ -281,6 +281,9 @@ public class RESTDispatcher implements Dispatcher {
usess.putEntryInNonClearedStore(AuthenticatedDispatcher.AUTHDISPATCHER_BUSINESSPATH, businessPath); usess.putEntryInNonClearedStore(AuthenticatedDispatcher.AUTHDISPATCHER_BUSINESSPATH, businessPath);
} }
} }
if(StringHelper.containsNonWhitespace(options) && usess != null) {
usess.putEntryInNonClearedStore(AuthenticatedDispatcher.AUTHDISPATCHER_OPTIONS, options);
}
} }
private Locale getLang(UserRequest ureq) { private Locale getLang(UserRequest ureq) {
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
package org.olat.shibboleth; package org.olat.shibboleth;
import org.olat.core.gui.UserRequest; import org.olat.core.gui.UserRequest;
import org.olat.core.gui.WindowSettings;
import org.olat.core.gui.Windows; import org.olat.core.gui.Windows;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.Window; import org.olat.core.gui.components.Window;
...@@ -79,7 +80,7 @@ public class MessageWindowController extends DefaultChiefController { ...@@ -79,7 +80,7 @@ public class MessageWindowController extends DefaultChiefController {
//Window w = new Window("messagewindow", this, jsadder); //Window w = new Window("messagewindow", this, jsadder);
Windows ws = Windows.getWindows(ureq); Windows ws = Windows.getWindows(ureq);
WindowBackOffice wbo = ws.getWindowManager().createWindowBackOffice("messagewindow", this); WindowBackOffice wbo = ws.getWindowManager().createWindowBackOffice("messagewindow", this, new WindowSettings());
Window w = wbo.getWindow(); Window w = wbo.getWindow();
msg.put("jsAndCssC", w.getJsCssRawHtmlHeader()); msg.put("jsAndCssC", w.getJsCssRawHtmlHeader());
......
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