mainvc.contextPut("jsMathEnabled", Boolean.valueOf(jsMathEnabled));
mainPanel.setContent(mainvc);
WindowManager winman = Windows.getWindows(ureq).getWindowManager();
wbo = winman.createWindowBackOffice("basechiefwindow", this);
Window w = wbo.getWindow();
// part that builds the css and javascript lib includes (<script src="..."> and <rel link
// e.g.
// <script type="text/javascript" src="/demo/g/2/js/jscalendar/calendar.js"></script>
mainvc.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader());
// control part for ajax-communication. returns an empty panel if ajax is not enabled, so that ajax can be turned on on the fly for development mode
jsServerC = wbo.createAJAXController(ureq);
mainvc.put("jsServer", jsServerC.getInitialComponent());
// init with no bookmark (=empty bc)
mainvc.contextPut("o_bc", "");
// the current language; used e.g. by screenreaders
mainvc.contextPut("lang", ureq.getLocale().toString());
// the current GUI theme and the global settings that contains the
// font-size. both are pushed as objects so that window.dirty always reads
// out the correct value
mainvc.contextPut("theme", w.getGuiTheme());
mainvc.contextPut("globalSettings", winman.getGlobalSettings());
// content panel
contentPanel = new Panel("olatContentPanel");
mainvc.put("olatContentPanel", contentPanel);
mainvc.contextPut("o_winid", Long.valueOf(w.getDispatchID()));
Version v = (Version) CoreSpringFactory.getBean("org.olat.core.Version");
mainvc.contextPut("buildversion", v.getVersion());
WindowControl wControl = new WindowControl() {
private WindowControlInfo wci;
{
wci = new WindowControlInfoImpl(BaseChiefController.this, null);
}
/**
* @see org.olat.core.gui.control.WindowControl#pushToMainArea(org.olat.core.gui.components.Component)
*/
public void pushToMainArea(Component newMainArea) {
currentGuiStack.pushContent(newMainArea);
}
/**
* @see org.olat.core.gui.control.WindowControl#pushAsModalDialog(java.lang.String,
* org.olat.core.gui.components.Component)
*/
public void pushAsModalDialog(Component newModalDialog) {
currentGuiStack.pushModalDialog(newModalDialog);
}
/**
* @see org.olat.core.gui.control.WindowControl#pop()
*/
public void pop() {
// reactivate latest dialog from stack, dumping current one
currentGuiStack.popContent();
}
/**
* @see org.olat.core.gui.control.WindowControl#setInfo(java.lang.String)
*/
public void setInfo(String info) {
throw new AssertException("not implemented, need e.g. a SimplBaseController on top of this class here to implement this function");
}
/**
* @see org.olat.core.gui.control.WindowControl#setError(java.lang.String)
*/
public void setError(String error) {
throw new AssertException("not implemented, need e.g. a SimplBaseController on top of this class here to implement this function");
}
/**
* @see org.olat.core.gui.control.WindowControl#setWarning(java.lang.String)
*/
public void setWarning(String warning) {
throw new AssertException("not implemented, need e.g. a SimplBaseController on top of this class here to implement this function");
}
public WindowControlInfo getWindowControlInfo() {
return wci;
}
public void makeFlat() {
throw new AssertException("not implemented, need e.g. a SimplBaseController on top of this class here to implement this function");
}
public BusinessControl getBusinessControl() {
return BusinessControlFactory.getInstance().getEmptyBusinessControl();
}
public WindowBackOffice getWindowBackOffice() {
return wbo;
}
};
super.setWindowControl(wControl);
if (wbo.isDebuging()) {
debugC = wbo.createDebugDispatcherController(ureq, getWindowControl());
mainvc.put("guidebug", debugC.getInitialComponent());
}
// Inline translation interceptor. when the translation tool is enabled it
// will start the translation tool in translation mode, if the overlay
// feature is enabled it will start in customizing mode
if (ureq.getUserSession().isAuthenticated() && ureq.getUserSession().getRoles().isOLATAdmin() && (I18nModule.isTransToolEnabled() || I18nModule.isOverlayEnabled())) {
inlineTranslationC = wbo.createInlineTranslationDispatcherController(ureq, getWindowControl());
Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
Boolean isInlineTranslationEnabled = (Boolean) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_INLINE_TRANSLATION_ENABLED, Boolean.FALSE);
I18nManager.getInstance().setMarkLocalizedStringsEnabled(ureq.getUserSession(), isInlineTranslationEnabled);
mainvc.put("inlineTranslation", inlineTranslationC.getInitialComponent());
}
// debug info if debugging
if (wbo.isDebuging()) {
developmentC = wbo.createDevelopmentController(ureq, getWindowControl());
mainvc.put("development", developmentC.getInitialComponent());
}
// attach AJAX javascript console
jsLoggerC = new JavaScriptTracingController(ureq, getWindowControl());
// the js logger provides only a header element, nevertheless we need to
// put it into the main velocity container.
mainvc.put("jsLoggerC", jsLoggerC.getInitialComponent());
//put the globals path like "/olat/classpath/61x/" into the main win, used for some dynamic injected js libs like jsMath
String resourcePath = getWindowControl().getWindowBackOffice().getWindowManager().getMapPathFor(this.getClass());
mainvc.contextPut("classPathStaticBaseURI", resourcePath.substring(0, resourcePath.indexOf("org.olat")));
// put the global js translator mapper path into the main window
mainvc.contextPut("jsTranslationMapperPath", jsTranslationMapperPath);
// master window
w.addListener(this); // to be able to report "browser reload" to the user
w.setContentPane(mainPanel);
setWindow(w);
}