diff --git a/src/main/java/de/bps/olat/modules/cl/ChecklistMultiSelectColumnDescriptor.java b/src/main/java/de/bps/olat/modules/cl/ChecklistMultiSelectColumnDescriptor.java index 23fcd5838cdbd606b7ce24d42c71300366e29e53..209c962a6b55394915a9a4245eb31716acdbe8a4 100644 --- a/src/main/java/de/bps/olat/modules/cl/ChecklistMultiSelectColumnDescriptor.java +++ b/src/main/java/de/bps/olat/modules/cl/ChecklistMultiSelectColumnDescriptor.java @@ -20,11 +20,9 @@ package de.bps.olat.modules.cl; import org.olat.core.gui.components.table.ColumnDescriptor; -import org.olat.core.gui.components.table.HrefGenerator; import org.olat.core.gui.components.table.Table; import org.olat.core.gui.render.Renderer; import org.olat.core.gui.render.StringOutput; -import org.olat.core.logging.AssertException; /** * Description:<br> @@ -96,11 +94,6 @@ public class ChecklistMultiSelectColumnDescriptor implements ColumnDescriptor { return null; } - public HrefGenerator getHrefGenerator() { - // no HrefGenerator - return null; - } - public String getPopUpWindowAttributes() { // no PopuWindow return null; @@ -122,10 +115,6 @@ public class ChecklistMultiSelectColumnDescriptor implements ColumnDescriptor { // nothing to do here } - public void setHrefGenerator(HrefGenerator h) { - throw new AssertException("Not allowed to set HrefGenerator on MultiSelectColumn."); - } - public void setTable(Table table) { this.table = table; } diff --git a/src/main/java/org/olat/NewControllerFactory.java b/src/main/java/org/olat/NewControllerFactory.java index 7eb707487333d5a307287cbe8aec8ad5d591768a..13159132909a26f2e6bd30c34b4bed2023020db7 100644 --- a/src/main/java/org/olat/NewControllerFactory.java +++ b/src/main/java/org/olat/NewControllerFactory.java @@ -193,11 +193,6 @@ public class NewControllerFactory extends LogDelegator { window = wControl.getWindowBackOffice().getWindow(); } DTabs dts = window.getDTabs(); - DTab dt = dts.getDTab(ores); - if (dt != null) { - // tab already open => close it - dts.removeDTab(ureq, dt);// disposes also dt and controllers - } String firstType = mainCe.getOLATResourceable().getResourceableTypeName(); // String firstTypeId = ClassToId.getInstance().lookup() BusinessGroup @@ -224,19 +219,16 @@ public class NewControllerFactory extends LogDelegator { TabContext context = typeHandler.getTabContext(ureq, ores, mainCe, entries); String siteClassName = typeHandler.getSiteClassName(ces, ureq); // open in existing site + + boolean launched = false; if (siteClassName != null) { dts.activateStatic(ureq, siteClassName, context.getContext()); - return true; + launched = true; } else { - // or create new tab - //String tabName = typeHandler.getTabName(mainCe, ureq); - // create and add Tab - dt = dts.createDTab(context.getTabResource(), re, context.getName()); + // get current tab or create new tab + DTab dt = dts.getDTab(ores); if (dt == null) { - // user error message is generated in BaseFullWebappController, nothing to do here - return false; - } else { - WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, dt.getWindowControl()); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, dts.getWindowControl()); usess.addToHistory(ureq, bc); Controller launchC = typeHandler.createController(ces, ureq, bwControl); @@ -245,14 +237,23 @@ public class NewControllerFactory extends LogDelegator { + bc.getAsString() + " for type " + typeHandler.getClass().getName() + " in advance with validateContextEntryAndShowError()."); } - dt.setController(launchC); - if(dts.addDTab(ureq, dt)) { - dts.activate(ureq, dt, context.getContext()); // null: do not activate to a certain view - return true; + dt = dts.createDTab(context.getTabResource(), re, launchC, context.getName()); + if (dt == null) { + // user error message is generated in BaseFullWebappController, nothing to do here + launched = false; } else { - return false; + if(dts.addDTab(ureq, dt)) { + dts.activate(ureq, dt, context.getContext()); + launched = true; + } else { + launched = false; + } } + } else { + dts.activate(ureq, dt, context.getContext()); + launched = true; } } + return launched; } } \ No newline at end of file diff --git a/src/main/java/org/olat/admin/layout/LayoutAdminController.java b/src/main/java/org/olat/admin/layout/LayoutAdminController.java index fd4d4816c6ae271ca8be9da5ebe3f5f2ab277314..675d50af18dc4f6271841027990612668b186b19 100644 --- a/src/main/java/org/olat/admin/layout/LayoutAdminController.java +++ b/src/main/java/org/olat/admin/layout/LayoutAdminController.java @@ -30,7 +30,6 @@ import java.util.Set; import org.apache.commons.lang.ArrayUtils; import org.olat.admin.SystemAdminMainController; import org.olat.core.gui.UserRequest; -import org.olat.core.gui.Windows; import org.olat.core.gui.components.form.flexible.FormItem; import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.elements.FileElement; @@ -223,7 +222,7 @@ public class LayoutAdminController extends FormBasicController { layoutModule.setLogoFilename(newLogo.getName()); logoUpload.setInitialFile(newLogo); deleteLogo.setVisible(true); - Windows.getWindows(ureq).getChiefController().wishReload(ureq, true); + getWindowControl().getWindowBackOffice().getChiefController().wishReload(ureq, true); } } else if(logoLinkTypeEl == source) { @@ -234,7 +233,7 @@ public class LayoutAdminController extends FormBasicController { logoUpload.reset(); deleteLogo.setVisible(false); logoUpload.setInitialFile(null); - Windows.getWindows(ureq).getChiefController().wishReload(ureq, true); + getWindowControl().getWindowBackOffice().getChiefController().wishReload(ureq, true); } else if(themeSelection == source) { // set new theme in Settings diff --git a/src/main/java/org/olat/admin/sysinfo/_content/loglevels.html b/src/main/java/org/olat/admin/sysinfo/_content/loglevels.html index 58277af439780219e913e0d821e717f25d791887..056420a43a3f64dcdd3a228636dd337230abe4da 100644 --- a/src/main/java/org/olat/admin/sysinfo/_content/loglevels.html +++ b/src/main/java/org/olat/admin/sysinfo/_content/loglevels.html @@ -13,14 +13,14 @@ ## could not make it work with (\\.) - workaround to use a-zA-Z0-9_- maybe more?? ## sorry for the pure uglyness below... quick hack to bring everything on one line without whitespace #set ($package="") - #foreach( $part in $logger.name.split("[^a-zA-Z0-9_-]"))#if ($package != "")#set ($package="${package}.${part}").#else#set ($package=$part)#end<a href="$r.commandURIbg("viewlog")?p=${package}" $r.bgTarget() style="display:inline">$part</a>#end + #foreach( $part in $logger.name.split("[^a-zA-Z0-9_-]"))#if ($package != "")#set ($package="${package}.${part}").#else#set ($package=$part)#end<a $r.hrefAndOnclick("viewlog",false,false,"p",${package}) style="display:inline">$part</a>#end </div> </td> <td>$logger.getEffectiveLevel()</td> - <td><a href="$r.commandURIbg("setlevel")?logger=$logger.name&level=error" $r.bgTarget()>Error</a></td> - <td><a href="$r.commandURIbg("setlevel")?logger=$logger.name&level=warn" $r.bgTarget()>Warn</a></td> - <td><a href="$r.commandURIbg("setlevel")?logger=$logger.name&level=info" $r.bgTarget()>Info</a></td> - <td><a href="$r.commandURIbg("setlevel")?logger=$logger.name&level=debug" $r.bgTarget()>Debug</a></td> + <td><a $r.hrefAndOnclick("setlevel",false,false,"logger",$logger.name,"level","error")>Error</a></td> + <td><a $r.hrefAndOnclick("setlevel",false,false,"logger",$logger.name,"level","warn")>Warn</a></td> + <td><a $r.hrefAndOnclick("setlevel",false,false,"logger",$logger.name,"level","info")>Info</a></td> + <td><a $r.hrefAndOnclick("setlevel",false,false,"logger",$logger.name,"level","debug")>Debug</a></td> </tr> #end </tbody> diff --git a/src/main/java/org/olat/basesecurity/AuthHelper.java b/src/main/java/org/olat/basesecurity/AuthHelper.java index ec1fa4036e4684fae3b6e68b74a98edbfe31ae3c..49868d1aa26379d27c9d432327534f1e8cd8b5c8 100644 --- a/src/main/java/org/olat/basesecurity/AuthHelper.java +++ b/src/main/java/org/olat/basesecurity/AuthHelper.java @@ -45,7 +45,6 @@ import org.olat.core.commons.fullWebApp.BaseFullWebappControllerParts; import org.olat.core.commons.persistence.DBFactory; import org.olat.core.dispatcher.DispatcherModule; import org.olat.core.gui.UserRequest; -import org.olat.core.gui.WindowManager; import org.olat.core.gui.Windows; import org.olat.core.gui.components.Window; import org.olat.core.gui.control.ChiefController; @@ -139,7 +138,7 @@ public class AuthHelper { // redirect to AuthenticatedDispatcher // IMPORTANT: windowID has changed due to re-registering current window -> do not use ureq.getWindowID() to build new URLBuilder. - URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED, currentWindow.getInstanceId(), "1", null); + URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED, currentWindow.getInstanceId(), "1"); StringOutput sout = new StringOutput(30); ubu.buildURI(sout, null, null); ureq.getDispatchResult().setResultingMediaResource(new RedirectMediaResource(sout.toString())); @@ -333,7 +332,7 @@ public class AuthHelper { //confirm signedOn sessionManager.signOn(usess); // set users web delivery mode - setAjaxModeFor(ureq); + Windows.getWindows(ureq).getWindowManager().setAjaxWanted(ureq); // update web delivery mode in session info usess.getSessionInfo().setWebModeFromUreq(ureq); return LOGIN_OK; @@ -395,7 +394,6 @@ public class AuthHelper { if(cookie!=null) { //A zero value causes the cookie to be deleted. cookie.setMaxAge(0); - //cookie.setMaxAge(-1); //TODO: LD: check this out as well cookie.setPath("/"); ureq.getHttpResp().addCookie(cookie); if(log.isDebug()) { @@ -404,22 +402,6 @@ public class AuthHelper { } } - /** - * Set AJAX / Web 2.0 based on User GUI-Preferences and configuration. - * If the "ajax feature" checkbox in the user settings is enabled, turn on ajax (do not care about which browser) - * @param ureq - */ - private static void setAjaxModeFor(UserRequest ureq) { - Boolean ajaxOn = (Boolean) ureq.getUserSession().getGuiPreferences().get(WindowManager.class, "ajax-beta-on"); - //if user does not have an gui preference it will be only enabled if globally on and browser is capable - if (ajaxOn != null) { - Windows.getWindows(ureq).getWindowManager().setAjaxEnabled(ajaxOn.booleanValue()); - } else { - // enable ajax if olat configured and browser matching - Windows.getWindows(ureq).getWindowManager().setAjaxWanted(ureq, true); - } - } - /** * Build session info * @param identity diff --git a/src/main/java/org/olat/collaboration/CollaborationTools.java b/src/main/java/org/olat/collaboration/CollaborationTools.java index 21c4fee5154eabc1b83d92a6a940bef9c9e9e1a6..0b72306f9f377f74eaa05fbd677d424c8c9f56cd 100644 --- a/src/main/java/org/olat/collaboration/CollaborationTools.java +++ b/src/main/java/org/olat/collaboration/CollaborationTools.java @@ -104,6 +104,7 @@ import org.olat.portfolio.EPUIFactory; import org.olat.portfolio.manager.EPFrontendManager; import org.olat.portfolio.model.structel.PortfolioStructureMap; import org.olat.portfolio.ui.structel.EPCreateMapController; +import org.olat.portfolio.ui.structel.EPMapViewController; import org.olat.properties.NarrowedPropertyManager; import org.olat.properties.Property; import org.olat.properties.PropertyManager; @@ -483,7 +484,7 @@ public class CollaborationTools implements Serializable { * @param wControl * @return */ - public Controller createPortfolioController(final UserRequest ureq, WindowControl wControl, final BusinessGroup group) { + public EPMapViewController createPortfolioController(final UserRequest ureq, WindowControl wControl, final BusinessGroup group) { final EPFrontendManager ePFMgr = (EPFrontendManager)CoreSpringFactory.getBean("epFrontendManager"); final NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(ores); //TODO gsync diff --git a/src/main/java/org/olat/commons/calendar/ui/_content/event_details.html b/src/main/java/org/olat/commons/calendar/ui/_content/event_details.html index 08d87bbaa409a9f539965476f461b8f24d51483a..befc02b31113ac5d8d1622f5311c0fd08535a145 100644 --- a/src/main/java/org/olat/commons/calendar/ui/_content/event_details.html +++ b/src/main/java/org/olat/commons/calendar/ui/_content/event_details.html @@ -14,7 +14,7 @@ <div class="o_cal_links"> #foreach($link in $links) #if($link.intern) - <a href="javascript:top.o_openUriInMainWindow('$link.uri')" title="$link.title" onclick="return o2cl();"><i class="o_icon $link.cssClass"> </i> $r.escapeHtml($link.displayName)</a> + <a href="javascript:top.o_openUriInMainWindow('$link.uri')" title="$link.title"><i class="o_icon $link.cssClass"> </i> $r.escapeHtml($link.displayName)</a> #else <a href="$link.uri" title="$link.title" class="$link.cssClass" target="_blank">$r.escapeHtml($link.displayName)</a> #end diff --git a/src/main/java/org/olat/commons/calendar/ui/components/FullCalendarComponentRenderer.java b/src/main/java/org/olat/commons/calendar/ui/components/FullCalendarComponentRenderer.java index b0c490e253669221ebd662904e556f5c9435cc65..c46eae44a90446cd3ae89f2ea0fe3d2e811002c2 100644 --- a/src/main/java/org/olat/commons/calendar/ui/components/FullCalendarComponentRenderer.java +++ b/src/main/java/org/olat/commons/calendar/ui/components/FullCalendarComponentRenderer.java @@ -138,19 +138,19 @@ public class FullCalendarComponentRenderer extends DefaultComponentRenderer { .append(" },\n") .append(" viewDisplay: function(view) {\n") .append(FormJSHelper.generateXHRFnCallVariables(rootForm, formId, 1)) - .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt,'evChangeView',view.name,'start',view.start.getTime());\n") + .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt, true, false,'evChangeView',view.name,'start',view.start.getTime());\n") .append(" },\n") .append(" eventDrop: function(calEvent, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {\n") .append(FormJSHelper.generateXHRFnCallVariables(rootForm, formId, 1)) - .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt,'evMove',calEvent.id,'dayDelta',dayDelta,'minuteDelta',minuteDelta,'allDay',allDay);\n") + .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt, true, false, 'evMove',calEvent.id,'dayDelta',dayDelta,'minuteDelta',minuteDelta,'allDay',allDay);\n") .append(" },\n") .append(" select: function(startDate, endDate, allDay, jsEvent, view) {\n") .append(FormJSHelper.generateXHRFnCallVariables(rootForm, formId, 1)) - .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt,'evAdd','new','start',startDate.getTime(),'end',endDate.getTime(),'allDay',allDay);\n") + .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt, true, false, 'evAdd','new','start',startDate.getTime(),'end',endDate.getTime(),'allDay',allDay);\n") .append(" },\n") .append(" eventClick: function(calEvent, jsEvent, view) {\n") .append(FormJSHelper.generateXHRFnCallVariables(rootForm, formId, 1)) - .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt,'evSelect',calEvent.id,'evDomId','o_cev_' + view.name + '_' + calEvent.id);\n") + .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt, true, false, 'evSelect',calEvent.id,'evDomId','o_cev_' + view.name + '_' + calEvent.id);\n") .append(" }\n") .append(" });\n") //print button @@ -158,7 +158,7 @@ public class FullCalendarComponentRenderer extends DefaultComponentRenderer { .append(" <span title=\"").append(translator.translate("print")).append("\"><i class=\"o_icon o_icon_print\"> </i></span></span>');\n") .append(" jQuery('.fc-button-print').click(function () {\n") .append(FormJSHelper.generateXHRFnCallVariables(rootForm, formId, 1)) - .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt,'print','print');\n") + .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt, false, false, 'print','print');\n") .append(" });\n"); if(fcC.isConfigurationEnabled()) { //config button @@ -166,7 +166,7 @@ public class FullCalendarComponentRenderer extends DefaultComponentRenderer { .append(" <span title=\"").append(translator.translate("cal.configuration.tooltip")).append("\"><i class=\"o_icon o_icon_customize\"> </i></span></span>');\n") .append(" jQuery('.fc-button-config').click(function () {\n") .append(FormJSHelper.generateXHRFnCallVariables(rootForm, formId, 1)) - .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt,'config','config');\n") + .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt, false, false, 'config', 'config');\n") .append(" });\n"); } if(fcC.isAggregatedFeedEnabled()) { @@ -175,7 +175,7 @@ public class FullCalendarComponentRenderer extends DefaultComponentRenderer { .append("<span title=\"").append(translator.translate("cal.icalfeed.aggregated.tooltip")).append("\"><i class=\"o_icon o_icon_rss\"> </i></span></span>');\n") .append(" jQuery('.fc-button-aggregate').click(function () {\n") .append(FormJSHelper.generateXHRFnCallVariables(rootForm, formId, 1)) - .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt,'aggregate','aggregate');\n") + .append(" o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt, false, false, 'aggregate','aggregate');\n") .append(" });\n"); } diff --git a/src/main/java/org/olat/commons/coordinate/cluster/jms/_content/nodeinfos.html b/src/main/java/org/olat/commons/coordinate/cluster/jms/_content/nodeinfos.html index 04216bc82bc178c8195c46effca8736bc81e9ced..4a703bd574a5ceaa3a995aa61ea1e85fe91fdd6f 100644 --- a/src/main/java/org/olat/commons/coordinate/cluster/jms/_content/nodeinfos.html +++ b/src/main/java/org/olat/commons/coordinate/cluster/jms/_content/nodeinfos.html @@ -17,7 +17,7 @@ #if ($thisNodeId==$stat.nodeId) <td>$r.translate("you.are.on.this.node")</td> #else - <td class="text-left"><a href="$r.commandURIbg("switchToNode")?nodeId=$stat.nodeId" $r.bgTarget()>$r.translate("switch.to.node")</a></td> + <td class="text-left"><a $r.hrefAndOnclick("switchToNode",false,false,"nodeId",$stat.nodeId)>$r.translate("switch.to.node")</a></td> #end </tr> </table> diff --git a/src/main/java/org/olat/commons/file/filechooser/FileChooseCreateEditController.java b/src/main/java/org/olat/commons/file/filechooser/FileChooseCreateEditController.java index c3e181f598460ebb469b4a92422e967f09ee5a7a..99689afb3b61f17f34bdbeee98806240c1b5caa5 100644 --- a/src/main/java/org/olat/commons/file/filechooser/FileChooseCreateEditController.java +++ b/src/main/java/org/olat/commons/file/filechooser/FileChooseCreateEditController.java @@ -98,11 +98,9 @@ public class FileChooseCreateEditController extends BasicController{ private static final String VC_CHANGE = "fileHasChanged"; private static final String VC_CHOSENFILE = "chosenFile"; private static final String VC_FIELDSETLEGEND = "fieldSetLegend"; - private static final String VC_DEFAULT = "default"; // NLS support - private static final String NLS_FIELDSET_CHOSECREATEEDITFILE = "fieldset.chosecreateeditfile"; private static final String NLS_UNZIP_ALREADYEXISTS = "unzip.alreadyexists"; private static final String NLS_FOLDER_DISPLAYNAME = "folder.displayname"; private static final String NLS_ERROR_CHOOSEFILEFIRST = "error.choosefilefirst"; @@ -160,24 +158,10 @@ public class FileChooseCreateEditController extends BasicController{ * @param target * @param fieldSetLegend */ - public FileChooseCreateEditController(UserRequest ureq, WindowControl wControl, String chosenFile, Boolean allowRelativeLinks, VFSContainer rootContainer, String target, String fieldSetLegend ) { + FileChooseCreateEditController(UserRequest ureq, WindowControl wControl, String chosenFile, Boolean allowRelativeLinks, VFSContainer rootContainer, String target, String fieldSetLegend ) { // use folder module fallback translator super(ureq,wControl, Util.createPackageTranslator(FolderModule.class, ureq.getLocale())); init(chosenFile, allowRelativeLinks, rootContainer, target, fieldSetLegend, ureq, wControl); - } - - /** - * - * @param ureq - * @param wControl - * @param chosenFile - * @param allowRelativeLinks - * @param rootContainer - */ - public FileChooseCreateEditController(UserRequest ureq, WindowControl wControl, String chosenFile, Boolean allowRelativeLinks, VFSContainer rootContainer ) { - super(ureq,wControl, Util.createPackageTranslator(FolderModule.class, ureq.getLocale())); - String fieldSetLegend = getTranslator().translate(NLS_FIELDSET_CHOSECREATEEDITFILE); - init(chosenFile, allowRelativeLinks, rootContainer, VC_DEFAULT, fieldSetLegend, ureq, wControl); } private void init(String file, Boolean allowRelLinks, VFSContainer rContainer, String target, String fieldSetLegend, UserRequest ureq, WindowControl wControl ) { diff --git a/src/main/java/org/olat/commons/file/filechooser/FileChooserController.java b/src/main/java/org/olat/commons/file/filechooser/FileChooserController.java deleted file mode 100644 index 7046f845c91a1c3753ace707eab62d077cff0652..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/commons/file/filechooser/FileChooserController.java +++ /dev/null @@ -1,316 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <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 -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <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> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ - -package org.olat.commons.file.filechooser; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.olat.core.commons.controllers.filechooser.FileChoosenEvent; -import org.olat.core.commons.controllers.filechooser.FileChooserUIFactory; -import org.olat.core.commons.modules.bc.FileUploadController; -import org.olat.core.commons.modules.bc.FolderEvent; -import org.olat.core.commons.modules.bc.FolderModule; -import org.olat.core.gui.UserRequest; -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.StackedPanel; -import org.olat.core.gui.components.velocity.VelocityContainer; -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.controller.BasicController; -import org.olat.core.util.CodeHelper; -import org.olat.core.util.FileUtils; -import org.olat.core.util.Util; -import org.olat.core.util.WebappHelper; -import org.olat.core.util.vfs.LocalFileImpl; -import org.olat.core.util.vfs.LocalFolderImpl; -import org.olat.core.util.vfs.Quota; -import org.olat.core.util.vfs.VFSContainer; -import org.olat.core.util.vfs.VFSItem; -import org.olat.core.util.vfs.VFSLeaf; -import org.olat.core.util.vfs.filters.VFSItemFilter; -import org.olat.user.PersonalFolderManager; - -/** - * Description: - * <p> - * This Controller offers first to choose from local folder or to upload files. - * Then the two subworkflows are triggered. - * <p> - * This workflow should not be used in any new workflows, it is very confusing, - * needs to be reimplemented from sratch with better navigation (e.g. crumb - * path) - * <p> - * @author Felix Jost - * @author Florian Gnägi - * @deprecated - */ -public class FileChooserController extends BasicController { - - private static final String CMD_SELECT = "select"; - - private static final String PARAM_SELECT_RADIO = "sel"; - - private static final String PACKAGE = Util.getPackageName(FileChooserController.class); - private static final String VELOCITY_ROOT = Util.getPackageVelocityRoot(PACKAGE); - - private boolean fileFromUpload = false; - private VFSContainer selectedContainer = null; - private VFSLeaf selectedFile = null; - private File uploadedFile = null; - private VFSLeaf uploadedVFSFile = null; - private String uploadedFileName; - - private VelocityContainer main; - - private int uploadLimitKB; - private List<String> folderNames; - private List<VFSContainer> containerRefs; - private VFSItemFilter suffixFilter; - private org.olat.core.commons.controllers.filechooser.FileChooserController fileChooserCtr; - private Boolean showCancelButton; - private Link foldersButton; - private Link uploadButton; - private Link cancelButton; - - private FileUploadController fileUploadCtr; - private StackedPanel panel; - private File uploadDir; - private VFSContainer uploadContainer; - - - /** - * @param ureq - * @param wControl - * @param cel - * @param uploadLimitKB - */ - public FileChooserController(UserRequest ureq, WindowControl wControl, int uploadLimitKB, boolean showCancelButton) { - super(ureq, wControl, Util.createPackageTranslator(FolderModule.class, ureq.getLocale())); - - this.uploadLimitKB = uploadLimitKB; - this.showCancelButton=new Boolean(showCancelButton); - - main = createVelocityContainer("index"); - foldersButton = LinkFactory.createButton("folders", main, this); - uploadButton = LinkFactory.createButton("upload", main, this); - cancelButton = LinkFactory.createButton("cancel", main, this); - // tmp upload container - uploadDir = new File(WebappHelper.getTmpDir(), CodeHelper.getUniqueID()); - uploadContainer = new LocalFolderImpl(uploadDir); - - folderNames = new ArrayList<String>(3); - containerRefs = new ArrayList<VFSContainer>(3); - //folderNames.add("groupFolder1"); - //containerRefs.add(new Path("/groups/gr1")); - main.contextPut("folderList", folderNames); - main.contextPut("maxUpload", new Long(uploadLimitKB * 1024)); - main.contextPut("showcancelbutton",this.showCancelButton); - // - panel = putInitialPanel(main); - } - - /** - * @see java.lang.Object#finalize() - */ - protected void finalize() throws Throwable { - super.finalize(); - release(); - } - - /** - * - */ - public void release() { - if (uploadedFile != null && uploadedFile.exists()) uploadedFile.delete(); - if (uploadDir != null && uploadDir.exists()) FileUtils.deleteDirsAndFiles(uploadDir, true, true); - } - - /** - * @param suffixFilter - */ - public void setSuffixFilter(VFSItemFilter suffixFilter) { - this.suffixFilter = suffixFilter; - } - - /** - * @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) - */ - public void event(UserRequest ureq, Component source, Event event) { - if (source == main) { - if (event.getCommand().equals(CMD_SELECT)) { - if (ureq.getParameter("cancel") != null) { - notifyCanceled(ureq); - return; - } else { - int selectedFolder; - try { - selectedFolder = Integer.parseInt(ureq.getParameter(PARAM_SELECT_RADIO)); - } catch (NumberFormatException nfe) { - getWindowControl().setError(translate("general.error")); - return; - } - selectedContainer = null; - if (selectedFolder == 0) { // personal folder - selectedContainer = PersonalFolderManager.getInstance().getContainer(ureq.getUserSession().getIdentityEnvironment()); - } else { // process other folders - selectedContainer = containerRefs.get(selectedFolder - 1); - } - initializeSelectionTree(ureq, selectedContainer); - main.setPage(VELOCITY_ROOT + "/selectfile.html"); - - return; - } - } - - } else if (source == foldersButton){ - main.setPage(VELOCITY_ROOT + "/folders.html"); - main.contextPut("showcancelbutton",this.showCancelButton); - - } else if (source == uploadButton){ - // Delegate upload process to file upload controller - removeAsListenerAndDispose(fileUploadCtr); - fileUploadCtr = new FileUploadController(getWindowControl(), uploadContainer, ureq, uploadLimitKB, Quota.UNLIMITED, null, - false, false, true, true, false); - listenTo(fileUploadCtr); - panel.setContent(fileUploadCtr.getInitialComponent()); - - } else if (source == cancelButton){ - notifyCanceled(ureq); - return; - - } - main.contextPut("folderList", folderNames); - } - - /** - * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event) - */ - public void event(UserRequest ureq, Controller source, Event event) { - if (source == fileUploadCtr) { - // catch upload event - if (event instanceof FolderEvent && event.getCommand().equals(FolderEvent.UPLOAD_EVENT)) { - FolderEvent folderEvent = (FolderEvent) event; - // Get file from temp folder location - uploadedFileName = folderEvent.getFilename(); - VFSItem file = uploadContainer.resolve(uploadedFileName); - if (file instanceof VFSLeaf) { - // remove old files first from a previous upload - if (uploadedFile != null && uploadedFile.exists()) uploadedFile.delete(); - // We knot it is a local file, cast is necessary to get file reference - uploadedFile = ((LocalFileImpl)file).getBasefile(); - uploadedVFSFile = (VFSLeaf)file; - fileFromUpload = true; - notifyFinished(ureq); - } else { - showError("error.general"); - } - } - // in any case move back to main view - panel.setContent(main); - - } else if (source == fileChooserCtr) { - if (event instanceof FileChoosenEvent) { - String selectedPath = FileChooserUIFactory.getSelectedRelativeItemPath((FileChoosenEvent) event, selectedContainer, null); - selectedFile = (VFSLeaf)selectedContainer.resolve(selectedPath); - notifyFinished(ureq); - return; - } else { - notifyCanceled(ureq); - return; - } - } - } - - private void notifyFinished(UserRequest ureq) { - fireEvent(ureq, Event.DONE_EVENT); - } - - private void notifyCanceled(UserRequest ureq) { - fireEvent(ureq, Event.CANCELLED_EVENT); - } - - private void initializeSelectionTree(UserRequest ureq, VFSContainer selContainer) { - removeAsListenerAndDispose(fileChooserCtr); - fileChooserCtr = FileChooserUIFactory.createFileChooserController(ureq, getWindowControl(), selContainer, suffixFilter, true); - listenTo(fileChooserCtr); - main.put("selectionTree", fileChooserCtr.getInitialComponent()); - } - - /** - * @return - */ - public boolean isFileFromUpload() { - return fileFromUpload; - } - - /** - * @return - */ - public boolean isFileFromFolder() { - return !fileFromUpload; - } - - /** - * @return - */ - public VFSLeaf getFileSelection() { - return selectedFile; - } - - /** - * @return - */ - public File getUploadedFile() { - return uploadedFile; - } - - /** - * @return - */ - public VFSLeaf getUploadedVFSFile() { - return uploadedVFSFile; - } - - /** - * @return - */ - public String getUploadedFileName() { - return uploadedFileName; - } - - /** - * @see org.olat.core.gui.control.DefaultController#doDispose(boolean) - */ - protected void doDispose() { - release(); - } - -} \ No newline at end of file diff --git a/src/main/java/org/olat/commons/file/filechooser/LinkChooseCreateEditController.java b/src/main/java/org/olat/commons/file/filechooser/LinkChooseCreateEditController.java index b5d5eb009079928953ee6621039a12d8fd6402c2..f627ec31506d6c0d546d19c6fa960d25d4f65c13 100644 --- a/src/main/java/org/olat/commons/file/filechooser/LinkChooseCreateEditController.java +++ b/src/main/java/org/olat/commons/file/filechooser/LinkChooseCreateEditController.java @@ -49,22 +49,6 @@ public class LinkChooseCreateEditController extends FileChooseCreateEditControll super(ureq, wControl, chosenFile, allowRelativeLinks, rootContainer, target, fieldSetLegend); this.customLinkTreeModel = customLinkTreeModel; } - - /** - * - */ - public LinkChooseCreateEditController(UserRequest ureq, WindowControl wControl, String chosenFile, Boolean allowRelativeLinks, VFSContainer rootContainer, CustomLinkTreeModel customLinkTreeModel) { - super(ureq, wControl, chosenFile, allowRelativeLinks, rootContainer); - this.customLinkTreeModel = customLinkTreeModel; - } - - /** - * @see org.olat.core.gui.control.DefaultController#doDispose(boolean) - */ - protected void doDispose() { - super.doDispose(); - } - /** * Creates a Controller with internal-link support. @@ -73,7 +57,6 @@ public class LinkChooseCreateEditController extends FileChooseCreateEditControll protected Controller createWysiwygController(UserRequest ureq, WindowControl windowControl, VFSContainer rootContainer, String chosenFile) { return WysiwygFactory.createWysiwygControllerWithInternalLink(ureq, windowControl, rootContainer, chosenFile, true, customLinkTreeModel); } - } diff --git a/src/main/java/org/olat/commons/file/filechooser/_content/folders.html b/src/main/java/org/olat/commons/file/filechooser/_content/folders.html deleted file mode 100644 index a149ce4a28cb881011fff7c23f592661306bcf65..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/commons/file/filechooser/_content/folders.html +++ /dev/null @@ -1,22 +0,0 @@ -<form class="o_form form-horizontal" method="post" action="$r.formURIbg('select')" $r.bgTarget()> -<fieldset> - <legend>$r.translate("folders")</legend> - <div class="o_info">$r.translate("chooseFolder.description")</div> - #set ($count = 1) - <div class="radio"> - <label><input type="radio" class="radio" name="sel" value="0" checked="checked"/>$r.translate("personalFolder")</label> - </div> - #foreach ($folder in $folderList) - <div class="radio"> - <label><input type="radio" class="radio" name="sel" value="$count" />$folder</label> - </div> - #set ($count = $count + 1) - #end - <div class="o_button_group"> - <input class="btn btn-primary" type="submit" name="submit" value="$r.translateInAttribute('chooseFolder')" /> - #if($showcancelbutton) - <input class="btn btn-default" type="submit" name="cancel" value="$r.translateInAttribute('cancel')" /> - #end - </div> -</fieldset> -</form> diff --git a/src/main/java/org/olat/commons/file/filechooser/_content/index.html b/src/main/java/org/olat/commons/file/filechooser/_content/index.html deleted file mode 100644 index 6dee6dc79d88e7d09f7dcc8dc868874e1a82110c..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/commons/file/filechooser/_content/index.html +++ /dev/null @@ -1,9 +0,0 @@ -<div class="o_info">$r.translate("folders.description")</div> -$r.render("folders") -<div class="o_info">$r.translate("upload.description")</div> -$r.render("upload") -#if($showcancelbutton) - <div class="o_button_group"> - $r.render("cancel") - </div> -#end \ No newline at end of file diff --git a/src/main/java/org/olat/commons/file/filechooser/_content/selectfile.html b/src/main/java/org/olat/commons/file/filechooser/_content/selectfile.html deleted file mode 100644 index 22b5687d58a080bc1ca70b1286c82bc1c3f636dd..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/commons/file/filechooser/_content/selectfile.html +++ /dev/null @@ -1,4 +0,0 @@ -<fieldset> - <legend>$r.translate("chooseFile.description")</legend> - $r.render("selectionTree") -</fieldset> \ No newline at end of file diff --git a/src/main/java/org/olat/core/_spring/mainCorecontext.xml b/src/main/java/org/olat/core/_spring/mainCorecontext.xml index 5fcb2120244a5a6dd71f6073e7bda732fe5e3f11..b5275e2e6891c78b36b607cf0fc343154077d5bc 100644 --- a/src/main/java/org/olat/core/_spring/mainCorecontext.xml +++ b/src/main/java/org/olat/core/_spring/mainCorecontext.xml @@ -8,11 +8,10 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> - <context:component-scan base-package="org.olat.core.dispatcher.mapper,org.olat.core.commons.controllers.impressum,org.olat.core.gui.render.velocity" /> + <context:component-scan base-package="org.olat.core.dispatcher.mapper,org.olat.core.id.context,org.olat.core.commons.controllers.impressum,org.olat.core.gui.render.velocity" /> <bean id="coreSpringFactory" class="org.olat.core.CoreSpringFactory" /> - <import resource="classpath:/org/olat/core/id/context/_spring/historyCorecontext.xml"/> <import resource="classpath:/org/olat/core/util/vfs/version/_spring/versioningCorecontext.xml"/> <import resource="classpath:/org/olat/core/util/i18n/_spring/i18nCorecontext.xml"/> <import resource="classpath:/org/olat/core/util/_spring/utilCorecontext.xml"/> diff --git a/src/main/java/org/olat/core/commons/controllers/impressum/ImpressumAdminController.java b/src/main/java/org/olat/core/commons/controllers/impressum/ImpressumAdminController.java index a90bf4feb3be28b7f4adbe7ea015201783a7646c..ee7371c11b58f85694d58ab98391d880e551939e 100644 --- a/src/main/java/org/olat/core/commons/controllers/impressum/ImpressumAdminController.java +++ b/src/main/java/org/olat/core/commons/controllers/impressum/ImpressumAdminController.java @@ -30,7 +30,6 @@ import org.olat.core.commons.controllers.impressum.ImpressumModule.Position; import org.olat.core.commons.editor.htmleditor.HTMLEditorController; import org.olat.core.commons.editor.htmleditor.WysiwygFactory; import org.olat.core.gui.UserRequest; -import org.olat.core.gui.Windows; import org.olat.core.gui.components.form.flexible.FormItem; import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.elements.FormLink; @@ -201,13 +200,13 @@ public class ImpressumAdminController extends FormBasicController { impressumCont.setVisible(enabled); getWindowControl().getWindowBackOffice().getWindow().setDirty(true); - Windows.getWindows(ureq).getChiefController().wishReload(ureq, true); + getWindowControl().getWindowBackOffice().getChiefController().wishReload(ureq, true); } else if(positionEl == source) { if(positionEl.isOneSelected()) { String key = positionEl.getSelectedKey(); impressumModule.setPosition(key); getWindowControl().getWindowBackOffice().getWindow().setDirty(true); - Windows.getWindows(ureq).getChiefController().wishReload(ureq, true); + getWindowControl().getWindowBackOffice().getChiefController().wishReload(ureq, true); } } else if(source instanceof FormLink) { FormLink link = (FormLink)source; 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 0198aefa2c3a2cdbe62fd53bb290903dab4d1990..90db5856a55a6e72e7a5cc9df321d6729a2a3683 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappController.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import org.olat.NewControllerFactory; import org.olat.admin.landingpages.LandingPagesModule; import org.olat.admin.layout.LayoutModule; import org.olat.admin.layout.LogoInformations; @@ -85,9 +86,9 @@ import org.olat.core.gui.translator.Translator; import org.olat.core.helpers.Settings; import org.olat.core.id.IdentityEnvironment; import org.olat.core.id.OLATResourceable; +import org.olat.core.id.context.BusinessControl; import org.olat.core.id.context.BusinessControlFactory; import org.olat.core.id.context.ContextEntry; -import org.olat.core.id.context.HistoryModule; import org.olat.core.id.context.HistoryPoint; import org.olat.core.id.context.HistoryPointImpl; import org.olat.core.id.context.StateEntry; @@ -121,7 +122,7 @@ import org.olat.login.AfterLoginInterceptionController; * * @author patrickb, Felix Jost, Florian Gnägi */ -public class BaseFullWebappController extends BasicController implements ChiefController, GenericEventListener { +public class BaseFullWebappController extends BasicController implements DTabs, ChiefController, GenericEventListener { private static final String PRESENTED_AFTER_LOGIN_WORKFLOW = "presentedAfterLoginWorkflow"; //Base chief @@ -178,7 +179,6 @@ public class BaseFullWebappController extends BasicController implements ChiefCo private AssessmentModeGuardController assessmentGuardCtrl; private StackedPanel initialPanel; - private DTabs myDTabsImpl; private WindowSettings wSettings; private final boolean isAdmin; @@ -209,13 +209,9 @@ public class BaseFullWebappController extends BasicController implements ChiefCo // define the new windowcontrol WindowControl myWControl = new BaseFullWebappWindowControl(this, wbo); overrideWindowControl(myWControl); - - // detach DTabs implementation from the controller - DTabs may be fetched from the window and locked on (synchronized access). - // if this is controller the controller is locked instead of only the DTabs part. - myDTabsImpl = new BaseFullWebappDTabs(this); - + Window myWindow = myWControl.getWindowBackOffice().getWindow(); - myWindow.setDTabs(myDTabsImpl); + myWindow.setDTabs(this); //REVIEW:PB remove if back support is desired myWindow.addListener(this);//to be able to report BACK / FORWARD / RELOAD @@ -597,31 +593,14 @@ public class BaseFullWebappController extends BasicController implements ChiefCo if (event == Window.OLDTIMESTAMPCALL) { getLogger().info("RELOAD"); - if(isBackEnabled(ureq)) { - HistoryPoint point = ureq.getUserSession().popLastHistoryEntry(); - if(point != null) { - back(ureq, point); - } + HistoryPoint point = ureq.getUserSession().popLastHistoryEntry(); + if(point != null) { + back(ureq, point); } } } } - private boolean isBackEnabled(UserRequest ureq) { - HistoryModule historyModule = (HistoryModule)CoreSpringFactory.getBean("historyModule"); - if(historyModule.isBackEnabled()) { - Preferences prefs = ureq.getUserSession().getGuiPreferences(); - Boolean be = (Boolean)prefs.get(WindowManager.class, "back-enabled"); - if (be != null) { - return be.booleanValue(); - } - else { - return historyModule.isBackDefaultSetting(); - } - } - return false; - } - protected void back(UserRequest ureq, HistoryPoint cstate) { List<ContextEntry> entries = cstate.getEntries(); if(entries.isEmpty()) return; @@ -711,11 +690,9 @@ public class BaseFullWebappController extends BasicController implements ChiefCo dtabToBusinessPath = null; } //clear the DTabs Service - Window myWindow = getWindowControl().getWindowBackOffice().getWindow(); - myDTabsImpl = null; - myWindow.setDTabs(null); - - getWindowControl().getWindowBackOffice().removeCycleListener(this); + WindowBackOffice wbackOffice = getWindowControl().getWindowBackOffice(); + wbackOffice.getWindow().setDTabs(null); + wbackOffice.removeCycleListener(this); if (jsServerC != null) { jsServerC.dispose(); @@ -1047,6 +1024,7 @@ public class BaseFullWebappController extends BasicController implements ChiefCo /** * @see org.olat.core.gui.control.generic.dtabs.DTabs#getDTab(org.olat.core.id.OLATResourceable */ + @Override public DTab getDTab(OLATResourceable ores) { synchronized (dtabs) { for (Iterator<DTab> it_dts = dtabs.iterator(); it_dts.hasNext();) { @@ -1062,11 +1040,8 @@ public class BaseFullWebappController extends BasicController implements ChiefCo } } - /** - * @see org.olat.core.gui.control.generic.dtabs.DTabs#createDTab(org.olat.core.id.OLATResourceable - * java.lang.String) - */ - public DTab createDTab(OLATResourceable ores, OLATResourceable repoOres, String title) { + @Override + public DTab createDTab(OLATResourceable ores, OLATResourceable repoOres, Controller rootController, String title) { final DTabImpl dt; if (dtabs.size() >= maxTabs) { getWindowControl().setError(translate("warn.tabsfull")); @@ -1076,14 +1051,12 @@ public class BaseFullWebappController extends BasicController implements ChiefCo || !lockResource.getResourceableTypeName().equals(ores.getResourceableTypeName()))) { dt = null; } else { - dt = new DTabImpl(ores, repoOres, title, getWindowControl()); + dt = new DTabImpl(ores, repoOres, title, rootController, getWindowControl()); } return dt; } - /** - * @see org.olat.core.gui.control.generic.dtabs.DTabs#addDTab(org.olat.core.gui.control.generic.dtabs.DTab) - */ + @Override public boolean addDTab(UserRequest ureq, DTab dt) { if(isDisposed()) { return false; @@ -1123,18 +1096,14 @@ public class BaseFullWebappController extends BasicController implements ChiefCo } return true; } - - /** - * @see org.olat.core.gui.control.generic.dtabs.DTabs#activate(org.olat.core.gui.UserRequest, - * org.olat.core.gui.control.generic.dtabs.DTab, java.lang.String) - */ - public void activate(final UserRequest ureq, DTab dTab, final String viewIdentifier, final List<ContextEntry> entries) { + + @Override + public void activate(UserRequest ureq, DTab dTab, List<ContextEntry> entries) { //update window settings if needed setWindowSettings(getWindowControl().getWindowBackOffice().getWindowSettings()); // init view (e.g. kurs in run mode, repo-detail-edit...) // jump here via external link or just open a new tab from e.g. repository - //fxdiff FXOLAT-113: business path in DMZ if(dTab == null && contentCtrl instanceof Activateable2) { ((Activateable2)contentCtrl).activate(ureq, entries, null); return; @@ -1142,9 +1111,11 @@ public class BaseFullWebappController extends BasicController implements ChiefCo DTabImpl dtabi = (DTabImpl) dTab; Controller c = dtabi.getController(); - if (c == null) throw new AssertException("no controller set yet! " + dTab + ", view: " + viewIdentifier); + if (c == null) { + throw new AssertException("no controller set yet! " + dTab); + } doActivateDTab(dtabi); - //fxdiff BAKS-7 Resume function + if(entries != null && !entries.isEmpty() && c instanceof Activateable2) { final Activateable2 activateable = ((Activateable2) c); activateable.activate(ureq, entries, null); @@ -1163,6 +1134,7 @@ public class BaseFullWebappController extends BasicController implements ChiefCo // this is the starting point. } + @Override public void activateStatic(UserRequest ureq, String className, List<ContextEntry> entries) { if(className != null && className.endsWith("HomeSite")) { activateSite(userTools, ureq, entries, false); @@ -1177,6 +1149,35 @@ public class BaseFullWebappController extends BasicController implements ChiefCo } } } + + @Override + public void closeDTab(UserRequest ureq, OLATResourceable ores, HistoryPoint launchedFromPoint) { + + // Now try to go back to place that is attached to (optional) root back business path + if (launchedFromPoint != null && StringHelper.containsNonWhitespace(launchedFromPoint.getBusinessPath()) + && launchedFromPoint.getEntries() != null && launchedFromPoint.getEntries().size() > 0) { + BusinessControl bc = BusinessControlFactory.getInstance().createFromPoint(launchedFromPoint); + if(bc.hasContextEntry()) { + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl()); + try { + //make the resume secure. If something fail, don't generate a red screen + NewControllerFactory.getInstance().launch(ureq, bwControl); + } catch (Exception e) { + logError("Error while resuming with root level back business path::" + launchedFromPoint.getBusinessPath(), e); + } + } + } + + // Navigate beyond the stack, our own layout has been popped - close this tab + DTabs tabs = getWindowControl().getWindowBackOffice().getWindow().getDTabs(); + if (tabs != null) { + + DTab tab = tabs.getDTab(ores); + if (tab != null) { + tabs.removeDTab(ureq, tab); + } + } + } @Override public void event(Event event) { @@ -1446,6 +1447,21 @@ public class BaseFullWebappController extends BasicController implements ChiefCo return canClose; } + @Override + public String getWindowTitle() { + String title = translate("page.appname"); + if(siteAndTabs.size() > 0) { + TabState state = siteAndTabs.get(siteAndTabs.size() - 1); + if(state != null) { + String tabTitle = state.getTitle(); + if(StringHelper.containsNonWhitespace(tabTitle)) { + title += " - " + tabTitle; + } + } + } + return title; + } + private void setCurrent(SiteInstance site, DTab tab) { curSite = site; curDTab = tab; @@ -1532,6 +1548,15 @@ public class BaseFullWebappController extends BasicController implements ChiefCo public SiteInstance getSite() { return site; } + + public String getTitle() { + if(site != null && site.getNavElement() != null) { + return site.getNavElement().getTitle(); + } else if(dtab != null) { + return dtab.getTitle(); + } + return null; + } } private enum LockStatus { diff --git a/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappDTabs.java b/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappDTabs.java deleted file mode 100644 index 28d83195b4fa2fc719723e8feb6ddbdab6737a0d..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappDTabs.java +++ /dev/null @@ -1,111 +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.commons.fullWebApp; - -import java.util.List; - -import org.olat.NewControllerFactory; -import org.olat.core.gui.UserRequest; -import org.olat.core.gui.control.WindowControl; -import org.olat.core.gui.control.generic.dtabs.DTab; -import org.olat.core.gui.control.generic.dtabs.DTabs; -import org.olat.core.id.OLATResourceable; -import org.olat.core.id.context.BusinessControl; -import org.olat.core.id.context.BusinessControlFactory; -import org.olat.core.id.context.ContextEntry; -import org.olat.core.id.context.HistoryPoint; -import org.olat.core.logging.OLog; -import org.olat.core.logging.Tracing; -import org.olat.core.util.StringHelper; - -/** - * - * Initial date: 17.04.2014<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -class BaseFullWebappDTabs implements DTabs { - - private static final OLog log = Tracing.createLoggerFor(BaseFullWebappDTabs.class); - - private final BaseFullWebappController webappCtrl; - - public BaseFullWebappDTabs(BaseFullWebappController webappCtrl) { - this.webappCtrl = webappCtrl; - } - - @Override - public void activate(UserRequest ureq, DTab dTab, List<ContextEntry> entries) { - webappCtrl.activate(ureq, dTab, null, entries); - } - - @Override - public void activateStatic(UserRequest ureq, String className, List<ContextEntry> entries) { - webappCtrl.activateStatic(ureq, className, entries); - } - - @Override - public boolean addDTab(UserRequest ureq, DTab dt) { - return webappCtrl.addDTab(ureq, dt); - } - - @Override - public DTab createDTab(OLATResourceable ores, OLATResourceable initialOres, String title) { - return webappCtrl.createDTab(ores, initialOres, title); - } - - @Override - public DTab getDTab(OLATResourceable ores) { - return webappCtrl.getDTab(ores); - } - - @Override - public void removeDTab(UserRequest ureq, DTab dt) { - webappCtrl.removeDTab(ureq, dt); - } - - @Override - public void closeDTab(UserRequest ureq, OLATResourceable ores, HistoryPoint launchedFromPoint) { - // Now try to go back to place that is attached to (optional) root back business path - if (launchedFromPoint != null && StringHelper.containsNonWhitespace(launchedFromPoint.getBusinessPath()) - && launchedFromPoint.getEntries() != null && launchedFromPoint.getEntries().size() > 0) { - BusinessControl bc = BusinessControlFactory.getInstance().createFromPoint(launchedFromPoint); - if(bc.hasContextEntry()) { - WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, webappCtrl.getWindowControl()); - try { - //make the resume secure. If something fail, don't generate a red screen - NewControllerFactory.getInstance().launch(ureq, bwControl); - } catch (Exception e) { - log.error("Error while resuming with root level back business path::" + launchedFromPoint.getBusinessPath(), e); - } - } - } - - // Navigate beyond the stack, our own layout has been popped - close this tab - DTabs tabs = webappCtrl.getWindowControl().getWindowBackOffice().getWindow().getDTabs(); - if (tabs != null) { - - DTab tab = tabs.getDTab(ores); - if (tab != null) { - tabs.removeDTab(ureq, tab); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappPopupBrowserWindow.java b/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappPopupBrowserWindow.java index 99ad4320c06e10349ff456b06390d84961c9de99..97428363b808cbd9631d3b23edcdf97222a922b3 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappPopupBrowserWindow.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/BaseFullWebappPopupBrowserWindow.java @@ -58,6 +58,7 @@ public class BaseFullWebappPopupBrowserWindow extends BaseFullWebappController i * org.olat.core.gui.control.generic.popup.PopupBrowserWindow#open(org.olat * .core.gui.UserRequest) */ + @Override public void open(UserRequest ureq) { ureq.getDispatchResult().setResultingWindow(getWindowControl().getWindowBackOffice().getWindow()); } @@ -65,6 +66,7 @@ public class BaseFullWebappPopupBrowserWindow extends BaseFullWebappController i /** * @see org.olat.core.gui.control.generic.popup.PopupBrowserWindow#getPopupWindowControl() */ + @Override public WindowControl getPopupWindowControl() { return getWindowControl(); } 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 68c2585bbebbade81cea0fe9d3b2de08148ce35c..0ab9a1305bfe2ad67b4797ee8c9024cd78964cd2 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsBackController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsBackController.java @@ -20,7 +20,6 @@ package org.olat.core.commons.fullWebApp; import org.olat.core.gui.UserRequest; -import org.olat.core.gui.Windows; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.link.LinkFactory; @@ -28,8 +27,8 @@ 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.WindowControl; import org.olat.core.gui.control.ScreenMode.Mode; +import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.controller.MainLayoutBasicController; import org.olat.core.gui.control.generic.layout.MainLayout3ColumnsController; @@ -118,8 +117,8 @@ public class LayoutMain3ColsBackController extends MainLayoutBasicController imp return fullScreen; } - public void setAsFullscreen(UserRequest ureq) { - ChiefController cc = Windows.getWindows(ureq).getChiefController(); + public void setAsFullscreen() { + ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController(); if (cc != null) { thebaseChief = cc; thebaseChief.getScreenMode().setMode(Mode.full); 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 bd917bde93951e800e59b2d500cbf719971aa1b1..d8e3798af2f10f31df08d8e7e5bec178481d6ecb 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsController.java @@ -191,7 +191,7 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme } public void setAsFullscreen(UserRequest ureq) { - ChiefController cc = Windows.getWindows(ureq).getChiefController(); + ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController(); if (cc != null) { thebaseChief = cc; thebaseChief.getScreenMode().setMode(Mode.full); @@ -211,7 +211,7 @@ public class LayoutMain3ColsController extends MainLayoutBasicController impleme if(thebaseChief != null) { thebaseChief.getScreenMode().setMode(Mode.standard); } else if (ureq != null){ - ChiefController cc = Windows.getWindows(ureq).getChiefController(); + ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController(); if (cc != null) { thebaseChief = cc; 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 b738d1101fe88cdb02675c4bd9964b928d72451b..2325149795044096b25acf26023ed92a400571ea 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsPreviewController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/LayoutMain3ColsPreviewController.java @@ -20,7 +20,6 @@ package org.olat.core.commons.fullWebApp; import org.olat.core.gui.UserRequest; -import org.olat.core.gui.Windows; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.link.LinkFactory; @@ -28,8 +27,8 @@ 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.WindowControl; import org.olat.core.gui.control.ScreenMode.Mode; +import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.controller.MainLayoutBasicController; import org.olat.core.gui.control.generic.layout.MainLayout3ColumnsController; @@ -111,8 +110,8 @@ public class LayoutMain3ColsPreviewController extends MainLayoutBasicController } - public void setAsFullscreen(UserRequest ureq) { - ChiefController cc = Windows.getWindows(ureq).getChiefController(); + public void setAsFullscreen() { + ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController(); if (cc != null) { thebaseChief = cc; thebaseChief.getScreenMode().setMode(Mode.full); diff --git a/src/main/java/org/olat/core/commons/fullWebApp/MessageWindowController.java b/src/main/java/org/olat/core/commons/fullWebApp/MessageWindowController.java index 8af6bd654a0f2d9d6878f4e8b8e1438f387a29b6..bb83b38b653dc7117ac357c6a10ba6bd804fc922 100644 --- a/src/main/java/org/olat/core/commons/fullWebApp/MessageWindowController.java +++ b/src/main/java/org/olat/core/commons/fullWebApp/MessageWindowController.java @@ -95,6 +95,11 @@ public class MessageWindowController extends DefaultChiefController { setWindow(w); } + @Override + public String getWindowTitle() { + return null; + } + @Override public boolean hasStaticSite(Class<? extends SiteInstance> type) { return false; 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 7c5a14ccd8fb9d78568f0153da1d9a77674acb83..c20d820d6b6f1652ef8287e82f223c83c83cb008 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 @@ -102,12 +102,16 @@ function o_start(){ <script type="text/javascript"> /* <![CDATA[ */ - jQuery.noConflict(); - ## references to objects for later access or cleanup - o_info.objectMap = new Hashtable(); + jQuery.noConflict(); ## Initialize js translator factory with the js translator mapper path jQuery(document).ooTranslator().initialize("$jsTranslationMapperPath"); o_info.oo_translator = jQuery(document).ooTranslator(); + ## History and back button support + jQuery(window).on("popstate", function(e) { + if(e.originalEvent.state && e.originalEvent.state.businessPath) { + window.location.href = e.originalEvent.state.businessPath; + } + }); /* ]]> */ </script> diff --git a/src/main/java/org/olat/core/commons/modules/bc/FolderRunController.java b/src/main/java/org/olat/core/commons/modules/bc/FolderRunController.java index f84f77189098ccf0ac0ef8ec027531dfd6f9e303..4e85906b3dd4684180494fe98ad87259788e50e8 100644 --- a/src/main/java/org/olat/core/commons/modules/bc/FolderRunController.java +++ b/src/main/java/org/olat/core/commons/modules/bc/FolderRunController.java @@ -400,7 +400,9 @@ public class FolderRunController extends BasicController implements Activateable // we catch events from both folderComponent and folderContainer // and process them through the generic folder command implementations String cmd = event.getCommand(); - if (cmd.equals(FORM_ACTION)) cmd = getFormAction(ureq); + if (cmd.equals(FORM_ACTION)) { + cmd = getFormAction(ureq); + } folderCommand = FolderCommandFactory.getInstance().getCommand(cmd, ureq, getWindowControl()); if (folderCommand != null) { @@ -481,6 +483,11 @@ public class FolderRunController extends BasicController implements Activateable String key = params.nextElement(); if (key.startsWith(ACTION_PRE)) { return key.substring(ACTION_PRE.length()); + } else if("multi_action_identifier".equals(key)) { + String actionKey = ureq.getParameter("multi_action_identifier"); + if (actionKey.startsWith(ACTION_PRE)) { + return actionKey.substring(ACTION_PRE.length()); + } } } return null; diff --git a/src/main/java/org/olat/core/commons/modules/bc/components/CrumbRenderer.java b/src/main/java/org/olat/core/commons/modules/bc/components/CrumbRenderer.java index 37892e68974c1bda76df6b307a6052a3df2379a1..59b442dd81e4b21c5b6d7942b4f1a425bc8b1eac 100644 --- a/src/main/java/org/olat/core/commons/modules/bc/components/CrumbRenderer.java +++ b/src/main/java/org/olat/core/commons/modules/bc/components/CrumbRenderer.java @@ -26,11 +26,13 @@ package org.olat.core.commons.modules.bc.components; +import java.io.IOException; import java.util.StringTokenizer; -import org.olat.core.gui.control.winmgr.AJAXFlags; import org.olat.core.gui.render.StringOutput; import org.olat.core.gui.render.URLBuilder; +import org.olat.core.logging.OLog; +import org.olat.core.logging.Tracing; import org.olat.core.util.StringHelper; /** @@ -40,6 +42,8 @@ import org.olat.core.util.StringHelper; */ public class CrumbRenderer { + private static final OLog log = Tracing.createLoggerFor(CrumbRenderer.class); + /** * Return a path-like html fragment for the given briefcase path. * @param dir @@ -49,39 +53,34 @@ public class CrumbRenderer { * @return HTML fragment of briefcase path */ public final void render(FolderComponent fc, StringOutput sb, URLBuilder ubu, boolean iframePostEnabled) { - StringOutput pathLink = new StringOutput(); - ubu.buildURI(pathLink, null, null, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - - // append toplevel node - sb.append("<ol class='breadcrumb'>") - .append("<li><a href='").append(pathLink).append("'"); - if (iframePostEnabled) { // add ajax iframe target - sb.append(so.toString()); - } - sb.append(">") - .append(StringHelper.escapeHtml(fc.getRootContainer().getName())).append("</a></li>"); - - String path = fc.getCurrentContainerPath(); - StringTokenizer st = new StringTokenizer(path, "/", false); - while (st.hasMoreElements()) { - String token = st.nextToken(); - if(pathLink.length() > 0) { - pathLink.append("/"); - } - pathLink.append(ubu.encodeUrl(token)); - if (st.hasMoreElements()) { - sb.append("<li><a href='").append(pathLink).append("'"); - if (iframePostEnabled) { // add ajax iframe target - sb.append(so.toString()); + try { + StringOutput pathLink = new StringOutput(); + + // append toplevel node + sb.append("<ol class='breadcrumb'><li><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false) + .append(">").append(StringHelper.escapeHtml(fc.getRootContainer().getName())).append("</a></li>"); + + String path = fc.getCurrentContainerPath(); + StringTokenizer st = new StringTokenizer(path, "/", false); + while (st.hasMoreElements()) { + String token = st.nextToken(); + if(pathLink.length() > 0) { + pathLink.append("/"); + } + pathLink.append(ubu.encodeUrl(token)); + if (st.hasMoreElements()) { + sb.append("<li><a "); + ubu.buildHrefAndOnclick(sb, pathLink.toString(), iframePostEnabled, false, false) + .append(">").append(StringHelper.escapeHtml(token)).append("</a></li>"); + } else { + sb.append("<li class='active'>").append(StringHelper.escapeHtml(token)).append("</li>"); } - sb.append(">").append(StringHelper.escapeHtml(token)).append("</a></li>"); - } else { - sb.append("<li class='active'>").append(StringHelper.escapeHtml(token)).append("</li>"); } + sb.append("</ol>"); + pathLink.close(); + } catch (IOException e) { + log.error("", e); } - sb.append("</ol>"); } } \ No newline at end of file diff --git a/src/main/java/org/olat/core/commons/modules/bc/components/FolderComponentRenderer.java b/src/main/java/org/olat/core/commons/modules/bc/components/FolderComponentRenderer.java index 03eb741278706dc4500c552801bd80ea79477291..a0cac10c7fcdeaea07e08b3a4964936afefcbec0 100644 --- a/src/main/java/org/olat/core/commons/modules/bc/components/FolderComponentRenderer.java +++ b/src/main/java/org/olat/core/commons/modules/bc/components/FolderComponentRenderer.java @@ -33,6 +33,7 @@ import org.olat.core.commons.modules.bc.FolderRunController; import org.olat.core.commons.modules.bc.commands.FolderCommandFactory; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.DefaultComponentRenderer; +import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.winmgr.AJAXFlags; import org.olat.core.gui.render.RenderResult; @@ -110,15 +111,15 @@ public class FolderComponentRenderer extends DefaultComponentRenderer { String formName = "folder" + CodeHelper.getRAMUniqueID(); target.append("<form method=\"post\" id=\"").append(formName).append("\" action=\""); ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] {FolderRunController.FORM_ACTION }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - target.append("\" onsubmit=\"if ( b_briefcase_isChecked('").append(formName) - .append("', '").append(Formatter.escapeSingleAndDoubleQuotes(StringHelper.escapeHtml(translator.translate("alert")).toString())) - .append("')) { if(o_info.linkbusy) return false; else o_beforeserver(); return true; } else {return false; }\""); + target.append("\" "); if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - target.append(so.toString()); + target.append("\" onsubmit=\"o_XHRSubmit('").append(formName).append("');\">"); + target.append("<input id=\"o_mai_").append(formName).append("\" type=\"hidden\" name=\"multi_action_identifier\" value=\"\"").append(" />"); + } else { + target.append("\" onsubmit=\"if ( b_briefcase_isChecked('").append(formName) + .append("', '").append(Formatter.escapeSingleAndDoubleQuotes(StringHelper.escapeHtml(translator.translate("alert")).toString())) + .append("')) { if(o_info.linkbusy) return false; else o_beforeserver(); return true; } else {return false; }\">"); } - target.append(">"); target.append("<div class=\"o_bc_createactions clearfix\"><ul class='nav navbar-nav navbar-right'>"); if (canWrite) { @@ -126,76 +127,46 @@ public class FolderComponentRenderer extends DefaultComponentRenderer { if(canVersion) { // deleted files - target.append("<li><a class=\"o_bc_deletedfiles\" href=\""); - ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "dfiles" }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - target.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - target.append(so.toString()); - } - target.append("><i class='o_icon o_icon_recycle o_icon-fw'></i> "); - target.append(translator.translate("dfiles")); - target.append("</a></li>"); + target.append("<li><a class=\"o_bc_deletedfiles\""); + ubu.buildHrefAndOnclick(target, null, iframePostEnabled, false, false, new NameValuePair(VelocityContainer.COMMAND_ID, "dfiles")) + .append("><i class='o_icon o_icon_recycle o_icon-fw'></i> ") + .append(translator.translate("dfiles")) + .append("</a></li>"); } if(canWrite) { if(fc.getExternContainerForCopy() != null && (fc.getExternContainerForCopy().getLocalSecurityCallback() == null || fc.getExternContainerForCopy().getLocalSecurityCallback().canCopy())) { //option copy file - target.append("<li><a class=\"o_bc_copy\" href=\""); - ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "copyfile" }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - target.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - target.append(so.toString()); - } - target.append("><i class='o_icon o_icon_copy o_icon-fw'></i> "); - target.append(translator.translate("copyfile")); - target.append("</a></li>"); + target.append("<li><a class=\"o_bc_copy\" "); + ubu.buildHrefAndOnclick(target, null, iframePostEnabled, false, false, new NameValuePair(VelocityContainer.COMMAND_ID, "copyfile" )) + .append("><i class='o_icon o_icon_copy o_icon-fw'></i> ") + .append(translator.translate("copyfile")) + .append("</a></li>"); } // option upload - target.append("<li><a class='o_bc_upload' href=\""); - ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "ul" }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - target.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - target.append(so.toString()); - } - target.append("><i class='o_icon o_icon_upload o_icon-fw'></i> "); - target.append(translator.translate("ul")); - target.append("</a></li>"); + target.append("<li><a class='o_bc_upload' "); + ubu.buildHrefAndOnclick(target, null, iframePostEnabled, false, false, new NameValuePair(VelocityContainer.COMMAND_ID, "ul" )) + .append("><i class='o_icon o_icon_upload o_icon-fw'></i> ") + .append(translator.translate("ul")) + .append("</a></li>"); if(canCreateFolder) { // option new folder - target.append("<li><a class=\"b_bc_newfolder\" href=\""); - ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "cf" }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - target.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - target.append(so.toString()); - } - target.append("><i class='o_icon o_icon_new_folder o_icon-fw'></i> "); - target.append(translator.translate("cf")); - target.append("</a></li>"); + target.append("<li><a class=\"b_bc_newfolder\" "); + ubu.buildHrefAndOnclick(target, null, iframePostEnabled, false, false, new NameValuePair(VelocityContainer.COMMAND_ID, "cf" )) + .append("><i class='o_icon o_icon_new_folder o_icon-fw'></i> ") + .append(translator.translate("cf")) + .append("</a></li>"); } // option new file - target.append("<li><a class=\"b_bc_newfile\" href=\""); - ubu.buildURI(target, new String[] { VelocityContainer.COMMAND_ID }, new String[] { "cfile" }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - target.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - target.append(so.toString()); - } - target.append("><i class='o_icon o_icon_new_document o_icon-fw'></i> "); - target.append(translator.translate("cfile")); - target.append("</a></li>"); + target.append("<li><a class=\"b_bc_newfile\" "); + ubu.buildHrefAndOnclick(target, null, iframePostEnabled, false, false, new NameValuePair(VelocityContainer.COMMAND_ID, "cfile" )) + .append("><i class='o_icon o_icon_new_document o_icon-fw'></i> ") + .append(translator.translate("cfile")) + .append("</a></li>"); } } @@ -222,51 +193,39 @@ public class FolderComponentRenderer extends DefaultComponentRenderer { .append("<div class='o_table_buttons'>"); if(canMail) { - target.append("<input type=\"submit\" class='btn btn-default' name=\""); - target.append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_MAIL); - target.append("\" value=\""); - target.append(StringHelper.escapeHtml(translator.translate("send"))); - target.append("\" />"); + target.append("<button type=\"button\" class='btn btn-default' onclick=\"o_TableMultiActionEvent('").append(formName).append("','") + .append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_MAIL) + .append("');\"><span>").append(StringHelper.escapeHtml(translator.translate("send"))).append("</span></button>"); } - target.append("<input type=\"submit\" class='btn btn-default' name=\"") + target.append(" <button type=\"button\" class='btn btn-default' onclick=\"o_TableMultiActionEvent('").append(formName).append("','") .append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_DOWNLOAD_ZIP) - .append("\" value=\"") - .append(StringHelper.escapeHtml(translator.translate("download"))) - .append("\" />"); + .append("');\"><span>").append(StringHelper.escapeHtml(translator.translate("download"))).append("</span></button>"); if (canDelete) { // delete - target.append("<input type=\"submit\" class='btn btn-default' name=\""); - target.append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_DEL); - target.append("\" value=\""); - target.append(StringHelper.escapeHtml(translator.translate("del"))); - target.append("\" />"); + target.append(" <button type=\"button\" class='btn btn-default' onclick=\"o_TableMultiActionEvent('").append(formName).append("','") + .append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_DEL) + .append("');\"><span>").append(StringHelper.escapeHtml(translator.translate("del"))).append("</span></button>"); } if (canWrite) { // move - target.append("<input type=\"submit\" class='btn btn-default' name=\""); - target.append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_MOVE); - target.append("\" value=\""); - target.append(StringHelper.escapeHtml(translator.translate("move"))); + target.append(" <button type=\"button\" class='btn btn-default' onclick=\"o_TableMultiActionEvent('").append(formName).append("','") + .append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_MOVE) + .append("');\"><span>").append(StringHelper.escapeHtml(translator.translate("move"))).append("</span></button>"); // copy - target.append("\" /><input type=\"submit\" class='btn btn-default' name=\""); - target.append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_COPY); - target.append("\" value=\""); - target.append(StringHelper.escapeHtml(translator.translate("copy"))); - target.append("\" />"); + target.append(" <button type=\"button\" class='btn btn-default' onclick=\"o_TableMultiActionEvent('").append(formName).append("','") + .append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_COPY) + .append("');\"><span>").append(StringHelper.escapeHtml(translator.translate("copy"))).append("</span></button>"); // zip - target.append("<input type=\"submit\" class='btn btn-default' name=\""); - target.append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_ZIP); - target.append("\" value=\""); - target.append(StringHelper.escapeHtml(translator.translate("zip"))); + target.append(" <button type=\"button\" class='btn btn-default' onclick=\"o_TableMultiActionEvent('").append(formName).append("','") + .append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_ZIP) + .append("');\"><span>").append(StringHelper.escapeHtml(translator.translate("zip"))).append("</span></button>"); //unzip - target.append("\" /><input type=\"submit\" class='btn btn-default' name=\""); - target.append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_UNZIP); - target.append("\" value=\""); - target.append(StringHelper.escapeHtml(translator.translate("unzip"))); - target.append("\" />"); + target.append(" <button type=\"button\" class='btn btn-default' onclick=\"o_TableMultiActionEvent('").append(formName).append("','") + .append(FolderRunController.ACTION_PRE).append(FolderCommandFactory.COMMAND_UNZIP) + .append("');\"><span>").append(StringHelper.escapeHtml(translator.translate("unzip"))).append("</span></button>"); } target.append("</div></div>"); } diff --git a/src/main/java/org/olat/core/commons/modules/bc/components/ListRenderer.java b/src/main/java/org/olat/core/commons/modules/bc/components/ListRenderer.java index e3df05288b293f02df473909b19df7192049f05c..bce65a7103ca9675e774ee1b829c5829ee2f7ca2 100644 --- a/src/main/java/org/olat/core/commons/modules/bc/components/ListRenderer.java +++ b/src/main/java/org/olat/core/commons/modules/bc/components/ListRenderer.java @@ -35,6 +35,7 @@ import org.olat.core.commons.modules.bc.FileSelection; import org.olat.core.commons.modules.bc.FolderConfig; import org.olat.core.commons.modules.bc.meta.MetaInfo; import org.olat.core.commons.modules.bc.meta.tagged.MetaTagged; +import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.control.winmgr.AJAXFlags; import org.olat.core.gui.render.StringOutput; import org.olat.core.gui.render.URLBuilder; @@ -112,81 +113,42 @@ public class ListRenderer { List<VFSItem> children = fc.getCurrentContainerChildren(); // folder empty? if (children.size() == 0) { - sb.append("<div class=\"o_bc_empty\"><i class='o_icon o_icon_warn'></i> "); - sb.append(translator.translate("NoFiles")); - sb.append("</div>"); + sb.append("<div class=\"o_bc_empty\"><i class='o_icon o_icon_warn'></i> ") + .append(translator.translate("NoFiles")) + .append("</div>"); return; } boolean canVersion = FolderConfig.versionsEnabled(fc.getCurrentContainer()); - sb.append("<table class=\"table table-condensed table-striped table-hover o_bc_table\">"); - // header - sb.append("<thead><tr><th>"); - - sb.append("<a href=\""); // file name column - ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_NAME }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append(">").append(translator.translate("header.Name")).append("</a>"); - sb.append("</th><th>"); - - sb.append("<a href=\""); // file size column - ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_SIZE }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append(">").append(translator.translate("header.Size")).append("</a>"); - sb.append("</th><th>"); - - sb.append("<a href=\""); // file type column - ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_DATE }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append(">").append(translator.translate("header.Modified")).append("</a>"); + sb.append("<table class=\"table table-condensed table-striped table-hover o_bc_table\">") + .append("<thead><tr><th><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_SORTID, FolderComponent.SORT_NAME)) + .append(">").append(translator.translate("header.Name")).append("</a>") + .append("</th><th><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_SORTID, FolderComponent.SORT_SIZE)) + .append(">").append(translator.translate("header.Size")).append("</a>") + .append("</th><th><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_SORTID, FolderComponent.SORT_DATE)) + .append(">").append(translator.translate("header.Modified")).append("</a>"); if(canVersion) { - sb.append("</th><th>") - .append("<a href=\""); // file size column - ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_REV }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append("><i class=\"o_icon o_icon_version o_icon-lg\"></i></a>"); + sb.append("</th><th><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_SORTID, FolderComponent.SORT_REV)) // file size column + .append("><i class=\"o_icon o_icon_version o_icon-lg\"></i></a>"); } - sb.append("</th><th>"); - sb.append("<a href=\""); // file lock - ubu.buildURI(sb, new String[] { PARAM_SORTID }, new String[] { FolderComponent.SORT_LOCK }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append("><i class=\"o_icon o_icon_locked o_icon-lg\"></i></a>"); - + sb.append("</th><th><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_SORTID, FolderComponent.SORT_LOCK)) + .append("><i class=\"o_icon o_icon_locked o_icon-lg\"></i></a>") // meta data column - sb.append("</th><th><i class=\"o_icon o_icon_edit_metadata o_icon-lg\"></i></th></tr></thead>"); + .append("</th><th><i class=\"o_icon o_icon_edit_metadata o_icon-lg\"></i></th></tr></thead>"); // render directory contents String currentContainerPath = fc.getCurrentContainerPath(); - if (currentContainerPath.length() > 0 && currentContainerPath.charAt(0) == '/') + if (currentContainerPath.length() > 0 && currentContainerPath.charAt(0) == '/') { currentContainerPath = currentContainerPath.substring(1); + } sb.append("<tbody>"); @@ -267,20 +229,14 @@ public class ListRenderer { sb.append(StringHelper.escapeHtml(name)); log.error("XSS Scan found something suspicious in: " + child); } else { - sb.append("<a id='o_sel_doc_").append(pos).append("' href=\""); + sb.append("<a id='o_sel_doc_").append(pos).append("'"); if (isContainer) { // for directories... normal module URIs - ubu.buildURI(sb, null, null, pathAndName, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } + ubu.buildHrefAndOnclick(sb, pathAndName, iframePostEnabled, false, false); } else { // for files, add PARAM_SERV command + sb.append(" href=\""); ubu.buildURI(sb, new String[] { PARAM_SERV }, new String[] { "x" }, pathAndName, AJAXFlags.MODE_NORMAL); - sb.append("\" target=\"_blank\""); - sb.append(" download=\"").append(name).append("\""); + sb.append("\" target=\"_blank\" download=\"").append(name).append("\""); } sb.append(">"); @@ -435,17 +391,10 @@ public class ListRenderer { if (actionCount == 1 && canMetaData) { // when only one action is available, don't render menu - sb.append("<a href='"); - ubu.buildURI(sb, new String[] { PARAM_EDTID }, new String[] { Integer.toString(pos) }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME - : AJAXFlags.MODE_NORMAL); - sb.append("'"); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append(" title=\"").append(StringHelper.escapeHtml(translator.translate("mf.edit"))) - .append("\"><i class=\"o_icon o_icon-fw o_icon_edit_metadata\"></i></a>"); + sb.append("<a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_EDTID, pos)) + .append(" title=\"").append(StringHelper.escapeHtml(translator.translate("mf.edit"))) + .append("\"><i class=\"o_icon o_icon-fw o_icon_edit_metadata\"></i></a>"); } else if (actionCount > 1) { // add actions to menu if multiple actions available @@ -455,44 +404,23 @@ public class ListRenderer { // meta edit action (rename etc) if (canMetaData) { // Metadata edit link... also handles rename for non-OlatRelPathImpls - sb.append("<li><a href='"); - ubu.buildURI(sb, new String[] { PARAM_EDTID }, new String[] { Integer.toString(pos) }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME - : AJAXFlags.MODE_NORMAL); - sb.append("'"); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append("><i class=\"o_icon o_icon-fw o_icon_edit_metadata\"></i> ").append(StringHelper.escapeHtml(translator.translate("mf.edit"))).append("</a></li>"); + sb.append("<li><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_EDTID, pos)) + .append("><i class=\"o_icon o_icon-fw o_icon_edit_metadata\"></i> ").append(StringHelper.escapeHtml(translator.translate("mf.edit"))).append("</a></li>"); } // content edit action if (isEditable) { - sb.append("<li><a href=\""); - ubu.buildURI(sb, new String[] { PARAM_CONTENTEDITID }, new String[] { Integer.toString(pos) }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME - : AJAXFlags.MODE_NORMAL); - sb.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append("><i class=\"o_icon o_icon-fw o_icon_edit_file\"></i> ").append(StringHelper.escapeHtml(translator.translate("editor"))).append("</a></li>"); + sb.append("<li><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_CONTENTEDITID, pos)) + .append("><i class=\"o_icon o_icon-fw o_icon_edit_file\"></i> ").append(StringHelper.escapeHtml(translator.translate("editor"))).append("</a></li>"); } // versions action if (canVersion) { // Versions link - sb.append("<li><a href=\""); - ubu.buildURI(sb, new String[] { PARAM_VERID }, new String[] { Integer.toString(pos) }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME - : AJAXFlags.MODE_NORMAL); - sb.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append("><i class=\"o_icon o_icon-fw o_icon_version\"></i> ").append(StringHelper.escapeHtml(translator.translate("versions"))).append("</a></li>"); + sb.append("<li><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_VERID, pos)) + .append("><i class=\"o_icon o_icon-fw o_icon_version\"></i> ").append(StringHelper.escapeHtml(translator.translate("versions"))).append("</a></li>"); } // eportfolio collect action @@ -501,16 +429,9 @@ public class ListRenderer { if (metaInfo != null) { Identity author = metaInfo.getAuthorIdentity(); if (author != null && fc.getIdentityEnvironnement().getIdentity().getKey().equals(author.getKey())) { - sb.append("<li><a href=\""); - ubu.buildURI(sb, new String[] { PARAM_EPORT }, new String[] { Integer.toString(pos) }, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME - : AJAXFlags.MODE_NORMAL); - sb.append("\""); - if (iframePostEnabled) { // add ajax iframe target - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - sb.append(so.toString()); - } - sb.append("><i class=\"o_icon o_icon-fw o_icon_eportfolio_add\"></i> ").append(StringHelper.escapeHtml(translator.translate("eportfolio"))).append("</a></li>"); + sb.append("<li><a "); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, false, false, new NameValuePair(PARAM_EPORT, pos)) + .append("><i class=\"o_icon o_icon-fw o_icon_eportfolio_add\"></i> ").append(StringHelper.escapeHtml(translator.translate("eportfolio"))).append("</a></li>"); } } } diff --git a/src/main/java/org/olat/core/commons/modules/glossary/GlossaryMainController.java b/src/main/java/org/olat/core/commons/modules/glossary/GlossaryMainController.java index 45f5551436ce3ccd95086ee7f54e9d7bfe0d6a89..899ff328a48d07195eda38ff38c7580f92402e74 100644 --- a/src/main/java/org/olat/core/commons/modules/glossary/GlossaryMainController.java +++ b/src/main/java/org/olat/core/commons/modules/glossary/GlossaryMainController.java @@ -28,7 +28,8 @@ import java.util.List; import java.util.Properties; import java.util.Set; -import org.olat.core.CoreSpringFactory; +import org.olat.NewControllerFactory; +import org.olat.basesecurity.BaseSecurity; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.link.Link; @@ -42,6 +43,7 @@ import org.olat.core.gui.control.generic.closablewrapper.CloseableModalControlle import org.olat.core.gui.control.generic.dtabs.Activateable2; import org.olat.core.gui.control.generic.modal.DialogBoxController; import org.olat.core.gui.control.generic.modal.DialogBoxUIFactory; +import org.olat.core.id.Identity; import org.olat.core.id.OLATResourceable; import org.olat.core.id.context.BusinessControl; import org.olat.core.id.context.BusinessControlFactory; @@ -56,7 +58,9 @@ import org.olat.core.util.StringHelper; import org.olat.core.util.coordinate.CoordinatorManager; import org.olat.core.util.coordinate.LockResult; import org.olat.core.util.vfs.VFSContainer; +import org.olat.user.UserInfoMainController; import org.olat.user.UserManager; +import org.springframework.beans.factory.annotation.Autowired; /** * Description:<br> @@ -79,15 +83,24 @@ public class GlossaryMainController extends BasicController implements Activatea private GlossaryItem currentDeleteItem; private String filterIndex = ""; private VFSContainer glossaryFolder; + + + private UserInfoMainController uimc; + private CloseableModalController cmcUserInfo; private CloseableModalController cmc; + private OLATResourceable resourceable; + private static final String CMD_EDIT = "cmd.edit."; private static final String CMD_DELETE = "cmd.delete."; private static final String CMD_AUTHOR = "cmd.author."; private static final String CMD_MODIFIER = "cmd.modifier."; private static final String REGISTER_LINK = "register.link."; private final Formatter formatter; - private final UserManager userManager; + @Autowired + private UserManager userManager; + @Autowired + private BaseSecurity securityManager; public GlossaryMainController(WindowControl control, UserRequest ureq, VFSContainer glossaryFolder, OLATResourceable res, GlossarySecurityCallback glossarySecCallback, boolean eventProfil) { @@ -100,7 +113,6 @@ public class GlossaryMainController extends BasicController implements Activatea ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_OPEN, getClass()); glistVC = createVelocityContainer("glossarylist"); - userManager = CoreSpringFactory.getImpl(UserManager.class); formatter = Formatter.getInstance(getLocale()); glossaryItemList = GlossaryItemManager.getInstance().getGlossaryItemListByVFSItem(glossaryFolder); @@ -229,15 +241,35 @@ public class GlossaryMainController extends BasicController implements Activatea } private void openProfil(UserRequest ureq, String pos, boolean author) { + Long identityKey = null; int id = Integer.parseInt(pos); - @SuppressWarnings("unchecked") List<GlossaryItemWrapper> wrappers = (List<GlossaryItemWrapper>)glistVC.getContext().get("editAndDelButtonList"); for(GlossaryItemWrapper wrapper:wrappers) { if(id == wrapper.getId()) { Revision revision = author ? wrapper.getAuthorRevision() : wrapper.getModifierRevision(); - Long identityKey = revision.getAuthor().extractKey(); - fireEvent(ureq, new OpenAuthorProfilEvent(identityKey)); + identityKey = revision.getAuthor().extractKey(); + break; + } + } + + if(identityKey != null) { + if(eventProfil) { + removeAsListenerAndDispose(cmc); + removeAsListenerAndDispose(uimc); + + Identity selectedIdentity = securityManager.loadIdentityByKey(identityKey); + if(selectedIdentity != null) { + uimc = new UserInfoMainController(ureq, getWindowControl(), selectedIdentity, false, false); + listenTo(uimc); + + cmcUserInfo = new CloseableModalController(getWindowControl(), "c", uimc.getInitialComponent()); + listenTo(cmcUserInfo); + cmcUserInfo.activate(); + } + } else { + String businessPath = "[Identity:" + identityKey + "]"; + NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl()); } } } @@ -250,7 +282,12 @@ public class GlossaryMainController extends BasicController implements Activatea GlossaryItemManager.getInstance().saveGlossaryItemList(glossaryFolder, glossaryItemList); glossaryItemList = GlossaryItemManager.getInstance().getGlossaryItemListByVFSItem(glossaryFolder); updateRegisterAndGlossaryItems(); - } else if (source == deleteDialogCtr) { + } else if(source == cmcUserInfo) { + removeAsListenerAndDispose(cmcUserInfo); + removeAsListenerAndDispose(uimc); + cmcUserInfo = null; + uimc = null; + } else if (source == deleteDialogCtr) { if (DialogBoxUIFactory.isYesEvent(event)) { glossaryItemList.remove(currentDeleteItem); GlossaryItemManager.getInstance().saveGlossaryItemList(glossaryFolder, glossaryItemList); @@ -372,7 +409,7 @@ public class GlossaryMainController extends BasicController implements Activatea } public String getAuthorCmd() { - return eventProfil ? CMD_AUTHOR + id : null; + return CMD_AUTHOR + id; } public String getAuthorLink() { @@ -391,7 +428,7 @@ public class GlossaryMainController extends BasicController implements Activatea } public String getModifierCmd() { - return eventProfil ? CMD_MODIFIER + id : null; + return CMD_MODIFIER + id; } public String getModifierLink() { diff --git a/src/main/java/org/olat/core/commons/modules/glossary/_content/glossarylist.html b/src/main/java/org/olat/core/commons/modules/glossary/_content/glossarylist.html index b12e674eab28590e31d6ad828c0c48b678f07072..6f8bc2ea360045583f49d47bccddf6cb21b60b4b 100644 --- a/src/main/java/org/olat/core/commons/modules/glossary/_content/glossarylist.html +++ b/src/main/java/org/olat/core/commons/modules/glossary/_content/glossarylist.html @@ -50,20 +50,12 @@ <div class="o_meta"> #if($glossaryItem.hasAuthor()) <span class="o_author">$r.translate("glossary.item.published.by") - #if($glossaryItem.authorCmd) - <a href="$r.commandURI($glossaryItem.authorCmd)" target="o_glossary_profil" onclick="return o2cl()">$r.escapeHtml($glossaryItem.authorName)</a> - #else - <a href="$glossaryItem.authorLink" class="">$r.escapeHtml($glossaryItem.authorName)</a>#end - ${glossaryItem.creationDate} - #if($glossaryItem.hasModifier()), #end</span> + <a $r.hrefAndOnclick($glossaryItem.authorCmd,true,true)>$r.escapeHtml($glossaryItem.authorName)</a> + ${glossaryItem.creationDate} #if($glossaryItem.hasModifier()), #end</span> #end #if($glossaryItem.hasModifier()) <span class="o_modifier">$r.translate("glossary.item.modified.by.on") - #if($glossaryItem.modifierCmd) - <a href="$r.commandURI($glossaryItem.modifierCmd)" target="o_glossary_profil" onclick="return o2cl()" >$r.escapeHtml($glossaryItem.modifierName)</a> - #else - <a href="$glossaryItem.modifierLink" class="">$r.escapeHtml($glossaryItem.modifierName)</a> - #end + <a $r.hrefAndOnclick($glossaryItem.modifierCmd,true,true)>$r.escapeHtml($glossaryItem.modifierName)</a> $glossaryItem.lastModificationDate</span> #end </div> diff --git a/src/main/java/org/olat/core/commons/services/notifications/ui/_content/notificationsNews.html b/src/main/java/org/olat/core/commons/services/notifications/ui/_content/notificationsNews.html index 7df2054ab96f198c610cad749661a505f32cdbf2..91b0b4d7789d5035595f4e0ebd17de16660fd389 100644 --- a/src/main/java/org/olat/core/commons/services/notifications/ui/_content/notificationsNews.html +++ b/src/main/java/org/olat/core/commons/services/notifications/ui/_content/notificationsNews.html @@ -38,7 +38,7 @@ #else #set($subscrItem = $subsFormatter.getSubscriptionItem($sub)) #if($subscrItem) - <a href="$subscrItem.getLink()" onkeypress="return o2cl();" onclick="return o2cl();"> + <a href="$subscrItem.getLink()"> $r.translate("resource.open", $subsFormatter.getType($sub)) <i class="o_icon o_icon_start"></i> </a> diff --git a/src/main/java/org/olat/core/gui/WindowManager.java b/src/main/java/org/olat/core/gui/WindowManager.java index 59bd52c73a7282b5f589d0c4a2e04ef701424227..31ac99dc9fd85ef5401a1eef8cd6c2cd74c9646b 100644 --- a/src/main/java/org/olat/core/gui/WindowManager.java +++ b/src/main/java/org/olat/core/gui/WindowManager.java @@ -42,16 +42,12 @@ import org.olat.core.gui.control.generic.popup.PopupBrowserWindow; public interface WindowManager extends Disposable { /** - * call this method after having e.g. logged on, and when you would like to switch to ajax mode.<br> - * ajax will be enable if all of the following criterion meet: - * a) it is globally enabled in olat.properties - * b) the browser of the user supports it - * c) the given argument "enabled" is true + * Call this method after having e.g. logged on, and when you would like to switch to ajax mode.<br> + * ajax will be enable if the browser of the user supports it. * * @param ureq - * @param enabled if true, ajax should be enabled if possible */ - public void setAjaxWanted(UserRequest ureq, boolean enabled); + public void setAjaxWanted(UserRequest ureq); public GlobalSettings getGlobalSettings(); @@ -62,10 +58,6 @@ public interface WindowManager extends Disposable { * @return */ public WindowBackOffice createWindowBackOffice(String windowName, ChiefController owner, WindowSettings settings); - - public void setAjaxEnabled(boolean enabled); - - public void setHighLightingEnabled(boolean enabled); /** * @param fontSize relative to default font size @@ -78,6 +70,8 @@ public interface WindowManager extends Disposable { * @return */ public boolean isAjaxEnabled(); + + public void setAjaxEnabled(boolean enabled); /** * a new browser window with content (controller) provided through the diff --git a/src/main/java/org/olat/core/gui/Windows.java b/src/main/java/org/olat/core/gui/Windows.java index ad750e38c7c301fb3bbf0c10a67a9322a42aee28..b3a082922bffa432f79cbe5f0744472264ee6e2a 100644 --- a/src/main/java/org/olat/core/gui/Windows.java +++ b/src/main/java/org/olat/core/gui/Windows.java @@ -214,8 +214,7 @@ public class Windows implements Disposable, Serializable { return contextHelpChiefController; } - public void setContextHelpChiefController( - ChiefController contextHelpChiefController) { + public void setContextHelpChiefController(ChiefController contextHelpChiefController) { this.contextHelpChiefController = contextHelpChiefController; } 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 c9c5cb8fff3b761623a26237a5db987cc0a33057..b457e31823eae447cb99b04dd772aa3a440dbd22 100644 --- a/src/main/java/org/olat/core/gui/components/Window.java +++ b/src/main/java/org/olat/core/gui/components/Window.java @@ -162,7 +162,7 @@ public class Window extends AbstractComponent { private CustomCSS customCSS; // wbackoffice reference - private WindowBackOfficeImpl wbackofficeImpl; + private final WindowBackOfficeImpl wbackofficeImpl; // mutex for rendering private final Object render_mutex = new Object(); // delegate for css and js includes @@ -175,7 +175,7 @@ public class Window extends AbstractComponent { public Window(String name, WindowBackOfficeImpl wbackoffice) { super(name); this.wbackofficeImpl = wbackoffice; - this.jsAndCssAdder = wbackoffice.createJSAndCSSAdder(); + jsAndCssAdder = wbackoffice.createJSAndCSSAdder(); // set default theme Theme myTheme = new Theme(Settings.getGuiThemeIdentifyer()); setGuiTheme(myTheme); @@ -515,7 +515,7 @@ public class Window extends AbstractComponent { log.debug("Perf-Test: Window durationBeforeServeResource=" + durationBeforeServeResource); } - wbackofficeImpl.pushCommands(request, response); + wbackofficeImpl.pushCommands(ureq, request, response); } catch (InvalidRequestParameterException e) { try { response.sendError(HttpServletResponse.SC_BAD_REQUEST); @@ -666,7 +666,7 @@ public class Window extends AbstractComponent { // window id. needed for asyncronous data like images loaded // todo maybe better delegate window registry to the windowbackoffice? - URLBuilder ubu = new URLBuilder(uriPrefix, resWindow.getInstanceId(), String.valueOf(resWindow.timestamp), resWindow.wbackofficeImpl); + URLBuilder ubu = new URLBuilder(uriPrefix, resWindow.getInstanceId(), String.valueOf(resWindow.timestamp)); StringOutput sout = new StringOutput(30); ubu.buildURI(sout, null, null); mr = new RedirectMediaResource(sout.toString()); @@ -742,7 +742,7 @@ public class Window extends AbstractComponent { // coding effort: setting an appropriate business path and launching for each controller. // note: the businesspath may also be used as a easy (but of course not perfect) back-button-solution: // if the timestamp of a request is outdated, simply jump to its bookmarked business control path. - URLBuilder ubu = new URLBuilder(uriPrefix, getInstanceId(), newTimestamp, wbackofficeImpl); + URLBuilder ubu = new URLBuilder(uriPrefix, getInstanceId(), newTimestamp); RenderResult renderResult = new RenderResult(); // if we have an around-component-interception @@ -854,7 +854,7 @@ public class Window extends AbstractComponent { public String renderComponent(Component cmp) { RenderResult renderResult = new RenderResult(); - URLBuilder ubu = new URLBuilder(getUriPrefix(), getInstanceId(), getTimestamp(), wbackofficeImpl); + URLBuilder ubu = new URLBuilder(getUriPrefix(), getInstanceId(), getTimestamp()); Renderer fr = Renderer.getInstance(cmp.getParent(), cmp.getTranslator(), ubu, renderResult, wbackofficeImpl.getGlobalSettings()); StringOutput sb = StringOutputPool.allocStringBuilder(2048); @@ -954,7 +954,7 @@ public class Window extends AbstractComponent { toRender.setDomReplaceable(false); wrapper.setContent(toRender); String newTimestamp = String.valueOf(timestamp); - URLBuilder ubu = new URLBuilder(uriPrefix,getInstanceId(), newTimestamp,wbackofficeImpl); + URLBuilder ubu = new URLBuilder(uriPrefix,getInstanceId(), newTimestamp); renderResult = new RenderResult(); @@ -1064,11 +1064,10 @@ public class Window extends AbstractComponent { * @return the new (relative) url as a string */ public String buildURIFor(Window win, String timestampId, String moduleUri) { - URLBuilder ubu = new URLBuilder(uriPrefix, win.getInstanceId(), timestampId, wbackofficeImpl); + URLBuilder ubu = new URLBuilder(uriPrefix, win.getInstanceId(), timestampId); StringOutput so = new StringOutput(); ubu.buildURI(so, null, null, moduleUri, 0); - String uri = so.toString(); - return uri; + return so.toString(); } private String buildURIForRedirect(String moduleUri) { @@ -1080,8 +1079,7 @@ public class Window extends AbstractComponent { } public URLBuilder getURLBuilder() { - URLBuilder ubu = new URLBuilder(getUriPrefix(), getInstanceId(), getTimestamp(), wbackofficeImpl); - return ubu; + return new URLBuilder(getUriPrefix(), getInstanceId(), getTimestamp()); } /** @@ -1155,7 +1153,7 @@ public class Window extends AbstractComponent { latestDispatchedComp = null; } - ChiefController chief = Windows.getWindows(ureq).getChiefController(); + ChiefController chief = wbackofficeImpl.getChiefController(); boolean reload = chief == null ? false : chief.wishReload(ureq, true); return new DispatchResult(toDispatch, incTimestamp, reload); } @@ -1190,7 +1188,6 @@ public class Window extends AbstractComponent { String targetInfo = target.getExtendedDebugInfo(); msg += targetInfo+"%%"; debugMsg.append(msg).append(LOG_SEPARATOR); - //Tracing.logDebug(msg, WindowStats.class); } else { // no windowcontrol -> ignore } diff --git a/src/main/java/org/olat/core/gui/components/choice/Choice.java b/src/main/java/org/olat/core/gui/components/choice/Choice.java index 83ea913d5a3153bc3f84f92b46f8a847e4b0a6fa..09e86cf1e19f2fef27a4f28e11693620b6ad0ce2 100644 --- a/src/main/java/org/olat/core/gui/components/choice/Choice.java +++ b/src/main/java/org/olat/core/gui/components/choice/Choice.java @@ -82,9 +82,11 @@ public class Choice extends AbstractComponent { protected void doDispatchRequest(UserRequest ureq) { // since we are a >form<, this must be a submit or a cancel // check for cancel first - if (ureq.getParameter(CANCEL_IDENTIFICATION) != null) { + + String action = ureq.getParameter("multi_action_identifier"); + if (CANCEL_IDENTIFICATION.equals(action)) { fireEvent(ureq, EVNT_FORM_CANCELLED); - } else if (ureq.getParameter(RESET_IDENTIFICATION) != null) { + } else if (RESET_IDENTIFICATION.equals(action)) { fireEvent(ureq, EVNT_FORM_RESETED); } else { selectedRows.clear(); diff --git a/src/main/java/org/olat/core/gui/components/choice/ChoiceRenderer.java b/src/main/java/org/olat/core/gui/components/choice/ChoiceRenderer.java index 92da4048d04ea870466126c1b9e4bb7f32e45a12..20a8608086da42f402085212f33f37c984f0eb85 100644 --- a/src/main/java/org/olat/core/gui/components/choice/ChoiceRenderer.java +++ b/src/main/java/org/olat/core/gui/components/choice/ChoiceRenderer.java @@ -64,12 +64,12 @@ public class ChoiceRenderer extends DefaultComponentRenderer { ubu.buildURI(target, null, null, iframePostEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); target.append("\""); if (iframePostEnabled) { - ubu.appendTarget(target); + target.append(" onsubmit=\"o_XHRSubmit('").append(id).append("')\""); } if (choice.getElementCssClass() != null) { target.append(" class=\"").append(choice.getElementCssClass()).append("\""); } - target.append(">"); + target.append("><input type=\"hidden\" name=\"multi_action_identifier\" value=\"\" />"); target.append("<table class=\"o_choice\">"); int rows = model.getRowCount(); @@ -108,24 +108,24 @@ public class ChoiceRenderer extends DefaultComponentRenderer { //buttons target.append("<tr><td colspan='2'><div class='btn-group btn-group-xs o_block_top'>"); // Submit button - target.append("<input type='submit' name='olat_fosm' value=\"") - .append(StringEscapeUtils.escapeHtml(translator.translate(choice.getSubmitKey()))) - .append("\" class='btn btn-primary' />"); + target.append("<button type='button' class='btn btn-primary'") + .append(" onclick=\"o_TableMultiActionEvent('").append(id).append("','olat_fosm');\"><span>") + .append(StringEscapeUtils.escapeHtml(translator.translate(choice.getSubmitKey()))).append("</span></button>"); //Reset button String resetKey = choice.getResetKey(); if (resetKey != null) { - target.append("<input type='submit' name='").append(Choice.RESET_IDENTIFICATION) - .append("' value=\"").append(StringEscapeUtils.escapeHtml(translator.translate(resetKey))) - .append("\" class='btn btn-default' />"); + target.append("<button type='button' class='btn btn-default'") + .append(" onclick=\"o_TableMultiActionEvent('").append(id).append("','").append(Choice.RESET_IDENTIFICATION).append("');\"><span>") + .append(StringEscapeUtils.escapeHtml(translator.translate(resetKey))).append("</span></button>"); } // Cancel button String cancelKey = choice.getCancelKey(); if (cancelKey != null) { - target.append("<input type='submit' name='").append(Choice.CANCEL_IDENTIFICATION) - .append("' value=\"").append(StringEscapeUtils.escapeHtml(translator.translate(cancelKey))) - .append("\" class='btn btn-default' />"); + target.append("<button type='button' class='btn btn-default'") + .append(" onclick=\"o_TableMultiActionEvent('").append(id).append("','").append(Choice.CANCEL_IDENTIFICATION).append("');\"><span>") + .append(StringEscapeUtils.escapeHtml(translator.translate(cancelKey))).append("</span></button>"); } target.append("</div></td></tr></table></form>"); } diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/Form.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/Form.java index 77aa3c97ced2aeb724f05c85419bf827494bb188..112a1ce6ad07c51f9a362cc87eabcc2c3d5be672 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/Form.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/Form.java @@ -166,7 +166,6 @@ public class Form extends LogDelegator { private boolean isValidAndSubmitted=true; private boolean isDirtyMarking=true; private boolean multipartEnabled = false; - private long multipartUploadMaxSizeKB = 0; // temporary form data, only valid within execution of evalFormRequest() private Map<String,String[]> requestParams = new HashMap<String,String[]>(); private Map<String, File> requestMultipartFiles = new HashMap<String,File>(); @@ -818,10 +817,8 @@ public class Form extends LogDelegator { removeListener(formBasicController); } - public void setMultipartEnabled(boolean multipartEnabled, long multipartUploadMaxSizeKB) { + public void setMultipartEnabled(boolean multipartEnabled) { this.multipartEnabled = multipartEnabled; - // Add upload size to already existing upload limit (two uploads are summed up) - this.multipartUploadMaxSizeKB += multipartUploadMaxSizeKB; } public boolean isMultipartEnabled() { diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormDecorator.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormDecorator.java index c94c11fa2abf58041678061e3c22598c427e258a..d57fee6f495a4907c428a303edf79e87db2fcf4f 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormDecorator.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormDecorator.java @@ -143,7 +143,7 @@ public class FormDecorator { public String ffXHREvent(String key, String value) { Form theForm = container.getRootForm(); String elementId = "o_fi" + container.getComponent().getDispatchID(); - return FormJSHelper.getXHRFnCallFor(theForm, elementId, 1, new NameValuePair(key, value)); + return FormJSHelper.getXHRFnCallFor(theForm, elementId, 1, true, true, new NameValuePair(key, value)); } public String getContainerCssClass() { diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormJSHelper.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormJSHelper.java index 51c8cd41a4d9e3933f07bb7fd31d8b0488f52d1a..456d391efc49c804b07a6ba28c8dacef22f3fc5c 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormJSHelper.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormJSHelper.java @@ -28,6 +28,7 @@ package org.olat.core.gui.components.form.flexible.impl; import java.util.Iterator; import java.util.Set; +import org.apache.commons.io.IOUtils; import org.json.JSONException; import org.json.JSONObject; import org.olat.core.gui.render.StringOutput; @@ -83,24 +84,35 @@ public class FormJSHelper { return content; } - public static String getXHRFnCallFor(Form form, String id, int actionIndex, NameValuePair... pairs) { - StringBuilder sb = new StringBuilder(128); + /** + * Build a flexi form event + * @param form + * @param id + * @param actionIndex + * @param dirtyCheck + * @param pushState + * @param pairs + * @return + */ + public static String getXHRFnCallFor(Form form, String id, int actionIndex, boolean dirtyCheck, boolean pushState, NameValuePair... pairs) { + StringOutput sb = new StringOutput(128); sb.append("o_ffXHREvent('") .append(form.getFormName()).append("','") .append(form.getDispatchFieldId()).append("','") .append(id).append("','") .append(form.getEventFieldId()).append("','") .append(FormEvent.ON_DOTDOTDOT[actionIndex]) - .append("'"); + .append("',").append(dirtyCheck) + .append(",").append(pushState).append(""); + if(pairs != null && pairs.length > 0) { for(NameValuePair pair:pairs) { - sb.append(",'") - .append(pair.getName()).append("','") - .append(pair.getValue()).append("'"); + sb.append(",'").append(pair.getName()).append("','").append(pair.getValue()).append("'"); } } sb.append(")"); + IOUtils.closeQuietly(sb); return sb.toString(); } @@ -177,10 +189,6 @@ public class FormJSHelper { return "})();\n /* ]]> */ \n</script>"; } - public static String getExtJSVarDeclaration(String id){ - return "var "+id+" = jQuery('#"+id+"'); "; - } - // Execute code within an anonymous function (closure) to not leak // variables to global scope (OLAT-5755) public static StringOutput appendFlexiFormDirty(StringOutput sb, Form form, String id) { @@ -196,11 +204,6 @@ public class FormJSHelper { .append("})();\n /* ]]> */ \n</script>"); return sb; } - - public static String getFocusFor(String id){ - // deactivated due OLAT-3094 and OLAT-3040 - return id +".focus();"; - } public static String getSetFlexiFormDirtyFnCallOnly(Form form){ if(form.isDirtyMarking()){ @@ -221,11 +224,11 @@ public class FormJSHelper { /* * yesFn emulates a click on the input field, which in turn "submits" to the inlineElement to extract the value */ - sb.append(FormJSHelper.getExtJSVarDeclaration(id)); - sb.append(id).append(".focus(1);");//defer focus,based on EXT - sb.append("var o_ff_inline_yesFn = function(e){"); - sb.append(FormJSHelper.getJSFnCallFor(rootForm, id, FormEvent.ONCLICK)).append(";};"); - sb.append("jQuery('#").append(id).append("').on('blur',o_ff_inline_yesFn);"); + sb.append("var ").append(id).append("=jQuery('#").append(id).append("');") + .append(id).append(".focus(1);")//defer focus + .append("var o_ff_inline_yesFn = function(e){") + .append(FormJSHelper.getJSFnCallFor(rootForm, id, FormEvent.ONCLICK)).append(";};") + .append("jQuery('#").append(id).append("').on('blur',o_ff_inline_yesFn);"); /* * noFn replaces the old value in the input field, and then "submits" to the inlineElement via yesFn @@ -239,28 +242,22 @@ public class FormJSHelper { .append(" }") .append("});"); } - + /** * submits a form when the enter key is pressed. - * TextAreas are handeled special and do not propagate the enter event to the outer world + * TextAreas are handled special and do not propagate the enter event to the outer world * @param formName * @return */ public static String submitOnKeypressEnter(String formName) { StringBuilder sb = new StringBuilder(); sb.append(getJSStart()) - .append("var myExtForm = jQuery('#").append(formName).append("');") - .append("if(myExtForm) {") - .append(" myExtForm.on('keypress', function(event) {if (13 == event.keyCode) {if (this.onsubmit()) {this.submit();}}}, myExtForm.dom);") - .append("} else {") - .append(" jQuery('#").append(formName).append("').each(function(formEl) {") - .append(" jQuery(formEl).on('keypress', function(event) {") - .append(" if (13 == event.keyCode) {") - .append(" if (this.onsubmit && this.onsubmit()) { this.submit(); }") - .append(" }") - .append(" }, formEl)") - .append(" });") - .append("}") + .append("jQuery('#").append(formName).append("').keypress(function(event) {\n") + .append(" if (13 == event.keyCode) {\n") + .append(" event.preventDefault();\n") + .append(" if (this.onsubmit()) { this.submit(); }\n") + .append(" }\n") + .append("});\n") .append(getJSEnd()); return sb.toString(); } diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormLayoutContainer.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormLayoutContainer.java index 6a64662f2c5324a3d11551869d4c9abe51479c97..690686952018f313238ee6e3d43ac66ef7a3d37f 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormLayoutContainer.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormLayoutContainer.java @@ -167,6 +167,7 @@ public class FormLayoutContainer extends FormItemImpl implements FormItemContain add(formComp.getName(), formComp); } + @Override public void add(String name, FormItem formComp) { if(!hasRootForm){ throw new AssertionError("first ensure that the layout container knows about its rootform!!"); @@ -198,11 +199,11 @@ public class FormLayoutContainer extends FormItemImpl implements FormItemContain // Check for multipart data, add upload limit to form if (formComp instanceof FormMultipartItem) { - FormMultipartItem mpItem = (FormMultipartItem) formComp; - getRootForm().setMultipartEnabled(true, mpItem.getMaxUploadSizeKB()); + getRootForm().setMultipartEnabled(true); } - } + + @Override public void add(String name, Collection<FormItem> foItems){ //remove if already in @@ -297,8 +298,7 @@ public class FormLayoutContainer extends FormItemImpl implements FormItemContain // Check for multipart data, add upload limit to form if (with instanceof FormMultipartItem) { - FormMultipartItem mpItem = (FormMultipartItem) with; - getRootForm().setMultipartEnabled(true, mpItem.getMaxUploadSizeKB()); + getRootForm().setMultipartEnabled(true); } } diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormWrapperContainerRenderer.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormWrapperContainerRenderer.java index b07c33c9d1776f441b8ab5dffd77f35987e5620f..e88951bbcd0c726c93c1720092729cbe3c582cf7 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormWrapperContainerRenderer.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/FormWrapperContainerRenderer.java @@ -102,18 +102,19 @@ class FormWrapperContainerRenderer implements ComponentRenderer { : AJAXFlags.MODE_NORMAL); sb.append("\" "); //check if ready to accept a new request - sb.append(" onsubmit=\"if(o_info.linkbusy) return false; else o_beforeserver(); return true;\" "); - if (iframePostEnabled) { - ubu.appendTarget(sb); + if(iframePostEnabled) { + sb.append(" onsubmit=\"o_XHRSubmit('").append(formC.getFormName()).append("');\" "); + } else { + sb.append(" onsubmit=\"if(o_info.linkbusy) return false; else o_beforeserver(); return true;\" "); } sb.append(">"); // hidden input field for dispatch uri - sb.append("<input type=\"hidden\" id=\""); - sb.append(formC.getDispatchFieldId()); - sb.append("\" name=\"dispatchuri\" value=\"").append(Form.FORM_UNDEFINED).append("\" />"); - sb.append("<input type=\"hidden\" id=\""); - sb.append(formC.getEventFieldId()); - sb.append("\" name=\"dispatchevent\" value=\"").append(Form.FORM_UNDEFINED).append("\" />"); + sb.append("<input type=\"hidden\" id=\"") + .append(formC.getDispatchFieldId()) + .append("\" name=\"dispatchuri\" value=\"").append(Form.FORM_UNDEFINED).append("\" />") + .append("<input type=\"hidden\" id=\"") + .append(formC.getEventFieldId()) + .append("\" name=\"dispatchevent\" value=\"").append(Form.FORM_UNDEFINED).append("\" />"); /* * FORM CONTAINER */ diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/NameValuePair.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/NameValuePair.java index 4327d06aa05f9f74dbf7d11d7cd0c0caf592c879..d1609349149136112e3dbc4f5603898d44e0d74f 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/NameValuePair.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/NameValuePair.java @@ -27,28 +27,27 @@ package org.olat.core.gui.components.form.flexible.impl; */ public class NameValuePair { - private String name; - private String value; + private final String name; + private final String value; public NameValuePair(String name, String value) { this.name = name; this.value = value; } + + public NameValuePair(String name, int value) { + this(name, Integer.toString(value)); + } + + public NameValuePair(String name, long value) { + this(name, Long.toString(value)); + } public String getName() { return name; } - public void setName(String name) { - this.name = name; - } - public String getValue() { return value; } - - public void setValue(String value) { - this.value = value; - } -} - +} \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/AbstractFlexiTableRenderer.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/AbstractFlexiTableRenderer.java index 7ce770e7885dd518a73fba03d3e5424ca00136f5..bb40a1d9ed63c382fa6a2fdccccf47a1cf1ac999 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/AbstractFlexiTableRenderer.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/AbstractFlexiTableRenderer.java @@ -227,7 +227,8 @@ public abstract class AbstractFlexiTableRenderer extends DefaultComponentRendere sb.append("<li class='divider'></li>"); } else { sb.append("<li><a href=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, new NameValuePair("filter", filter.getFilter()))) + .append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, + new NameValuePair("filter", filter.getFilter()))) .append("\">").append("<i class='o_icon o_icon_check o_icon-fw'> </i> ", filter.isSelected()); if(filter.getIconLeftCSS() != null) { sb.append("<i class='o_icon ").append(filter.getIconLeftCSS()).append("'> </i> "); @@ -261,7 +262,7 @@ public abstract class AbstractFlexiTableRenderer extends DefaultComponentRendere sb.append("<li class='divider'></li>"); } else { sb.append("<li><a href=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, + .append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, new NameValuePair("sort", sort.getSortKey().getKey()), new NameValuePair("asc", sort.getSortKey().isAsc() ? "desc" : "asc"))) .append("\">"); @@ -317,13 +318,13 @@ public abstract class AbstractFlexiTableRenderer extends DefaultComponentRendere sb.append("<label class='checkbox-inline'><a id='") .append(dispatchId).append("_sa' href=\"javascript:o_table_toggleCheck('").append(formName).append("', true);") - .append(FormJSHelper.getXHRFnCallFor(ftE.getRootForm(), dispatchId, 1, new NameValuePair("select", "checkall"))) + .append(FormJSHelper.getXHRFnCallFor(ftE.getRootForm(), dispatchId, 1, true, true, new NameValuePair("select", "checkall"))) .append("\"><i class='o_icon o_icon-lg o_icon_check_on'> </i> <span>").append(translator.translate("form.checkall")) .append("</span></a></label>"); sb.append("<label class='checkbox-inline'><a id='") .append(dispatchId).append("_dsa' href=\"javascript:o_table_toggleCheck('").append(formName).append("', false);") - .append(FormJSHelper.getXHRFnCallFor(ftE.getRootForm(), dispatchId, 1, new NameValuePair("select", "uncheckall"))) + .append(FormJSHelper.getXHRFnCallFor(ftE.getRootForm(), dispatchId, 1, true, true, new NameValuePair("select", "uncheckall"))) .append("\"><i class='o_icon o_icon-lg o_icon_check_off'> </i> <span>").append(translator.translate("form.uncheckall")) .append("</span></a></label>"); @@ -419,16 +420,16 @@ public abstract class AbstractFlexiTableRenderer extends DefaultComponentRendere int[] sizes = new int[]{ 20, 50, 100, 250 }; for(int size:sizes) { sb.append("<li><a href=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, + .append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, new NameValuePair("pagesize", Integer.toString(size)))) - .append("\" onclick=\"return o2cl();\">").append(Integer.toString(size)).append("</a></li>"); + .append("\">").append(Integer.toString(size)).append("</a></li>"); } if(ftE.isShowAllRowsEnabled()) { sb.append("<li><a href=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, + .append(FormJSHelper.getXHRFnCallFor(theForm, dispatchId, 1, true, true, new NameValuePair("pagesize", "all"))) - .append("\" onclick=\"return o2cl();\">").append(translator.translate("show.all")).append("</a></li>"); + .append("\">").append(translator.translate("show.all")).append("</a></li>"); } sb.append("</ul></div>") @@ -445,7 +446,8 @@ public abstract class AbstractFlexiTableRenderer extends DefaultComponentRendere sb.append("#"); } else { sb.append("javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, new NameValuePair("page", Integer.toString(page - 1)))); + .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, + new NameValuePair("page", Integer.toString(page - 1)))); } sb.append("\">").append("«").append("</a></li>"); } @@ -459,7 +461,8 @@ public abstract class AbstractFlexiTableRenderer extends DefaultComponentRendere sb.append("#"); } else { sb.append("javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, new NameValuePair("page", Integer.toString(page + 1)))); + .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, + new NameValuePair("page", Integer.toString(page + 1)))); } sb.append("\">").append("»").append("</li></a>"); } @@ -507,7 +510,8 @@ public abstract class AbstractFlexiTableRenderer extends DefaultComponentRendere FlexiTableElementImpl ftE = ftC.getFlexiTableElement(); Form theForm = ftE.getRootForm(); sb.append("<li").append(" class='active'", (page == i)).append("><a href=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, new NameValuePair("page", Integer.toString(i)))) + .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, + new NameValuePair("page", Integer.toString(i)))) .append("\">").append(i+1).append("</a></li>"); } diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableClassicRenderer.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableClassicRenderer.java index 819cfd493f7a728d1f44766eccc970787137f72b..94014c0c8850444da66863784fb6dad4e0530ac4 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableClassicRenderer.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/FlexiTableClassicRenderer.java @@ -101,16 +101,19 @@ class FlexiTableClassicRenderer extends AbstractFlexiTableRenderer implements Co Form theForm = ftE.getRootForm(); if(asc == null) { sb.append("<a class='o_orderby' href=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, new NameValuePair("sort", sortKey), new NameValuePair("asc", "asc"))) - .append("\" onclick=\"return o2cl();\">"); + .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, + new NameValuePair("sort", sortKey), new NameValuePair("asc", "asc"))) + .append("\">"); } else if(asc.booleanValue()) { sb.append("<a class='o_orderby o_orderby_asc' href=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, new NameValuePair("sort", sortKey), new NameValuePair("asc", "desc"))) - .append("\" onclick=\"return o2cl();\">"); + .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, + new NameValuePair("sort", sortKey), new NameValuePair("asc", "desc"))) + .append("\">"); } else { sb.append("<a class='o_orderby o_orderby_desc' href=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, new NameValuePair("sort", sortKey), new NameValuePair("asc", "asc"))) - .append("\" onclick=\"return o2cl();\">"); + .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, true, true, + new NameValuePair("sort", sortKey), new NameValuePair("asc", "asc"))) + .append("\">"); } sb.append(header).append("</a>"); } @@ -145,7 +148,7 @@ class FlexiTableClassicRenderer extends AbstractFlexiTableRenderer implements Co target.append("<td>") .append("<input type='checkbox' name='tb_ms' value='").append(rowIdPrefix).append(row).append("'") .append(" onclick=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, new NameValuePair("chkbox", Integer.toString(row)))) + .append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, false, false, new NameValuePair("chkbox", Integer.toString(row)))) .append("\""); if(ftE.isMultiSelectedIndex(row)) { target.append(" checked='checked'"); diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/StaticFlexiCellRenderer.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/StaticFlexiCellRenderer.java index d81f20d4c8bb480243891c1346e7960ff1750c16..2a12ce6264fa4f354d34f5a357de3e4d07ff5faa 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/StaticFlexiCellRenderer.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/table/StaticFlexiCellRenderer.java @@ -82,7 +82,7 @@ public class StaticFlexiCellRenderer implements FlexiCellRenderer { String id = source.getFormDispatchId(); Form rootForm = ftE.getRootForm(); NameValuePair pair = new NameValuePair(cellAction, Integer.toString(row)); - String jsCode = FormJSHelper.getXHRFnCallFor(rootForm, id, 1, pair); + String jsCode = FormJSHelper.getXHRFnCallFor(rootForm, id, 1, true, true, pair); target.append("<a href=\"javascript:").append(jsCode).append("\""); if(StringHelper.containsNonWhitespace(linkTitle)) { target.append(" title=\"").append(StringEscapeUtils.escapeHtml(linkTitle)).append("\""); @@ -90,7 +90,7 @@ public class StaticFlexiCellRenderer implements FlexiCellRenderer { if(StringHelper.containsNonWhitespace(linkCSS)) { target.append(" class=\"").append(linkCSS).append("\""); } - target.append(" onclick=\"return o2cl();\">"); + target.append(">"); if(StringHelper.containsNonWhitespace(iconCSS)) { target.append("<i class=\"o_icon ").append(iconCSS).append("\"> </i>"); } diff --git a/src/main/java/org/olat/core/gui/components/link/Link.java b/src/main/java/org/olat/core/gui/components/link/Link.java index a7fd51b163bc88f23279e6e824a3f6512c3525f3..ea28e8149fee48f3518964317c0e6bac5aa3c82f 100644 --- a/src/main/java/org/olat/core/gui/components/link/Link.java +++ b/src/main/java/org/olat/core/gui/components/link/Link.java @@ -89,7 +89,6 @@ public class Link extends AbstractComponent { private String iconLeftCSS; private String iconRightCSS; private String target; - private String modURI; private Object internalAttachedObj; private Object userObject; private String accessKey; @@ -104,7 +103,7 @@ public class Link extends AbstractComponent { private boolean hasTooltip; private boolean suppressDirtyFormWarning = false; - private boolean isDownloadLink = false; + private Badge badge; private LinkPopupSettings popup; @@ -315,19 +314,12 @@ public class Link extends AbstractComponent { * @see org.olat.core.gui.components.Component#setEnabled(boolean) * @param true or false */ + @Override public void setEnabled(boolean b){ super.setEnabled(b); setDirty(true); } - public String getModURI() { - return modURI; - } - - public void setModURI(String modURI) { - this.modURI = modURI; - } - protected String getTextReasonForDisabling() { return textReasonForDisabling; } @@ -584,16 +576,6 @@ public class Link extends AbstractComponent { setDirty(true); } - /** - * - */ - void setStartsDownload() { - isDownloadLink = true; - } - boolean getStartsDownload(){ - return isDownloadLink; - } - /** * @param iconCSS The CSS classes used as icons in the i element on the left hand side of the link text */ diff --git a/src/main/java/org/olat/core/gui/components/link/LinkFactory.java b/src/main/java/org/olat/core/gui/components/link/LinkFactory.java index c8f0a821068c0666020b104b5784e8a53ce3b9b2..adc32df324f2bfc69c1756e834aafe7cc8435079 100644 --- a/src/main/java/org/olat/core/gui/components/link/LinkFactory.java +++ b/src/main/java/org/olat/core/gui/components/link/LinkFactory.java @@ -267,19 +267,4 @@ public class LinkFactory { public static Link createButtonXSmall(String name, VelocityContainer vc, ComponentEventListener listener){ return new Link(name, name, name, Link.BUTTON_XSMALL, vc, listener); } - - /** - * @param link the Link to be deajaxified - * @return the given Link changed so that it renders its url always in standard mode even if ajax-mode is on - */ - public static Link deAjaxify(Link link) { - link.setAjaxEnabled(false); - return link; - } - - public static Link markDownloadLink(Link link){ - link.setStartsDownload(); - return link; - } - } diff --git a/src/main/java/org/olat/core/gui/components/link/LinkRenderer.java b/src/main/java/org/olat/core/gui/components/link/LinkRenderer.java index a89e66fb29c1677079a3664a6251212161054881..e99cf0e43c8bf0ad5ebe7aaf19430e0970fa9d01 100644 --- a/src/main/java/org/olat/core/gui/components/link/LinkRenderer.java +++ b/src/main/java/org/olat/core/gui/components/link/LinkRenderer.java @@ -34,6 +34,7 @@ import org.olat.core.gui.components.Component; import org.olat.core.gui.components.DefaultComponentRenderer; import org.olat.core.gui.components.form.flexible.impl.Form; import org.olat.core.gui.components.form.flexible.impl.FormJSHelper; +import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.winmgr.AJAXFlags; import org.olat.core.gui.render.RenderResult; @@ -49,8 +50,8 @@ import org.olat.core.util.StringHelper; * */ public class LinkRenderer extends DefaultComponentRenderer { - private static Pattern singleQuote = Pattern.compile("\'"); - private static Pattern doubleQutoe = Pattern.compile("\""); + private static final Pattern singleQuote = Pattern.compile("\'"); + private static final Pattern doubleQutoe = Pattern.compile("\""); @Override public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, @@ -114,13 +115,7 @@ public class LinkRenderer extends DefaultComponentRenderer { if (link.isEnabled()) { // only set a target on an enabled link, target in span makes no sense if (link.getTarget() != null){ - cssSb.append(" target=\""+ link.getTarget() +"\""); - } else if (iframePostEnabled && link.isEnabled() && !flexiformlink) { - //flexi form link is excluded because the form post goes to the - //iframe - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - cssSb.append(so.toString()); + cssSb.append(" target=\"").append(link.getTarget()).append("\""); } } @@ -134,10 +129,7 @@ public class LinkRenderer extends DefaultComponentRenderer { extJsSb.append(" <script type=\"text/javascript\">\n/* <![CDATA[ */\n"); // Execute code within an anonymous function (closure) to not leak // variables to global scope (OLAT-5755) - extJsSb.append("(function(){"); - extJsSb.append("var "); - extJsSb.append(elementId); - extJsSb.append(" = jQuery('#").append(elementId).append("');"); + extJsSb.append("(function(){ var ").append(elementId).append(" = jQuery('#").append(elementId).append("');"); boolean hasExtJsSb = false; boolean inForm = isInForm(args); @@ -146,19 +138,20 @@ public class LinkRenderer extends DefaultComponentRenderer { String title = link.getTitle(); String customDisplayText = link.getCustomDisplayText(); - // a form link can not have tooltips at the moment // tooltip sets its own id into the <a> tag. if (link.isEnabled()) { - sb.append("<p class='form-control-static'>", inForm).append("<a "); - // add layouting - sb.append(cssSb); + sb.append("<p class='form-control-static'>", inForm) + .append("<a ") + // add layouting + .append(cssSb); //REVIEW:pb elementId is not null if it is a form link //the javascript handler and the link.registerForMousePositionEvent //need also access to a created and id set. -> avoid "o_c"+link.getDispatchID() - // FIXME:pb:a refactor for 5.3 - if (elementId != null) sb.append(" id=\"").append(elementId).append("\" "); + if (elementId != null) { + sb.append(" id=\"").append(elementId).append("\" "); + } String accessKey = link.getAccessKey(); if (accessKey != null) { @@ -168,22 +161,19 @@ public class LinkRenderer extends DefaultComponentRenderer { //no target if flexi form link! because target is set on //post action of form Form theForm = (Form)link.getInternalAttachedObject(); - sb.append("href=\"javascript:"); - sb.append(FormJSHelper.getJSFnCallFor(theForm, elementId, 1)); - sb.append("\" "); + sb.append("href=\"javascript:") + .append(FormJSHelper.getJSFnCallFor(theForm, elementId, 1)) + .append("\" "); } else if(link.isPopup()) { StringOutput href = new StringOutput(); LinkPopupSettings popup = link.getPopup(); - ubu.buildURI(href, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command }, - link.getModURI(), AJAXFlags.MODE_NORMAL); - sb.append("href=\"#\" onclick=\"o_openPopUp('").append(href).append("','") + ubu.buildURI(href, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command }, null, AJAXFlags.MODE_NORMAL); + sb.append("href=\"javascript:;\" onclick=\"o_openPopUp('").append(href).append("','") .append(popup.getTarget()).append("',").append(popup.getWidth()) .append(",").append(popup.getHeight()).append("); return false;\" "); } else { - sb.append("href=\""); - ubu.buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command }, - link.getModURI(), iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("\""); + ubu.buildHrefAndOnclick(sb, null, iframePostEnabled, link.isSuppressDirtyFormWarning(), true, + new NameValuePair(VelocityContainer.COMMAND_ID, command)); } //tooltips @@ -204,23 +194,10 @@ public class LinkRenderer extends DefaultComponentRenderer { } else { text = translator.translate(title); } - //text = StringEscapeUtils.escapeJavaScript(text); sb.append(" title=\"").append(StringEscapeUtils.escapeHtml(text)).append("\""); - //extJsSb.append(elementId).append(".tooltip({ html:true, container:'body', title:function(){ return \"").append(text).append("\";}});"); - //hasExtJsSb = true; } } - - if (/* !link.isEnabledForLongTransaction && */!flexiformlink && (!link.isPopup() || link.getTarget() != null)) { - // clash with onclick ... FIXME:pb/as find better solution to solve this - // problem. - String clickCmd = (link.isSuppressDirtyFormWarning() ? "o2c=0;return o2cl();" : "return o2cl();"); - // only catch click event - modern browser fire click event even - // when event was triggered by keyboard - sb.append(" onclick=\"").append(clickCmd).append("\">"); - } else { - sb.append(">"); - } + sb.append(">"); // CSS icon if (link.getIconLeftCSS() != null) { @@ -322,27 +299,18 @@ public class LinkRenderer extends DefaultComponentRenderer { sb.append("</a>"); } - if(link.getStartsDownload() || link.getTarget() != null){ - //if the link starts a download -> the o_afterserver is not called in - //non-ajax mode if a download is started. - //on click execute the "same" javascript as in o_ainvoke(r,true) for - //case 3: - hasExtJsSb = true; - extJsSb.append("if (").append(elementId).append(") ") - .append(elementId).append(".click(function() {setTimeout(removeBusyAfterDownload,1200)});"); - } - + //disabled or not, all tags should be closed here //now append all gathered javascript stuff if any if(hasExtJsSb){ // Execute anonymous function (closure) now (OLAT-5755) - extJsSb.append("})();"); - extJsSb.append("\n/* ]]> */\n</script>"); + extJsSb.append("})();") + .append("\n/* ]]> */\n</script>"); sb.append(extJsSb); } } - private boolean isInForm(String[] args) { + private final boolean isInForm(String[] args) { boolean embedded = false; if(args != null && args.length > 0) { for(String arg:args) { diff --git a/src/main/java/org/olat/core/gui/components/rating/RatingRenderer.java b/src/main/java/org/olat/core/gui/components/rating/RatingRenderer.java index 6e2aa3265e44fca66f95f420d6abc6491feef599..f39b974ca77c6fb38b404493ce76956019887720 100644 --- a/src/main/java/org/olat/core/gui/components/rating/RatingRenderer.java +++ b/src/main/java/org/olat/core/gui/components/rating/RatingRenderer.java @@ -29,7 +29,6 @@ import org.olat.core.gui.components.form.flexible.impl.Form; import org.olat.core.gui.components.form.flexible.impl.FormJSHelper; import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.components.velocity.VelocityContainer; -import org.olat.core.gui.control.winmgr.AJAXFlags; import org.olat.core.gui.render.RenderResult; import org.olat.core.gui.render.Renderer; import org.olat.core.gui.render.StringOutput; @@ -100,25 +99,17 @@ public class RatingRenderer extends DefaultComponentRenderer { if (rating.isAllowUserInput() && rating.isEnabled()) { if(rating.getForm() == null) { // Add link - sb.append(" href=\""); - ubu.buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { (i+1) +"" }, - ajaxModeEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("\""); - // add link target - if (ajaxModeEnabled) { - ubu.appendTarget(sb); - } - // add check for olat busy - sb.append(" onclick=\"return o2cl()\" onkeypress=\"return o2cl()\""); + sb.append(" "); + ubu.buildHrefAndOnclick(sb, ajaxModeEnabled, + new NameValuePair(VelocityContainer.COMMAND_ID, Integer.toString(i+1))); } else { Form theForm = rating.getForm(); String elementId = FormBaseComponentIdProvider.DISPPREFIX + rating.getDispatchID(); sb.append(" href=\"javascript:") - .append(FormJSHelper.getXHRFnCallFor(theForm, elementId, 1, + .append(FormJSHelper.getXHRFnCallFor(theForm, elementId, 1, true, false, new NameValuePair(VelocityContainer.COMMAND_ID, Integer.toString(i+1)))) - .append("\" onclick=\"return o2cl();\" "); + .append("\" "); } - } else { // Disabled link sb.append(" href='javascript:;' onclick='return false;'"); diff --git a/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneRenderer.java b/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneRenderer.java index a665420d6008f94b56845d4afa1183284bc37652..824bb158adc6d0f66bfbec17e64cd8000ac2c422 100644 --- a/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneRenderer.java +++ b/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneRenderer.java @@ -29,7 +29,7 @@ package org.olat.core.gui.components.tabbedpane; import org.apache.commons.lang.StringEscapeUtils; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.ComponentRenderer; -import org.olat.core.gui.control.winmgr.AJAXFlags; +import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.render.RenderResult; import org.olat.core.gui.render.Renderer; import org.olat.core.gui.render.RenderingState; @@ -69,14 +69,9 @@ public class TabbedPaneRenderer implements ComponentRenderer { sb.append("<li"); if (i != selPane && cnt > 1) { if (tb.isEnabled(i)) { - sb.append("><a href='"); - ubu.buildURI(sb, new String[]{ TabbedPane.PARAM_PANE_ID }, new String[]{ String.valueOf(i) }, iframePostEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("' onclick='return o2cl()'"); - if (iframePostEnabled) { - ubu.appendTarget(sb); - } - sb.append(">").append(tabName).append("</a></li>"); - + sb.append("><a "); + ubu.buildHrefAndOnclick(sb, iframePostEnabled, new NameValuePair(TabbedPane.PARAM_PANE_ID, String.valueOf(i))); + sb.append(">").append(tabName).append("</a></li>"); } else { // disabled panels can not be clicked, but for layout reason needs still a a href sb.append(" class='disabled'><a href='javascript:;' title='").append(StringEscapeUtils.escapeHtml(translator.translate("disabled"))).append("'>").append(tabName).append("</a></li>"); diff --git a/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneScreenreaderRenderer.java b/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneScreenreaderRenderer.java deleted file mode 100644 index 08b574d914fcdd6bc671aba944d60880112425d2..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneScreenreaderRenderer.java +++ /dev/null @@ -1,123 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <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 -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <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> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -* <p> -*/ - -package org.olat.core.gui.components.tabbedpane; - -import org.olat.core.gui.components.Component; -import org.olat.core.gui.components.ComponentRenderer; -import org.olat.core.gui.control.winmgr.AJAXFlags; -import org.olat.core.gui.render.RenderResult; -import org.olat.core.gui.render.Renderer; -import org.olat.core.gui.render.RenderingState; -import org.olat.core.gui.render.StringOutput; -import org.olat.core.gui.render.URLBuilder; -import org.olat.core.gui.translator.Translator; - -/** - * Description:<br> - * @author Felix Jost - */ -public class TabbedPaneScreenreaderRenderer implements ComponentRenderer { -/** - * - * - */ - public TabbedPaneScreenreaderRenderer() { - // - } - - /** - * - * @see org.olat.core.gui.render.ui.ComponentRenderer#render(org.olat.core.gui.render.Renderer, org.olat.core.gui.render.StringOutput, org.olat.core.gui.components.Component, org.olat.core.gui.render.URLBuilder, org.olat.core.gui.translator.Translator, org.olat.core.gui.render.RenderResult, java.lang.String[]) - */ - public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) { - TabbedPane tb = (TabbedPane)source; - int cnt = tb.getTabCount(); - if (cnt == 0) return; // nothing to render - // (cnt > 0) render tabs - int selPane = tb.getSelectedPane(); - boolean iframePostEnabled = renderer.getGlobalSettings().getAjaxFlags().isIframePostEnabled(); - - // add overview info for screenreader - Translator comptrans = tb.getCompTrans(); - sb.append(comptrans.translate("sr.intro", new String[] {String.valueOf(cnt)})); - for (int i = 0; i < cnt; i++) { - String tabName = tb.getDisplayNameAt(i); - if (!tb.isEnabled(i)) { - // if a pane is not enabled - sb.append(comptrans.translate("sr.tab.notenabled", new String[] {tabName})); - } else if (i == selPane) { - // mark active pane - sb.append(comptrans.translate("sr.tab.active", new String[] {tabName})); - } else { - // normal, enabled, but not active pane - sb.append("<a href=\""); - ubu.buildURI(sb, new String[]{ TabbedPane.PARAM_PANE_ID }, new String[]{ String.valueOf(i) }, iframePostEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - sb.append("\" onclick=\"return o2cl()\""); - if (iframePostEnabled) { - ubu.appendTarget(sb); - } - sb.append(">"); - sb.append(comptrans.translate("sr.tab.normal", new String[] {tabName})); - sb.append("</a>"); - } - } - sb.append(comptrans.translate("sr.introcontent")); - // now let the selected component render itself - Component paneToRender = tb.getTabAt(selPane); - if (paneToRender == null) throw new RuntimeException("a tabbed pane must not be null, but a component"); - renderer.render(sb, paneToRender, null); - } - /** - * - * @see org.olat.core.gui.render.ui.ComponentRenderer#renderHeaderIncludes(org.olat.core.gui.render.Renderer, org.olat.core.gui.render.StringOutput, org.olat.core.gui.components.Component, org.olat.core.gui.render.URLBuilder, org.olat.core.gui.translator.Translator) - */ - public void renderHeaderIncludes(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderingState rstate) { - TabbedPane tp = (TabbedPane)source; - int cnt = tp.getTabCount(); - if (cnt > 0) { - Component toRender = tp.getTabAt(tp.getSelectedPane()); - // delegate header rendering to the selected pane - renderer.renderHeaderIncludes(sb, toRender, rstate); - } - } - - /** - * - * @see org.olat.core.gui.render.ui.ComponentRenderer#renderBodyOnLoadJSFunctionCall(org.olat.core.gui.render.Renderer, org.olat.core.gui.render.StringOutput, org.olat.core.gui.components.Component) - */ - public void renderBodyOnLoadJSFunctionCall(Renderer renderer, StringOutput sb, Component source, RenderingState rstate) { - TabbedPane tp = (TabbedPane)source; - int cnt = tp.getTabCount(); - if (cnt > 0) { - Component toRender = tp.getTabAt(tp.getSelectedPane()); - // delegate js rendering to the selected pane - renderer.renderBodyOnLoadJSFunctionCall(sb, toRender, rstate); - } - } - - -} diff --git a/src/main/java/org/olat/core/gui/components/table/ColumnDescriptor.java b/src/main/java/org/olat/core/gui/components/table/ColumnDescriptor.java index cf56e54c1c40e84fd59de9257859cb4e5698c15e..a8d1b162accdb642a960af9738c225992a60c624 100644 --- a/src/main/java/org/olat/core/gui/components/table/ColumnDescriptor.java +++ b/src/main/java/org/olat/core/gui/components/table/ColumnDescriptor.java @@ -142,11 +142,4 @@ public interface ColumnDescriptor { */ String getPopUpWindowAttributes(); - /** - * @param h - */ - void setHrefGenerator(HrefGenerator h); - - HrefGenerator getHrefGenerator(); - } \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/components/table/DefaultColumnDescriptor.java b/src/main/java/org/olat/core/gui/components/table/DefaultColumnDescriptor.java index d805d97dd733a57fe0a687f6b9ea73ee000ad6f6..763fa840db7e05e55f308961e445f716c5675b15 100644 --- a/src/main/java/org/olat/core/gui/components/table/DefaultColumnDescriptor.java +++ b/src/main/java/org/olat/core/gui/components/table/DefaultColumnDescriptor.java @@ -53,7 +53,6 @@ public class DefaultColumnDescriptor implements ColumnDescriptor { private int alignment; private boolean popUpWindowAction; private String popUpWindowAttributes; - private HrefGenerator hrefGenerator; //protected to allow overriding of compare method protected Locale locale; protected Collator collator; @@ -336,19 +335,4 @@ public class DefaultColumnDescriptor implements ColumnDescriptor { this.popUpWindowAction = popUpWindowAction; this.popUpWindowAttributes = popUpWindowAttributes; } - - /** - * @return Returns the hrefGenerator. - */ - public HrefGenerator getHrefGenerator() { - return hrefGenerator; - } - - /** - * @param hrefGenerator The hrefGenerator to set. - */ - public void setHrefGenerator(final HrefGenerator hrefGenerator) { - this.hrefGenerator = hrefGenerator; - } - } diff --git a/src/main/java/org/olat/core/gui/components/table/HrefGenerator.java b/src/main/java/org/olat/core/gui/components/table/HrefGenerator.java deleted file mode 100644 index ba207176e270b58adc3f435165b8d726c79fa5fc..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/core/gui/components/table/HrefGenerator.java +++ /dev/null @@ -1,41 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <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 -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <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> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -* <p> -*/ - -package org.olat.core.gui.components.table; - -/** - * @deprecated Needs new concept. Does not play well with Table using form.submit(). - */ -public interface HrefGenerator { - /** - * @deprecated FIXME:fj:b a new concept is needed here, since it is too generic to conform to e.g. urlbuilding (any javascript can be inserted here) - * @param row - * @param href - * @return - */ - String generate(int row, String href); - -} diff --git a/src/main/java/org/olat/core/gui/components/table/MultiSelectColumnDescriptor.java b/src/main/java/org/olat/core/gui/components/table/MultiSelectColumnDescriptor.java index d70d6663428b4dc27dc74fc3bf87e13d40b662f6..fd7cee3aea66eabfabc63e726192fd5404efe5a3 100644 --- a/src/main/java/org/olat/core/gui/components/table/MultiSelectColumnDescriptor.java +++ b/src/main/java/org/olat/core/gui/components/table/MultiSelectColumnDescriptor.java @@ -29,7 +29,6 @@ package org.olat.core.gui.components.table; import org.olat.core.gui.render.Renderer; import org.olat.core.gui.render.StringOutput; import org.olat.core.gui.translator.Translator; -import org.olat.core.logging.AssertException; class MultiSelectColumnDescriptor implements ColumnDescriptor { @@ -135,10 +134,6 @@ class MultiSelectColumnDescriptor implements ColumnDescriptor { return null; } - public HrefGenerator getHrefGenerator() { - return null; - } - public String getPopUpWindowAttributes() { return null; } @@ -159,10 +154,6 @@ class MultiSelectColumnDescriptor implements ColumnDescriptor { // nothing to do here } - public void setHrefGenerator(final HrefGenerator h) { - throw new AssertException("Not allowed to set HrefGenerator on MultiSelectColumn."); - } - public void setTable(final Table table) { this.table = table; } diff --git a/src/main/java/org/olat/core/gui/components/table/StaticColumnDescriptor.java b/src/main/java/org/olat/core/gui/components/table/StaticColumnDescriptor.java index b93e5ac12833e659224627bbd54db888e07ba9aa..8f0409534655d82c685cda4697a5ae20f231aaf6 100644 --- a/src/main/java/org/olat/core/gui/components/table/StaticColumnDescriptor.java +++ b/src/main/java/org/olat/core/gui/components/table/StaticColumnDescriptor.java @@ -45,7 +45,6 @@ public class StaticColumnDescriptor implements ColumnDescriptor { private String cellValue; private boolean popUpWindowAction; private String popUpWindowAttributes; - private HrefGenerator hrefGenerator; private boolean translateHeaderKey = true; /** @@ -188,18 +187,9 @@ public class StaticColumnDescriptor implements ColumnDescriptor { this.popUpWindowAttributes = popUpWindowAttributes; } - public void setHrefGenerator(final HrefGenerator h) { - this.hrefGenerator = h; - } - - public HrefGenerator getHrefGenerator() { - return hrefGenerator; - } - public String toString(final int rowid) { StringOutput sb = new StringOutput(); renderValue(sb,rowid,null); return sb.toString(); } - } \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/components/table/Table.java b/src/main/java/org/olat/core/gui/components/table/Table.java index 0557864fea934901b5407461bc724966bb9b17aa..3c001873b4917be4b8ca61e38bea4c958d7b1845 100644 --- a/src/main/java/org/olat/core/gui/components/table/Table.java +++ b/src/main/java/org/olat/core/gui/components/table/Table.java @@ -55,6 +55,7 @@ import org.olat.core.util.filter.FilterFactory; * @author Felix Jost */ public class Table extends AbstractComponent { + private static final int NO_ROW_SELECTED = -1; private static final int DEFAULT_RESULTS_PER_PAGE = 20; private static final int INITIAL_COLUMNSIZE = 5; @@ -74,14 +75,14 @@ public class Table extends AbstractComponent { /** * Comment for <code>COMMAND_ROWACTION_CLICKED_ROWID</code> */ - protected static final String COMMANDLINK_ROWACTION_ID = "p"; + public static final String COMMANDLINK_ROWACTION_ID = "p"; // The following commands will be submitted via hidden form parameters. // The commands are internal to the table and affect functionality such as sorting and pageing. // The two ids formCmd and formParam are the hidden fields used by the form to submit the relevant actions. - private static final String FORM_CMD = "cmd"; - private static final String FORM_PARAM = "param"; + protected static final String FORM_CMD = "cmd"; + protected static final String FORM_PARAM = "param"; /** * Comment for <code>COMMAND_SORTBYCOLUMN</code> @@ -311,123 +312,101 @@ public class Table extends AbstractComponent { /** * @see org.olat.core.gui.components.Component#dispatchRequest(org.olat.core.gui.UserRequest) */ + @Override protected void doDispatchRequest(final UserRequest ureq) { String formCmd = ureq.getParameter(FORM_CMD); String formParam = ureq.getParameter(FORM_PARAM); String rowAction = ureq.getParameter(COMMANDLINK_ROWACTION_CLICKED); + String multiAction = ureq.getParameter("multi_action_identifier"); - // translate from ureq param, replay can then reuse code - int cmd = -1; - String value1 = formParam; - String value2 = null; - if (formCmd != null && formCmd.length() > 0) { // this is an internal command submitted by a form-submit() // first update the multiselect state updateMultiSelectState(ureq); // then fetch the internal command to be processed if (formCmd.equals(COMMAND_SORTBYCOLUMN)) { - cmd = TableReplayableEvent.SORT; + doSort(ureq, formParam); } else if (formCmd.equals(COMMAND_PAGEACTION)) { - cmd = TableReplayableEvent.PAGE_ACTION; + doAction(ureq, formParam); } } else if (rowAction != null) { // this is a row action clicked by the user. no form is submitted, so we don't evaluate any columns. - cmd = TableReplayableEvent.ROW_ACTION; - value1 = rowAction; - value2 = ureq.getParameter(COMMANDLINK_ROWACTION_ID); + + String actionId = ureq.getParameter(COMMANDLINK_ROWACTION_ID); // sanity check - int rowid = Integer.parseInt(value1); + int rowid = Integer.parseInt(rowAction); int actualrows = getTableDataModel().getRowCount(); if (rowid < 0 || rowid >= actualrows){ setDirty(true); return; } - } else { + + selectedRowId = rowid; + //setDirty(true); commented as timestamp was consumed in AJAX mode: see OLAT-2007 + // create and add replay event + fireEvent(ureq, new TableEvent(COMMANDLINK_ROWACTION_CLICKED, selectedRowId, actionId)); + } else if(StringHelper.containsNonWhitespace(multiAction)) { // check for multiselect actions for (TableMultiSelect action: multiSelectActions) { String actionIdentifier = action.getAction(); - if (ureq.getParameter(actionIdentifier) != null) { + if (multiAction.equals(actionIdentifier)) { // get the multiselect command - cmd = TableReplayableEvent.MULTISELECT_ACTION; - value1 = actionIdentifier; // update multiselect state updateMultiSelectState(ureq); + + setDirty(true); + fireEvent(ureq, new TableMultiSelectEvent(COMMAND_MULTISELECT, actionIdentifier, getMultiSelectSelectedRows())); break; } } } - dispatchRequest(ureq, cmd, value1, value2); } + + private void doSort(UserRequest ureq, String value) { + // if sorting command, resort + int oldSortColumn = sortColumn; + sortColumn = Integer.parseInt(value); + if (oldSortColumn == sortColumn) { // click the same column again, change + // sort order + sortAscending = !sortAscending; + } else { // new column, always sort ascending first + sortAscending = true; + } - /** - * @param ureq - * @param theCmd - * @param theValue - */ - private void dispatchRequest(final UserRequest ureq, final int cmd, final String value1, final String value2) { - if (cmd == TableReplayableEvent.SORT) { - // if sorting command, resort - int oldSortColumn = sortColumn; - sortColumn = Integer.parseInt(value1); - if (oldSortColumn == sortColumn) { // click the same column again, change - // sort order - sortAscending = !sortAscending; - } else { // new column, always sort ascending first - sortAscending = true; - } - + setDirty(true); + resort(); + fireEvent(ureq, new TableEvent(COMMAND_SORTBYCOLUMN, -1, COMMAND_SORTBYCOLUMN)); + } + + private void doAction(UserRequest ureq, String value) { + if (value.equals(COMMAND_PAGEACTION_SHOWALL)) { + //updatePageing(null); (see OLAT-1340) + setShowAllSelected(true); + fireEvent(ureq, new Event(COMMAND_PAGEACTION_SHOWALL)); setDirty(true); - resort(); - - fireEvent(ureq, new TableEvent(COMMAND_SORTBYCOLUMN, -1, COMMAND_SORTBYCOLUMN)); - } else if (cmd == TableReplayableEvent.PAGE_ACTION) { - - if (value1.equals(COMMAND_PAGEACTION_SHOWALL)) { - //updatePageing(null); (see OLAT-1340) - setShowAllSelected(true); - fireEvent(ureq, new Event(COMMAND_PAGEACTION_SHOWALL)); + } else if (value.equals(COMMAND_PAGEACTION_FORWARD)) { + if (currentPageId != null) { + updatePageing(Integer.valueOf(currentPageId.intValue() + 1)); setDirty(true); - } else if (value1.equals(COMMAND_PAGEACTION_FORWARD)) { - if (currentPageId != null) { - updatePageing(Integer.valueOf(currentPageId.intValue() + 1)); - setDirty(true); - } - } else if (value1.equals(COMMAND_PAGEACTION_BACKWARD)) { - if (currentPageId != null) { - updatePageing(Integer.valueOf(currentPageId.intValue() - 1)); - setDirty(true); - } - } else if (value1.equals(COMMAND_SHOW_PAGES)) { - setShowAllSelected(false); - fireEvent(ureq, new Event(COMMAND_SHOW_PAGES)); - if (currentPageId != null) { - updatePageing(Integer.valueOf(currentPageId.intValue())); - }else { - updatePageing(Integer.valueOf(1)); - } - setDirty(true); - } else { - updatePageing(Integer.valueOf(value1)); + } + } else if (value.equals(COMMAND_PAGEACTION_BACKWARD)) { + if (currentPageId != null) { + updatePageing(Integer.valueOf(currentPageId.intValue() - 1)); setDirty(true); + } + } else if (value.equals(COMMAND_SHOW_PAGES)) { + setShowAllSelected(false); + fireEvent(ureq, new Event(COMMAND_SHOW_PAGES)); + if (currentPageId != null) { + updatePageing(Integer.valueOf(currentPageId.intValue())); + }else { + updatePageing(Integer.valueOf(1)); } - - } else if (cmd == TableReplayableEvent.ROW_ACTION) { - selectedRowId = Integer.parseInt(value1); - String actionId = value2; - - - //setDirty(true); commented as timestamp was consumed in AJAX mode: see OLAT-2007 - // create and add replay event - fireEvent(ureq, new TableEvent(COMMANDLINK_ROWACTION_CLICKED, selectedRowId, actionId)); - return; - } else if (cmd == TableReplayableEvent.MULTISELECT_ACTION) { - + setDirty(true); + } else { + updatePageing(Integer.valueOf(value)); setDirty(true); - fireEvent(ureq, new TableMultiSelectEvent(COMMAND_MULTISELECT, value1, getMultiSelectSelectedRows())); } - - } /** diff --git a/src/main/java/org/olat/core/gui/components/table/TableRenderer.java b/src/main/java/org/olat/core/gui/components/table/TableRenderer.java index c321e4fb9c4e439a0dfbff64c92c80e858780c4d..89367ce3e381fa3df20ec3f13e916a294733b83b 100644 --- a/src/main/java/org/olat/core/gui/components/table/TableRenderer.java +++ b/src/main/java/org/olat/core/gui/components/table/TableRenderer.java @@ -31,6 +31,7 @@ import java.util.List; import org.apache.commons.lang.StringEscapeUtils; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.DefaultComponentRenderer; +import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.control.winmgr.AJAXFlags; import org.olat.core.gui.render.RenderResult; import org.olat.core.gui.render.Renderer; @@ -48,15 +49,8 @@ import org.olat.core.logging.Tracing; */ public class TableRenderer extends DefaultComponentRenderer { - private static final String CLOSE_HTML_BRACE = "\">"; - private static final String CLOSE_DIV = "</div>"; - private static final String A_CLASS = "<a class=\""; - private static final String HREF_JAVA_SCRIPT_TABLE_FORM_INJECT_COMMAND_AND_SUBMIT = "\" href=\"JavaScript:tableFormInjectCommandAndSubmit('"; - private static final String CLOSE_HREF = "</a>"; - private static final String CLOSE_AND_O2CLICK = "');\" onclick=\"return o2cl();\">"; - private static final String SINGLE_COMMA_SINGLE = "', '"; - private static final String A_HREF = "<a href=\""; protected static final String TABLE_MULTISELECT_GROUP = "tb_ms"; + private static final OLog log = Tracing.createLoggerFor(TableRenderer.class); /** @@ -105,18 +99,16 @@ public class TableRenderer extends DefaultComponentRenderer { target.append("<div class=\"o_table_wrapper\" id=\"o_table_wrapper_").append(table.hashCode()).append("\">") .append("<table id=\"o_table").append(table.hashCode()).append("\" class=\"o_table table table-striped table-condensed table-hover") .append(" table-bordered", table.isDisplayTableGrid()) - .append(CLOSE_HTML_BRACE); - appendHeaderLinks(target, translator, table, formName, cols); + .append("\">"); + appendHeaderLinks(target, translator, table, cols, iframePostEnabled, ubu); appendDataRows(renderer, target, ubu, table, iframePostEnabled, cols, selRowUnSelectable, selRowId, startRowId, endRowId); target.append("</table><div class='o_table_footer'>"); - appendSelectDeselectAllButtons(target, translator, table, formName, rows, resultsPerPage); - appendTablePageing(target, translator, table, formName, rows, resultsPerPage, currentPageId, usePageing); - appendMultiselectFormActions(target, translator, table); - target.append("</div></div>"); + appendSelectDeselectAllButtons(target, translator, table, formName, rows, resultsPerPage, iframePostEnabled, ubu); + appendTablePageing(target, translator, table, rows, resultsPerPage, currentPageId, usePageing, iframePostEnabled, ubu); + appendMultiselectFormActions(target, formName, translator, table); + target.append("</div></div>") // lastly close multiselect - target.append("</form>"); - - + .append("</form>"); appendViewportResizeJsFix(target, source, rows, usePageing); if (log.isDebug()) { @@ -132,13 +124,13 @@ public class TableRenderer extends DefaultComponentRenderer { // entries after the 1023 entry or even the entire table unreadable. // Comment CDATA section to make it work with prototype's stripScripts method ! if (!usePageing && rows > 1000) { - target.append("<script type=\"text/javascript\">/* <![CDATA[ */\n "); - target.append("jQuery(function() { jQuery('#o_table_wrapper").append(source.hashCode()).append("').height(o_viewportHeight()/3*2);});"); - target.append("/* ]]> */\n</script>"); + target.append("<script type=\"text/javascript\">/* <![CDATA[ */\n ") + .append("jQuery(function() { jQuery('#o_table_wrapper").append(source.hashCode()).append("').height(o_viewportHeight()/3*2);});") + .append("/* ]]> */\n</script>"); } } - private void appendMultiselectFormActions(final StringOutput target, final Translator translator, final Table table) { + private void appendMultiselectFormActions(StringOutput target, String formName, Translator translator, Table table) { // add multiselect form actions List<TableMultiSelect> multiSelectActions = table.getMultiSelectActions(); if (table.isMultiSelect() && multiSelectActions.isEmpty()) { @@ -157,70 +149,71 @@ public class TableRenderer extends DefaultComponentRenderer { value = action.getLabel(); } - target.append("<input type=\"submit\" name=\"").append(multiSelectActionIdentifer) - .append("\" value=\"").append(value).append("\" class=\"btn btn-default\" />"); + target.append("<button type=\"button\" name=\"").append(multiSelectActionIdentifer) + .append("\" class=\"btn btn-default\" onclick=\"o_TableMultiActionEvent('").append(formName).append("','").append(multiSelectActionIdentifer).append("');\"><span>").append(value).append("</span></button> "); } - target.append(CLOSE_DIV); + target.append("</div>"); // add hidden action command placeholders to the form. these will be manipulated when // the user clicks on a regular link within the table to e.g. re-sort the columns. target.append("<input type=\"hidden\" name=\"cmd\" value=\"\" />") .append("<input type=\"hidden\" name=\"param\" value=\"\" />"); } - private void appendTablePageing(final StringOutput target, final Translator translator, final Table table, final String formName, final int rows, int resultsPerPage, final Integer currentPageId, - final boolean usePageing) { + private void appendTablePageing(StringOutput target, Translator translator, Table table, int rows, + int resultsPerPage, Integer currentPageId, boolean usePageing, boolean ajaxEnabled, URLBuilder ubu) { if (usePageing && (rows > resultsPerPage)) { int pageid = currentPageId.intValue(); // paging bug OLAT-935 part missing second page, or missing last page due rounding issues. int maxpageid = (int) Math.ceil(((double) rows / (double) resultsPerPage)); target.append("<div class='o_table_pagination'><ul class='pagination'>"); - appendTablePageingBackLink(target, formName, pageid); - addPageNumberLinks(target, formName, pageid, maxpageid); - appendTablePageingNextLink(target, formName, rows, resultsPerPage, pageid); - appendTablePageingShowallLink(target, translator, table, formName); - + appendTablePageingBackLink(target, pageid, ajaxEnabled, ubu); + addPageNumberLinks(target, pageid, maxpageid, ajaxEnabled, ubu); + appendTablePageingNextLink(target, rows, resultsPerPage, pageid, ajaxEnabled, ubu); + appendTablePageingShowallLink(target, translator, table, ajaxEnabled, ubu); + target.append("</ul></div>"); - } } - private void appendTablePageingShowallLink(final StringOutput target, final Translator translator, final Table table, final String formName) { + private void appendTablePageingShowallLink(StringOutput sb, Translator translator, Table table, boolean ajaxEnabled, URLBuilder ubu) { if (table.isShowAllLinkEnabled()) { - target.append("<li>"); - target.append(A_CLASS).append(HREF_JAVA_SCRIPT_TABLE_FORM_INJECT_COMMAND_AND_SUBMIT); - target.append(formName).append(SINGLE_COMMA_SINGLE).append(Table.COMMAND_PAGEACTION).append(SINGLE_COMMA_SINGLE).append(Table.COMMAND_PAGEACTION_SHOWALL).append(CLOSE_AND_O2CLICK); - target.append(translator.translate("table.showall")).append("</a></li>"); + sb.append("<li><a "); + ubu.buildHrefAndOnclick(sb, ajaxEnabled, + new NameValuePair(Table.FORM_CMD,Table.COMMAND_PAGEACTION), + new NameValuePair(Table.FORM_PARAM, Table.COMMAND_PAGEACTION_SHOWALL)) + .append(">").append(translator.translate("table.showall")).append("</a></li>"); } } - private void appendTablePageingNextLink(StringOutput target, String formName, int rows, int resultsPerPage, int pageid) { + private void appendTablePageingNextLink(StringOutput target, int rows, int resultsPerPage, int pageid, boolean ajaxEnabled, URLBuilder ubu) { boolean enabled = ((pageid * resultsPerPage) < rows); - target.append("<li").append(" class='disabled'", !enabled).append("><a href=\""); + target.append("<li").append(" class='disabled'", !enabled).append("><a "); if(enabled) { - target.append("JavaScript:tableFormInjectCommandAndSubmit('") - .append(formName).append(SINGLE_COMMA_SINGLE).append(Table.COMMAND_PAGEACTION).append(SINGLE_COMMA_SINGLE) - .append(Table.COMMAND_PAGEACTION_FORWARD).append(CLOSE_AND_O2CLICK); + ubu.buildHrefAndOnclick(target, ajaxEnabled, + new NameValuePair(Table.FORM_CMD,Table.COMMAND_PAGEACTION), + new NameValuePair(Table.FORM_PARAM, Table.COMMAND_PAGEACTION_FORWARD)); } else { - target.append("#\">"); + target.append("href=\"javascript:;\""); } - target.append("»").append("</a></li>"); + target.append(">»").append("</a></li>"); } - private void appendTablePageingBackLink(StringOutput target, String formName, int pageid) { + private void appendTablePageingBackLink(StringOutput target, int pageid, boolean ajaxEnabled, URLBuilder ubu) { boolean enabled = pageid > 1; - target.append("<li").append(" class='disabled'", !enabled).append("><a href=\""); + target.append("<li").append(" class='disabled'", !enabled).append("><a "); if(enabled) { - target.append("JavaScript:tableFormInjectCommandAndSubmit('") - .append(formName).append(SINGLE_COMMA_SINGLE).append(Table.COMMAND_PAGEACTION).append(SINGLE_COMMA_SINGLE) - .append(Table.COMMAND_PAGEACTION_BACKWARD).append(CLOSE_AND_O2CLICK); + ubu.buildHrefAndOnclick(target, ajaxEnabled, + new NameValuePair(Table.FORM_CMD,Table.COMMAND_PAGEACTION), + new NameValuePair(Table.FORM_PARAM, Table.COMMAND_PAGEACTION_BACKWARD)); } else { - target.append("#\">"); + target.append("href=\"javascript:;\""); } - target.append("«").append(CLOSE_HREF); + target.append(">«").append("</a>"); } - private void appendSelectDeselectAllButtons(final StringOutput target, final Translator translator, Table table, String formName, int rows, int resultsPerPage) { + private void appendSelectDeselectAllButtons(StringOutput target, Translator translator, Table table, String formName, int rows, int resultsPerPage, + boolean ajaxEnabled, URLBuilder ubu) { if (table.isMultiSelect()) { target.append("<div class='o_table_checkall input-sm'>") .append("<label class='checkbox-inline'>") @@ -236,11 +229,15 @@ public class TableRenderer extends DefaultComponentRenderer { } if (table.isShowAllSelected() && (rows > resultsPerPage)) { - target.append("<div class='o_table_pagination'><ul class='pagination'><li>"); - target.append(A_CLASS).append("btn btn-sm btn-default").append(HREF_JAVA_SCRIPT_TABLE_FORM_INJECT_COMMAND_AND_SUBMIT); - target.append(formName).append(SINGLE_COMMA_SINGLE).append(Table.COMMAND_PAGEACTION).append(SINGLE_COMMA_SINGLE).append(Table.COMMAND_SHOW_PAGES).append(CLOSE_AND_O2CLICK); - target.append(translator.translate("table.showpages")).append("</a>"); - target.append("</li><ul></div>"); + target.append("<div class='o_table_pagination'><ul class='pagination'><li>") + .append("<a class=\"").append("btn btn-sm btn-default").append("\" "); + + ubu.buildHrefAndOnclick(target, ajaxEnabled, + new NameValuePair(Table.FORM_CMD, Table.COMMAND_PAGEACTION), + new NameValuePair(Table.FORM_PARAM, Table.COMMAND_SHOW_PAGES)) + .append(">") + .append(translator.translate("table.showpages")).append("</a>") + .append("</li><ul></div>"); } } @@ -266,7 +263,7 @@ public class TableRenderer extends DefaultComponentRenderer { } } - target.append("<tr class=\"").append(cssClass).append(CLOSE_HTML_BRACE); + target.append("<tr class=\"").append(cssClass).append("\">"); appendSingleDataRow(renderer, target, ubu, table, iframePostEnabled, cols, i, currentPosInModel, isMark); target.append("</tr>"); } @@ -290,7 +287,7 @@ public class TableRenderer extends DefaultComponentRenderer { if (isMark) { target.append(" o_table_marked"); } - target.append(CLOSE_HTML_BRACE); + target.append("\">"); String action = cd.getAction(i); if (action != null) { StringOutput so = new StringOutput(100); @@ -303,26 +300,16 @@ public class TableRenderer extends DefaultComponentRenderer { } } - private void appendSingleDataRowActionColumn(final StringOutput target, final URLBuilder ubu, final boolean iframePostEnabled, final int i, final int currentPosInModel, final int j, - final ColumnDescriptor cd, final String action, final String renderval) { + private void appendSingleDataRowActionColumn(StringOutput target, URLBuilder ubu, boolean ajaxEnabled, int i, int currentPosInModel, int j, + ColumnDescriptor cd, String action, String renderval) { // If we have actions on the table rows, we just submit traditional style (not via form.submit()) // Note that changes in the state of multiselects will not be reflected in the model. - HrefGenerator hrefG = cd.getHrefGenerator(); - - if (hrefG != null) { - target.append(A_HREF); - StringOutput link = new StringOutput(); - ubu.buildURI(link, new String[] { Table.COMMANDLINK_ROWACTION_CLICKED, Table.COMMANDLINK_ROWACTION_ID }, new String[] { String.valueOf(currentPosInModel), action }); // url - target.append(hrefG.generate(currentPosInModel, link.toString())); - target.append(CLOSE_HTML_BRACE); - - } else if (cd.isPopUpWindowAction()) { + target.append("<a "); + if (cd.isPopUpWindowAction()) { // render as popup window - target.append(A_HREF); - target.append("javascript:{var win=window.open('"); + target.append("href=\"javascript:{var win=window.open('"); ubu.buildURI(target, new String[] { Table.COMMANDLINK_ROWACTION_CLICKED, Table.COMMANDLINK_ROWACTION_ID }, new String[] { String.valueOf(currentPosInModel), action }); // url - target.append("','tw_").append(i + "_" + j); // javascript window - // name + target.append("','tw_").append(i + "_" + j); // javascript window name target.append("','"); String popUpAttributes = cd.getPopUpWindowAttributes(); if (popUpAttributes != null) { @@ -331,21 +318,14 @@ public class TableRenderer extends DefaultComponentRenderer { target.append("');win.focus();}\">"); } else { // render in same window - target.append(A_HREF); - ubu.buildURI(target, new String[] { Table.COMMANDLINK_ROWACTION_CLICKED, Table.COMMANDLINK_ROWACTION_ID }, new String[] { String.valueOf(currentPosInModel), action }, - iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - target.append("\" onclick=\"return o2cl()\""); - if (iframePostEnabled) { - ubu.appendTarget(target); - } - target.append(">"); - + ubu.buildHrefAndOnclick(target, ajaxEnabled, + new NameValuePair(Table.COMMANDLINK_ROWACTION_CLICKED, currentPosInModel), + new NameValuePair(Table.COMMANDLINK_ROWACTION_ID, action)).append(">"); } - target.append(renderval); - target.append(CLOSE_HREF); + target.append(renderval).append("</a>"); } - private void appendHeaderLinks(final StringOutput target, final Translator translator, Table table, String formName, int cols) { + private void appendHeaderLinks(final StringOutput target, final Translator translator, Table table, int cols, boolean ajaxEnabled, URLBuilder ubu) { if (!table.isDisplayTableHeader()) return; target.append("<thead><tr>"); for (int i = 0; i < cols; i++) { @@ -360,10 +340,12 @@ public class TableRenderer extends DefaultComponentRenderer { target.append("<th>"); // header either a link or not if (table.isSortingEnabled() && cd.isSortingAllowed()) { - target.append("<a class='o_orderby' href=\"javascript:tableFormInjectCommandAndSubmit('") - .append(formName).append("','").append(Table.COMMAND_SORTBYCOLUMN).append("','").append(i).append("');\">") + target.append("<a class='o_orderby' "); + ubu.buildHrefAndOnclick(target, ajaxEnabled, + new NameValuePair(Table.FORM_CMD, Table.COMMAND_SORTBYCOLUMN), + new NameValuePair(Table.FORM_PARAM, i)).append(">") .append(header) - .append(CLOSE_HREF); + .append("</a>"); } else { target.append(header); } @@ -378,13 +360,13 @@ public class TableRenderer extends DefaultComponentRenderer { target.append(formName); target.append("\" action=\""); ubu.buildURI(target, null, null, iframePostEnabled ? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - target.append("\" id=\""); - target.append(formName); - target.append("\""); + target.append("\" id=\"").append(formName).append("\""); if (iframePostEnabled) { - ubu.appendTarget(target); + target.append(" onsubmit=\"o_XHRSubmit('").append(formName).append("');\">"); + } else { + target.append(" onsubmit=\"o_beforeserver();\">"); } - target.append(" onsubmit=\"o_beforeserver();\">"); + target.append("<input id=\"o_mai_").append(formName).append("\" type=\"hidden\" name=\"multi_action_identifier\" value=\"\"").append(" />"); return formName; } @@ -394,48 +376,48 @@ public class TableRenderer extends DefaultComponentRenderer { * @param pageid * @param maxpageid */ - private void addPageNumberLinks(StringOutput target, String formName, int pageid, int maxpageid) { + private void addPageNumberLinks(StringOutput target, int pageid, int maxpageid, boolean ajaxEnabled, URLBuilder ubu) { if (maxpageid < 12) { - addPageNumberLinksForSimpleCase(target, formName, pageid, maxpageid); - return; - } - - int powerOf10 = String.valueOf(maxpageid).length() - 1; - int maxStepSize = (int) Math.pow(10, powerOf10); - int stepSize = (int) Math.pow(10, String.valueOf(pageid).length() - 1); - boolean isStep = false; - int useEveryStep = 3; - int stepCnt = 0; - boolean isNear = false; - int nearleft = 5; - int nearright = 5; - if (pageid < nearleft) { - nearleft = pageid; - nearright += (nearright - nearleft); - } else if (pageid > (maxpageid - nearright)) { - nearright = maxpageid - pageid; - nearleft += (nearleft - nearright); - } - for (int i = 1; i <= maxpageid; i++) { - // adapt stepsize if needed - stepSize = adaptStepsizeIfNeeded(pageid, maxStepSize, stepSize, i); - - isStep = ((i % stepSize) == 0); - if (isStep) { - stepCnt++; - isStep = isStep && (stepCnt % useEveryStep == 0); + addPageNumberLinksForSimpleCase(target, pageid, maxpageid, ajaxEnabled, ubu); + } else { + int powerOf10 = String.valueOf(maxpageid).length() - 1; + int maxStepSize = (int) Math.pow(10, powerOf10); + int stepSize = (int) Math.pow(10, String.valueOf(pageid).length() - 1); + boolean isStep = false; + int useEveryStep = 3; + int stepCnt = 0; + boolean isNear = false; + int nearleft = 5; + int nearright = 5; + if (pageid < nearleft) { + nearleft = pageid; + nearright += (nearright - nearleft); + } else if (pageid > (maxpageid - nearright)) { + nearright = maxpageid - pageid; + nearleft += (nearleft - nearright); } - isNear = (i > (pageid - nearleft) && i < (pageid + nearright)); - if (i == 1 || i == maxpageid || isStep || isNear) { - appendPagenNumberLink(target, formName, pageid, i); + for (int i = 1; i <= maxpageid; i++) { + // adapt stepsize if needed + stepSize = adaptStepsizeIfNeeded(pageid, maxStepSize, stepSize, i); + + isStep = ((i % stepSize) == 0); + if (isStep) { + stepCnt++; + isStep = isStep && (stepCnt % useEveryStep == 0); + } + isNear = (i > (pageid - nearleft) && i < (pageid + nearright)); + if (i == 1 || i == maxpageid || isStep || isNear) { + appendPagenNumberLink(target, pageid, i, ajaxEnabled, ubu); + } } } } - private void appendPagenNumberLink(StringOutput target, String formName, int pageid, int i) { - target.append("<li").append(" class='active'", pageid == i).append("><a ") - .append(" href=\"JavaScript:tableFormInjectCommandAndSubmit('") - .append(formName).append(SINGLE_COMMA_SINGLE + Table.COMMAND_PAGEACTION + SINGLE_COMMA_SINGLE).append(i).append("');\">") + private void appendPagenNumberLink(StringOutput target, int pageid, int i, boolean ajaxEnabled, URLBuilder ubu) { + target.append("<li").append(" class='active'", pageid == i).append("><a "); + ubu.buildHrefAndOnclick(target, ajaxEnabled, + new NameValuePair(Table.FORM_CMD, Table.COMMAND_PAGEACTION), + new NameValuePair(Table.FORM_PARAM, i)).append(">") .append(i).append("</a></li>"); } @@ -449,9 +431,9 @@ public class TableRenderer extends DefaultComponentRenderer { return newStepSize; } - private void addPageNumberLinksForSimpleCase(final StringOutput target, String formName, int pageid, int maxpageid) { + private void addPageNumberLinksForSimpleCase(final StringOutput target, int pageid, int maxpageid, boolean ajaxEnabled, URLBuilder ubu) { for (int i = 1; i <= maxpageid; i++) { - appendPagenNumberLink(target, formName, pageid, i); + appendPagenNumberLink(target, pageid, i, ajaxEnabled, ubu); } } } \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/components/table/TableReplayableEvent.java b/src/main/java/org/olat/core/gui/components/table/TableReplayableEvent.java deleted file mode 100644 index 324bda6484970740e228606d9524a6578e69cee7..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/core/gui/components/table/TableReplayableEvent.java +++ /dev/null @@ -1,124 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <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 -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <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> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -* <p> -*/ - -package org.olat.core.gui.components.table; - -import java.util.Locale; -import java.util.Map; - -/** - * Description:<br> - * TODO: patrickb Class Description for TableReplayableEvent - * - * <P> - * Initial Date: 09.07.2006 <br> - * @author patrickb - */ -public class TableReplayableEvent { - private static final String M_DATA = "mData"; - private static final String I_MODE = "iMode"; - static final int SORT = 0; - static final int PAGE_ACTION = 3; - static final int ROW_ACTION = 4; - static final int MULTISELECT_ACTION = 5; - - private int cmd; - private Map recMap; - private String title; - - /** - * for replaying - * @param baseTypeMap - */ - public TableReplayableEvent(final Map<String,Object> baseTypeMap){ - recMap = (Map)baseTypeMap.get(M_DATA); - cmd = ((Integer)baseTypeMap.get(I_MODE)).intValue(); - } - - public TableReplayableEvent(final int recCmd, final Map recMap) { - this.recMap = recMap; - this.cmd = recCmd; - } - - /** - * @see org.olat.core.gui.control.recorder.ReplayableEvent#getDescription(java.util.Locale) - */ - public String getDescription(final Locale locale) { - return null; - } - - /** - * @see org.olat.core.gui.control.recorder.ReplayableEvent#getTitle(java.util.Locale) - */ - public String getTitle(final Locale locale) { - return title; - } - - /** - * @see org.olat.core.gui.control.recorder.ReplayableEvent#saveTo(java.util.Map) - */ - public void saveTo(final Map<String,Object> baseTypeMap) { - baseTypeMap.put(M_DATA,recMap); - baseTypeMap.put(I_MODE,Integer.valueOf(cmd)); - } - - /** - * @return Returns the cmd. - */ - public int getCmd() { - return cmd; - } - - /** - * @param cmd The cmd to set. - */ - public void setCmd(final int cmd) { - this.cmd = cmd; - } - - /** - * @return Returns the recMap. - */ - public Map getRecMap() { - return recMap; - } - - /** - * @param recMap The recMap to set. - */ - public void setRecMap(final Map recMap) { - this.recMap = recMap; - } - - /** - * @param replayTitle - */ - public void setTitle(final String title) { - this.title = title; - - } - -} diff --git a/src/main/java/org/olat/core/gui/components/table/TableSortRenderer.java b/src/main/java/org/olat/core/gui/components/table/TableSortRenderer.java index 6ecb1fb2b2c17d9a7526852defe9000a1868e021..446d58f37f83656d0bc921524279a6ccd7732bce 100644 --- a/src/main/java/org/olat/core/gui/components/table/TableSortRenderer.java +++ b/src/main/java/org/olat/core/gui/components/table/TableSortRenderer.java @@ -22,6 +22,7 @@ package org.olat.core.gui.components.table; import org.apache.commons.lang.StringEscapeUtils; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.DefaultComponentRenderer; +import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.render.RenderResult; import org.olat.core.gui.render.Renderer; import org.olat.core.gui.render.StringOutput; @@ -52,16 +53,17 @@ class TableSortRenderer extends DefaultComponentRenderer { int cols = table.getColumnCount(); boolean asc = table.isSortAscending(); - String formName = "tb_ms_" + table.hashCode(); ColumnDescriptor sortedCD = table.getCurrentlySortedColumnDescriptor(); for (int i = 0; i < cols; i++) { ColumnDescriptor cd = table.getColumnDescriptor(i); // header either a link or not if (cd.isSortingAllowed()) { - sb.append("<li>") - .append("<a class=\"").append("\" href=\"JavaScript:tableFormInjectCommandAndSubmit('") - .append(formName).append("','").append(Table.COMMAND_SORTBYCOLUMN).append("','").append(i).append("');\" title=\"") + sb.append("<li><a "); + ubu.buildHrefAndOnclick(sb, false, + new NameValuePair(Table.FORM_CMD, Table.COMMAND_SORTBYCOLUMN), + new NameValuePair(Table.FORM_PARAM, i)) + .append(" title=\"") .append(StringEscapeUtils.escapeHtml(translator.translate("row.sort"))).append("\">"); if(sortedCD == cd) { diff --git a/src/main/java/org/olat/core/gui/components/tree/MenuTreeRenderer.java b/src/main/java/org/olat/core/gui/components/tree/MenuTreeRenderer.java index c628d5ebd3290eb28e39e4085386ef9c04b20ebd..fd134273a19b2c93aa5450cde145f10018e61e66 100644 --- a/src/main/java/org/olat/core/gui/components/tree/MenuTreeRenderer.java +++ b/src/main/java/org/olat/core/gui/components/tree/MenuTreeRenderer.java @@ -45,6 +45,7 @@ import org.olat.core.gui.components.Component; import org.olat.core.gui.components.DefaultComponentRenderer; import org.olat.core.gui.components.form.flexible.impl.FormEvent; import org.olat.core.gui.components.form.flexible.impl.FormJSHelper; +import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.components.tree.InsertionPoint.Position; import org.olat.core.gui.control.winmgr.AJAXFlags; import org.olat.core.gui.render.RenderResult; @@ -256,55 +257,29 @@ public class MenuTreeRenderer extends DefaultComponentRenderer { .append("<span class=\"o_tree_leaf o_tree_oc_l").append(level).append("\"> </span>") .append("<span class='o_tree_link o_tree_l").append(level).append(" o_insertion_point'><a href=\""); - // Build menu item URI - boolean iframePostEnabled = flags.isIframePostEnabled(); - if (iframePostEnabled) { - ubu.buildURI(sb, new String[] { COMMAND_ID, NODE_IDENT }, new String[] { COMMAND_TREENODE_INSERT_REMOVE, node.getIdent() }, AJAXFlags.MODE_TOBGIFRAME); - } else { - ubu.buildURI(sb, new String[] { COMMAND_ID, NODE_IDENT }, new String[] { COMMAND_TREENODE_INSERT_REMOVE, node.getIdent() }); - } - sb.append("\""); - if(iframePostEnabled) { - ubu.appendTarget(sb); - } - + ubu.buildHrefAndOnclick(sb, null, flags.isIframePostEnabled(), false, false, + new NameValuePair(COMMAND_ID, COMMAND_TREENODE_INSERT_REMOVE), + new NameValuePair(NODE_IDENT, node.getIdent())); + Translator pointTranslator = Util.createPackageTranslator(MenuTreeRenderer.class, tree.getTranslator().getLocale()); String pointTranslation = pointTranslator.translate("insertion.point"); - sb.append("'><span>").append(pointTranslation).append(" <i class='o_icon o_icon_remove'> </i></span>") + sb.append("><span>").append(pointTranslation).append(" <i class='o_icon o_icon_remove'> </i></span>") .append("</a></span></div></li>"); } } private void renderOpenClose(TreeNode curRoot, StringOutput target, int level, boolean renderChildren, URLBuilder ubu, AJAXFlags flags, MenuTree tree) { int chdCnt = curRoot.getChildCount(); - boolean iframePostEnabled = flags.isIframePostEnabled(); // expand icon // add ajax support and real open/close function if (((tree.isRootVisible() && level != 0) || !tree.isRootVisible()) && chdCnt > 0) { // root has not open/close icon, append open / close icon only if there is children - target.append("<a onclick='return "); - if(tree.getMenuTreeItem() == null) { - target.append("o2cl_secure()"); - } else { - // open/close disturb the dirty check in the flexi form version - // of the menu tree. It's ok because open close in flexi cannot - // discard a form. - target.append("o2cl_noDirtyCheck()"); - } - - target.append(";' href=\""); - - // Build menu item URI - String cmd = renderChildren ? MenuTree.TREENODE_CLOSE : MenuTree.TREENODE_OPEN; - if (iframePostEnabled) { - ubu.buildURI(target, new String[] { COMMAND_ID, NODE_IDENT, COMMAND_TREENODE }, new String[] { COMMAND_TREENODE_CLICKED, curRoot.getIdent(), cmd }, AJAXFlags.MODE_TOBGIFRAME); - } else { - ubu.buildURI(target, new String[] { COMMAND_ID, NODE_IDENT, cmd }, new String[] { COMMAND_TREENODE_CLICKED, curRoot.getIdent(), cmd }); - } - - target.append("\""); - if(iframePostEnabled) { - ubu.appendTarget(target); - } + target.append("<a "); + + ubu.buildHrefAndOnclick(target, null, flags.isIframePostEnabled(), tree.getMenuTreeItem() != null, true, + new NameValuePair(COMMAND_ID, COMMAND_TREENODE_CLICKED), + new NameValuePair(NODE_IDENT, curRoot.getIdent()), + new NameValuePair(COMMAND_TREENODE, renderChildren ? MenuTree.TREENODE_CLOSE : MenuTree.TREENODE_OPEN)); + String openCloseCss = renderChildren ? "close" : "open"; target.append(" class='o_tree_oc_l").append(level).append("'><i class='o_icon o_icon_").append(openCloseCss).append("_tree'></i></a>"); } else if (level != 0 && chdCnt == 0) { @@ -353,22 +328,13 @@ public class MenuTreeRenderer extends DefaultComponentRenderer { if(tree.isMultiSelect() && tree.getMenuTreeItem() != null) { renderCheckbox(target, curRoot, tree); } - - // add css class to identify level, FireFox script - if(tree.getMenuTreeItem() != null && tree.getMenuTreeItem().isNoDirtyCheckOnClick()) { - target.append("<a onclick='return o2cl_noDirtyCheck();' href=\""); - } else { - target.append("<a onclick='return o2cl_secure();' href=\""); - } - - // Build menu item URI - if (iframePostEnabled) { - ubu.buildURI(target, new String[] { COMMAND_ID, NODE_IDENT }, new String[] { COMMAND_TREENODE_CLICKED, curRoot.getIdent() }, AJAXFlags.MODE_TOBGIFRAME); - } else { - ubu.buildURI(target, new String[] { COMMAND_ID, NODE_IDENT }, new String[] { COMMAND_TREENODE_CLICKED, curRoot.getIdent() }); - } - target.append("\""); + // Build menu item URI + target.append("<a "); + boolean dirtyCheck = tree.getMenuTreeItem() == null || !tree.getMenuTreeItem().isNoDirtyCheckOnClick(); + ubu.buildHrefAndOnclick(target, null, iframePostEnabled, dirtyCheck, true, + new NameValuePair(COMMAND_ID, COMMAND_TREENODE_CLICKED), + new NameValuePair(NODE_IDENT, curRoot.getIdent())); // Add menu item title as alt hoover text String alt = curRoot.getAltText(); @@ -377,10 +343,6 @@ public class MenuTreeRenderer extends DefaultComponentRenderer { .append(StringEscapeUtils.escapeHtml(alt).toString()) .append("\""); } - - if (iframePostEnabled) { - ubu.appendTarget(target); - } target.append(">"); String iconCssClass = curRoot.getIconCssClass(); @@ -447,17 +409,10 @@ public class MenuTreeRenderer extends DefaultComponentRenderer { } private void renderInsertCalloutButton(String cmd, String cssClass, StringOutput sb, TreeNode node, URLBuilder ubu, AJAXFlags flags) { - boolean iframePostEnabled = flags.isIframePostEnabled(); - sb.append("<a class='btn btn-default small' onclick='return o2cl_secure();' href=\""); - if (iframePostEnabled) { - ubu.buildURI(sb, new String[] { COMMAND_ID, NODE_IDENT }, new String[] { cmd, node.getIdent() }, AJAXFlags.MODE_TOBGIFRAME); - } else { - ubu.buildURI(sb, new String[] { COMMAND_ID, NODE_IDENT }, new String[] { cmd, node.getIdent() }); - } - sb.append("\""); - if (iframePostEnabled) { - ubu.appendTarget(sb); - } + sb.append("<a class='btn btn-default small' "); + ubu.buildHrefAndOnclick(sb, flags.isIframePostEnabled(), + new NameValuePair(COMMAND_ID, cmd), + new NameValuePair(NODE_IDENT, node.getIdent())); sb.append("><i class='o_icon ").append(cssClass).append("'> </i></a>"); } 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 c9de0e27bbeb9d2282682ba1849df84944f7ca2b..948cb2209a0da0b631958942630eec62e636925a 100644 --- a/src/main/java/org/olat/core/gui/control/ChiefController.java +++ b/src/main/java/org/olat/core/gui/control/ChiefController.java @@ -41,6 +41,12 @@ public interface ChiefController extends Controller { * @return the window */ public Window getWindow(); + + /** + * + * @return The title of the browser window + */ + public String getWindowTitle(); /** * @return the windowcontrol diff --git a/src/main/java/org/olat/core/gui/control/WindowBackOffice.java b/src/main/java/org/olat/core/gui/control/WindowBackOffice.java index af079acb8db5fc5a98aeac5221ff861e6def5301..420c3b5e1acddc5d08231b580a67232283675fb8 100644 --- a/src/main/java/org/olat/core/gui/control/WindowBackOffice.java +++ b/src/main/java/org/olat/core/gui/control/WindowBackOffice.java @@ -55,7 +55,9 @@ public interface WindowBackOffice extends Disposable{ /** * @return the window associated */ - Window getWindow(); + public Window getWindow(); + + public ChiefController getChiefController(); /** * @param ureq diff --git a/src/main/java/org/olat/core/gui/control/floatingresizabledialog/FloatingResizableDialogController.java b/src/main/java/org/olat/core/gui/control/floatingresizabledialog/FloatingResizableDialogController.java index ba087b06581ffd73c9fdd860d7c93d68683b61a5..579988975a70cf84130fb78d81a9831ed162b051 100644 --- a/src/main/java/org/olat/core/gui/control/floatingresizabledialog/FloatingResizableDialogController.java +++ b/src/main/java/org/olat/core/gui/control/floatingresizabledialog/FloatingResizableDialogController.java @@ -25,8 +25,9 @@ */ package org.olat.core.gui.control.floatingresizabledialog; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.StringTokenizer; import org.apache.commons.lang.StringEscapeUtils; import org.olat.core.gui.UserRequest; @@ -157,10 +158,6 @@ public class FloatingResizableDialogController extends BasicController { putInitialPanel(wrapper); } - private static final Pattern allGeometry = Pattern.compile("^(\\d+),(\\d+):(\\d+),(\\d+)$"); - private static final Pattern posGeometry = Pattern.compile("^(\\d+),(\\d+)$"); - private static final Pattern parseGeometry = Pattern.compile("(\\d+)"); - public void setElementCSSClass(String cssClass) { if(StringHelper.containsNonWhitespace(cssClass)) { wrapper.contextPut("cssClass", cssClass); @@ -175,33 +172,33 @@ public class FloatingResizableDialogController extends BasicController { @Override public void event(UserRequest ureq, Component source, Event event) { if (event.getCommand().equals("geometry")) { - String p = ureq.getHttpReq().getParameter("p"); - if (p != null) { - if(allGeometry.matcher(p).matches()) { - Matcher m = parseGeometry.matcher(p); - - if (m.find()) offsetX = Integer.parseInt(m.group()); - if (m.find()) offsetY = Integer.parseInt(m.group()); - if (m.find()) width = Integer.parseInt(m.group()); - if (m.find()) height = Integer.parseInt(m.group()); - - boolean dirt = wrapper.isDirty(); - wrapper.contextPut("width" , width); - wrapper.contextPut("height" , height); - wrapper.contextPut("offsetX", offsetX); - wrapper.contextPut("offsetY", offsetY); - wrapper.setDirty(dirt); - } else if(posGeometry.matcher(p).matches()) { - Matcher m = parseGeometry.matcher(p); - - if (m.find()) offsetX = Integer.parseInt(m.group()); - if (m.find()) offsetY = Integer.parseInt(m.group()); - - boolean dirt = wrapper.isDirty(); + String p = ureq.getParameter("p"); + if (p != null) { + try { + p = URLDecoder.decode(p, "UTF-8"); + } catch (UnsupportedEncodingException e) { + logError("", e); + } + + boolean dirt = wrapper.isDirty(); + StringTokenizer tokens = new StringTokenizer(p, ",:"); + if(tokens.hasMoreTokens()) { + offsetX = (int)Double.parseDouble(tokens.nextToken()); wrapper.contextPut("offsetX", offsetX); + } + if(tokens.hasMoreTokens()) { + offsetY = (int)Double.parseDouble(tokens.nextToken()); wrapper.contextPut("offsetY", offsetY); - wrapper.setDirty(dirt); } + if(tokens.hasMoreTokens()) { + width = (int)Double.parseDouble(tokens.nextToken()); + wrapper.contextPut("width" , width); + } + if(tokens.hasMoreTokens()) { + height = (int)Double.parseDouble(tokens.nextToken()); + wrapper.contextPut("height" , height); + } + wrapper.setDirty(dirt); } } else if (source == wrapper) { if (event.getCommand().equals("close")) { diff --git a/src/main/java/org/olat/core/gui/control/floatingresizabledialog/_content/index.html b/src/main/java/org/olat/core/gui/control/floatingresizabledialog/_content/index.html index e7a0396e26bd2f5bb1a17ba2c32d32ade1cc1610..39afab76a99d4f5e3ae241aa8a79e718210ced94 100644 --- a/src/main/java/org/olat/core/gui/control/floatingresizabledialog/_content/index.html +++ b/src/main/java/org/olat/core/gui/control/floatingresizabledialog/_content/index.html @@ -37,16 +37,14 @@ dialogClass: 'o_modal-ui', stack: true, close: function() { - o_beforeserver(); jQuery(this).dialog('destroy').remove(); - $r.javaScriptBgCommand("close") + $r.javaScriptCommand("close") }, resize: function(event, ui) { #if ($ajaxFlags.isIframePostEnabled()) if (!o_info.linkbusy) { window.suppressOlatOnUnloadOnce = true; - o_beforeserver(); - $r.javaScriptBgCommand("geometry") + '?p='+ encodeURIComponent(ui.position.left + ',' + ui.position.top + ':' + ui.size.width + ',' + ui.size.height); + $r.openBackgroundCommand("geometry"),"p",encodeURIComponent(ui.position.left + ',' + ui.position.top + ':' + ui.size.width + ',' + ui.size.height)) } #end try { @@ -57,8 +55,7 @@ #if ($ajaxFlags.isIframePostEnabled()) if (!o_info.linkbusy) { window.suppressOlatOnUnloadOnce = true; - o_beforeserver(); - $r.javaScriptBgCommand("geometry") + '?p='+ encodeURIComponent(ui.position.left + ',' + ui.position.top); + $r.openBackgroundCommand("geometry"),"p",encodeURIComponent(ui.position.left + ',' + ui.position.top)) } #end try { diff --git a/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/AutoCompleterController.java b/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/AutoCompleterController.java index ddad6227a9381ddfba3841fab8f094056451ea40..404a592352313e5193ac471f7d2aedfa2f4ef362 100644 --- a/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/AutoCompleterController.java +++ b/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/AutoCompleterController.java @@ -39,7 +39,6 @@ import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.controller.BasicController; -import org.olat.core.gui.control.winmgr.JSCommand; import org.olat.core.gui.render.velocity.VelocityRenderDecorator; /** @@ -62,8 +61,6 @@ import org.olat.core.gui.render.velocity.VelocityRenderDecorator; public class AutoCompleterController extends BasicController { private static final String COMMAND_SELECT = "select"; private static final String JSNAME_INPUTFIELD = "o_autocomplete_input"; - private static final String JSNAME_DATASTORE = "autocompleterDatastore"; - private static final String JSNAME_COMBOBOX = "autocompleterCombobox"; static final String AUTOCOMPLETER_NO_RESULT = "AUTOCOMPLETER_NO_RESULT"; @@ -72,9 +69,6 @@ public class AutoCompleterController extends BasicController { private final ListProvider gprovider; private final String noResults; private boolean emptyAsReset; - - private String datastoreName; - private String comboboxName; /** * Constructor to create an auto completer controller @@ -119,10 +113,6 @@ public class AutoCompleterController extends BasicController { myContent.contextPut("showDisplayKey", Boolean.valueOf(showDisplayKey)); myContent.contextPut("inputWidth", Integer.valueOf(inputWidth)); myContent.contextPut("minChars", Integer.valueOf(minChars)); - // Create name for addressing the javascript components - datastoreName = "o_s" + JSNAME_DATASTORE + myContent.getDispatchID(); - comboboxName = "o_s" + JSNAME_COMBOBOX + myContent.getDispatchID(); - // Create a mapper for the server responses for a given input mapper = new AutoCompleterMapper(noResults, showDisplayKey, gprovider); @@ -204,25 +194,6 @@ public class AutoCompleterController extends BasicController { @Override protected void doDispose() { - // Cleanup javascript objects on browser side by triggering dispose - // function - StringBuffer sb = new StringBuffer(); - // first datastore - sb.append("if (o_info.objectMap.containsKey('") - .append(datastoreName) - .append("')) {var oldStore = o_info.objectMap.removeKey('") - .append(datastoreName) - .append("');if (oldStore) {oldStore.destroy();} oldStore = null;}"); - // second combobox - sb.append("if (o_info.objectMap.containsKey('") - .append(comboboxName) - .append("')) { var oldCombo = o_info.objectMap.removeKey('") - .append(comboboxName) - .append("'); if (oldCombo) { oldCombo.destroy(); } oldCombo = null;}"); // - JSCommand jsCommand = new JSCommand(sb.toString()); - getWindowControl().getWindowBackOffice().sendCommandTo(jsCommand); - - // Mapper autodisposed by basic controller } } \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/FlexiAutoCompleterController.java b/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/FlexiAutoCompleterController.java index fff44ed421d9ffc3667210976ad0f4bffd738190..263b2cbe265df42779c361c2dab0dba8daa254ce 100644 --- a/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/FlexiAutoCompleterController.java +++ b/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/FlexiAutoCompleterController.java @@ -42,7 +42,6 @@ import org.olat.core.gui.components.htmlheader.jscss.CustomJSFormItem; 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.winmgr.JSCommand; /** * @@ -73,9 +72,6 @@ public class FlexiAutoCompleterController extends FormBasicController { private ListProvider gprovider; private boolean allowNewValues; private boolean formElement; - - private String datastoreName; - private String comboboxName; /** * Constructor to create an auto completer controller @@ -159,10 +155,6 @@ public class FlexiAutoCompleterController extends FormBasicController { layoutCont.contextPut("inputWidth", Integer.valueOf(inputWidth)); layoutCont.contextPut("minChars", Integer.valueOf(minChars)); layoutCont.contextPut("flexi", Boolean.TRUE); - // Create name for addressing the javascript components - datastoreName = "o_s" + JSNAME_DATASTORE + layoutCont.getComponent().getDispatchID(); - comboboxName = "o_s" + JSNAME_COMBOBOX + layoutCont.getComponent().getDispatchID(); - layoutCont.getComponent().addListener(this); // Create a mapper for the server responses for a given input @@ -265,26 +257,8 @@ public class FlexiAutoCompleterController extends FormBasicController { /** * @see org.olat.core.gui.control.DefaultController#doDispose() */ + @Override protected void doDispose() { - // Cleanup javascript objects on browser side by triggering dispose - // function - StringBuilder sb = new StringBuilder(128); - // first datastore - sb.append("if (o_info.objectMap.containsKey('") - .append(datastoreName) - .append("')) {var oldStore = o_info.objectMap.removeKey('") - .append(datastoreName) - .append("');if (oldStore) {oldStore.destroy();} oldStore = null;}"); - // second combobox - sb.append("if (o_info.objectMap.containsKey('") - .append(comboboxName) - .append("')) { var oldCombo = o_info.objectMap.removeKey('") - .append(comboboxName) - .append("'); if (oldCombo) { oldCombo.destroy(); } oldCombo = null;}"); // - JSCommand jsCommand = new JSCommand(sb.toString()); - getWindowControl().getWindowBackOffice().sendCommandTo(jsCommand); - - // Mapper autodisposed by basic controller } } \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/_content/autocomplete.html b/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/_content/autocomplete.html index 852be53e359053a927e372935bd5cf05cfaebb64..6934e5c37a6fc8c42360284a43e1e393133c6e3f 100644 --- a/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/_content/autocomplete.html +++ b/src/main/java/org/olat/core/gui/control/generic/ajax/autocompletion/_content/autocomplete.html @@ -2,7 +2,7 @@ #if($flexi) <div id='$r.getId("aj_ac_f")'> #else - <form id='$r.getId("aj_ac_f")' action="$r.formURIbg('select')" method="post" $r.bgTarget()> + <form id='$r.getId("aj_ac_f")' action="$r.formURI('select')" method="post" onsubmit="o_XHRSubmit('$r.getId("aj_ac_f")');"> #end #if ($autocompleter_label) $autocompleter_label @@ -50,7 +50,7 @@ jQuery(function(){ displayKey: 'fullName', source: fullNameTypeahead.ttAdapter() }).on('typeahead:selected', function (e, object) { - $r.javaScriptBgCommand("select") + '?key=' + object.value; + $r.openJavaScriptCommand("select"),'key',object.value); }); }); /* ]]> */ diff --git a/src/main/java/org/olat/core/gui/control/generic/closablewrapper/_content/callout.html b/src/main/java/org/olat/core/gui/control/generic/closablewrapper/_content/callout.html index c66bd339e91ad22cb7418ae6c007c39cdeb11aa5..65cfa0917b0f8b23bacec35a0000e2f94c68a7e3 100644 --- a/src/main/java/org/olat/core/gui/control/generic/closablewrapper/_content/callout.html +++ b/src/main/java/org/olat/core/gui/control/generic/closablewrapper/_content/callout.html @@ -10,7 +10,7 @@ jQuery(function() { jQuery('#callout_layer_$r.getCId()').each(function(index, el) { jQuery(el).parents('div.popover').next('div.o_callout_overlay').each(function(index2, el2) { jQuery(el2).click(function() { - if (o2cl()) { $r.javaScriptBgCommand('close'); } + $r.javaScriptCommand('close'); }); }); }); diff --git a/src/main/java/org/olat/core/gui/control/generic/dtabs/DTab.java b/src/main/java/org/olat/core/gui/control/generic/dtabs/DTab.java index 8bb8c4b3629b6e150420b65de74b2d8b2379a454..ac53c781c5ef69a0cece7c9e92fedbc6c6cb6e1f 100644 --- a/src/main/java/org/olat/core/gui/control/generic/dtabs/DTab.java +++ b/src/main/java/org/olat/core/gui/control/generic/dtabs/DTab.java @@ -70,13 +70,12 @@ public interface DTab extends Disposable, CustomCSSProvider { /** * @return the olat resourceable */ - //fxdiff BAKS-7 Resume function public OLATResourceable getInitialOLATResourceable(); - - public Controller getController(); /** - * @param launchController + * + * @return The root controller */ - public void setController(Controller launchController); + public Controller getController(); + } \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/control/generic/dtabs/DTabImpl.java b/src/main/java/org/olat/core/gui/control/generic/dtabs/DTabImpl.java index 0e2ff3ad2d13cd4c24966a6d258b19830513d4c7..0364cfa73dcb46ab4360232d2b5700062de12d9a 100644 --- a/src/main/java/org/olat/core/gui/control/generic/dtabs/DTabImpl.java +++ b/src/main/java/org/olat/core/gui/control/generic/dtabs/DTabImpl.java @@ -46,24 +46,26 @@ import org.olat.repository.ui.RepositoyUIFactory; */ public class DTabImpl implements Disposable, DTab { - private OLATResourceable ores; - private OLATResourceable initialOres; - private Controller controller; + private final OLATResourceable ores; + private final OLATResourceable initialOres; + private final Controller controller; private GuiStack guiStackHandle; - private String title; + private final String title; private String description; private final WindowControl wControl; - private NavElement navElement; + private final NavElement navElement; /** * @param ores * @param title * @param wControl */ - public DTabImpl(OLATResourceable ores, OLATResourceable initialOres, String title, WindowControl wOrigControl) { + public DTabImpl(OLATResourceable ores, OLATResourceable initialOres, String title, Controller controller, WindowControl wOrigControl) { this.ores = ores; - this.initialOres = initialOres; this.title = title; + this.controller = controller; + this.initialOres = initialOres; + //Root the JumpInPath - typically all resources are opened in tabs StackedBusinessControl businessControl = new StackedBusinessControl(null, wOrigControl.getBusinessControl()); wControl = BusinessControlFactory.getInstance().createBusinessWindowControl(businessControl, wOrigControl); @@ -76,6 +78,7 @@ public class DTabImpl implements Disposable, DTab { * [used by velocity] * @return the navigation element for this dtab */ + @Override public NavElement getNavElement() { return navElement; } @@ -83,6 +86,7 @@ public class DTabImpl implements Disposable, DTab { /** * @return the controller */ + @Override public Controller getController() { return controller; } @@ -90,6 +94,7 @@ public class DTabImpl implements Disposable, DTab { /** * @return the gui stack handle */ + @Override public GuiStack getGuiStackHandle() { if (guiStackHandle == null) { guiStackHandle = wControl.getWindowBackOffice().createGuiStack(controller.getInitialComponent()); @@ -100,6 +105,7 @@ public class DTabImpl implements Disposable, DTab { /** * @return the title */ + @Override public String getTitle() { return title; } @@ -114,12 +120,12 @@ public class DTabImpl implements Disposable, DTab { /** * @return the olat resourceable */ + @Override public OLATResourceable getOLATResourceable() { return ores; } @Override - //fxdiff BAKS-7 Resume function public OLATResourceable getInitialOLATResourceable() { return initialOres; } @@ -127,8 +133,9 @@ public class DTabImpl implements Disposable, DTab { /** * @see org.olat.core.gui.control.Disposable#dispose(boolean) */ + @Override public void dispose() { - if(controller != null){//OLAT-3500 + if(controller != null) { controller.dispose(); } } @@ -136,22 +143,15 @@ public class DTabImpl implements Disposable, DTab { /** * @see org.olat.core.gui.control.generic.dtabs.DTab#getWindowControl() */ + @Override public WindowControl getWindowControl() { - //TODO: wrap it in own windowcontrol for docking/undocking feature return wControl; } - - /** - * @see org.olat.core.gui.control.generic.dtabs.DTab#setController(org.olat.core.gui.control.Controller) - */ - public void setController(Controller launchController) { - this.controller = launchController; - - } /** * @see java.lang.Object#toString() */ + @Override public String toString() { return "ores: "+ores.getResourceableTypeName()+","+ores.getResourceableId()+", title: "+title; } @@ -159,6 +159,7 @@ public class DTabImpl implements Disposable, DTab { /** * @see org.olat.core.gui.components.htmlheader.jscss.CustomCSSProvider#getCustomCSS() */ + @Override public CustomCSS getCustomCSS() { // delegate to content controller if of type main layout controller if (controller != null && controller instanceof MainLayoutController) { @@ -167,5 +168,4 @@ public class DTabImpl implements Disposable, DTab { } return null; } - } \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/control/generic/dtabs/DTabs.java b/src/main/java/org/olat/core/gui/control/generic/dtabs/DTabs.java index 7ba83e45a634f9ad18cd6647e2771d1082401f3f..a42a3f2122689302c7e9a7b96b2a210479c14241 100644 --- a/src/main/java/org/olat/core/gui/control/generic/dtabs/DTabs.java +++ b/src/main/java/org/olat/core/gui/control/generic/dtabs/DTabs.java @@ -29,6 +29,8 @@ package org.olat.core.gui.control.generic.dtabs; import java.util.List; import org.olat.core.gui.UserRequest; +import org.olat.core.gui.control.Controller; +import org.olat.core.gui.control.WindowControl; import org.olat.core.id.OLATResourceable; import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.HistoryPoint; @@ -40,6 +42,8 @@ import org.olat.core.id.context.HistoryPoint; * @author Felix Jost */ public interface DTabs { + + public WindowControl getWindowControl(); /** * @param ores @@ -51,9 +55,10 @@ public interface DTabs { * @param ores * @param repoOres * @param title + * * @return the tab or null if the headerbar is full. if null, the implementation of the DTabs should issue a warning to the current windowcontrol */ - public DTab createDTab(OLATResourceable ores, OLATResourceable repoOres, String title); + public DTab createDTab(OLATResourceable ores, OLATResourceable repoOres, Controller rootController, String title); /** * @param ureq diff --git a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java index a9ba00c98c45b5293c0e508251bb562d348099d0..146b055a13af96002972c0a88a64dccbe9bcf5cd 100644 --- a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java +++ b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java @@ -359,6 +359,7 @@ public class IFrameDisplayController extends BasicController implements GenericE // This event gets triggered from the iframe content by calling a js function outside // Get new uri from JS method and fire to parents String newUri = ureq.getModuleURI(); + newUri = ureq.getHttpReq().getParameter("uri"); int baseUriPos = newUri.indexOf(baseURI); if (baseUriPos != -1) { int newUriPos = baseUriPos + baseURI.length(); diff --git a/src/main/java/org/olat/core/gui/control/generic/iframe/_content/event.html b/src/main/java/org/olat/core/gui/control/generic/iframe/_content/event.html index a5739d7bbfb732da67fd1fefd2a5ef65efa5ca58..bebf46398932e8eaa3ea36e27647e630eaa53177 100644 --- a/src/main/java/org/olat/core/gui/control/generic/iframe/_content/event.html +++ b/src/main/java/org/olat/core/gui/control/generic/iframe/_content/event.html @@ -3,10 +3,9 @@ function newUriEvent(uri){ // don't forward event when another request is beeing processed or when page not // yet fully loaded (e.g. in case of a full page refresh when loading TinyMCE) - if (!o_info.linkbusy && o_info.initialPageLoadFinished) { - o_beforeserver(); - ${r.javaScriptBgCommand("newUriEvent")} + uri; - } + if (!o_info.linkbusy && o_info.initialPageLoadFinished) { + ${r.openJavaScriptCommand("newUriEvent")},'uri',uri); + } } -/* ]]> */ +/* ]]> */ </script> \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/control/generic/portal/PortalMainController.java b/src/main/java/org/olat/core/gui/control/generic/portal/PortalMainController.java index 56b6293ac1dae2535c7ba97630705eeb5c42411a..34899b998588b5e69e4d501ae76313f0a32165a5 100644 --- a/src/main/java/org/olat/core/gui/control/generic/portal/PortalMainController.java +++ b/src/main/java/org/olat/core/gui/control/generic/portal/PortalMainController.java @@ -60,13 +60,7 @@ public class PortalMainController extends BasicController { portalEditButton = LinkFactory.createButtonSmall("command.portal.edit", welcome, this); portalEditButton.setIconLeftCSS("o_icon o_icon_edit"); portalEditButton.setElementCssClass("pull-right"); - - if(CoreSpringFactory.containsBean("baksModule")){ - welcome.contextPut("isbaks", true); - }else{ - welcome.contextPut("isbaks", false); - } - + // rss link String rssLink = RSSUtil.getPersonalRssLink(ureq); welcome.contextPut("rssLink", rssLink); diff --git a/src/main/java/org/olat/core/gui/control/generic/portal/_content/welcome.html b/src/main/java/org/olat/core/gui/control/generic/portal/_content/welcome.html index add931982de7e8436739cfe7c6eaf39c8370c8f4..934879f978dc5c7c33286a0a52b51c4f73f19a7c 100644 --- a/src/main/java/org/olat/core/gui/control/generic/portal/_content/welcome.html +++ b/src/main/java/org/olat/core/gui/control/generic/portal/_content/welcome.html @@ -9,12 +9,9 @@ <h1>$r.translate("welcome.header")</h1> #set ($intro = $r.translate("welcome.intro")) #if ($intro != "") - <div class="o_block_large"> - $intro - </div> + <div class="o_block_large">$intro</div> #end </div> - <div class="o_home_portaleditlink clearfix"> #if ($portalEditMode) <div class="o_block_large_bottom"> @@ -24,80 +21,4 @@ $r.render("command.portal.edit") #end </div> - -#if($isbaks) -<div id="baks_home_launcher"> - <img src="$r.staticLink("themes/baks/images/portal_launcher_bg.png")" onclick="gotoSite(event);"/> - <div id="baks_goto_repository" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Meine Veranstaltungen</a></div> - <div id="baks_goto_members" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Mitglieder</a></div> - <div id="baks_goto_library" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Bibliothek</a></div> - <div id="baks_goto_friends" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Freundeskreis</a></div> - <div id="baks_goto_network" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Netzwerk</a></div> -</div> - -<script type="text/javascript"> -/* <![CDATA[ */ -function gotoSite(event) { - var el = $("baks_home_launcher"); - var dim = Element.getDimensions(el); - var pos = Element.positionedOffset(el); - var offsetLeft = pos.left; - var offsetTop = pos.top; - - var i=0; - for(var offsetParent = Element.getOffsetParent(el); offsetParent.id != 'o_body'; offsetParent = Element.getOffsetParent(offsetParent)) { - var posn = Element.positionedOffset(offsetParent); - if(offsetParent.id != "o_main_center" && offsetParent.id != "o_page") {//ie give it an offset which is the same as _content - offsetLeft += posn.left; - offsetTop += posn.top; - } - if(i++==10) { break; }//security - } - - //inner square is difficult - var centerX = dim.width / 2; - var centerY = dim.height / 2; - //shift 0,0 coordinate to center - var px = Event.pointerX(event) - offsetLeft - centerX; - var py = centerY - (Event.pointerY(event) - offsetTop); - //calculate the x position on the line x = -y + centerY; - var theoy = (centerY - 5) - Math.abs(px); - if(Math.abs(py) < theoy) { - launchSite('site_demo_icon'); - } - else if(px > 0 && py < 0) { - launchSite('baks_friends'); - } - else if(px > 0 && py > 0) { - launchSite('fx_members'); - } - else if(px < 0 && py > 0) { - launchSite('o_site_repository'); - } - else { - launchSite('f_site_library'); - } -} - -function launchSite(site) { - var siteLinks = $$('li.' + site + ' a'); - if (siteLinks && siteLinks.length > 0) { - var siteLink = siteLinks[0]; - if (o2cl()) { - var target = siteLink.target; - if (target == 'oaa0') { - $('oaa0').src=siteLink.href; - } else { - document.location.href=siteLink.href; - } - } - } else { - alert("Diese Funktion ist noch nicht vorhanden"); - } -} -/* ]]> */ -</script> - -#end ##end of baks-check - $r.render("myPortal") diff --git a/src/main/java/org/olat/core/gui/control/winmgr/AJAXFlags.java b/src/main/java/org/olat/core/gui/control/winmgr/AJAXFlags.java index 21a16b098f06a160d0f0907d9a29a374afd74559..03a19277d9a008fe08deeed373f376eec8e9eb8d 100644 --- a/src/main/java/org/olat/core/gui/control/winmgr/AJAXFlags.java +++ b/src/main/java/org/olat/core/gui/control/winmgr/AJAXFlags.java @@ -61,15 +61,4 @@ public class AJAXFlags { public boolean isIframePostEnabled() { return impl.isAjaxEnabled(); } - - /** - * @return - */ - /*public boolean isDragAndDropEnabled() { - // drag and drop support makes sense only when dom replacement works also: dom-repl(=iframe-post) -> dnd; - // so we are not considering non-dom browsers which could dnd, which seems fine if looking at the current browser's compabilities - return impl.isAjaxEnabled(); - }*/ - - } diff --git a/src/main/java/org/olat/core/gui/control/winmgr/AjaxController.java b/src/main/java/org/olat/core/gui/control/winmgr/AjaxController.java index c7bdda3b1f110d2fe198549b965c2c769de3ca7c..0b7f67f1d3123bc5fff98d097994feb92e7a1144 100644 --- a/src/main/java/org/olat/core/gui/control/winmgr/AjaxController.java +++ b/src/main/java/org/olat/core/gui/control/winmgr/AjaxController.java @@ -34,7 +34,6 @@ import java.util.Locale; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.lang.StringEscapeUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -59,17 +58,23 @@ import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowBackOffice; import org.olat.core.gui.control.pushpoll.WindowCommand; import org.olat.core.gui.media.MediaResource; +import org.olat.core.gui.media.NothingChangedMediaResource; import org.olat.core.gui.media.StringMediaResource; import org.olat.core.gui.render.StringOutput; import org.olat.core.gui.render.URLBuilder; import org.olat.core.gui.translator.Translator; import org.olat.core.helpers.Settings; +import org.olat.core.id.context.BusinessControlFactory; +import org.olat.core.id.context.ContextEntry; +import org.olat.core.id.context.HistoryPoint; import org.olat.core.logging.AssertException; import org.olat.core.logging.OLog; import org.olat.core.logging.Tracing; import org.olat.core.util.FileUtils; +import org.olat.core.util.StringHelper; import org.olat.core.util.Util; import org.olat.core.util.WebappHelper; +import org.springframework.beans.factory.annotation.Autowired; /** * Description:<br> - to be used by the windowmanager only! - this controller @@ -82,17 +87,15 @@ import org.olat.core.util.WebappHelper; */ public class AjaxController extends DefaultController { private static final String VELOCITY_ROOT = Util.getPackageVelocityRoot(AjaxController.class); - private OLog log = Tracing.createLoggerFor(AjaxController.class); - private VelocityContainer myContent; - private VelocityContainer pollPeriodContent; - private Panel mainP; - private Panel pollperiodPanel; + private static final OLog log = Tracing.createLoggerFor(AjaxController.class); + private final VelocityContainer myContent; + private final VelocityContainer pollPeriodContent; + private final Panel mainP; + private final Panel pollperiodPanel; // protected only for performance improvement protected List<WindowCommand> windowcommands = new ArrayList<WindowCommand>(3); - private Mapper m, sbm; - private MapperKey mKey, sbmKey; - private boolean showJSON = false; - protected final WindowBackOfficeImpl wboImpl; + private final Mapper m, sbm; + private final MapperKey mKey, sbmKey; private static final int DEFAULT_POLLPERIOD = 5000;//reasonable default value private int pollperiod = DEFAULT_POLLPERIOD;//reasonable default value @@ -100,14 +103,15 @@ public class AjaxController extends DefaultController { private long creationTime = System.currentTimeMillis(); private boolean ajaxEnabled; - private final SessionStatsManager statsManager; + private WindowBackOffice wboImpl; + + @Autowired + private SessionStatsManager statsManager; - AjaxController(UserRequest ureq, final WindowBackOfficeImpl wboImpl, boolean ajaxEnabled, String iframeName) { + AjaxController(UserRequest ureq, WindowBackOfficeImpl wboImpl, boolean ajaxEnabled) { super(null); - this.wboImpl = wboImpl; this.ajaxEnabled = ajaxEnabled; - - statsManager = CoreSpringFactory.getImpl(SessionStatsManager.class); + this.wboImpl = wboImpl; pollPeriodContent = new VelocityContainer("jsserverpartpoll", VELOCITY_ROOT + "/pollperiod.html", null, this); pollPeriodContent.contextPut("pollperiod", new Integer(pollperiod)); @@ -121,6 +125,7 @@ public class AjaxController extends DefaultController { // create a mapper to not block main traffic when polling (or vica versa) final Window window = wboImpl.getWindow(); m = new Mapper() { + @Override public MediaResource handle(String relPath, HttpServletRequest request) { pollCount++; statsManager.incrementAuthenticatedPollerClick(); @@ -129,11 +134,13 @@ public class AjaxController extends DefaultController { UserRequest ureq = new UserRequestImpl(uriPrefix, request, null); boolean reload = false; Windows ws = Windows.getWindows(ureq); - if(ws != null && ws.getChiefController() != null) { - ChiefController cc = ws.getChiefController(); + if(ws != null && wboImpl.getChiefController() != null) { + ChiefController cc = wboImpl.getChiefController(); reload = cc.wishAsyncReload(ureq, false); } + MediaResource resource; + try { // check for dirty components now. wboImpl.fireCycleEvent(Window.BEFORE_INLINE_RENDERING); @@ -150,21 +157,23 @@ public class AjaxController extends DefaultController { windowcommands.add(new WindowCommand(wboImpl, rmrcom)); } } + resource = extractMediaResource(false); + } else { + resource = new NothingChangedMediaResource(); } } catch (CannotReplaceDOMFragmentException e) { String timestampID = ureq.getTimestampID(); String reRenderUri = window.buildURIFor(window, timestampID, null); Command rmrcom = CommandFactory.createParentRedirectTo(reRenderUri); windowcommands.add(new WindowCommand(wboImpl, rmrcom)); + resource = extractMediaResource(false); } - return extractMediaResource(false); + return resource; } }; mKey = CoreSpringFactory.getImpl(MapperService.class).register(ureq.getUserSession(), m); myContent.contextPut("mapuri", mKey.getUrl()); - myContent.contextPut("iframeName", iframeName); - myContent.contextPut("showJSON", Boolean.valueOf(showJSON)); mainP = new Panel("ajaxMainPanel"); mainP.setContent(myContent); @@ -177,16 +186,14 @@ public class AjaxController extends DefaultController { // either turn ajax on or off setAjaxEnabled(ajaxEnabled); - // The following is for the "standby page" - final Locale flocale = ureq.getLocale(); sbm = new Mapper() { Translator t = Util.createPackageTranslator(ChiefController.class, flocale); - + @Override public MediaResource handle(String relPath, HttpServletRequest request) { StringMediaResource smr = new StringMediaResource(); smr.setContentType("text/html;charset=utf-8"); @@ -197,7 +204,7 @@ public class AjaxController extends DefaultController { StaticMediaDispatcher.renderStaticURI(slink, null); //slink now holds static url base like /olat/raw/700/ - URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED, "1", "1", null); + URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED, "1", "1"); StringOutput blink = new StringOutput(50); ubu.buildURI(blink, null, null); //blink holds the link back to olat like /olat/auth/1%3A1%3A0%3A0%3A0/ @@ -227,19 +234,16 @@ public class AjaxController extends DefaultController { * @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) */ + @Override public void event(UserRequest ureq, Component source, Event event) { // } - public void setHighLightingEnabled(boolean enabled) { - myContent.contextPut("highlight", Boolean.valueOf(enabled)); - } - - public void pushResource(Writer sb, boolean wrapHTML) throws IOException { + public void pushResource(UserRequest ureq, Writer sb, boolean wrapHTML) throws IOException { if (wrapHTML) { // most ajax responses are a lot smaller than 16k sb.append("<html><head><script type=\"text/javascript\">\n/* <![CDATA[ */\nfunction invoke(){var r="); - pushJSONAndClear(sb); + pushJSONAndClear(ureq, sb); sb.append("; ") .append("if (parent!=self&&parent.window.o_info){") .append("parent.window.o_ainvoke(r);") @@ -249,7 +253,7 @@ public class AjaxController extends DefaultController { // b) fast double-click when target causes a 302 and browser's window's document has been updated, but old link was still clickable // c) ... // -> in all cases, do not show the json command, but reload the window which contained the link clicked (= window id of url) - + .append(" try{ parent.window.o_removeIframe(document.defaultView.frameElement.id); } catch(e) {} ") .append("} else {") // inform user that ajax-request cannot be opened in a new window, // todo felix: maybe send back request to bookmark-launch current url? -> new window? @@ -261,11 +265,11 @@ public class AjaxController extends DefaultController { //.append("this.document.location=self.location+\"?o_win_jsontop=1\";") .append("}}\n/* ]]> */\n</script></head><body onLoad=\"invoke()\"></body></html>"); } else { - pushJSONAndClear(sb); + pushJSONAndClear(ureq, sb); } } - public void pushJSONAndClear(Writer writer) throws IOException { + public void pushJSONAndClear(UserRequest ureq, Writer writer) throws IOException { synchronized (windowcommands) { //o_clusterOK by:fj // handle all windowcommands now, create json writer.append("{\"cmds\":["); @@ -278,11 +282,40 @@ public class AjaxController extends DefaultController { pushJSON(wc, writer); } } - writer.append("],\"cmdcnt\":").append(Integer.toString(sum)).append("}"); + String historyPointId = getHistoryPointID(ureq); + String businessPath = getCurrentBusinessPath(ureq); + String documentTitle = getCurrentDocumentTitle(); + writer.append("],\"cmdcnt\":").append(Integer.toString(sum)).append(",") + .append("\"businessPath\":\"").append(businessPath).append("\",") + .append("\"historyPointId\":\"").append(historyPointId).append("\",") + .append("\"documentTitle\":\"").append(documentTitle).append("\"") + .append("}"); windowcommands.clear(); } } + private String getCurrentDocumentTitle() { + ChiefController ctrl = wboImpl.getChiefController(); + return ctrl == null ? null : ctrl.getWindowTitle(); + } + + private String getCurrentBusinessPath(UserRequest ureq) { + HistoryPoint p = ureq.getUserSession().getLastHistoryPoint(); + if(p != null && StringHelper.containsNonWhitespace(p.getBusinessPath())) { + List<ContextEntry> ces = p.getEntries(); + return BusinessControlFactory.getInstance().getAsAuthURIString(ces, true); + } + return ""; + } + + private String getHistoryPointID(UserRequest ureq) { + HistoryPoint p = ureq.getUserSession().getLastHistoryPoint(); + if(p != null && StringHelper.containsNonWhitespace(p.getBusinessPath())) { + return p.getUuid(); + } + return ""; + } + private void pushJSON(WindowCommand wc, Writer writer) throws IOException { Command c = wc.getCommand(); String winId = wc.getWindowBackOffice().getWindow().getDispatchID(); @@ -300,49 +333,34 @@ public class AjaxController extends DefaultController { public MediaResource extractMediaResource(boolean wrapHTML) { JSONObject json = getAndClearJSON(true); String res; - String jsonText = json.toString(); - //System.out.println("jsontext:"+jsonText); if (wrapHTML) { // most ajax responses are a lot smaller than 16k StringBuilder sb = new StringBuilder(16384); sb.append("<html><head><script type=\"text/javascript\">\n/* <![CDATA[ */\nfunction invoke(){var r=") - .append(jsonText).append("; ") - .append("if (parent!=self&&parent.window.o_info){") - .append("parent.window.o_ainvoke(r);") + .append(json.toString()).append("; ") + .append("if (parent!=self&&parent.window.o_info) {") + .append(" parent.window.o_ainvoke(r);") + .append(" try{ parent.window.o_removeIframe(document.defaultView.frameElement.id); } catch(e) {} ") // normal case: ajax result can be delivered into the hidden iframe. // else: no parent frame or parent frame is not olat -> reasons: // a) mouse-right-click to open in new tab/window // b) fast double-click when target causes a 302 and browser's window's document has been updated, but old link was still clickable // c) ... // -> in all cases, do not show the json command, but reload the window which contained the link clicked (= window id of url) - - .append("} else {") + .append("} else {") // inform user that ajax-request cannot be opened in a new window, // todo felix: maybe send back request to bookmark-launch current url? -> new window? // we could then come near to what the user probably wanted when he/she opened a link in a new window - .append("this.document.location=\"") - .append(StaticMediaDispatcher.createStaticURIFor("msg/json/en/info.html")) - .append("\";") - //.append("window.open(self.location+\"?o_win_jsontop=1\"); this.close();") - //.append("this.document.location=self.location+\"?o_win_jsontop=1\";") - .append("}}") - .append("\n/* ]]> */\n</script></head><body onLoad=\"invoke()\">"); - if (showJSON) { - try { - sb.append("<pre style=\"font-size:12px;\">len:").append(jsonText.length()).append(":\n").append(StringEscapeUtils.escapeHtml(json.toString(2))).append("</pre>"); - } catch (JSONException e) { - sb.append("error while prettyprinting json for debug mode: ").append(e.getMessage()); - } - } - sb.append("</body></html>"); - res = sb.toString(); + .append(" this.document.location=\"").append(StaticMediaDispatcher.createStaticURIFor("msg/json/en/info.html")).append("\";") + .append("}}") + .append("\n/* ]]> */\n</script></head><body onLoad=\"invoke()\"></body></html>"); + res = sb.toString(); } else { - res = jsonText; + res = json.toString(); } StringMediaResource smr = new StringMediaResource(); smr.setContentType("text/html;charset=utf-8"); - // TODO: check if it worked also with text/javascript smr.setEncoding("utf-8"); smr.setData(res); return smr; @@ -433,15 +451,6 @@ public class AjaxController extends DefaultController { } else { mainP.setContent(null); } - - } - - /** - * @param showJSON The showJSON to set. - */ - public void setShowJSON(boolean showJSON) { - this.showJSON = showJSON; - myContent.contextPut("showJSON", Boolean.valueOf(showJSON)); } /** diff --git a/src/main/java/org/olat/core/gui/control/winmgr/WindowBackOfficeImpl.java b/src/main/java/org/olat/core/gui/control/winmgr/WindowBackOfficeImpl.java index 5e849a90ad46432688c17f5c644984a6c8743c2c..bce9e37ee11d0ead3cc98450944de106e93cbb1d 100644 --- a/src/main/java/org/olat/core/gui/control/winmgr/WindowBackOfficeImpl.java +++ b/src/main/java/org/olat/core/gui/control/winmgr/WindowBackOfficeImpl.java @@ -81,42 +81,37 @@ public class WindowBackOfficeImpl implements WindowBackOffice { private static final OLog log = Tracing.createLoggerFor(WindowBackOfficeImpl.class); private final WindowManagerImpl winmgrImpl; - private Window window; + private final Window window; private WindowSettings settings; - private ChiefController windowOwner; + private final ChiefController windowOwner; private InterceptHandler linkedInterceptHandler; - // not private to avoid synthetic accessor - InterceptHandler debug_interceptHandler = null; - InterceptHandler inlineTranslation_interceptHandler = null; + private InterceptHandler debug_interceptHandler; + private InterceptHandler inlineTranslation_interceptHandler; + private AjaxController ajaxC; private GuiDebugDispatcherController guidebugC; private InlineTranslationInterceptHandlerController inlineTranslationC; - - private String iframeName; private List<ZIndexWrapper> guiMessages = new ArrayList<ZIndexWrapper>(); // request-transient render-related data private transient List<GenericEventListener> cycleListeners = new CopyOnWriteArrayList<GenericEventListener>(); - /** - * - */ - WindowBackOfficeImpl(final WindowManagerImpl winmgrImpl, String windowName, ChiefController windowOwner, int wboId, WindowSettings settings) { + WindowBackOfficeImpl(final WindowManagerImpl winmgrImpl, String windowName, ChiefController windowOwner, WindowSettings settings) { this.winmgrImpl = winmgrImpl; this.windowOwner = windowOwner; - this.iframeName = "oaa"+wboId; window = new Window(windowName, this); this.settings = settings; - // TODO make simpler, we do only need to support one intercept handler at a time! linkedInterceptHandler = new InterceptHandler() { + @Override public InterceptHandlerInstance createInterceptHandlerInstance() { InterceptHandler debugH = debug_interceptHandler; InterceptHandler inlineTranslationH = inlineTranslation_interceptHandler; final InterceptHandlerInstance debugI = debugH == null? null: debugH.createInterceptHandlerInstance(); final InterceptHandlerInstance inlineTranslationI = (inlineTranslationH == null ? null : inlineTranslationH.createInterceptHandlerInstance()); return new InterceptHandlerInstance() { + @Override public ComponentRenderer createInterceptComponentRenderer(ComponentRenderer originalRenderer) { ComponentRenderer toUse = originalRenderer; @@ -134,21 +129,28 @@ public class WindowBackOfficeImpl implements WindowBackOffice { /* (non-Javadoc) * @see org.olat.core.gui.control.WindowBackOffice#getWindow() */ + @Override public Window getWindow() { return window; } + @Override + public ChiefController getChiefController() { + return windowOwner; + } + /* (non-Javadoc) * @see org.olat.core.gui.control.WindowBackOffice#createDevelopmentController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl) */ + @Override public Controller createDevelopmentController(UserRequest ureq, WindowControl windowControl) { - DevelopmentController dc = new DevelopmentController(ureq, windowControl,this); - return dc; + return new DevelopmentController(ureq, windowControl,this); } /* (non-Javadoc) * @see org.olat.core.gui.control.WindowBackOffice#getGlobalSettings() */ + @Override public GlobalSettings getGlobalSettings() { return winmgrImpl.getGlobalSettings(); } @@ -181,7 +183,7 @@ public class WindowBackOfficeImpl implements WindowBackOffice { if (ajaxC != null) ajaxC.sendCommandTo(new WindowCommand(this,wco)); } - public void pushCommands(HttpServletRequest request, HttpServletResponse response) { + public void pushCommands(UserRequest ureq, HttpServletRequest request, HttpServletResponse response) { Writer w = null; try { boolean acceptJson = false; @@ -198,11 +200,11 @@ public class WindowBackOfficeImpl implements WindowBackOffice { if(acceptJson) { ServletUtil.setJSONResourceHeaders(response); w = response.getWriter(); - ajaxC.pushJSONAndClear(w); + ajaxC.pushJSONAndClear(ureq, w); } else { ServletUtil.setStringResourceHeaders(response); w = response.getWriter(); - ajaxC.pushResource(w, true); + ajaxC.pushResource(ureq, w, true); } } catch (IOException e) { log.error("Error pushing commans to the AJAX canal.", e); @@ -254,7 +256,7 @@ public class WindowBackOfficeImpl implements WindowBackOffice { public Controller createAJAXController(UserRequest ureq) { boolean ajaxEnabled = winmgrImpl.isAjaxEnabled(); - ajaxC = new AjaxController(ureq, this, ajaxEnabled, iframeName); + ajaxC = new AjaxController(ureq, this, ajaxEnabled); return ajaxC; } @@ -269,9 +271,7 @@ public class WindowBackOfficeImpl implements WindowBackOffice { return winmgrImpl; } - /** - * - */ + @Override public void dispose() { windowOwner.dispose(); } @@ -283,20 +283,6 @@ public class WindowBackOfficeImpl implements WindowBackOffice { if (ajaxC != null) ajaxC.setAjaxEnabled(enabled); } - /** - * @param enabled - */ - public void setHighLightingEnabled(boolean enabled) { - if (ajaxC != null) ajaxC.setHighLightingEnabled(enabled); - } - - /** - * @param enabled - */ - public void setShowJSON(boolean enabled) { - if (ajaxC != null) ajaxC.setShowJSON(enabled); - } - /** * @param refreshInterval */ @@ -316,18 +302,11 @@ public class WindowBackOfficeImpl implements WindowBackOffice { /* (non-Javadoc) * @see org.olat.core.gui.control.WindowBackOffice#getWindowManager() */ + @Override public WindowManager getWindowManager() { return winmgrImpl; } - - /** - * @return - */ - public String getIframeTargetName() { - return iframeName; - } - /* (non-Javadoc) * @see org.olat.core.gui.control.WindowBackOffice#createGuiStack(org.olat.core.gui.components.Component) */ diff --git a/src/main/java/org/olat/core/gui/control/winmgr/WindowManagerImpl.java b/src/main/java/org/olat/core/gui/control/winmgr/WindowManagerImpl.java index 819646a505918b53a09374cdad40ff495a98932f..377cbdeccb7d07408f4e81aa2fca7e41ca7c79b5 100644 --- a/src/main/java/org/olat/core/gui/control/winmgr/WindowManagerImpl.java +++ b/src/main/java/org/olat/core/gui/control/winmgr/WindowManagerImpl.java @@ -60,8 +60,6 @@ public class WindowManagerImpl extends BasicManager implements WindowManager { private int fontSize = 100; // default width - private int wboId = 0; - private PopupBrowserWindowControllerCreator pbwcc; public WindowManagerImpl() { @@ -91,11 +89,8 @@ public class WindowManagerImpl extends BasicManager implements WindowManager { } @Override - public void setAjaxWanted(UserRequest ureq, boolean enabled) { - boolean globalOk = Settings.isAjaxGloballyOn(); - boolean browserOk = !Settings.isBrowserAjaxBlacklisted(ureq); - boolean all = globalOk && browserOk && enabled; - setAjaxEnabled(all); + public void setAjaxWanted(UserRequest ureq) { + setAjaxEnabled(!Settings.isBrowserAjaxBlacklisted(ureq)); } /** @@ -120,22 +115,6 @@ public class WindowManagerImpl extends BasicManager implements WindowManager { wboImpl.setAjaxEnabled(enabled); } } - - @Override - public void setHighLightingEnabled(boolean enabled) { - for (WindowBackOfficeImpl wboImpl : wbos) { - wboImpl.setHighLightingEnabled(enabled); - } - } - - /* (non-Javadoc) - * @see org.olat.core.gui.WindowManager#setShowJSON(boolean) - */ - public void setShowJSON(boolean enabled) { - for (WindowBackOfficeImpl wboImpl : wbos) { - wboImpl.setShowJSON(enabled); - } - } public void setShowDebugInfo(boolean showDebugInfo) { this.showDebugInfo = showDebugInfo; @@ -158,7 +137,7 @@ public class WindowManagerImpl extends BasicManager implements WindowManager { */ @Override public WindowBackOffice createWindowBackOffice(String windowName, ChiefController owner, WindowSettings settings) { - WindowBackOfficeImpl wbo = new WindowBackOfficeImpl(this, windowName, owner, wboId++, settings); + WindowBackOfficeImpl wbo = new WindowBackOfficeImpl(this, windowName, owner, settings); wbos.add(wbo); return wbo; } diff --git a/src/main/java/org/olat/core/gui/control/winmgr/_content/serverpart.html b/src/main/java/org/olat/core/gui/control/winmgr/_content/serverpart.html index 62a5bf7570c0868381a77ff9f1ea02e7d6b8d0c8..ebce0e28446a0bbd5bd551c3641cbd59b589a136 100644 --- a/src/main/java/org/olat/core/gui/control/winmgr/_content/serverpart.html +++ b/src/main/java/org/olat/core/gui/control/winmgr/_content/serverpart.html @@ -20,10 +20,8 @@ o_info.mainwinref = this.window; o_info.wins = {}; o_info.poller = null; -var growthrate = 10; // -var pollminutes = 60; // -var showjson = $showJSON; - +var growthrate = 10; +var pollminutes = 60; var pollcount = 0; var pollError = 0; var pollgrowth = 0; @@ -47,9 +45,14 @@ function tick () { timestampLastPoll = now; pollcount++; pollgrowth = Math.ceil((this.period+pollgrowth)*(100+growthrate)/100) - this.period; - o_info.ajaxpp = jQuery.ajax({method:'POST', url:'$mapuri/', success:onPollSuccess, error:onPollFailure}); - //var idl = (now - o_info.lastClickTime)/1000; - //log("sent poll request. idle="+idl+"s gr="+growthrate+" g="+pollgrowth+" c="+pollcount+" eff="+Math.floor(idl/pollcount*1000)); + o_info.ajaxpp = jQuery.ajax({ + method:'POST', + url:'$mapuri/', + cache: false, + success:onPollSuccess, + error:onPollFailure + }); + } } else { stopped = true; @@ -88,9 +91,9 @@ function tick () { jQuery(document).ready(initPolling); #if ($isAdmin) -##check whether polling started or not. Wrap in ext makes it more stable +##check whether polling started or not. Wrap it makes it more stable jQuery(function() { - setTimeout( function(){ if (!o_info.ajaxpp) { + setTimeout( function(){ if (!o_info.ajaxpp) { showMessageBox('error', 'error', 'Some core functionality could not be started. Please log out of OLAT and login again.'); if(jQuery(document).ooLog().isDebugEnabled()) jQuery(document).ooLog('debug','Could not initialize polling!', "serverpart.html"); }},60000); @@ -112,22 +115,7 @@ function onPollSuccess(content, s, response) { function onPollFailure() { pollError++; } - /* ]]> */ </script> $r.render("pollperiodPanel") - -#if ($showJSON) -## COMMENTED out for browser-history reasons -JSON <iframe src="javascript:false;document.write('');" name="$iframeName" class="o_debug_json" ></iframe> -#else -## for safari: we cannot use display:none which would be the obvious choice here -<div id="oaawrp" style="visibility:hidden;width:0px;height:0px"> -## don't use the document.write approach, triggers an 'page contains insecure elements' warning (OLAT-4548). Load empty.html instead -<iframe src='$r.staticLink("empty.html")' name="$iframeName" id="$iframeName" width="1" height="1" onload="clearAfterAjaxIframeCall()"></iframe> -## try javascript:void(0) -</div> -#end -## below we need to provide an action attribute to make it html 4.01 transitional - <form id="o_oaap" method="post" action="#" onsubmit="return false" target="oaa0"><input type="hidden" name="v"></form> </div> \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/dev/controller/DevelopmentController.java b/src/main/java/org/olat/core/gui/dev/controller/DevelopmentController.java index d2902bd7ab1a8006ee904f719945d56a2bf83a4a..615a92127abfb7faa181f9d215bea84a542e4d31 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/DevelopmentController.java +++ b/src/main/java/org/olat/core/gui/dev/controller/DevelopmentController.java @@ -77,9 +77,6 @@ public class DevelopmentController extends BasicController { private Link web10Link; private Link web20Link; - private Link web20hlLink; - - private Link showJson; private Link showComponentTree; private List<Link> modes = new ArrayList<Link>(); @@ -115,22 +112,27 @@ public class DevelopmentController extends BasicController { // a special case here: these link must work in regular mode (normal uri with full screen refresh (as // opposed to partial page refresh )in order to switch modes correctly. // (grouping only needed for coloring) - modes.add(web10Link = LinkFactory.deAjaxify(LinkFactory.createLink("web10", myContent, this))); - modes.add(web20Link = LinkFactory.deAjaxify(LinkFactory.createLink("web20", myContent, this))); - modes.add(web20hlLink = LinkFactory.deAjaxify(LinkFactory.createLink("web20hl", myContent, this))); - modes.add(debugLink = LinkFactory.deAjaxify(LinkFactory.createLink("debug", myContent, this))); - modes.add(showJson = LinkFactory.deAjaxify(LinkFactory.createLink("showJson", myContent, this))); + web10Link = LinkFactory.createLink("web10", myContent, this); + web10Link.setAjaxEnabled(false); + web20Link =LinkFactory.createLink("web20", myContent, this); + web20Link.setAjaxEnabled(false); + debugLink = LinkFactory.createLink("debug", myContent, this); + debugLink.setAjaxEnabled(false); + + modes.add(web10Link); + modes.add(web20Link); + modes.add(debugLink); if (winMgrImpl.isAjaxEnabled()) { - chosenMode = web20Link; - } else { - chosenMode = web10Link; + chosenMode = web20Link; + } else { + chosenMode = web10Link; } updateUI(); // commands - showComponentTree = LinkFactory.deAjaxify(LinkFactory.createButton("showComponentTree", myContent, this)); + showComponentTree = LinkFactory.createButton("showComponentTree", myContent, this); + showComponentTree.setAjaxEnabled(false); myContent.contextPut("compdump", ""); - //boolean iframepost = wboImpl.getGlobalSettings().getAjaxFlags().isIframePostEnabled(); myContent.contextPut("sys", this); toggleAutorefresh = LinkFactory.createButtonSmall("toggleAutorefresh", myContent, this); @@ -143,14 +145,14 @@ public class DevelopmentController extends BasicController { myContent.put("bandwidth",bandwithController.getInitialComponent()); mainpanel = new Panel("developermainpanel"); - Component protectedMainPanel = DebugHelper.createDebugProtectedWrapper(mainpanel); devToolLink = LinkFactory.createCustomLink("devTool", "devTool", "", Link.NONTRANSLATED, myContent, this); devToolLink.setIconLeftCSS("o_icon o_icon_dev o_icon-fw"); devToolLink.setCustomEnabledLinkCSS("o_dev hidden-print"); devToolLink.setTitle(translate("devTool")); + + Component protectedMainPanel = DebugHelper.createDebugProtectedWrapper(mainpanel); spacesaverController = new ExpColController(ureq, getWindowControl(), false, protectedMainPanel, devToolLink); - mainComp = DebugHelper.createDebugProtectedWrapper(spacesaverController.getInitialComponent()); putInitialPanel(mainComp); } @@ -192,8 +194,6 @@ public class DevelopmentController extends BasicController { // choose regular mode winMgrImpl.setShowDebugInfo(false); winMgrImpl.setAjaxEnabled(false); - winMgrImpl.setHighLightingEnabled(false); - winMgrImpl.setShowJSON(false); winMgrImpl.setIdDivsForced(false); chosenMode = web10Link; updateUI(); @@ -201,27 +201,13 @@ public class DevelopmentController extends BasicController { // enable ajax / generic-dom-replacement GDR mode winMgrImpl.setShowDebugInfo(false); winMgrImpl.setAjaxEnabled(true); - winMgrImpl.setHighLightingEnabled(false); - winMgrImpl.setShowJSON(false); winMgrImpl.setIdDivsForced(false); chosenMode = web20Link; updateUI(); - } else if (source == web20hlLink) { - // ajax mode with highlighting - winMgrImpl.setShowDebugInfo(false); - winMgrImpl.setAjaxEnabled(true); - winMgrImpl.setHighLightingEnabled(true); - winMgrImpl.setShowJSON(false); - //brasato:: setIdDivsForced is removed!! check if it works - winMgrImpl.setIdDivsForced(false); - chosenMode = web20hlLink; - updateUI(); } else if (source == debugLink) { // debug mode requires web 1.0 mode at the moment winMgrImpl.setShowDebugInfo(true); winMgrImpl.setAjaxEnabled(false); - winMgrImpl.setHighLightingEnabled(false); - winMgrImpl.setShowJSON(false); winMgrImpl.setIdDivsForced(false); chosenMode = debugLink; updateUI(); @@ -235,14 +221,6 @@ public class DevelopmentController extends BasicController { updateComponentTree(); } treeShown = !treeShown; - } else if (source == showJson) { - winMgrImpl.setShowDebugInfo(false); - winMgrImpl.setAjaxEnabled(true); - winMgrImpl.setHighLightingEnabled(true); - winMgrImpl.setShowJSON(true); - winMgrImpl.setIdDivsForced(false); - chosenMode = showJson; - updateUI(); } else if (source == toggleAutorefresh) { autorefresh = !autorefresh; if (autorefresh) { diff --git a/src/main/java/org/olat/core/gui/dev/controller/SourceViewController.java b/src/main/java/org/olat/core/gui/dev/controller/SourceViewController.java index e9f693d3f628a6325cb27f12d98bbacf950265df..1fdd6d314aca048be108d467552619140e1d350a 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/SourceViewController.java +++ b/src/main/java/org/olat/core/gui/dev/controller/SourceViewController.java @@ -61,13 +61,13 @@ public class SourceViewController extends BasicController { private static final String TEXT_HTML_CHARSET_UTF_8 = "text/html; charset=utf-8"; private VelocityContainer content; private Link viewJSource, viewVeloctiySource; - private Class clazz; + private Class<?> clazz; private VelocityContainer vc, sourceview; private CloseableModalController view; private final static String HTML_START = "<html><body>"; private final static String HTML_STOP = "</body></html>"; - public SourceViewController(UserRequest ureq, WindowControl control, Class clazz, VelocityContainer vc) { + public SourceViewController(UserRequest ureq, WindowControl control, Class<?> clazz, VelocityContainer vc) { super(ureq, control); this.clazz = clazz; this.vc = vc; diff --git a/src/main/java/org/olat/core/gui/dev/controller/_content/index.html b/src/main/java/org/olat/core/gui/dev/controller/_content/index.html index 4f0d0fdfc355f4f43ac0c97d9e92725a75b001dd..ea1920bf3b94c137df0bb3151fe516431ab68583 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_content/index.html +++ b/src/main/java/org/olat/core/gui/dev/controller/_content/index.html @@ -11,8 +11,6 @@ <li #if ($debugActive) class="active" #end>$r.render("debug")</li> <li #if ($web10Active) class="active" #end>$r.render("web10")</li> <li #if ($web20Active) class="active" #end>$r.render("web20")</li> - <li #if ($web20hlActive) class="active" #end>$r.render("web20hl")</li> - <li #if ($showJsonActive) class="active" #end>$r.render("showJson")</li> </ul> </fieldset> <fieldset class="clearfix small"> diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_ar.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_ar.properties index 1b135457738297017658eba05eec532f14fd4260..2e68a81a55040ebbe23970a1554cfb43c1f62c96 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_ar.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_ar.properties @@ -4,9 +4,6 @@ debugView=\u0627\u0644\u062A\u0635\u062D\u064A\u062D devTool=\u0623\u062F\u0627\u0629 \u0627\u0644\u062A\u0637\u0648\u064A\u0631 jsource=\u0639\u0631\u0636 \u0634\u0641\u0631\u0629 \u0645\u0635\u062F\u0631 \u0627\u0644\u062C\u0627\u0641\u0627 showComponentTree=\u0634\u062C\u0631\u0629 \u0627\u0644\u0639\u0646\u0635\u0631 -showJson=\u0648\u064A\u0628 2.0 vsource=\u0639\u0631\u0636 \u0634\u0641\u0631\u0629 \u0631\u0645\u0632 \u0627\u0644\u0633\u0631\u0639\u0629 web10=\u0648\u064A\u0628 1.0 web20=\u0648\u064A\u0628 2.0 -web20hl=\u0648\u064A\u0628 2.0 -web21=\u0648\u064A\u0628 2.0 (\u0633\u0647\u0648\u0644\u0629 \u0627\u0644\u0648\u0635\u0648\u0644) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_bg.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_bg.properties index 0b1ad3d2867a05a5693c2fd433ffec169bdc1334..d3fc76dbe329028c3fa3c2966ae7c159996b5576 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_bg.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_bg.properties @@ -4,9 +4,6 @@ debugView=\u041D\u0430\u043C\u0435\u0440\u0438 \u0438 \u043F\u043E\u043F\u0440\u devTool=\u0418\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442 \u0437\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0430 jsource=\u0412\u0438\u0436\u0442\u0435 \u0438\u0437\u0445\u043E\u0434\u043D\u0438\u044F Java \u043A\u043E\u0434 showComponentTree=\u041A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u043D\u043E \u0434\u044A\u0440\u0432\u043E -showJson=\u0423\u0435\u0431 2.0 (\u043F\u043E\u043A\u0430\u0436\u0435\u0442\u0435 JSON) vsource=\u0412\u0438\u0436\u0442\u0435 \u0438\u0437\u0445\u043E\u0434\u043D\u0438\u044F \u043A\u043E\u0434 \u0437\u0430 \u0441\u043A\u043E\u0440\u043E\u0441\u0442 web10=\u0423\u0435\u0431 1.0 web20=\u0423\u0435\u0431 2.0 -web20hl=\u0423\u0435\u0431 2.0 (\u043C\u0430\u0440\u043A\u0438\u0440\u0430\u043D\u0435) -web21=\u0423\u0435\u0431 2a (\u0414\u043E\u0441\u0442\u044A\u043F\u043D\u043E\u0441\u0442) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_cs.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_cs.properties index eb4ae00d4d6765ed0bd1955174e903f3ad27e003..1ae7b7977f08f22bdda02ab06c5b2be1ac18019c 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_cs.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_cs.properties @@ -3,8 +3,5 @@ debug=Debug debugView=Debug devTool=V\u00FDvojov\u00FD n\u00E1stroj showComponentTree=Strom komponent -showJson=Web 2.0 (zobrazit JSON) web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (zv\u00EDrazn\u011Bn\u00ED) -web21=Web 2a (P\u0159\u00EDstupnost) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_de.properties index 750de46d1f30d6bfe663ab237fde0069719fb555..a94145760b09b97fa50ee2e9cd4b0f1d7aa6c7cd 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_de.properties @@ -3,10 +3,7 @@ debug=Debug debugView=Debug devTool=Entwicklungswerkzeug showComponentTree=Component Tree -showJson=Web 2.0 (show JSON) web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (highlighting) -web21=Web 2a (Accessibility) jsource=View Java Source Code vsource=View Velocity Source Code diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_el.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_el.properties index a27916691a4cfa3c4767fbfa96f219a111a09d95..41cdc6ba40eaf2cc33417aebff6fb78330d735a1 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_el.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_el.properties @@ -4,9 +4,6 @@ debugView=\u0391\u03C0\u03BF\u03BC\u03AC\u03BA\u03C1\u03C5\u03BD\u03C3\u03B7 \u0 devTool=\u0395\u03C1\u03B3\u03B1\u03BB\u03B5\u03AF\u03BF \u03B1\u03BD\u03AC\u03C0\u03C4\u03C5\u03BE\u03B7\u03C2 jsource=\u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03C0\u03B7\u03B3\u03B1\u03AF\u03BF\u03C5 \u03BA\u03CE\u03B4\u03B9\u03BA\u03B1 Java showComponentTree=\u0394\u03AD\u03BD\u03C4\u03C1\u03BF \u03C3\u03C5\u03BD\u03B9\u03C3\u03C4\u03C9\u03C3\u03CE\u03BD -showJson=Web 2.0 (show JSON) vsource=\u03A0\u03C1\u03BF\u03B2\u03BF\u03BB\u03AE \u03C4\u03B1\u03C7\u03CD\u03C4\u03B7\u03C4\u03B1\u03C2 \u03C0\u03B7\u03B3\u03B1\u03AF\u03BF\u03C5 \u03BA\u03CE\u03B4\u03B9\u03BA\u03B1 web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (highlighting) -web21=Web 2a (\u03A0\u03C1\u03BF\u03C3\u03B2\u03B1\u03C3\u03B9\u03BC\u03CC\u03C4\u03B7\u03C4\u03B1) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_en.properties index 0fdd2c30e315fbb18941a97a147ede6dfb456838..46e20152de1a88ad58adff881b4a0d43c8d6124d 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_en.properties @@ -4,9 +4,6 @@ debugView=Debug devTool=Development tool jsource=View Java source code showComponentTree=Component tree -showJson=Web 2.0 (show JSON) vsource=View velocity source code web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (highlighting) -web21=Web 2a (accessibility) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_es.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_es.properties index ac2db2e4697c5553e946e6670c0f7392724b6360..f76e8b909ed0365918967392281c7267569233b8 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_es.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_es.properties @@ -4,9 +4,6 @@ debugView=Debug devTool=Herramienta de desarrollo jsource=Ver C\u00F3digo Fuente Java showComponentTree=Component Tree -showJson=Web 2.0 (show JSON) vsource=Ver C\u00F3digo Fuente Velocity web10=Web 1.0\r\n web20=Web 2.0 -web20hl=Web 2.0 (highlighting) -web21=Web 2a (Accessibility) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_fr.properties index a1e43bdf09438ddab40c7738bb164a67e48ea797..1d56f611f8c741e96c74e9ceb77e1434d38d4aac 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_fr.properties @@ -4,9 +4,6 @@ debugView=Debug devTool=Outil de d\u00E9veloppement jsource=Voir source code java showComponentTree=Component Tree -showJson=Web 2.0 (show JSON) vsource=Voir code source velocity web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (highlighting) -web21=Web 2a (Accessibility) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_it.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_it.properties index 6487ddebd02b33aee3f4b27219dc2b837b614913..875ea19a67b27effa351c865866d508685d14781 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_it.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_it.properties @@ -4,9 +4,6 @@ debugView=Debug devTool=Strumento di sviluppo jsource=View Java Source Code showComponentTree=Component Tree -showJson=Web 2.0 (show JSON) vsource=View Velocity Source Code web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (highlighting) -web21=Web 2a (Accessibility) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_jp.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_jp.properties index d15b9b37a461cfbd2387a4106a625f836e785364..344182c2e0442c4792df5b90aabe6c5f031ee839 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_jp.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_jp.properties @@ -4,9 +4,6 @@ debugView=\u30C7\u30D0\u30C3\u30B0 devTool=\u958B\u767A\u30C4\u30FC\u30EB jsource=Java\u30BD\u30FC\u30B9\u30B3\u30FC\u30C9\u3092\u8868\u793A\u3059\u308B showComponentTree=\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u30C4\u30EA\u30FC -showJson=Web 2.0 (JSON\u3092\u8868\u793A\u3059\u308B) vsource=Velocity\u30BD\u30FC\u30B9\u30B3\u30FC\u30C9\u3092\u8868\u793A\u3059\u308B web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (\u5F37\u8ABF\u8868\u793A) -web21=Web 2a (\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_lt.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_lt.properties index 74c1775bf926fa942de70b35c2408958be47e3ff..533a02ecc04df71ad0c08e9ed5ef23174e7a2a64 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_lt.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_lt.properties @@ -3,8 +3,5 @@ debug=Pa\u0161alinimas debugView=Derinti devTool=Projektavimo priemon\u0117 showComponentTree=Element\u0173 medis -showJson=Web 2.0 (rodyti JSON) web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (pa\u017Eenklinimas) -web21=Web 2a (Pritaikymas ne\u012Fgaliesiems) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_nl_NL.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_nl_NL.properties index d70627bf0ae827ded57027e700a507cfa1eb38eb..2a143434233a024570441a51a8471d652a4a6068 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_nl_NL.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_nl_NL.properties @@ -4,9 +4,6 @@ debugView=Debug devTool=Ontwikkelingstool jsource=Java broncode bekijken showComponentTree=Boomstructuur van de componenten -showJson=Web 2.0 (toon JSON) vsource=Velocity broncode bekijken web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (markeren) -web21=Web 2a (Toegankelijkheid) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_pl.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_pl.properties index e1a207b1a41065c306b854bdaa02258056882d61..02a5009199f49832e9287e010123164f6cd8c385 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_pl.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_pl.properties @@ -4,9 +4,6 @@ debugView=Debug devTool=Narz\u0119dzie deweloperskie jsource=Obejrzyj kod \u017Ar\u00F3d\u0142owy Java showComponentTree=Component tree -showJson=Web 2.0 (show JSON) vsource=View velocity source code web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (highlighting) -web21=Web 2a (Accessibility) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_pt_BR.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_pt_BR.properties index 99a481287526d3972a91c1ddb6162b726ce13774..3a99364eafdcb4c345e66166ec2f115c627cdb28 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_pt_BR.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_pt_BR.properties @@ -4,9 +4,6 @@ debugView=Debug devTool=Ferramenta de desenvolvimento jsource=Ver c\u00F3digo-fonte Java showComponentTree=\u00C1rvore componente -showJson=Web 2.0 (mostrar JSON) vsource=Ver c\u00F3digo-fonte velocity web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (destacando) -web21=Web 2a (Acessibilidade) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_ru.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_ru.properties index 7000036008f4beb7333e9295f99834675e4121b5..9a691ca382d755b5d592046638110011c7645209 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_ru.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_ru.properties @@ -4,9 +4,6 @@ debugView=\u041E\u043B\u0430\u0434\u043A\u0430 (Debug) devTool=\u041F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0430 \u0434\u043B\u044F \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u0447\u0438\u043A\u043E\u0432 jsource=\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0439 Java-\u043A\u043E\u0434 showComponentTree=\u0414\u0435\u0440\u0435\u0432\u043E \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u043E\u0432 -showJson=Web 2.0 (show JSON) vsource=\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0438\u0441\u0445\u043E\u0434\u043D\u044B\u0439 Velocity-\u043A\u043E\u0434 web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (highlighting) -web21=Web 2a (Accessibility) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_sq.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_sq.properties index 8d29ace479114c92eec4e132eae17fea6f30ef24..406fd3e03160ec6a8092f4378ed7fe73cec3d3a6 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_sq.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_sq.properties @@ -3,8 +3,5 @@ debug=Korrigjo debugView=Korrigjo devTool=Vegla e zhvillimit showComponentTree=Komponent trung -showJson=Web 2.0 (shfaq JSON) web10=Ueb 1.0 web20=Ueb 2.0 -web20hl=Web 2.0 (highlighting) -web21=Web 2a (Accessibility) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_zh_CN.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_zh_CN.properties index 245685e3f87b8c3bd464810d03f10f7d47411117..f1436d1edcf727a3ee2cd81cdc028d0f47f9e1de 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_zh_CN.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_zh_CN.properties @@ -4,9 +4,6 @@ debugView=\u8C03\u8BD5 devTool=\u5F00\u53D1\u5DE5\u5177 jsource=\u6D4F\u89C8Java\u6E90\u4EE3\u7801 showComponentTree=\u7EC4\u4EF6\u7ED3\u6784 -showJson=Web 2.0(\u663E\u793AJSON) vsource=\u6D4F\u89C8velocity\u6E90\u7801 web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0(\u9AD8\u4EAE\u663E\u793A) -web21=Web 2a(\u53EF\u8BBF\u95EE\u6027) diff --git a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_zh_TW.properties b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_zh_TW.properties index fb444059c809e2bf7d63b8c1cf201c3a97a472ec..e4132065ec2e3b30115dc0e83cf4c7045829d1ef 100644 --- a/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_zh_TW.properties +++ b/src/main/java/org/olat/core/gui/dev/controller/_i18n/LocalStrings_zh_TW.properties @@ -4,9 +4,6 @@ debugView=\u9664\u932F devTool=\u958B\u767C\u5DE5\u5177 jsource=\u89C0\u770B Java \u539F\u59CB\u78BC showComponentTree=\u5143\u4EF6\u6A39 -showJson=Web 2.0 (\u986F\u793A JSON) vsource=\u89C0\u770B velocity \u539F\u59CB\u78BC web10=Web 1.0 web20=Web 2.0 -web20hl=Web 2.0 (\u9AD8\u4EAE) -web21=Web 2a (\u7121\u969C\u7919\u74B0\u5883) diff --git a/src/main/java/org/olat/core/gui/exception/ExceptionWindowController.java b/src/main/java/org/olat/core/gui/exception/ExceptionWindowController.java index d57f76c14b8d1d8dced77f3ba8ed0c277eb8fa32..060f3491bcd1068759d22aaaef5f5abd365dc1f2 100644 --- a/src/main/java/org/olat/core/gui/exception/ExceptionWindowController.java +++ b/src/main/java/org/olat/core/gui/exception/ExceptionWindowController.java @@ -236,7 +236,12 @@ public class ExceptionWindowController extends DefaultChiefController { w.setContentPane(msg); setWindow(w); } - + + @Override + public String getWindowTitle() { + return null; + } + @Override public void addBodyCssClass(String cssClass) { // diff --git a/src/main/java/org/olat/core/gui/media/NothingChangedMediaResource.java b/src/main/java/org/olat/core/gui/media/NothingChangedMediaResource.java index a57ccb3eb6fe79685ff0dfe508e0cbdf00394d90..5d135efe2d1db09af0f9a99bcc224cb605961bb0 100644 --- a/src/main/java/org/olat/core/gui/media/NothingChangedMediaResource.java +++ b/src/main/java/org/olat/core/gui/media/NothingChangedMediaResource.java @@ -41,6 +41,6 @@ public class NothingChangedMediaResource extends DefaultMediaResource { */ @Override public void prepare(HttpServletResponse hres) { - hres.setStatus(HttpServletResponse.SC_OK); + hres.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } } \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/media/ServletUtil.java b/src/main/java/org/olat/core/gui/media/ServletUtil.java index dd68e23423b7f560aee3639496755de0dc9e9db4..b34e04c1ffe9841d078b4de663e278e9bcf7848b 100644 --- a/src/main/java/org/olat/core/gui/media/ServletUtil.java +++ b/src/main/java/org/olat/core/gui/media/ServletUtil.java @@ -79,6 +79,17 @@ public class ServletUtil { } } + public static boolean acceptJson(HttpServletRequest request) { + boolean acceptJson = false; + for(Enumeration<String> headers=request.getHeaders("Accept"); headers.hasMoreElements(); ) { + String accept = headers.nextElement(); + if(accept.contains("application/json")) { + acceptJson = true; + } + } + return acceptJson; + } + /** * @param httpReq * @param httpResp diff --git a/src/main/java/org/olat/core/gui/render/EmptyURLBuilder.java b/src/main/java/org/olat/core/gui/render/EmptyURLBuilder.java index aa91ad0cef2563f035228d6d8e753a34b4d47bb9..0a12c77265661ee0b3b9261aa420197d446b14c6 100644 --- a/src/main/java/org/olat/core/gui/render/EmptyURLBuilder.java +++ b/src/main/java/org/olat/core/gui/render/EmptyURLBuilder.java @@ -30,17 +30,7 @@ import org.olat.core.gui.components.Component; public class EmptyURLBuilder extends URLBuilder { public EmptyURLBuilder() { - super(null, null, null, null); - } - - @Override - public void appendTarget(StringOutput sb) { - // nothing to do - } - - @Override - public void buildJavaScriptBgCommand(StringOutput buf, String[] keys, String[] values, int mode) { - // nothing to do + super(null, null, null); } @Override @@ -53,11 +43,6 @@ public class EmptyURLBuilder extends URLBuilder { // nothing to do } - @Override - public void buildURI(StringOutput buf, String[] keys, String[] values, String modURI) { - // nothing to do - } - @Override public void buildURI(StringOutput buf, String[] keys, String[] values) { // nothing to do diff --git a/src/main/java/org/olat/core/gui/render/URLBuilder.java b/src/main/java/org/olat/core/gui/render/URLBuilder.java index 91f8cdcc79b6f0421386e04e4adaf88ed9aebc68..cfd324ed5040d646a0638c59c23c1b994efe6beb 100644 --- a/src/main/java/org/olat/core/gui/render/URLBuilder.java +++ b/src/main/java/org/olat/core/gui/render/URLBuilder.java @@ -32,9 +32,10 @@ import java.util.regex.Pattern; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.Component; +import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.control.winmgr.AJAXFlags; -import org.olat.core.gui.control.winmgr.WindowBackOfficeImpl; import org.olat.core.logging.AssertException; +import org.olat.core.util.StringHelper; /** * @@ -46,15 +47,10 @@ public class URLBuilder { private static final Pattern p2 = Pattern.compile("%2F"); private final String uriPrefix; - private final String windowID; private final String timestampID; private String componentID; private String componentTimestamp; - - private final String iframeTargetName; - - private final WindowBackOfficeImpl wboImpl; /** * @param uriPrefix @@ -62,20 +58,17 @@ public class URLBuilder { * @param timestampID * @param businessControlPath may be null */ - public URLBuilder(String uriPrefix, String windowID, String timestampID, WindowBackOfficeImpl wboImpl) { + public URLBuilder(String uriPrefix, String windowID, String timestampID) { this.uriPrefix = uriPrefix; // e.g. /olat/auth this.windowID = windowID; this.timestampID = timestampID; - this.wboImpl = wboImpl; - // brasato:: add helper method a la window.createredirecturi so we need not check on null below - see call hierarchy of this constructor - this.iframeTargetName = wboImpl == null? null: wboImpl.getIframeTargetName(); } /** * @return */ public URLBuilder createCopyFor(Component source) { - URLBuilder n = new URLBuilder(uriPrefix, windowID, timestampID, wboImpl); + URLBuilder n = new URLBuilder(uriPrefix, windowID, timestampID); // adjust the component id of the urlbuilder for the new component n.componentID = source.getDispatchID(); // for ajax-mode needed: (but we set it anyway) @@ -85,61 +78,6 @@ public class URLBuilder { return n; } - /** - * appends the "target" attribute that is needed for ajax-links. the caller has to make sure that this.isAjaxOn() is true. - * @param sb - */ - public void appendTarget(StringOutput sb) { - sb.append(" target=\"").append(iframeTargetName).append("\""); - } - - /** - * builds a java script command that executes in background iframe or as document.location.replace depending on the AJAX mode - * @param buf the buffer to write to - * @param keys the keys - * @param values the values. - * @param mode - */ - public void buildJavaScriptBgCommand(StringOutput buf, String[] keys, String[] values, int mode) { - if (mode == AJAXFlags.MODE_TOBGIFRAME) { - buf.append("frames['"); - buf.append(iframeTargetName); - buf.append("']."); - } - buf.append("location.href = \""); - // add URI - buildURI(buf, keys, values, mode); - buf.append("\""); - // DON'T append anything after this. The JS code might append some URL - // parameter to this command! - } - - /** - * builds a java script command that executes in background iframe or as document.location.replace depending on the AJAX mode. - * This version also includes safety checks for not breaking other running ajax requests - * TODO: may only offer one method but check for usage of o_beforeserver first! - * @param buf the buffer to write to - * @param keys the keys - * @param values the values. - * @param mode - * @param singe or double quote as string termination - */ - public void buildJavaScriptBgCommand(StringOutput buf, String[] keys, String[] values, int mode, boolean useSingleQuotes) { - String quote = "\""; - if (useSingleQuotes) quote = "'"; - if (mode == AJAXFlags.MODE_TOBGIFRAME) { - buf.append("if(!o_info.linkbusy){o_beforeserver();frames['"); - buf.append(iframeTargetName); - buf.append("']."); - } - - buf.append("location.href=").append(quote); - // add URI - buildURI(buf, keys, values, mode); - if (mode == AJAXFlags.MODE_TOBGIFRAME) buf.append(quote).append(";}"); - else buf.append(quote); - } - /** * builds an uri. neither key nor values may contain the character * UserRequest.PARAM_DELIM which is a ":" (colon). in case you think you @@ -155,7 +93,7 @@ public class URLBuilder { * @param mode indicates what kind of link it is (0 normal, 1 into background-iframe, ...) */ public void buildURI(StringOutput buf, String[] keys, String[] values, String modURI, int mode) { - StringBuilder result = new StringBuilder(100); + StringOutput result = new StringOutput(100); result.append(uriPrefix); encodeParams(result, mode); @@ -168,15 +106,12 @@ public class URLBuilder { } } - result.append('/'); - if (modURI != null) result.append(modURI); - //FIXME:fj:a urlEncodeUTF8 is slow; improve the regexp, also convert only the modURI to utf-8? + result.append("/"); + if (modURI != null) { + result.append(modURI); + } buf.append(encodeUrl(result.toString())); } - - public void buildURI(StringOutput buf, String[] keys, String[] values, String modURI) { - buildURI(buf, keys, values, modURI, 0); - } /** * @param buf @@ -197,13 +132,88 @@ public class URLBuilder { public void buildURI(StringOutput buf, String[] keys, String[] values, int mode) { buildURI(buf, keys, values, null, mode); } + + public void buildURI(StringOutput buf, int mode, NameValuePair... pairs) { + final String[] keys; + final String[] values; + if(pairs == null || pairs.length == 0) { + keys = values = new String[0]; + } else { + keys = new String[pairs.length]; + values = new String[pairs.length]; + for(int i=pairs.length; i-->0; ) { + keys[i] = pairs[i].getName(); + values[i] = pairs[i].getValue(); + } + } + + buildURI(buf, keys, values, null, mode); + } + + public StringOutput buildHrefAndOnclick(StringOutput sb, boolean ajaxEnabled, NameValuePair... commands) { + return buildHrefAndOnclick(sb, null, ajaxEnabled, true, true, commands); + } + + public StringOutput buildHrefAndOnclick(StringOutput sb, String urlEnding, boolean ajaxEnabled, boolean dirtyCheck, boolean pushState, NameValuePair... commands) { + sb.append(" href=\""); + buildURI(sb, ajaxEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL, commands); + sb.append("\" onclick=\""); + if(ajaxEnabled) { + buildXHREvent(sb, urlEnding, dirtyCheck, pushState, commands).append(" return false;"); + } else { + sb.append("return o2cl();"); + } + sb.append("\" "); + return sb; + } + + public StringOutput buildXHREvent(StringOutput sb, String urlEnding, boolean dirtyCheck, boolean pushState, NameValuePair... commands) { + return openXHREvent(sb, urlEnding, dirtyCheck, pushState, commands).append(");"); + } + + public StringOutput openXHREvent(StringOutput sb, String urlEnding, boolean dirtyCheck, boolean pushState, NameValuePair... commands) { + sb.append("o_XHREvent('").append(uriPrefix); + encodeParams(sb, AJAXFlags.MODE_TOBGIFRAME); + sb.append("/"); + if(StringHelper.containsNonWhitespace(urlEnding)) { + sb.append(urlEnding); + } + sb.append("',").append(dirtyCheck).append(",").append(pushState); + commandParameters(sb, commands); + return sb; + } + + public StringOutput getXHRNoResponseEvent(StringOutput sb, String urlEnding, NameValuePair... commands) { + return openXHRNoResponseEvent(sb, urlEnding, commands).append(");"); + } + + public StringOutput openXHRNoResponseEvent(StringOutput sb, String urlEnding, NameValuePair... commands) { + sb.append("o_XHRNFEvent('").append(uriPrefix); + encodeParams(sb, AJAXFlags.MODE_TOBGIFRAME); + sb.append("/"); + if(StringHelper.containsNonWhitespace(urlEnding)) { + sb.append(urlEnding); + } + sb.append("'"); + commandParameters(sb, commands); + return sb; + } + + private final void commandParameters(StringOutput sb, NameValuePair... commands) { + if(commands != null && commands.length > 0 && commands[0] != null) { + for(NameValuePair command:commands) { + sb.append(",'") + .append(command.getName()).append("','").append(command.getValue()).append("'"); + } + } + } /** * encodes the internal params (timestamp, window id, and component id) * * @return */ - private StringBuilder encodeParams(StringBuilder result, int mode) { + private StringOutput encodeParams(StringOutput result, int mode) { // encode framework parameters result.append(windowID == null ? "0" : windowID); result.append(UserRequest.PARAM_DELIM); diff --git a/src/main/java/org/olat/core/gui/render/intercept/debug/GuiDebugDispatcherController.java b/src/main/java/org/olat/core/gui/render/intercept/debug/GuiDebugDispatcherController.java index 1b39569ababea5cfb06fb8c28e6c91d3ea738476..13b1f8720285e0ac3d9f0f787e91ed64a8da781e 100644 --- a/src/main/java/org/olat/core/gui/render/intercept/debug/GuiDebugDispatcherController.java +++ b/src/main/java/org/olat/core/gui/render/intercept/debug/GuiDebugDispatcherController.java @@ -28,7 +28,6 @@ */ package org.olat.core.gui.render.intercept.debug; -import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -39,7 +38,6 @@ import org.olat.core.gui.components.Component; import org.olat.core.gui.components.ComponentRenderer; import org.olat.core.gui.components.delegating.DelegatingComponent; import org.olat.core.gui.components.panel.StackedPanel; -import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; @@ -55,10 +53,6 @@ import org.olat.core.gui.render.intercept.DebugHelper; import org.olat.core.gui.render.intercept.InterceptHandler; import org.olat.core.gui.render.intercept.InterceptHandlerInstance; import org.olat.core.gui.translator.Translator; -import org.olat.core.helpers.Settings; -import org.olat.core.util.WebappHelper; -import org.olat.core.util.vfs.LocalFileImpl; -import org.olat.core.util.vfs.VFSLeaf; /** * Description:<br> @@ -83,7 +77,7 @@ public class GuiDebugDispatcherController extends BasicController implements Int super(ureq, wControl); dc = new DelegatingComponent("deleg", new ComponentRenderer() { - + @Override public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) { // save urlbuilder for later use (valid only for one request scope thus @@ -91,22 +85,18 @@ public class GuiDebugDispatcherController extends BasicController implements Int debugURLBuilder = ubu; } + @Override public void renderHeaderIncludes(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderingState rstate) { // void } + @Override public void renderBodyOnLoadJSFunctionCall(Renderer renderer, StringOutput sb, Component source, RenderingState rstate) { // void } }); - /*{ - @Override - /*public boolean isDirty() { - return true; - } - }; - */ + dc.addListener(this); dc.setDomReplaceable(false); mainP = putInitialPanel(dc); @@ -118,12 +108,9 @@ public class GuiDebugDispatcherController extends BasicController implements Int * org.olat.core.gui.components.Component, * org.olat.core.gui.control.Event) */ + @Override public void event(UserRequest ureq, Component source, Event event) { if (source == dc) { - String cid = ureq.getParameter("cid"); - Component infoComponent = idToComponent.get(cid); - - String com = ureq.getParameter("com"); // ------- open java IDE ------- if (com.equals("ojava")) { @@ -135,23 +122,11 @@ public class GuiDebugDispatcherController extends BasicController implements Int } catch (IOException e) { getWindowControl().setError("Could not render java source code. Make sure you have set the source path (olat and olatcore) in the config (olat.properties) and have the source files there available"); } - } else if (com.equals("vc")) { - // ------- open velocity container for editing ------- - VelocityContainer vc = (VelocityContainer) infoComponent; - String velocityTemplatePath = WebappHelper.getSourcePath()+"/"+vc.getPage(); - VFSLeaf vcContentFile = new LocalFileImpl(new File(velocityTemplatePath)); - boolean readOnly = Settings.isReadOnlyDebug(); - vcEditorController = new PlainTextEditorController(ureq, getWindowControl(), vcContentFile, "utf-8", true, true, null); - vcEditorController.setReadOnly(readOnly); - vcEditorController.addControllerListener(this); - VelocityContainer vcWrap = createVelocityContainer("vcWrapper"); - if (readOnly) vcWrap.contextPut("readOnly", Boolean.TRUE); - vcWrap.put("editor", vcEditorController.getInitialComponent()); - getWindowControl().pushAsModalDialog(DebugHelper.createDebugProtectedWrapper(vcWrap)); - } + } } } + @Override protected void event(UserRequest ureq, Controller source, Event event) { if (source == vcEditorController) { // saving was already done by editor, just pop @@ -162,8 +137,9 @@ public class GuiDebugDispatcherController extends BasicController implements Int /** * @see org.olat.core.gui.control.DefaultController#doDispose(boolean) */ + @Override protected void doDispose() { - // + // } /* @@ -171,9 +147,11 @@ public class GuiDebugDispatcherController extends BasicController implements Int * * @see org.olat.core.gui.render.debug.DebugHandler#createDebugComponentRenderer(org.olat.core.gui.components.ComponentRenderer) */ + @Override public ComponentRenderer createInterceptComponentRenderer(final ComponentRenderer originalRenderer) { return new ComponentRenderer() { + @Override public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) { if (debugURLBuilder != null && !DebugHelper.isProtected(source)) { @@ -195,15 +173,6 @@ public class GuiDebugDispatcherController extends BasicController implements Int sb.append("Info: <b>").append(source.getComponentName()).append("</b> ("+cnameShort+") id:"); sb.append(String.valueOf(source.getDispatchID())).append(" level:").append(lev); - // offer velocity editor if appropriate. - // todo: let component provide component-specific editors - if (source instanceof VelocityContainer) { - VelocityContainer vcc = (VelocityContainer) source; - sb.append("<br />velocity: <a href=\""); - debugURLBuilder.buildURI(sb, new String[] { "cid", "com" }, new String[] { String.valueOf(did), "vc" }); - sb.append("\">").append("page:").append(vcc.getPage()+"</a>"); - } - Controller listC = Util.getListeningControllerFor(source); if (listC != null) { sb.append("<br /><b>controller:</b> <a target=\"_blank\" href=\""); @@ -256,11 +225,13 @@ public class GuiDebugDispatcherController extends BasicController implements Int } } + @Override public void renderHeaderIncludes(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderingState rstate) { originalRenderer.renderHeaderIncludes(renderer, sb, source, ubu, translator, rstate); } + @Override public void renderBodyOnLoadJSFunctionCall(Renderer renderer, StringOutput sb, Component source, RenderingState rstate) { originalRenderer.renderBodyOnLoadJSFunctionCall(renderer, sb, source, rstate); } @@ -273,6 +244,7 @@ public class GuiDebugDispatcherController extends BasicController implements Int * * @see org.olat.core.gui.render.debug.DebugHandler#createDebugHandlerRenderInstance() */ + @Override public InterceptHandlerInstance createInterceptHandlerInstance() { // clear all previous data and return this. // otherwise this map would collect all components from all clicks, but we @@ -282,7 +254,6 @@ public class GuiDebugDispatcherController extends BasicController implements Int return this; } - /** * @param showDebugInfo */ @@ -293,5 +264,4 @@ public class GuiDebugDispatcherController extends BasicController implements Int mainP.setContent(null); } } - } diff --git a/src/main/java/org/olat/core/gui/render/intercept/debug/_content/vcWrapper.html b/src/main/java/org/olat/core/gui/render/intercept/debug/_content/vcWrapper.html deleted file mode 100644 index 85bc8b0f6478dd7ac6792691b355d54ad6900c39..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/core/gui/render/intercept/debug/_content/vcWrapper.html +++ /dev/null @@ -1,6 +0,0 @@ -<h1>Edit velocity html template</h1> -$r.render("editor") -#if ($readOnly) -<span style="font-size:16px; color:red">To enable write permissions, please set the -readOnlyDebug flag to false in coreconfig.xml</span> -#end \ No newline at end of file diff --git a/src/main/java/org/olat/core/gui/render/velocity/VelocityRenderDecorator.java b/src/main/java/org/olat/core/gui/render/velocity/VelocityRenderDecorator.java index 60cfdc390c581e9a5f1c1936bd20ef8a806aedfe..c2936f98f9993ea23d26bf147975cf55235b8ddb 100644 --- a/src/main/java/org/olat/core/gui/render/velocity/VelocityRenderDecorator.java +++ b/src/main/java/org/olat/core/gui/render/velocity/VelocityRenderDecorator.java @@ -41,6 +41,7 @@ import org.olat.core.CoreSpringFactory; import org.olat.core.commons.contextHelp.ContextHelpModule; import org.olat.core.commons.services.help.HelpModule; import org.olat.core.gui.components.Component; +import org.olat.core.gui.components.form.flexible.impl.NameValuePair; import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.winmgr.AJAXFlags; import org.olat.core.gui.render.Renderer; @@ -135,21 +136,8 @@ public class VelocityRenderDecorator implements Closeable { renderer.getUrlBuilder().buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command }, isIframePostEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); return sb; } - - /** - * renderer a target="oaa" if ajax-mode is on, otherwise returns an empty string - * @return - */ - public StringOutput bgTarget() { - StringOutput sb = new StringOutput(16); - if (isIframePostEnabled) { - renderer.getUrlBuilder().appendTarget(sb); - } - return sb; - } /** - * FIXME:fj:b search occurences for $r.commandURI and try to replace them with $r.link(...) or such * @param command * @return */ @@ -158,36 +146,76 @@ public class VelocityRenderDecorator implements Closeable { renderer.getUrlBuilder().buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command }); return sb; } + + public String hrefAndOnclick(String command, boolean dirtyCheck, boolean pushState) { + renderer.getUrlBuilder().buildHrefAndOnclick(target, null, isIframePostEnabled, dirtyCheck, pushState, + new NameValuePair(VelocityContainer.COMMAND_ID, command)); + return ""; + } + + public String hrefAndOnclick(String command, boolean dirtyCheck, boolean pushState, String key, String value) { + renderer.getUrlBuilder().buildHrefAndOnclick(target, null, isIframePostEnabled, dirtyCheck, pushState, + new NameValuePair(VelocityContainer.COMMAND_ID, command), + new NameValuePair(key, value)); + return ""; + } + + public String hrefAndOnclick(String command, boolean dirtyCheck, boolean pushState, String key1, String value1, String key2, String value2) { + renderer.getUrlBuilder().buildHrefAndOnclick(target, null, isIframePostEnabled, dirtyCheck, pushState, + new NameValuePair(VelocityContainer.COMMAND_ID, command), + new NameValuePair(key1, value1), + new NameValuePair(key2, value2)); + return ""; + } /** - * Creates a java script fragment to execute a background request. In ajax - * mode the request uses the ajax asynchronous methods, in legacy mode it - * uses a standard document.location.request + * Creates a java script fragment to execute a ajax background request. * * @param command - * @param paramKey - * @param paramValue * @return */ - public StringOutput javaScriptBgCommand(String command, String paramKey, String paramValue) { - StringOutput sb = new StringOutput(100); - renderer.getUrlBuilder().buildJavaScriptBgCommand(sb, new String[] { VelocityContainer.COMMAND_ID, paramKey }, new String[] { command, paramValue }, isIframePostEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - return sb; + public String javaScriptCommand(String command) { + renderer.getUrlBuilder().buildXHREvent(target, null, false, false, + new NameValuePair(VelocityContainer.COMMAND_ID, command)); + return ""; } - + /** - * Creates a java script fragment to execute a background request. In ajax - * mode the request uses the ajax asynchronous methods, in legacy mode it - * uses a standard document.location.request + * Creates the start of a java script fragment to execute a background request. It's + * up to you to close the javascript call. * * @param command * @return */ - public StringOutput javaScriptBgCommand(String command) { - StringOutput sb = new StringOutput(100); - renderer.getUrlBuilder().buildJavaScriptBgCommand(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command}, isIframePostEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); - return sb; - } + public String openJavaScriptCommand(String command) { + renderer.getUrlBuilder().openXHREvent(target, null, false, false, + new NameValuePair(VelocityContainer.COMMAND_ID, command)); + return ""; + } + + /** + * + * @param command + * @return + */ + public String backgroundCommand(String command) { + renderer.getUrlBuilder().getXHRNoResponseEvent(target, null, + new NameValuePair(VelocityContainer.COMMAND_ID, command)); + return ""; + } + + public String backgroundCommand(String command, String key, String value) { + renderer.getUrlBuilder().getXHRNoResponseEvent(target, null, + new NameValuePair(VelocityContainer.COMMAND_ID, command), + new NameValuePair(key, value)); + return ""; + } + + public String openBackgroundCommand(String command) { + renderer.getUrlBuilder().openXHRNoResponseEvent(target, null, + new NameValuePair(VelocityContainer.COMMAND_ID, command)); + return ""; + } /** * Use it to create the action for a handmade form in a velocity template, @@ -429,19 +457,18 @@ public class VelocityRenderDecorator implements Closeable { public StringOutput contextHelpRelativeLink(String bundleName, String pageName, String linkText) { StringOutput sb = new StringOutput(100); if (ContextHelpModule.isContextHelpEnabled()) { - sb.append("<a href=\""); + sb.append("<a "); + NameValuePair[] commands; if (bundleName == null) { - renderer.getUrlBuilder().buildURI(sb, new String[] { VelocityContainer.COMMAND_ID }, new String[] { pageName }, isIframePostEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); + commands = new NameValuePair[]{ new NameValuePair(VelocityContainer.COMMAND_ID, pageName) }; } else { - renderer.getUrlBuilder().buildURI(sb, new String[] { VelocityContainer.COMMAND_ID, PARAM_CHELP_BUNDLE }, new String[] { pageName, bundleName }, isIframePostEnabled? AJAXFlags.MODE_TOBGIFRAME : AJAXFlags.MODE_NORMAL); + commands = new NameValuePair[]{ + new NameValuePair(VelocityContainer.COMMAND_ID, pageName), + new NameValuePair(PARAM_CHELP_BUNDLE, bundleName) + }; } - sb.append("\" "); - if(isIframePostEnabled) { - renderer.getUrlBuilder().appendTarget(sb); - } - sb.append(">"); - sb.append(linkText); - sb.append("</a>"); + renderer.getUrlBuilder().buildHrefAndOnclick(sb, isIframePostEnabled, commands); + sb.append(">").append(linkText).append("</a>"); } return sb; } diff --git a/src/main/java/org/olat/core/helpers/Settings.java b/src/main/java/org/olat/core/helpers/Settings.java index e674c3a62dafff8c8c0893a7a54832b9f066af8f..617599bce207b24f9d4786c361b2be9dc409a362 100644 --- a/src/main/java/org/olat/core/helpers/Settings.java +++ b/src/main/java/org/olat/core/helpers/Settings.java @@ -63,9 +63,6 @@ import org.springframework.core.io.Resource; public class Settings implements Initializable, Destroyable, GenericEventListener { private static boolean debug = false; - private static boolean allowLoadtestMode = false; - private static boolean readOnlyDebug = false; - private static boolean ajaxGloballyOnBoolean = false; private static String guiThemeIdentifyer = "light"; private static String htmlEditorContentCssClassPrefixes; private static List<Pattern> ajaxBlacklistPatterns = new ArrayList<Pattern>(); @@ -165,55 +162,6 @@ public class Settings implements Initializable, Destroyable, GenericEventListene return debug; } - /** - * @return if ajax mode is system-wide enabled or not - */ - public static boolean isAjaxGloballyOn() { - return ajaxGloballyOnBoolean; - } - - - public static boolean isAllowLoadtestMode() { - return allowLoadtestMode; - } - - /** - * [spring] - * @param allowLoadtestMode - */ - public void setAllowLoadtestMode(boolean allowLoadtestMode) { - Settings.allowLoadtestMode = allowLoadtestMode; - } - - public static boolean isReadOnlyDebug() { - return readOnlyDebug; - } - - /** - * [spring] - * @param readOnlyDebug - */ - public void setReadOnlyDebug(boolean readOnlyDebug) { - Settings.readOnlyDebug = readOnlyDebug; - } - - /** - * affects only new usersessions - * [spring] - * @param - */ - public void setAjaxGloballyOn(boolean ajaxGloballyOn) { - Settings.ajaxGloballyOnBoolean = ajaxGloballyOn; - } - - /** - * for direct static access from code - * @param ajaxGloballyOn - */ - public static void setAjaxGloballyEnabled(boolean ajaxGloballyOn) { - Settings.ajaxGloballyOnBoolean = ajaxGloballyOn; - } - /** * Set the list of regular expressions that represent user agents that are not * allowed to use the ajax mode. diff --git a/src/main/java/org/olat/core/id/context/BusinessControlFactory.java b/src/main/java/org/olat/core/id/context/BusinessControlFactory.java index 7000806bd191cbfc73ee37349b708f138bd3b421..257cbc4c541938d4581154384fef0384568f6ead 100644 --- a/src/main/java/org/olat/core/id/context/BusinessControlFactory.java +++ b/src/main/java/org/olat/core/id/context/BusinessControlFactory.java @@ -422,7 +422,22 @@ public class BusinessControlFactory { StringBuilder retVal = new StringBuilder(); retVal.append(Settings.getServerContextPathURI()) .append("/url/"); + + return appendToURIString(retVal, ceList, normalize); + } + public String getAsAuthURIString(List<ContextEntry> ceList, boolean normalize) { + StringBuilder retVal = new StringBuilder(); + retVal.append(Settings.getServerContextPathURI()) + .append("/auth/"); + + if(ceList == null || ceList.isEmpty()) { + return retVal.toString(); + } + return appendToURIString(retVal, ceList, normalize); + } + + private String appendToURIString(StringBuilder retVal, List<ContextEntry> ceList, boolean normalize) { String lastEntryString = null; for (ContextEntry contextEntry : ceList) { String ceStr = contextEntry != null ? contextEntry.toString() : "NULL_ENTRY"; diff --git a/src/main/java/org/olat/core/id/context/HistoryManager.java b/src/main/java/org/olat/core/id/context/HistoryManager.java index 2c7b0f9ede48225a98cd12bb94796b6da9e04e4c..2d2b789a0814e16f7e8aefbf1f0a02ff0d7587e2 100644 --- a/src/main/java/org/olat/core/id/context/HistoryManager.java +++ b/src/main/java/org/olat/core/id/context/HistoryManager.java @@ -26,13 +26,15 @@ import java.io.IOException; import org.olat.core.commons.modules.bc.FolderConfig; import org.olat.core.id.Identity; -import org.olat.core.manager.BasicManager; +import org.olat.core.logging.OLog; +import org.olat.core.logging.Tracing; import org.olat.core.util.FileUtils; import org.olat.core.util.resource.Resourceable; import org.olat.core.util.xml.XStreamHelper; import org.olat.group.BusinessGroup; import org.olat.group.BusinessGroupImpl; import org.olat.repository.RepositoryEntry; +import org.springframework.stereotype.Service; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.converters.ConversionException; @@ -45,7 +47,10 @@ import com.thoughtworks.xstream.converters.ConversionException; * Initial Date: 26 jan. 2011 <br> * @author srosse, stephane.rosse@frentix.com, www.frentix.com */ -public class HistoryManager extends BasicManager { +@Service("historyManager") +public class HistoryManager { + + private static final OLog log = Tracing.createLoggerFor(HistoryManager.class); private static HistoryManager THIS; private static XStream historyReadStream = XStreamHelper.createXStreamInstance(); @@ -97,7 +102,7 @@ public class HistoryManager extends BasicManager { historyWriteStream.toXML(historyPoint, out); FileUtils.closeSafely(out); } catch (Exception e) { - logError("UserSession:::logging off write resume: ", e); + log.error("UserSession:::logging off write resume: ", e); } } @@ -107,10 +112,10 @@ public class HistoryManager extends BasicManager { File resumeXml = new File(pathHomePage, "resume.xml"); return readHistory(resumeXml); } catch(ConversionException e) { - logWarn("Cannot read resume file: ", e); + log.warn("Cannot read resume file: ", e); return null; } catch (Exception e) { - logError("Cannot read resume file: ", e); + log.error("Cannot read resume file: ", e); return null; } } @@ -123,7 +128,7 @@ public class HistoryManager extends BasicManager { resumeXml.delete(); } } catch (Exception e) { - logError("Can not delete history file", e); + log.error("Can not delete history file", e); } } diff --git a/src/main/java/org/olat/core/id/context/HistoryModule.java b/src/main/java/org/olat/core/id/context/HistoryModule.java index dcac1f58e4189e9ee3f80f3fe967710370ffea34..fbf9c70f8ad2db1c23ef934c68c2338a1b84665c 100644 --- a/src/main/java/org/olat/core/id/context/HistoryModule.java +++ b/src/main/java/org/olat/core/id/context/HistoryModule.java @@ -19,10 +19,12 @@ */ package org.olat.core.id.context; -import org.olat.core.configuration.AbstractOLATModule; -import org.olat.core.configuration.ConfigOnOff; -import org.olat.core.configuration.PersistedProperties; +import org.olat.core.configuration.AbstractSpringModule; import org.olat.core.util.StringHelper; +import org.olat.core.util.coordinate.CoordinatorManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; /** * @@ -32,45 +34,24 @@ import org.olat.core.util.StringHelper; * Initial Date: 26 jan. 2011 <br> * @author srosse, stephane.rosse@frentix.com, www.frentix.com */ -public class HistoryModule extends AbstractOLATModule implements ConfigOnOff { +@Service("historyModule") +public class HistoryModule extends AbstractSpringModule { - private static final String BACK_ENABLED_PROP = "back.enabled"; - private static final String BACK_ENABLED_DEFAULT_PROP = "back.enabled.default"; - private static final String MOD_ENABLED_PROP = "history.enabled"; private static final String RESUME_ENABLED_PROP = "resume.enabled"; private static final String RESUME_ENABLED_DEFAULT_PROP = "resume.enabled.default"; - private boolean enabled; - private boolean backEnabled; - private boolean backDefaultSetting; + @Value("${history.resume.enabled:true}") private boolean resumeEnabled; + @Value("${history.resume.enabled.default:ondemand}") private String resumeDefaultSetting; - /** - * [used by Spring] - */ - private HistoryModule() { - // + @Autowired + public HistoryModule(CoordinatorManager coordinatorManager) { + super(coordinatorManager); } @Override public void init() { - //back enabled/disabled - String enabledObj = getStringPropertyValue(MOD_ENABLED_PROP, true); - if(StringHelper.containsNonWhitespace(enabledObj)) { - enabled = "true".equals(enabledObj); - } - - String backObj = getStringPropertyValue(BACK_ENABLED_PROP, true); - if(StringHelper.containsNonWhitespace(backObj)) { - backEnabled = "true".equals(backObj); - } - - String backDefSettings = getStringPropertyValue(BACK_ENABLED_DEFAULT_PROP, true); - if(StringHelper.containsNonWhitespace(backDefSettings)) { - backDefaultSetting = "true".equals(backDefSettings); - } - String resumeObj = getStringPropertyValue(RESUME_ENABLED_PROP, true); if(StringHelper.containsNonWhitespace(resumeObj)) { resumeEnabled = "true".equals(resumeObj); @@ -80,44 +61,15 @@ public class HistoryModule extends AbstractOLATModule implements ConfigOnOff { if(StringHelper.containsNonWhitespace(resumeDefSettings)) { resumeDefaultSetting = resumeDefSettings; } - - logInfo("Back/resume module is enabled: " + Boolean.toString(enabled)); - } - - @Override - protected void initDefaultProperties() { - enabled = getBooleanConfigParameter(MOD_ENABLED_PROP, true); - backEnabled = getBooleanConfigParameter(BACK_ENABLED_PROP, true); - backDefaultSetting = getBooleanConfigParameter(BACK_ENABLED_DEFAULT_PROP, true); - resumeEnabled = getBooleanConfigParameter(RESUME_ENABLED_PROP, true); - resumeDefaultSetting = getStringConfigParameter(RESUME_ENABLED_DEFAULT_PROP, "ondemand", true); } @Override protected void initFromChangedProperties() { init(); } - - @Override - public void setPersistedProperties(PersistedProperties persistedProperties) { - this.moduleConfigProperties = persistedProperties; - } - - @Override - public boolean isEnabled() { - return enabled; - } - - public boolean isBackEnabled() { - return enabled && backEnabled; - } - - public boolean isBackDefaultSetting() { - return backDefaultSetting; - } public boolean isResumeEnabled() { - return enabled && resumeEnabled; + return resumeEnabled; } public String getResumeDefaultSetting() { @@ -127,10 +79,4 @@ public class HistoryModule extends AbstractOLATModule implements ConfigOnOff { public void setResumeDefaultSetting(String resumeDefaultSetting) { this.resumeDefaultSetting = resumeDefaultSetting; } - - public void setEnabled(boolean enabled) { - if(this.enabled != enabled) { - setStringProperty(BACK_ENABLED_PROP, Boolean.toString(enabled), true); - } - } } diff --git a/src/main/java/org/olat/core/id/context/_spring/historyCorecontext.xml b/src/main/java/org/olat/core/id/context/_spring/historyCorecontext.xml deleted file mode 100644 index 5b68dd81dfecf61b72a2f347bdb496cf932fa0c0..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/core/id/context/_spring/historyCorecontext.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - - <bean id="historyModule" class="org.olat.core.id.context.HistoryModule" > - <property name="persistedProperties"> - <bean class="org.olat.core.configuration.PersistedProperties" scope="prototype" init-method="init" destroy-method="destroy" - depends-on="coordinatorManager,org.olat.core.util.WebappHelper"> - <constructor-arg index="0" ref="coordinatorManager"/> - <constructor-arg index="1" ref="historyModule" /> - </bean> - </property> - </bean> - - <!-- default configuration --> - <bean id="historyModuleDefaultConfiguration" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> - <property name="targetObject" ref="historyModule" /> - <property name="targetMethod" value="init" /> - <property name="arguments"> - <value> - history.enabled=true - back.enabled=${history.back.enabled} - back.enabled.default=${history.back.enabled.default} - resume.enabled=${history.resume.enabled} - resume.enabled.default=${history.resume.enabled.default} - </value> - </property> - </bean> - - - <bean id="historyManager" class="org.olat.core.id.context.HistoryManager" > - - </bean> - -</beans> diff --git a/src/main/java/org/olat/core/servlets/OpenOLATServlet.java b/src/main/java/org/olat/core/servlets/OpenOLATServlet.java index b9d767f92b01321fa554af93efe49a64e8fd9b99..eee9b0e2b9acc96f67ab6f9d145b692bd57c03de 100644 --- a/src/main/java/org/olat/core/servlets/OpenOLATServlet.java +++ b/src/main/java/org/olat/core/servlets/OpenOLATServlet.java @@ -151,6 +151,7 @@ public class OpenOLATServlet extends HttpServlet { sessionStatsManager.incrementRequest(); sessionStatsManager.incrementConcurrentCounter(); } + try{ final String method = req.getMethod(); diff --git a/src/main/java/org/olat/core/util/SessionInfo.java b/src/main/java/org/olat/core/util/SessionInfo.java index c786608ca6d7a4eb78c875ace40e93106f1dd306..edf6c2a3ab5c8067026dcaeac7da9f849b8829a6 100644 --- a/src/main/java/org/olat/core/util/SessionInfo.java +++ b/src/main/java/org/olat/core/util/SessionInfo.java @@ -294,7 +294,9 @@ public class SessionInfo implements Serializable { String deliveryMode = "web 1.0"; // default, e.g. when connecting with webdav if (ureq != null) { // calculate ajax delivery mode - if (Windows.getWindows(ureq).getWindowManager().isAjaxEnabled()) deliveryMode = "web 2.0"; + if (Windows.getWindows(ureq).getWindowManager().isAjaxEnabled()) { + deliveryMode = "web 2.0"; + } } this.webMode = deliveryMode; } diff --git a/src/main/java/org/olat/core/util/UserSession.java b/src/main/java/org/olat/core/util/UserSession.java index 6abc731345d37ef58bdd5a88ebdfe868850458c7..6dee18d7f9463313e740199dd340f283084a13b5 100644 --- a/src/main/java/org/olat/core/util/UserSession.java +++ b/src/main/java/org/olat/core/util/UserSession.java @@ -112,6 +112,7 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList nonClearedStore = new HashMap<String,Object>(); singleUserSystemBus = CoordinatorManager.getInstance().getCoordinator().createSingleUserInstance(); savedSession = true; + authenticated = false;//reset authentication return this; } @@ -367,6 +368,18 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList return history.lastElement(); } + public HistoryPoint getHistoryPoint(String id) { + if(history.isEmpty()) { + return null; + } + for(HistoryPoint point:history) { + if(id.equals(point.getUuid())) { + return point; + } + } + return null; + } + public HistoryPoint popLastHistoryEntry() { if(history.isEmpty()) return null; history.pop();//current point diff --git a/src/main/java/org/olat/core/util/_spring/utilCorecontext.xml b/src/main/java/org/olat/core/util/_spring/utilCorecontext.xml index b4dcd6f50c0f5e66d61f86ecd8939f36841af518..91e96044cb3ac48d43ec95d696cc5b9a941d635f 100644 --- a/src/main/java/org/olat/core/util/_spring/utilCorecontext.xml +++ b/src/main/java/org/olat/core/util/_spring/utilCorecontext.xml @@ -60,18 +60,6 @@ <property name="legacyContext" value="${server.legacy.context}" /> <!-- true enable debug mode, not for production mode but for productive hours ;) --> <property name="debug" value="${olat.debug}" /> - <!-- if readOnlyDebug, then no file changes can be made in the debug mode --> - <property name="readOnlyDebug" value="false" /> - <!-- - For Performance and/or Functional Tests. - if allowLoadtestMode is set to true, it is possible to switch a session to loadtest mode - using the url parameter ?loadtest and ?noloadtest even without logging in. - Thus the same urls can be reused over and over again, which is needed for tools like JMeter or such. - - Not to be used for productive mode! (no double post checks, asynchronous inline rendering does not work etc.)- - --> - <property name="allowLoadtestMode" value="${allow.loadtest.mode}" /> - <!-- true when ajax should be enabled system-wide (but for non-supported browsers the system will automatically fallback to web 1.0 mode) --> - <property name="ajaxGloballyOn" value="true" /> <!-- List of user agents that should be served using the web 1.0 mode (no ajax DOM replacement). A user agent that matches against one of the regular expressions below will be blocked. --> diff --git a/src/main/java/org/olat/core/util/tree/TreeHelper.java b/src/main/java/org/olat/core/util/tree/TreeHelper.java index 0cc9bd8c59a372f5aea933d11d79e27a2beb68cf..fb95474d18364d5a89a78175cd368157a7bbd60e 100644 --- a/src/main/java/org/olat/core/util/tree/TreeHelper.java +++ b/src/main/java/org/olat/core/util/tree/TreeHelper.java @@ -125,23 +125,6 @@ public class TreeHelper { return cur; } - public static String buildTreePath(TreeNode node) { - // if in load performance mode -> generate the treeposition and include it as param, - // since the nodeid itself is random and thus not replayable - StringBuilder conPath = new StringBuilder(); - // we need at least one char in the var, even if we click the root node - conPath.append('_'); - TreeNode cur = node; - TreeNode par = (TreeNode) cur.getParent(); - while (par != null) { - int cpos = cur.getPosition(); - conPath.append(cpos).append('_'); - cur = par; - par = (TreeNode) cur.getParent(); - } - return conPath.toString(); - } - public static List<TreeNode> getTreePath(TreeNode node) { List<TreeNode> conPath = new ArrayList<TreeNode>(); for (TreeNode cur = node; cur != null; cur = (TreeNode) cur.getParent()) { diff --git a/src/main/java/org/olat/course/assessment/bulk/BulkAssessment_1_SelectCourseNodeStep.java b/src/main/java/org/olat/course/assessment/bulk/BulkAssessment_1_SelectCourseNodeStep.java index 0eef192c47307acba10c7f7bcb0e1dedf42a2e2f..623f83e06875324a6366d18588af9bce43cc3480 100644 --- a/src/main/java/org/olat/course/assessment/bulk/BulkAssessment_1_SelectCourseNodeStep.java +++ b/src/main/java/org/olat/course/assessment/bulk/BulkAssessment_1_SelectCourseNodeStep.java @@ -52,7 +52,7 @@ public class BulkAssessment_1_SelectCourseNodeStep extends BasicStep { @Override public StepFormController getStepController(UserRequest ureq, WindowControl wControl, StepsRunContext context, Form form) { - form.setMultipartEnabled(true, Integer.MAX_VALUE); + form.setMultipartEnabled(true); SelectCourseNodeStepForm ctrl = new SelectCourseNodeStepForm(ureq, wControl, courseOres, context, form); return ctrl; } diff --git a/src/main/java/org/olat/course/assessment/bulk/BulkAssessment_2_DatasStep.java b/src/main/java/org/olat/course/assessment/bulk/BulkAssessment_2_DatasStep.java index 6f312cdc08deea2b2479b6cea30122a23723b18f..7f6a36ad7d3b5fd49d167cb1583f3f9e222b8139 100644 --- a/src/main/java/org/olat/course/assessment/bulk/BulkAssessment_2_DatasStep.java +++ b/src/main/java/org/olat/course/assessment/bulk/BulkAssessment_2_DatasStep.java @@ -80,7 +80,7 @@ public class BulkAssessment_2_DatasStep extends BasicStep { @Override public StepFormController getStepController(UserRequest ureq, WindowControl wControl, StepsRunContext context, Form form) { - form.setMultipartEnabled(true, Integer.MAX_VALUE); + form.setMultipartEnabled(true); if(courseNode != null) { context.put("courseNode", courseNode); } diff --git a/src/main/java/org/olat/course/assessment/ui/AssessmentModeGuardController.java b/src/main/java/org/olat/course/assessment/ui/AssessmentModeGuardController.java index 992f391b5f3740aa6b42093e6d19d4d18fec1c3e..8ee5fff86fdba0bd99fa0863679b90b49470ea37 100644 --- a/src/main/java/org/olat/course/assessment/ui/AssessmentModeGuardController.java +++ b/src/main/java/org/olat/course/assessment/ui/AssessmentModeGuardController.java @@ -26,7 +26,6 @@ import java.util.Locale; import org.olat.NewControllerFactory; import org.olat.core.gui.UserRequest; -import org.olat.core.gui.Windows; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.countdown.CountDownComponent; import org.olat.core.gui.components.link.Link; @@ -382,7 +381,7 @@ public class AssessmentModeGuardController extends BasicController implements Ge ureq.getUserSession().setAssessmentModes(null); OLATResourceable resource = mode.getResource(); ureq.getUserSession().setLockResource(resource, mode); - Windows.getWindows(ureq).getChiefController().lockResource(resource); + getWindowControl().getWindowBackOffice().getChiefController().lockResource(resource); fireEvent(ureq, new ChooseAssessmentModeEvent(mode)); String businessPath = "[RepositoryEntry:" + mode.getRepositoryEntryKey() + "]"; diff --git a/src/main/java/org/olat/course/editor/ChooseNodeController.java b/src/main/java/org/olat/course/editor/ChooseNodeController.java index 248e5ea639e285caf61f24caedc8908909695a76..317dfa0e915e6553a4a454c17ec1357884d6f6ea 100644 --- a/src/main/java/org/olat/course/editor/ChooseNodeController.java +++ b/src/main/java/org/olat/course/editor/ChooseNodeController.java @@ -75,7 +75,7 @@ public class ChooseNodeController extends BasicController { for (String courseNodeAlias : cnf.getRegisteredCourseNodeAliases()) { CourseNodeConfiguration cnConfig = cnf.getCourseNodeConfiguration(courseNodeAlias); if(cnConfig.isDeprecated()) { - continue; + //continue; } try { diff --git a/src/main/java/org/olat/course/nodes/basiclti/LTIRunController.java b/src/main/java/org/olat/course/nodes/basiclti/LTIRunController.java index 4bd592521e78e3cf2aecfddb28b9aac8609389d1..c3b22bcd93d507f19f12b40dabb1e167114d74fd 100644 --- a/src/main/java/org/olat/course/nodes/basiclti/LTIRunController.java +++ b/src/main/java/org/olat/course/nodes/basiclti/LTIRunController.java @@ -34,7 +34,6 @@ import org.imsglobal.basiclti.BasicLTIUtil; import org.olat.core.CoreSpringFactory; import org.olat.core.dispatcher.mapper.Mapper; import org.olat.core.gui.UserRequest; -import org.olat.core.gui.Windows; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.link.LinkFactory; @@ -323,9 +322,6 @@ public class LTIRunController extends BasicController { mainPanel.setContent(startPage); } else if(display == LTIDisplayOptions.window) { mainPanel.setContent(startPage); - } else if(display == LTIDisplayOptions.fullscreen && Windows.getWindows(ureq).getChiefController() == null) { - // directly opening the LTI after resume is not supported - mainPanel.setContent(startPage); } else { openBasicLTIContent(ureq); } @@ -335,7 +331,7 @@ public class LTIRunController extends BasicController { // container is "run", "runFullscreen" or "runPopup" depending in configuration doBasicLTI(ureq, run); if (display == LTIDisplayOptions.fullscreen) { - ChiefController cc = Windows.getWindows(ureq).getChiefController(); + ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController(); if (cc != null) { thebaseChief = cc; thebaseChief.getScreenMode().setMode(Mode.full); diff --git a/src/main/java/org/olat/course/nodes/gta/ui/_content/coach.html b/src/main/java/org/olat/course/nodes/gta/ui/_content/coach.html index d12f8e71f013960064403f84bfdc9d93bc6a90d2..66313a3c7f43be73ea15d67b200c5c67cb1d6131 100644 --- a/src/main/java/org/olat/course/nodes/gta/ui/_content/coach.html +++ b/src/main/java/org/olat/course/nodes/gta/ui/_content/coach.html @@ -34,9 +34,9 @@ $r.render("contextualSubscription") </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_assignement_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=assignment'); + $r.backgroundCommand("hide","step","assignment") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=assignment'); + $r.backgroundCommand("show","step","assignment") }) /* ]]> */</script> #end @@ -62,9 +62,9 @@ $r.render("contextualSubscription") </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_submit_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=submit'); + $r.backgroundCommand("hide","step","submit") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=submit'); + $r.backgroundCommand("show","step","submit") }) /* ]]> */</script> #end @@ -91,9 +91,9 @@ $r.render("contextualSubscription") </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_review_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=reviewAndCorrection'); + $r.backgroundCommand("hide","step","reviewAndCorrection") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=reviewAndCorrection'); + $r.backgroundCommand("show","step","reviewAndCorrection") }) /* ]]> */</script> #end @@ -110,9 +110,9 @@ $r.render("contextualSubscription") </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_revision_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=revision'); + $r.backgroundCommand("hide","step","revision") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=revision'); + $r.backgroundCommand("show","step","revision") }) /* ]]> */</script> #end @@ -134,9 +134,9 @@ $r.render("contextualSubscription") </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_solution_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=solution'); + $r.backgroundCommand("hide","step","solution") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=solution'); + $r.backgroundCommand("show","step","solution") }) /* ]]> */</script> #end @@ -165,9 +165,9 @@ $r.render("contextualSubscription") </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_grading_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=grading'); + $r.backgroundCommand("hide","step","grading") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=grading'); + $r.backgroundCommand("show","step","grading") }) /* ]]> */</script> #end diff --git a/src/main/java/org/olat/course/nodes/gta/ui/_content/run.html b/src/main/java/org/olat/course/nodes/gta/ui/_content/run.html index 779acf5c953e5c49abec0067f9390324ac1893be..f40c07e54c487ca34d35ab764bd43769f8b22346 100644 --- a/src/main/java/org/olat/course/nodes/gta/ui/_content/run.html +++ b/src/main/java/org/olat/course/nodes/gta/ui/_content/run.html @@ -46,9 +46,9 @@ </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_assignement_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=assignment'); + $r.backgroundCommand("hide","step","assignment") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=assignment'); + $r.backgroundCommand("show","step","assignment") }) /* ]]> */</script> #end @@ -80,9 +80,9 @@ </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_submit_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=submit'); + $r.backgroundCommand("hide","step","submit") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=submit'); + $r.backgroundCommand("show","step","submit"); }) /* ]]> */</script> #end @@ -102,9 +102,9 @@ </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_review_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=reviewAndCorrection'); + $r.backgroundCommand("hide","step","reviewAndCorrection") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=reviewAndCorrection'); + $r.backgroundCommand("show","step","reviewAndCorrection") }) /* ]]> */</script> #end @@ -124,9 +124,9 @@ </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_revision_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=revision'); + $r.backgroundCommand("hide","step","revision") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=revision'); + $r.backgroundCommand("show","step","revision") }) /* ]]> */</script> #end @@ -148,9 +148,9 @@ </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_solution_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=solution'); + $r.backgroundCommand("hide","step","solution") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=solution'); + $r.backgroundCommand("show","step","solution") }) /* ]]> */</script> #end @@ -179,9 +179,9 @@ </div> <script type='text/javascript'>/* <![CDATA[ */ jQuery('#o_step_grading_content').on('hide.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("hide")?step=grading'); + $r.backgroundCommand("hide","step","grading") }).on('show.bs.collapse', function () { - o_ffXHRNFEvent('$r.commandURIbg("show")?step=grading'); + $r.backgroundCommand("show","step","grading") }) /* ]]> */</script> #end diff --git a/src/main/java/org/olat/course/nodes/ta/AbstractTaskNotificationHandler.java b/src/main/java/org/olat/course/nodes/ta/AbstractTaskNotificationHandler.java index 72a7b12509ed9f1a727349d3c1098999f69ab5ea..2cb968691cc5bc80b163460b3164d6f69141c767 100644 --- a/src/main/java/org/olat/course/nodes/ta/AbstractTaskNotificationHandler.java +++ b/src/main/java/org/olat/course/nodes/ta/AbstractTaskNotificationHandler.java @@ -175,7 +175,8 @@ public abstract class AbstractTaskNotificationHandler extends LogDelegator { } } - public static ContextualSubscriptionController createContextualSubscriptionController(UserRequest ureq, WindowControl wControl, String folderPath, SubscriptionContext subsContext, Class callerClass) { + public static ContextualSubscriptionController createContextualSubscriptionController(UserRequest ureq, WindowControl wControl, String folderPath, + SubscriptionContext subsContext, Class<?> callerClass) { String businessPath = wControl.getBusinessControl().getAsString(); PublisherData pdata = new PublisherData(OresHelper.calculateTypeName(callerClass), folderPath, businessPath); ContextualSubscriptionController contextualSubscriptionCtr = new ContextualSubscriptionController(ureq, wControl, subsContext, pdata); diff --git a/src/main/java/org/olat/course/nodes/ta/DropboxController.java b/src/main/java/org/olat/course/nodes/ta/DropboxController.java index b93b8d68d132414fa597942a5b4c7e9ee2fede72..17ec8c1aad138fb0185d60796c7c6e433fbc0faf 100644 --- a/src/main/java/org/olat/course/nodes/ta/DropboxController.java +++ b/src/main/java/org/olat/course/nodes/ta/DropboxController.java @@ -27,6 +27,8 @@ package org.olat.course.nodes.ta; import java.io.BufferedOutputStream; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.InputStream; import java.io.OutputStream; import java.text.SimpleDateFormat; @@ -37,7 +39,6 @@ import java.util.List; import org.apache.velocity.VelocityContext; import org.apache.velocity.context.Context; import org.olat.admin.quota.QuotaConstants; -import org.olat.commons.file.filechooser.FileChooserController; import org.olat.core.CoreSpringFactory; import org.olat.core.commons.modules.bc.meta.MetaInfo; import org.olat.core.commons.modules.bc.meta.tagged.MetaTagged; @@ -195,7 +196,7 @@ public class DropboxController extends BasicController { if (source == ulButton) { removeAsListenerAndDispose(fileChooserController); - fileChooserController = new FileChooserController(ureq, getWindowControl(), getUploadLimit(ureq) , true); + fileChooserController = new FileChooserController(ureq, getWindowControl(), getUploadLimit()); listenTo(fileChooserController); removeAsListenerAndDispose(cmc); @@ -212,49 +213,50 @@ public class DropboxController extends BasicController { * @param ureq * @return max upload limit in KB */ - private int getUploadLimit(UserRequest ureq) { - String dropboxPath = getRelativeDropBoxFilePath(ureq.getIdentity()); + private int getUploadLimit() { + String dropboxPath = getRelativeDropBoxFilePath(getIdentity()); Quota dropboxQuota = QuotaManager.getInstance().getCustomQuota(dropboxPath); if (dropboxQuota == null) { dropboxQuota = QuotaManager.getInstance().getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_NODES); } - OlatRootFolderImpl rootFolder = new OlatRootFolderImpl( getRelativeDropBoxFilePath(ureq.getIdentity()), null); - VFSContainer dropboxContainer = new OlatNamedContainerImpl(ureq.getIdentity().getName(), rootFolder); + OlatRootFolderImpl rootFolder = new OlatRootFolderImpl( getRelativeDropBoxFilePath(getIdentity()), null); + VFSContainer dropboxContainer = new OlatNamedContainerImpl(getIdentity().getName(), rootFolder); FullAccessWithQuotaCallback secCallback = new FullAccessWithQuotaCallback(dropboxQuota); rootFolder.setLocalSecurityCallback(secCallback); - int ulLimit = QuotaManager.getInstance().getUploadLimitKB(dropboxQuota.getQuotaKB(),dropboxQuota.getUlLimitKB(),dropboxContainer); - return ulLimit; + return QuotaManager.getInstance().getUploadLimitKB(dropboxQuota.getQuotaKB(),dropboxQuota.getUlLimitKB(),dropboxContainer); } /** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event) */ + @Override public void event(UserRequest ureq, Controller source, Event event) { if (source == fileChooserController) { cmc.deactivate(); if (event.equals(Event.DONE_EVENT)) { - VFSLeaf fIn; boolean success = false; + File fIn = fileChooserController.getUploadFile(); VFSContainer fDropbox = getDropBox(ureq.getIdentity()); - if (fileChooserController.isFileFromFolder()) { - fIn = fileChooserController.getFileSelection(); - } else { - fIn = fileChooserController.getUploadedVFSFile(); - } - + String filename = fileChooserController.getUploadFileName(); + VFSLeaf fOut; - if (fDropbox.resolve(fIn.getName()) != null) { + if (fDropbox.resolve(filename) != null) { //FIXME ms: check if dropbox quota is exceeded -> clarify with customers - fOut = fDropbox.createChildLeaf(getNewUniqueName(fIn.getName())); + fOut = fDropbox.createChildLeaf(getNewUniqueName(filename)); } else { - fOut = fDropbox.createChildLeaf(fIn.getName()); + fOut = fDropbox.createChildLeaf(filename); } - InputStream in = fIn.getInputStream(); - OutputStream out = new BufferedOutputStream(fOut.getOutputStream(false)); - success = FileUtils.copy(in, out); - FileUtils.closeSafely(in); - FileUtils.closeSafely(out); + try { + InputStream in = new FileInputStream(fIn); + OutputStream out = new BufferedOutputStream(fOut.getOutputStream(false)); + success = FileUtils.copy(in, out); + FileUtils.closeSafely(in); + FileUtils.closeSafely(out); + } catch (FileNotFoundException e) { + logError("", e); + return; + } if(fOut instanceof MetaTagged) { MetaInfo info = ((MetaTagged)fOut).getMetaInfo(); @@ -268,7 +270,7 @@ public class DropboxController extends BasicController { int numFiles = fDropbox.getItems().size(); myContent.contextPut("numfiles", new String[] {Integer.toString(numFiles)}); // assemble confirmation - String confirmation = getConfirmation(ureq, fIn.getName()); + String confirmation = getConfirmation(ureq, fOut.getName()); // send email if necessary Boolean sendEmail = (Boolean)config.get(TACourseNode.CONF_DROPBOX_ENABLEMAIL); if (sendEmail == null) sendEmail = Boolean.FALSE; @@ -318,7 +320,6 @@ public class DropboxController extends BasicController { if(!sendMailError) { getWindowControl().setInfo(confirmation.replace("\n", " ").replace("\r", " ").replace("\u2028", " ")); } - return; } else { showInfo("dropbox.upload.failed"); } diff --git a/src/main/java/org/olat/course/nodes/ta/FileChooserController.java b/src/main/java/org/olat/course/nodes/ta/FileChooserController.java new file mode 100644 index 0000000000000000000000000000000000000000..0cac9b33baee6df1526d12ec2b8464fb1173d868 --- /dev/null +++ b/src/main/java/org/olat/course/nodes/ta/FileChooserController.java @@ -0,0 +1,101 @@ +/** + * <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.course.nodes.ta; + +import java.io.File; + +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.components.form.flexible.FormItemContainer; +import org.olat.core.gui.components.form.flexible.elements.FileElement; +import org.olat.core.gui.components.form.flexible.impl.FormBasicController; +import org.olat.core.gui.components.form.flexible.impl.FormEvent; +import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer; +import org.olat.core.gui.control.Controller; +import org.olat.core.gui.control.Event; +import org.olat.core.gui.control.WindowControl; + +/** + * + * @author srosse, + * + */ +public class FileChooserController extends FormBasicController { + + private FileElement fileEl; + private long maxUploadSizeKb; + + public FileChooserController(UserRequest ureq, WindowControl wControl, long maxUploadSizeKb) { + super(ureq, wControl); + this.maxUploadSizeKb = maxUploadSizeKb; + initForm(ureq); + } + + @Override + protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { + formLayout.setElementCssClass("o_sel_course_gta_upload_task_form"); + + fileEl = uifactory.addFileElement("file", "dropbox.upload", formLayout); + fileEl.setMaxUploadSizeKB(maxUploadSizeKb, "error.limit.exceeded", new String[]{ Long.toString(maxUploadSizeKb) }); + fileEl.setMandatory(true); + fileEl.addActionListener(FormEvent.ONCHANGE); + + FormLayoutContainer buttonCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator()); + buttonCont.setRootForm(mainForm); + formLayout.add(buttonCont); + uifactory.addFormSubmitButton("save", buttonCont); + uifactory.addFormCancelButton("cancel", buttonCont, ureq, getWindowControl()); + } + + @Override + protected void doDispose() { + // + } + + @Override + protected boolean validateFormLogic(UserRequest ureq) { + boolean allOk = true; + + fileEl.clearError(); + if(fileEl.getInitialFile() == null && fileEl.getUploadFile() == null) { + fileEl.setErrorKey("form.mandatory.hover", null); + allOk &= false; + } + + return allOk & super.validateFormLogic(ureq); + } + + public String getUploadFileName() { + return fileEl.getUploadFileName(); + } + + public File getUploadFile() { + return fileEl.getUploadFile(); + } + + @Override + protected void formOK(UserRequest ureq) { + fireEvent(ureq, Event.DONE_EVENT); + } + + @Override + protected void formCancelled(UserRequest ureq) { + fireEvent(ureq, Event.CANCELLED_EVENT); + } +} diff --git a/src/main/java/org/olat/course/nodes/ta/SolutionController.java b/src/main/java/org/olat/course/nodes/ta/SolutionController.java index 3e935e3d755a84b96239349bb16c37757779e731..3ce13906d38cddcc90a3b494b992ba8c997c71d8 100644 --- a/src/main/java/org/olat/course/nodes/ta/SolutionController.java +++ b/src/main/java/org/olat/course/nodes/ta/SolutionController.java @@ -25,7 +25,6 @@ package org.olat.course.nodes.ta; -import org.olat.commons.file.filechooser.FileChooserController; import org.olat.core.commons.modules.bc.FolderRunController; import org.olat.core.commons.modules.bc.vfs.OlatNamedContainerImpl; import org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl; @@ -34,7 +33,6 @@ import org.olat.core.commons.services.notifications.ui.ContextualSubscriptionCon import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.Component; import org.olat.core.gui.components.velocity.VelocityContainer; -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.controller.BasicController; @@ -51,7 +49,6 @@ import org.olat.course.run.environment.CourseEnvironment; public class SolutionController extends BasicController { private VelocityContainer myContent; - private FileChooserController fileChooserController; private FolderRunController solutionFolderRunController; private SubscriptionContext subsContext; private ContextualSubscriptionController contextualSubscriptionCtr; @@ -108,23 +105,14 @@ public class SolutionController extends BasicController { */ public void event(UserRequest ureq, Component source, Event event) { - } - - /** - * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event) - */ - public void event(UserRequest ureq, Controller source, Event event) { - } /** * * @see org.olat.core.gui.control.DefaultController#doDispose(boolean) */ + @Override protected void doDispose() { - if (fileChooserController != null) { - fileChooserController.dispose(); - fileChooserController = null; - } + // } } diff --git a/src/main/java/org/olat/course/nodes/ta/TaskController.java b/src/main/java/org/olat/course/nodes/ta/TaskController.java index 1598fa7ddb9874ab9f75b6c7a16ab2a87317d83d..3506a52997da990d350603ad183cc91a7e013302 100644 --- a/src/main/java/org/olat/course/nodes/ta/TaskController.java +++ b/src/main/java/org/olat/course/nodes/ta/TaskController.java @@ -55,7 +55,6 @@ import org.olat.core.id.Identity; import org.olat.core.logging.AssertException; import org.olat.core.logging.OLog; import org.olat.core.logging.Tracing; -import org.olat.core.util.FileUtils; import org.olat.core.util.StringHelper; import org.olat.core.util.vfs.VFSItem; import org.olat.core.util.vfs.VFSLeaf; @@ -290,8 +289,8 @@ public class TaskController extends BasicController { myContent.contextPut(VC_TASKTEXT, taskText); } - String taskFilename = getTaskFilename(assignedTask); - taskLaunchButton.setModURI(taskFilename); + //String taskFilename = getTaskFilename(assignedTask); + //taskLaunchButton.setModURI(taskFilename); myContent.put("task.launch", taskLaunchButton); myContent.contextPut(VC_ASSIGNEDTASK, assignedTask); myContent.contextPut(VC_ASSIGNEDTASK_NEWWINDOW,Boolean.TRUE); @@ -299,7 +298,7 @@ public class TaskController extends BasicController { panel.setContent(myContent); } - private String getTaskFilename(String task) { + /*private String getTaskFilename(String task) { if(!StringHelper.containsNonWhitespace(task)) { return null; } @@ -310,7 +309,7 @@ public class TaskController extends BasicController { String filename = assignedTask.substring(0, assignedTask.length() - extension.length()); return StringHelper.transformDisplayNameToFileSystemName(filename) + "." + extension; - } + }*/ /** * Auto-assign a task to an identity and mark it as sampled if necessary. diff --git a/src/main/java/org/olat/course/run/CourseRuntimeController.java b/src/main/java/org/olat/course/run/CourseRuntimeController.java index 24db80fab7c85ca4a6da54b6db714d2f590fd8e5..391ef7b07d5e91dd5b0307c250a7e4e6bd827008 100644 --- a/src/main/java/org/olat/course/run/CourseRuntimeController.java +++ b/src/main/java/org/olat/course/run/CourseRuntimeController.java @@ -145,7 +145,6 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private static final String CMD_START_GROUP_PREFIX = "cmd.group.start.ident."; private Delayed delayedClose; - private CloseableModalController cmc; //tools private Link folderLink, @@ -160,7 +159,8 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im openGlossaryLink, enableGlossaryLink; private Link currentUserCountLink; private Dropdown myCourse, glossary; - + + private CloseableModalController cmc; private CourseAreasController areasCtrl; private ConfirmLeaveController leaveDialogBox; private ArchiverMainController archiverCtrl; @@ -320,7 +320,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void addCustomCSS(UserRequest ureq) { ICourse course = CourseFactory.loadCourse(getOlatResourceable()); CustomCSS customCSS = CourseFactory.getCustomCourseCss(ureq.getUserSession(), course.getCourseEnvironment()); - ChiefController cc = Windows.getWindows(ureq).getChiefController(); + ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController(); if (cc != null) { if(customCSS == null) { cc.removeCurrentCustomCSSFromView(); @@ -331,8 +331,8 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im setCustomCSS(customCSS); } - private void removeCustomCSS(UserRequest ureq) { - ChiefController cc = Windows.getWindows(ureq).getChiefController(); + private void removeCustomCSS() { + ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController(); if (cc != null) { cc.removeCurrentCustomCSSFromView(); } @@ -858,7 +858,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im doCatalog(ureq); } else if("Infos".equalsIgnoreCase(type)) { doDetails(ureq); - } else if("EditDescription".equalsIgnoreCase(type)) { + } else if("EditDescription".equalsIgnoreCase(type) || "Settings".equalsIgnoreCase(type)) { doEditSettings(ureq); } else if("Settings".equalsIgnoreCase(type)) { doOptions(ureq); @@ -936,7 +936,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im protected void doAccess(UserRequest ureq) { if(delayedClose == Delayed.access || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) { - removeCustomCSS(ureq); + removeCustomCSS(); super.doAccess(ureq); } } else { @@ -949,12 +949,14 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im if ((reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) && !repositoryManager.createRepositoryEntryStatus(getRepositoryEntry().getStatusCode()).isClosed()) { - removeCustomCSS(ureq); + removeCustomCSS(); popToRoot(ureq); cleanUp(); - + CourseNode currentCourseNode = getCurrentCourseNode(); - EditorMainController ctrl = CourseFactory.createEditorController(ureq, getWindowControl(), toolbarPanel, getRepositoryEntry(), currentCourseNode); + WindowControl bwControl = getSubWindowControl("Editor"); + EditorMainController ctrl = CourseFactory.createEditorController(ureq, addToHistory(ureq, bwControl), + toolbarPanel, getRepositoryEntry(), currentCourseNode); //user activity logger which was initialized with course run if(ctrl != null){ editorCtrl = pushController(ureq, "Editor", ctrl); @@ -970,7 +972,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im protected void doEditSettings(UserRequest ureq) { if(delayedClose == Delayed.editSettings || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) { - removeCustomCSS(ureq); + removeCustomCSS(); super.doEditSettings(ureq); } } else { @@ -982,10 +984,8 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im protected Activateable2 doMembers(UserRequest ureq) { if(delayedClose == Delayed.members || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT) || hasCourseRight(CourseRights.RIGHT_MEMBERMANAGEMENT)) { - removeCustomCSS(ureq); - OLATResourceable ores = OresHelper.createOLATResourceableInstance("MembersMgmt", 0l); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); - WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + removeCustomCSS(); + WindowControl bwControl = getSubWindowControl("MembersMgmt"); MembersManagementMainController ctrl = new MembersManagementMainController(ureq, addToHistory(ureq, bwControl), toolbarPanel, getRepositoryEntry(), reSecurity.isEntryAdmin(), hasCourseRight(CourseRights.RIGHT_GROUPMANAGEMENT), hasCourseRight(CourseRights.RIGHT_MEMBERMANAGEMENT)); @@ -1044,7 +1044,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doLayout(UserRequest ureq) { if(delayedClose == Delayed.layout || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) { - removeCustomCSS(ureq); + removeCustomCSS(); ICourse course = CourseFactory.loadCourse(getRepositoryEntry()); boolean managedLayout = RepositoryEntryManagedFlag.isManaged(getRepositoryEntry(), RepositoryEntryManagedFlag.layout); CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig().clone(); @@ -1063,7 +1063,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doOptions(UserRequest ureq) { if(delayedClose == Delayed.options || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) { - removeCustomCSS(ureq); + removeCustomCSS(); ICourse course = CourseFactory.loadCourse(getOlatResourceable()); CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig().clone(); CourseOptionsController ctrl = new CourseOptionsController(ureq, getWindowControl(), getRepositoryEntry(), courseConfig, true); @@ -1079,7 +1079,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doAssessmentMode(UserRequest ureq) { if(delayedClose == Delayed.assessmentMode || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) { - removeCustomCSS(ureq); + removeCustomCSS(); AssessmentModeListController ctrl = new AssessmentModeListController(ureq, getWindowControl(), toolbarPanel, getRepositoryEntry()); assessmentModeCtrl = pushController(ureq, translate("command.assessment.mode"), ctrl); @@ -1094,10 +1094,12 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doCertificatesOptions(UserRequest ureq) { if(delayedClose == Delayed.certificates || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) { - removeCustomCSS(ureq); + removeCustomCSS(); ICourse course = CourseFactory.loadCourse(getOlatResourceable()); CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig().clone(); - CertificatesOptionsController ctrl = new CertificatesOptionsController(ureq, getWindowControl(), getRepositoryEntry(), courseConfig, true); + WindowControl bwControl = getSubWindowControl("CertificationSettings"); + CertificatesOptionsController ctrl = new CertificatesOptionsController(ureq, addToHistory(ureq, bwControl), + getRepositoryEntry(), courseConfig, true); certificatesOptionsCtrl = pushController(ureq, translate("command.options"), ctrl); setActiveTool(certificatesOptionsLink); currentToolCtr = certificatesOptionsCtrl; @@ -1110,7 +1112,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doReminders(UserRequest ureq) { if(delayedClose == Delayed.reminders || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) { - removeCustomCSS(ureq); + removeCustomCSS(); CourseRemindersController ctrl = new CourseRemindersController(ureq, getWindowControl(), getRepositoryEntry(), toolbarPanel); remindersCtrl = pushController(ureq, translate("command.reminders"), ctrl); @@ -1125,7 +1127,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doArchive(UserRequest ureq) { if(delayedClose == Delayed.archive || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_ARCHIVING)) { - removeCustomCSS(ureq); + removeCustomCSS(); ICourse course = CourseFactory.loadCourse(getOlatResourceable()); ArchiverMainController ctrl = new ArchiverMainController(ureq, getWindowControl(), course, new FullAccessArchiverCallback()); listenTo(ctrl); @@ -1140,7 +1142,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private FolderRunController doCourseFolder(UserRequest ureq) { if(delayedClose == Delayed.courseFolder || requestForClose(ureq)) { - removeCustomCSS(ureq); + removeCustomCSS(); // Folder for course with custom link model to jump to course nodes ICourse course = CourseFactory.loadCourse(getOlatResourceable()); VFSContainer namedCourseFolder = new NamedContainerImpl(translate("command.coursefolder"), course.getCourseFolderContainer()); @@ -1159,7 +1161,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doCourseAreas(UserRequest ureq) { if(delayedClose == Delayed.courseAreas || requestForClose(ureq)) { - removeCustomCSS(ureq); + removeCustomCSS(); ICourse course = CourseFactory.loadCourse(getOlatResourceable()); CourseAreasController ctrl = new CourseAreasController(ureq, getWindowControl(), getRepositoryEntry().getOlatResource()); ctrl.addLoggingResourceable(LoggingResourceable.wrap(course)); @@ -1174,7 +1176,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doDatabases(UserRequest ureq) { if(delayedClose == Delayed.databases || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_DB)) { - removeCustomCSS(ureq); + removeCustomCSS(); ICourse course = CourseFactory.loadCourse(getOlatResourceable()); CustomDBMainController ctrl = new CustomDBMainController(ureq, getWindowControl(), course); listenTo(ctrl); @@ -1190,7 +1192,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doCourseStatistics(UserRequest ureq) { if(delayedClose == Delayed.courseStatistics || requestForClose(ureq)) { if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_STATISTICS)) { - removeCustomCSS(ureq); + removeCustomCSS(); ICourse course = CourseFactory.loadCourse(getOlatResourceable()); StatisticMainController ctrl = new StatisticMainController(ureq, getWindowControl(), course); listenTo(ctrl); @@ -1237,7 +1239,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); WindowControl swControl = addToHistory(ureq, ores, null); if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach() || hasCourseRight(CourseRights.RIGHT_STATISTICS)) { - removeCustomCSS(ureq); + removeCustomCSS(); UserCourseEnvironmentImpl uce = getUserCourseEnvironment(); StatisticCourseNodesController ctrl = new StatisticCourseNodesController(ureq, swControl, toolbarPanel, uce, types); listenTo(ctrl); @@ -1257,7 +1259,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im // 1) course admins and users with tool right: full access if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_ASSESSMENT)) { - removeCustomCSS(ureq); + removeCustomCSS(); AssessmentMainController ctrl = new AssessmentMainController(ureq, swControl, toolbarPanel, getOlatResourceable(), new FullAccessAssessmentCallback(reSecurity.isEntryAdmin())); ctrl.activate(ureq, null, null); @@ -1269,7 +1271,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im } // 2) users with coach right: limited access to coached groups if (reSecurity.isCourseCoach() || reSecurity.isGroupCoach()) { - removeCustomCSS(ureq); + removeCustomCSS(); AssessmentMainController ctrl = new AssessmentMainController(ureq, swControl, toolbarPanel, getOlatResourceable(), new CoachingGroupAccessAssessmentCallback()); ctrl.activate(ureq, null, null); @@ -1288,7 +1290,9 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void doEfficiencyStatements(UserRequest ureq) { if(delayedClose == Delayed.efficiencyStatements || requestForClose(ureq)) { // will not be disposed on course run dispose, popus up as new browserwindow - CertificateAndEfficiencyStatementController efficiencyStatementController = new CertificateAndEfficiencyStatementController(getWindowControl(), ureq, getRepositoryEntry()); + WindowControl bwControl = getSubWindowControl("Certification"); + CertificateAndEfficiencyStatementController efficiencyStatementController + = new CertificateAndEfficiencyStatementController(addToHistory(ureq, bwControl), ureq, getRepositoryEntry()); listenTo(efficiencyStatementController); efficiencyStatementController = pushController(ureq, translate("command.efficiencystatement"), efficiencyStatementController); currentToolCtr = efficiencyStatementController; @@ -1345,6 +1349,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im private void launchCalendar(UserRequest ureq) { ControllerCreator ctrlCreator = new ControllerCreator() { + @Override public Controller createController(UserRequest lureq, WindowControl lwControl) { ICourse course = CourseFactory.loadCourse(getRepositoryEntry()); ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(getRepositoryEntry()); @@ -1387,8 +1392,9 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im } private void launchPersonalNotes(UserRequest ureq) { - // will not be disposed on course run dispose, popus up as new browserwindow + // will not be disposed on course run dispose, pop up as new browser window ControllerCreator ctrlCreator = new ControllerCreator() { + @Override public Controller createController(UserRequest lureq, WindowControl lwControl) { ICourse course = CourseFactory.loadCourse(getRepositoryEntry()); Controller notesCtr = new NoteController(lureq, course, course.getCourseTitle(), lwControl); diff --git a/src/main/java/org/olat/course/run/RunMainController.java b/src/main/java/org/olat/course/run/RunMainController.java index 1f5eb5fc2c94d258adb2d3d9d7621d81bcb7c8d1..a58e5600ce0ae139199201a355cf4b707e69689c 100644 --- a/src/main/java/org/olat/course/run/RunMainController.java +++ b/src/main/java/org/olat/course/run/RunMainController.java @@ -458,7 +458,7 @@ public class RunMainController extends MainLayoutBasicController implements Gene } else if (source == coursemain) { if (event.getCommand().equals("activateCourseNode")) { // Events from the JS function o_activateCourseNode() - activate the given node id - String nodeid = ureq.getModuleURI(); + String nodeid = ureq.getParameter("nodeid"); if (nodeid != null) { CourseNode identNode = course.getRunStructure().getNode(nodeid); boolean success = updateTreeAndContent(ureq, identNode, null); diff --git a/src/main/java/org/olat/course/run/_content/glossaryToolLink.html b/src/main/java/org/olat/course/run/_content/glossaryToolLink.html deleted file mode 100644 index 57ecf5432a45c1c3077c0bc63cf37418770f96ef..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/course/run/_content/glossaryToolLink.html +++ /dev/null @@ -1,28 +0,0 @@ -<a href="#" class="dropdown-toggle" data-toggle="dropdown"> - <i class="o_icon o_FileResource-GLOSSARY_icon"> </i> - <span>$r.translate("command.glossary")</span> - <i class="o_icon o_icon_caret"> </i> -</a> -<ul class="dropdown-menu" role="menu"> - <li> - <a id="o_sel_course_glossary" href="$r.commandURI("command.glossary")" target="o_glossary" onclick="return o2cl()"> - <span> - $r.translate("command.glossary.open") - </span> - </a> - </li> - - <li> - #if($r.available("command.glossary.on.alt")) - $r.render("command.glossary.on.alt") - #else - $r.render("command.glossary.off.alt") - #end - </li> -</ul> - -<script> -// <![CDATA[ - jQuery('#o_sel_course_glossary').each(function(index, el){ jQuery(el).click(function() { setTimeout(removeBusyAfterDownload, 1200)}) }); -// ]]> -</script> diff --git a/src/main/java/org/olat/course/run/_content/index.html b/src/main/java/org/olat/course/run/_content/index.html index e8b866e25cf5ecd310e331c7e0e3f3dda11adba8..139e73892404caef0e8feabc1b03e16db38de42d 100644 --- a/src/main/java/org/olat/course/run/_content/index.html +++ b/src/main/java/org/olat/course/run/_content/index.html @@ -4,10 +4,9 @@ o_info.course_id="$courserepokey"; ## o_activateCourseNode is called from functions.js gotonode() method and implements ## the activation of the given node id in the course run structure function o_activateCourseNode(nodeid) { - if (!o_info.linkbusy) { - o_beforeserver(); + if (!o_info.linkbusy) { window.focus(); - ${r.javaScriptBgCommand("activateCourseNode")} + nodeid; + ${r.openJavaScriptCommand("activateCourseNode")},"nodeid",nodeid); ## Go to top of page (OLAT-5675) o_scrollToElement('#o_top'); } diff --git a/src/main/java/org/olat/course/run/glossary/CourseGlossaryToolLinkController.java b/src/main/java/org/olat/course/run/glossary/CourseGlossaryToolLinkController.java index e1bbcf2ca11c6842c26963881252b6e22781f7d7..630c2d545d9cf95dfc11fe2e6ee5ae9d984a24c0 100644 --- a/src/main/java/org/olat/course/run/glossary/CourseGlossaryToolLinkController.java +++ b/src/main/java/org/olat/course/run/glossary/CourseGlossaryToolLinkController.java @@ -24,45 +24,6 @@ */ package org.olat.course.run.glossary; -import java.util.List; - -import org.olat.basesecurity.BaseSecurityManager; -import org.olat.core.commons.fullWebApp.LayoutMain3ColsController; -import org.olat.core.commons.fullWebApp.popup.BaseFullWebappPopupLayoutFactory; -import org.olat.core.commons.modules.glossary.GlossaryMainController; -import org.olat.core.commons.modules.glossary.OpenAuthorProfilEvent; -import org.olat.core.gui.UserRequest; -import org.olat.core.gui.Windows; -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.velocity.VelocityContainer; -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.controller.BasicController; -import org.olat.core.gui.control.creator.ControllerCreator; -import org.olat.core.gui.control.generic.dtabs.DTab; -import org.olat.core.gui.control.generic.dtabs.DTabs; -import org.olat.core.gui.control.generic.messages.MessageUIFactory; -import org.olat.core.gui.control.generic.textmarker.GlossaryMarkupItemController; -import org.olat.core.gui.translator.Translator; -import org.olat.core.id.Identity; -import org.olat.core.id.OLATResourceable; -import org.olat.core.id.context.BusinessControlFactory; -import org.olat.core.id.context.ContextEntry; -import org.olat.core.util.prefs.Preferences; -import org.olat.core.util.resource.OresHelper; -import org.olat.course.CourseFactory; -import org.olat.course.ICourse; -import org.olat.course.config.CourseConfig; -import org.olat.course.run.RunMainController; -import org.olat.repository.RepositoryEntry; -import org.olat.repository.RepositoryManager; -import org.olat.user.HomePageConfig; -import org.olat.user.HomePageConfigManagerImpl; -import org.olat.user.HomePageDisplayController; - /** * Description:<br> * Toolbox link that shows a link to open the glossary in read or read/write @@ -73,150 +34,7 @@ import org.olat.user.HomePageDisplayController; * * @author Florian Gnägi, frentix GmbH, http://www.frentix.com */ -public class CourseGlossaryToolLinkController extends BasicController { - - private VelocityContainer mainVC; - private Link onCommand, offCommand; - private String guiPrefsKey; - private boolean allowGlossaryEditing; - private OLATResourceable courseOres; - private GlossaryMarkupItemController glossMarkupItmCtr; - - public CourseGlossaryToolLinkController(WindowControl wControl, UserRequest ureq, ICourse course, Translator translator, - boolean allowGlossaryEditing, GlossaryMarkupItemController glossMarkupItmCtr) { - super(ureq, wControl, translator); - setBasePackage(RunMainController.class); - this.courseOres = OresHelper.clone(course); - this.allowGlossaryEditing = allowGlossaryEditing; - guiPrefsKey = CourseGlossaryFactory.createGuiPrefsKey(course); - - mainVC = createVelocityContainer("glossaryToolLink"); - - Preferences prefs = ureq.getUserSession().getGuiPreferences(); - Boolean state = (Boolean) prefs.get(CourseGlossaryToolLinkController.class, guiPrefsKey); - if (state == null || !state.booleanValue()) { - onCommand = LinkFactory.createLink("command.glossary.on.alt", mainVC, this); - } else { - offCommand = LinkFactory.createLink("command.glossary.off.alt", mainVC, this); - } - - // keep reference to textMarkerContainerCtr for later enabling/disabling - this.glossMarkupItmCtr = glossMarkupItmCtr; +public class CourseGlossaryToolLinkController { - putInitialPanel(mainVC); - } - public void setAllowGlossaryEditing(boolean edit) { - this.allowGlossaryEditing = edit; - } - - /** - * @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) - */ - @Override - public void event(UserRequest ureq, Component source, Event event) { - if (source == onCommand) { - // toggle on - Preferences prefs = ureq.getUserSession().getGuiPreferences(); - prefs.put(CourseGlossaryToolLinkController.class, guiPrefsKey, Boolean.TRUE); - prefs.save(); - // update gui - mainVC.remove(onCommand); - offCommand = LinkFactory.createLink("command.glossary.off.alt", mainVC, this); - // notify textmarker controller - glossMarkupItmCtr.setTextMarkingEnabled(true); - fireEvent(ureq, new Event("glossaryOn")); - - } else if (source == offCommand) { - // toggle off - Preferences prefs = ureq.getUserSession().getGuiPreferences(); - prefs.put(CourseGlossaryToolLinkController.class, guiPrefsKey, Boolean.FALSE); - prefs.save(); - // update gui - mainVC.remove(offCommand); - onCommand = LinkFactory.createLink("command.glossary.on.alt", mainVC, this); - // notify textmarker controller - glossMarkupItmCtr.setTextMarkingEnabled(false); - fireEvent(ureq, new Event("glossaryOff")); - } else if (source == mainVC && event.getCommand().equals("command.glossary")){ - // start glossary in window - ICourse course = CourseFactory.loadCourse(courseOres); - final CourseConfig cc = course.getCourseConfig(); // do not cache cc, not save - - // if glossary had been opened from LR as Tab before, warn user: - DTabs dts = Windows.getWindows(ureq).getWindow(ureq).getDTabs(); - RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false); - DTab dt = dts.getDTab(repoEntry.getOlatResource()); - if (dt != null) { - List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType(allowGlossaryEditing ? "true" : "false"); - dts.activate(ureq, dt, entries); - } else { - ControllerCreator ctrlCreator = new ControllerCreator() { - public Controller createController(UserRequest lureq, WindowControl lwControl) { - GlossaryMainController glossaryController = CourseGlossaryFactory.createCourseGlossaryMainRunController(lwControl, lureq, cc, - allowGlossaryEditing); - listenTo(glossaryController); - if (glossaryController == null) { - // happens in the unlikely event of a user who is in a course and - // now - // tries to access the glossary - String text = translate("error.noglossary"); - return MessageUIFactory.createInfoMessage(lureq, lwControl, null, text); - } else { - // use a one-column main layout - LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, glossaryController); - // dispose glossary on layout dispose - layoutCtr.addDisposableChildController(glossaryController); - return layoutCtr; - } - } - }; - - ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator); - // open in new browser window - openInNewBrowserWindow(ureq, layoutCtrlr); - return;// immediate return after opening new browser window! - } - } - } - - @Override - protected void event(UserRequest ureq, Controller source, Event event) { - if(event instanceof OpenAuthorProfilEvent) { - OpenAuthorProfilEvent uriEvent = (OpenAuthorProfilEvent)event; - Long identityKey = uriEvent.getKey(); - if(identityKey == null) return; - final Identity identity = BaseSecurityManager.getInstance().loadIdentityByKey(identityKey, false); - if(identity == null) return; - final HomePageConfig homePageConfig = HomePageConfigManagerImpl.getInstance().loadConfigFor(identity.getName()); - - ControllerCreator ctrlCreator = new ControllerCreator() { - public Controller createController(UserRequest lureq, WindowControl lwControl) { - HomePageDisplayController homePageCtrl = new HomePageDisplayController(lureq, lwControl, identity, homePageConfig); - LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(lureq, lwControl, homePageCtrl); - // dispose glossary on layout dispose - layoutCtr.addDisposableChildController(homePageCtrl); - return layoutCtr; - } - }; - - ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator); - // open in new browser window - openInNewBrowserWindow(ureq, layoutCtrlr); - return;// immediate return after opening new browser window! - } else { - super.event(ureq, source, event); - } - } - - /** - * @see org.olat.core.gui.control.DefaultController#doDispose(boolean) - */ - @Override - protected void doDispose() { - // no need to dispose the textMarkerContainerCtr - should be done by parent - // controller - } } diff --git a/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java b/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java index a826e88e079bd5c00ce53bba4fd77643e187a923..b43984a4215a245480e4cf795c4798eb074cb592 100644 --- a/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java +++ b/src/main/java/org/olat/dispatcher/AuthenticatedDispatcher.java @@ -26,6 +26,8 @@ package org.olat.dispatcher; import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; import java.util.Locale; import javax.servlet.http.HttpServletRequest; @@ -44,13 +46,17 @@ import org.olat.core.gui.Windows; import org.olat.core.gui.components.Window; import org.olat.core.gui.components.form.flexible.impl.InvalidRequestParameterException; import org.olat.core.gui.control.ChiefController; +import org.olat.core.gui.control.WindowBackOffice; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.exception.MsgFactory; +import org.olat.core.gui.media.ServletUtil; import org.olat.core.id.context.BusinessControl; import org.olat.core.id.context.BusinessControlFactory; +import org.olat.core.id.context.HistoryPoint; import org.olat.core.logging.OLog; import org.olat.core.logging.Tracing; import org.olat.core.util.SessionInfo; +import org.olat.core.util.StringHelper; import org.olat.core.util.URIHelper; import org.olat.core.util.UserSession; import org.olat.core.util.i18n.I18nManager; @@ -97,6 +103,7 @@ public class AuthenticatedDispatcher implements Dispatcher { if ( log.isDebug() ) { startExecute = System.currentTimeMillis(); } + UserSession usess = CoreSpringFactory.getImpl(UserSessionManager.class).getUserSession(request); UserRequest ureq = null; try{ @@ -128,7 +135,15 @@ public class AuthenticatedDispatcher implements Dispatcher { } String guestAccess = ureq.getParameter(GUEST); if (guestAccess == null || !CoreSpringFactory.getImpl(LoginModule.class).isGuestLoginEnabled()) { - DispatcherModule.redirectToDefaultDispatcher(response); + if(ServletUtil.acceptJson(request)) { + try {//TODO xhr + response.sendError(HttpServletResponse.SC_UNAUTHORIZED); + } catch (IOException e) { + log.error("", e); + } + } else { + DispatcherModule.redirectToDefaultDispatcher(response); + } return; } else if (guestAccess.equals(TRUE)) { // try to log in as anonymous @@ -200,7 +215,22 @@ public class AuthenticatedDispatcher implements Dispatcher { // valid uri for dispatching (has timestamp, componentid and windowid) processValidDispatchURI(ureq, usess, request, response); } else { - log.error("Invalid URI in AuthenticatedDispatcher: " + request.getRequestURI()); + + final String origUri = request.getRequestURI(); + String restPart = origUri.substring(uriPrefix.length()); + try { + restPart = URLDecoder.decode(restPart, "UTF8"); + } catch (UnsupportedEncodingException e) { + log.error("Unsupported encoding", e); + } + + String[] split = restPart.split("/"); + if (split.length > 0 && split.length % 2 == 0) { + businessPath = BusinessControlFactory.getInstance().formatFromURI(restPart); + processBusinessPath(businessPath, ureq, usess); + } else { + log.error("Invalid URI in AuthenticatedDispatcher: " + request.getRequestURI()); + } } } } catch (InvalidRequestParameterException e) { @@ -252,20 +282,29 @@ public class AuthenticatedDispatcher implements Dispatcher { } private void processBusinessPath(String businessPath, UserRequest ureq, UserSession usess) { - BusinessControl bc = BusinessControlFactory.getInstance().createFromString(businessPath); - ChiefController cc = Windows.getWindows(usess).getChiefController(); - WindowControl wControl = cc.getWindowControl(); + WindowBackOffice windowBackOffice = Windows.getWindows(usess).getChiefController().getWindow().getWindowBackOffice(); String wSettings = (String) usess.removeEntryFromNonClearedStore(WINDOW_SETTINGS); if(wSettings != null) { WindowSettings settings = WindowSettings.parse(wSettings); - wControl.getWindowBackOffice().setWindowSettings(settings); + windowBackOffice.setWindowSettings(settings); + } + + BusinessControl bc = null; + String historyPointId = ureq.getHttpReq().getParameter("historyPointId"); + if(StringHelper.containsNonWhitespace(historyPointId)) { + HistoryPoint point = ureq.getUserSession().getHistoryPoint(historyPointId); + bc = BusinessControlFactory.getInstance().createFromContextEntries(point.getEntries()); + } + if(bc == null) { + bc = BusinessControlFactory.getInstance().createFromString(businessPath); } + WindowControl wControl = windowBackOffice.getChiefController().getWindowControl(); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, wControl); NewControllerFactory.getInstance().launch(ureq, bwControl); // render the window - Window w = cc.getWindow(); + Window w = windowBackOffice.getWindow(); w.dispatchRequest(ureq, true); // renderOnly } } \ No newline at end of file diff --git a/src/main/java/org/olat/dispatcher/RESTDispatcher.java b/src/main/java/org/olat/dispatcher/RESTDispatcher.java index e673d48d2a05f5fe9111cce0ab5d633b90f729a2..3035a602ca6ca4838843ff92a799770a4c4e17b9 100644 --- a/src/main/java/org/olat/dispatcher/RESTDispatcher.java +++ b/src/main/java/org/olat/dispatcher/RESTDispatcher.java @@ -313,7 +313,7 @@ public class RESTDispatcher implements Dispatcher { ChiefController cc = Windows.getWindows(usess).getChiefController(); Window w = cc.getWindow(); - URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED, w.getInstanceId(), String.valueOf(w.getTimestamp()), null); + URLBuilder ubu = new URLBuilder(WebappHelper.getServletContextPath() + DispatcherModule.PATH_AUTHENTICATED, w.getInstanceId(), String.valueOf(w.getTimestamp())); StringOutput sout = new StringOutput(30); ubu.buildURI(sout, null, null); diff --git a/src/main/java/org/olat/dispatcher/RedirectToAutoGuestLoginDispatcher.java b/src/main/java/org/olat/dispatcher/RedirectToAutoGuestLoginDispatcher.java deleted file mode 100644 index adeb979dded5e65868527fa79eaa4f96a2544cfe..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/dispatcher/RedirectToAutoGuestLoginDispatcher.java +++ /dev/null @@ -1,107 +0,0 @@ -/** -* OLAT - Online Learning and Training<br> -* http://www.olat.org -* <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 -* <p> -* http://www.apache.org/licenses/LICENSE-2.0 -* <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> -* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),<br> -* University of Zurich, Switzerland. -* <hr> -* <a href="http://www.openolat.org"> -* OpenOLAT - Online Learning and Training</a><br> -* This file has been modified by the OpenOLAT community. Changes are licensed -* under the Apache 2.0 license as the original file. -*/ -package org.olat.dispatcher; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.olat.basesecurity.AuthHelper; -import org.olat.core.CoreSpringFactory; -import org.olat.core.dispatcher.Dispatcher; -import org.olat.core.dispatcher.DispatcherModule; -import org.olat.core.gui.UserRequest; -import org.olat.core.gui.UserRequestImpl; -import org.olat.core.gui.Windows; -import org.olat.core.gui.components.Window; -import org.olat.core.gui.control.ChiefController; -import org.olat.core.logging.AssertException; -import org.olat.core.logging.OLog; -import org.olat.core.logging.Tracing; -import org.olat.core.util.UserSession; -import org.olat.core.util.i18n.I18nManager; -import org.olat.core.util.session.UserSessionManager; - -/** - * Description:<br> - * Dispatcher which redirects requests from / (root) to the default path - * defined in the <code>_spring/defaultconfig.xml</code> or the respective <code>_spring/extconfig.xml</code> - * and appended by the AutoGuest-login provider - * for example in a default installation this will be:<br> - * http://www.yourthingy.org/olat/ -> http://www.yourthingy.org/olat/dmz/?lp=xyz - * - * <P> - * Initial Date: 08.07.2006 <br> - * @author patrickb - * @author Lars Eberle (<a href="http://www.bps-system.de/">BPS Bildungsportal Sachsen GmbH</a>) - */ -public class RedirectToAutoGuestLoginDispatcher implements Dispatcher { - - private static final OLog log = Tracing.createLoggerFor(RedirectToAutoGuestLoginDispatcher.class); - - /** - * @see org.olat.core.dispatcher.Dispatcher#execute(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String) - */ - @Override - public void execute(HttpServletRequest request, HttpServletResponse response) { - UserSession usess = CoreSpringFactory.getImpl(UserSessionManager.class).getUserSession(request); - UserRequest ureq = null; - try{ - //upon creation URL is checked for - String uriPrefix = DispatcherModule.getLegacyUriPrefix(request); - ureq = new UserRequestImpl(uriPrefix, request, response); - }catch(NumberFormatException nfe){ - //MODE could not be decoded - //typically if robots with wrong urls hit the system - //or user have bookmarks - //or authors copy-pasted links to the content. - //showing redscreens for non valid URL is wrong instead - //a 404 message must be shown -> e.g. robots correct their links. - if(log.isDebug()){ - log.debug("Bad Request "+request.getPathInfo()); - } - DispatcherModule.sendBadRequest(request.getPathInfo(), response); - return; - } - String lang = ureq.getParameter("language"); - if (lang == null) { - // support for legacy lang parameter - lang = ureq.getParameter("lang"); - } - int loginStatus = AuthHelper.doAnonymousLogin(ureq,I18nManager.getInstance().getLocaleOrDefault(lang) ); - if ( loginStatus != AuthHelper.LOGIN_OK) { - if (loginStatus == AuthHelper.LOGIN_NOTAVAILABLE) { - DispatcherModule.redirectToServiceNotAvailable(response); - } - DispatcherModule.redirectToDefaultDispatcher(response); // error, redirect to login screen - return; - } - - ChiefController cc = Windows.getWindows(usess).getChiefController(); - if (cc == null) throw new AssertException("logged in, but no window/Chiefcontroller 'olatmain' found!"); - Window w = cc.getWindow(); - w.dispatchRequest(ureq, true); // renderOnly - } - -} diff --git a/src/main/java/org/olat/dispatcher/RemoteLoginformDispatcher.java b/src/main/java/org/olat/dispatcher/RemoteLoginformDispatcher.java index 9911e31d2bf2c53079a1787c011bd1b481d74015..4381a5acb7ba97f433e8ffc986315e100e87e852 100644 --- a/src/main/java/org/olat/dispatcher/RemoteLoginformDispatcher.java +++ b/src/main/java/org/olat/dispatcher/RemoteLoginformDispatcher.java @@ -205,10 +205,9 @@ public class RemoteLoginformDispatcher implements Dispatcher { } private String getRedirectToURL(UserSession usess) { - ChiefController cc = Windows.getWindows(usess).getChiefController(); - Window w = cc.getWindow(); + Window w = Windows.getWindows(usess).getChiefController().getWindow(); - URLBuilder ubu = new URLBuilder("", w.getInstanceId(), String.valueOf(w.getTimestamp()), null); + URLBuilder ubu = new URLBuilder("", w.getInstanceId(), String.valueOf(w.getTimestamp())); StringOutput sout = new StringOutput(30); ubu.buildURI(sout, null, null); diff --git a/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java b/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java index 06f7d85b53df9bed1cc36358b44001045f705b72..64c4efe77669615a61f791cec58a204011f2a9ef 100644 --- a/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java +++ b/src/main/java/org/olat/group/ui/run/BusinessGroupMainRunController.java @@ -128,21 +128,17 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im private static final String INITVIEW_TOOLFORUM = "toolforum"; public static final OLATResourceable ORES_TOOLFORUM = OresHelper.createOLATResourceableType(INITVIEW_TOOLFORUM); - private static final String INITVIEW_TOOLWIKI = WikiManager.WIKI_RESOURCE_FOLDER_NAME; - public static final OLATResourceable ORES_TOOLWIKI = OresHelper.createOLATResourceableType(INITVIEW_TOOLWIKI); - - private static final String INITVIEW_TOOLPORTFOLIO = "toolportfolio"; - public static final OLATResourceable ORES_TOOLPORTFOLIO = OresHelper.createOLATResourceableType(INITVIEW_TOOLPORTFOLIO); - private static final String INITVIEW_TOOLOPENMEETINGS = "toolportfolio"; - public static final OLATResourceable ORES_TOOLOPENMEETINGS = OresHelper.createOLATResourceableType(INITVIEW_TOOLOPENMEETINGS); - - public static final String INITVIEW_TOOLCAL = "action.calendar.group"; - public static final OLATResourceable ORES_TOOLCAL = OresHelper.createOLATResourceableType(INITVIEW_TOOLCAL); + public static final OLATResourceable ORES_TOOLCHAT = OresHelper.createOLATResourceableType("toolchat"); + public static final OLATResourceable ORES_TOOLCAL = OresHelper.createOLATResourceableType("toolcalendar"); public static final OLATResourceable ORES_TOOLMSG = OresHelper.createOLATResourceableType("toolmsg"); public static final OLATResourceable ORES_TOOLADMIN = OresHelper.createOLATResourceableType("tooladmin"); public static final OLATResourceable ORES_TOOLCONTACT = OresHelper.createOLATResourceableType("toolcontact"); public static final OLATResourceable ORES_TOOLMEMBERS = OresHelper.createOLATResourceableType("toolmembers"); public static final OLATResourceable ORES_TOOLRESOURCES = OresHelper.createOLATResourceableType("toolresources"); + public static final OLATResourceable ORES_TOOLPORTFOLIO = OresHelper.createOLATResourceableType("toolportfolio"); + public static final OLATResourceable ORES_TOOLBOOKING = OresHelper.createOLATResourceableType("toolbooking"); + public static final OLATResourceable ORES_TOOLOPENMEETINGS = OresHelper.createOLATResourceableType("toolopenmeetings"); + public static final OLATResourceable ORES_TOOLWIKI = OresHelper.createOLATResourceableType(WikiManager.WIKI_RESOURCE_FOLDER_NAME); // activity identifyers are used as menu user objects and for the user // activity events @@ -207,12 +203,6 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im */ private boolean isGroupsAdmin; - @Autowired - private ACService acService; - @Autowired - private CalendarModule calendarModule; - @Autowired - private BusinessGroupService businessGroupService; private EventBus singleUserEventBus; private String adminNodeId; // reference to admin menu item private HistoryPoint launchedFromPoint; @@ -228,6 +218,13 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im private boolean needActivation; private boolean chatAvailable; private boolean wildcard; + + @Autowired + private ACService acService; + @Autowired + private CalendarModule calendarModule; + @Autowired + private BusinessGroupService businessGroupService; /** * Do not use this constructor! Use the BGControllerFactory instead! @@ -306,8 +303,6 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im isAdmin = (wcard != null && Boolean.TRUE.equals(wcard)) || isGroupsAdmin || businessGroupService.isIdentityInBusinessGroup(getIdentity(), businessGroup.getKey(), true, false, null); - - // Initialize translator: // package translator with default group fallback translators and type @@ -380,7 +375,6 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im return CoreSpringFactory.getImpl(InstantMessagingModule.class).isEnabled() && CoreSpringFactory.getImpl(InstantMessagingModule.class).isGroupEnabled() && CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup).isToolEnabled(CollaborationTools.TOOL_CHAT); - } private Component getOnWaitingListMessage(UserRequest ureq, BusinessGroup group) { @@ -429,9 +423,6 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im TreeNode selTreeNode = bgTree.getSelectedNode(); String cmd = (String) selTreeNode.getUserObject(); handleTreeActions(ureq, cmd); - if(collabToolCtr != null) { - addToHistory(ureq, collabToolCtr); - } } else if (groupRunDisabled) { handleTreeActions(ureq, ACTIVITY_MENUSELECT_OVERVIEW); showError("grouprun.disabled"); @@ -631,8 +622,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im } CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); - ContactFormController cofocntrllr = collabTools.createContactFormController(ureq, getWindowControl(), cmsg); - return cofocntrllr; + return collabTools.createContactFormController(ureq, getWindowControl(), cmsg); } /** @@ -645,65 +635,20 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im // release edit lock if available removeAsListenerAndDispose(bgEditCntrllr); removeAsListenerAndDispose(collabToolCtr); - - CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); - + // init new controller according to user click if (ACTIVITY_MENUSELECT_OVERVIEW.equals(cmd)) { - // root node clicked display overview - mainPanel.setContent(main); + doMain(ureq); } else if (ACTIVITY_MENUSELECT_FORUM.equals(cmd)) { - addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLFORUM, OlatResourceableType.forum)); - SubscriptionContext sc = new SubscriptionContext(businessGroup, INITVIEW_TOOLFORUM); - - WindowControl bwControl = getWindowControl(); - // calculate the new businesscontext for the forum clicked - ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLFORUM); - bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl); - - collabToolCtr = collabTools.createForumController(ureq, bwControl, isAdmin, ureq.getUserSession().getRoles().isGuestOnly(), sc); - listenTo(collabToolCtr); - mainPanel.setContent(collabToolCtr.getInitialComponent()); + doForum(ureq); } else if (ACTIVITY_MENUSELECT_CHAT.equals(cmd)) { - collabToolCtr = collabTools.createChatController(ureq, getWindowControl(), businessGroup, isAdmin); - if(collabToolCtr == null) { - showWarning("groupchat.not.available"); - mainPanel.setContent(new Panel("empty")); - } else { - mainPanel.setContent(collabToolCtr.getInitialComponent()); - } + doChat(ureq); } else if (ACTIVITY_MENUSELECT_CALENDAR.equals(cmd)) { - addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLCAL, OlatResourceableType.calendar)); - - WindowControl bwControl = getWindowControl(); - // calculate the new businesscontext for the forum clicked - ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLCAL); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable())); - bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl); - - collabToolCtr = collabTools.createCalendarController(ureq, bwControl, businessGroup, isAdmin, true); - listenTo(collabToolCtr); - mainPanel.setContent(collabToolCtr.getInitialComponent()); + doCalendar(ureq); } else if (ACTIVITY_MENUSELECT_INFORMATION.equals(cmd)) { - ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLMSG); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable())); - WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); - collabToolCtr = collabTools.createNewsController(ureq, bwControl); - listenTo(collabToolCtr); - mainPanel.setContent(collabToolCtr.getInitialComponent()); + doInformations(ureq); } else if (ACTIVITY_MENUSELECT_FOLDER.equals(cmd)) { - addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLFOLDER, OlatResourceableType.sharedFolder)); - - SubscriptionContext sc = new SubscriptionContext(businessGroup, INITVIEW_TOOLFOLDER); - - WindowControl bwControl = getWindowControl(); - // calculate the new businesscontext for the forum clicked - ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLFOLDER); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable())); - bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl); - collabToolCtr = collabTools.createFolderController(ureq, bwControl, businessGroup, isAdmin, sc); - listenTo(collabToolCtr); - mainPanel.setContent(collabToolCtr.getInitialComponent()); + doFolder(ureq); } else if (ACTIVITY_MENUSELECT_MEMBERSLIST.equals(cmd)) { doShowMembers(ureq); } else if (ACTIVITY_MENUSELECT_CONTACTFORM.equals(cmd)) { @@ -713,64 +658,175 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im } else if (ACTIVITY_MENUSELECT_SHOW_RESOURCES.equals(cmd)) { doShowResources(ureq); } else if (ACTIVITY_MENUSELECT_WIKI.equals(cmd)) { - addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLWIKI, OlatResourceableType.wiki)); - WindowControl bwControl = getWindowControl(); - // calculate the new businesscontext for the wiki clicked - ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLWIKI); - bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapWikiOres(ce.getOLATResourceable())); - - collabToolCtr = collabTools.createWikiController(ureq, bwControl); - listenTo(collabToolCtr); - mainPanel.setContent(collabToolCtr.getInitialComponent()); + doWiki(ureq); } else if (ACTIVITY_MENUSELECT_PORTFOLIO.equals(cmd)) { - addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLPORTFOLIO, OlatResourceableType.portfolio)); - WindowControl bwControl = getWindowControl(); - // calculate the new businesscontext for the wiki clicked - ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLPORTFOLIO); - bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(ce.getOLATResourceable())); - - collabToolCtr = collabTools.createPortfolioController(ureq, bwControl, businessGroup); - listenTo(collabToolCtr); - mainPanel.setContent(collabToolCtr.getInitialComponent()); + doPortfolio(ureq); } else if (ACTIVITY_MENUSELECT_OPENMEETINGS.equals(cmd)) { - addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLOPENMEETINGS, OlatResourceableType.portfolio)); - WindowControl bwControl = getWindowControl(); - // calculate the new businesscontext for the wiki clicked - ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLOPENMEETINGS); - bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, bwControl); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(ce.getOLATResourceable())); - - collabToolCtr = collabTools.createOpenMeetingsController(ureq, bwControl, businessGroup, isAdmin); - listenTo(collabToolCtr); - mainPanel.setContent(collabToolCtr.getInitialComponent()); + doOpenMeetings(ureq); } else if (ACTIVITY_MENUSELECT_AC.equals(cmd)) { doAccessControlHistory(ureq); } } + + private void doMain(UserRequest ureq) { + // root node clicked display overview + mainPanel.setContent(main); + addToHistory(ureq, this); + } + + private void doChat(UserRequest ureq) { + ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLCHAT); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); + addToHistory(ureq, bwControl); + + CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); + collabToolCtr = collabTools.createChatController(ureq, bwControl, businessGroup, isAdmin); + if(collabToolCtr == null) { + showWarning("groupchat.not.available"); + mainPanel.setContent(new Panel("empty")); + } else { + mainPanel.setContent(collabToolCtr.getInitialComponent()); + } + } + + private Activateable2 doForum(UserRequest ureq) { + addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLFORUM, OlatResourceableType.forum)); + SubscriptionContext sc = new SubscriptionContext(businessGroup, INITVIEW_TOOLFORUM); + + // calculate the new businesscontext for the forum clicked + ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLFORUM); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); + addToHistory(ureq, bwControl); + + CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); + collabToolCtr = collabTools.createForumController(ureq, bwControl, isAdmin, ureq.getUserSession().getRoles().isGuestOnly(), sc); + listenTo(collabToolCtr); + mainPanel.setContent(collabToolCtr.getInitialComponent()); + return (Activateable2)collabToolCtr; + } + + private Activateable2 doCalendar(UserRequest ureq) { + addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLCAL, OlatResourceableType.calendar)); + + // calculate the new businesscontext for the forum clicked + ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLCAL); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable())); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); + addToHistory(ureq, bwControl); + + CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); + collabToolCtr = collabTools.createCalendarController(ureq, bwControl, businessGroup, isAdmin, true); + listenTo(collabToolCtr); + mainPanel.setContent(collabToolCtr.getInitialComponent()); + return (Activateable2)collabToolCtr; + } + + private void doInformations(UserRequest ureq) { + ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLMSG); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable())); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); + addToHistory(ureq, bwControl); + + CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); + collabToolCtr = collabTools.createNewsController(ureq, bwControl); + listenTo(collabToolCtr); + mainPanel.setContent(collabToolCtr.getInitialComponent()); + } + + private Activateable2 doFolder(UserRequest ureq) { + addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLFOLDER, OlatResourceableType.sharedFolder)); + + SubscriptionContext sc = new SubscriptionContext(businessGroup, INITVIEW_TOOLFOLDER); + + ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLFOLDER); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ce.getOLATResourceable())); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); + addToHistory(ureq, bwControl); + + CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); + collabToolCtr = collabTools.createFolderController(ureq, bwControl, businessGroup, isAdmin, sc); + listenTo(collabToolCtr); + mainPanel.setContent(collabToolCtr.getInitialComponent()); + return (Activateable2)collabToolCtr; + } + + private Activateable2 doWiki(UserRequest ureq) { + addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLWIKI, OlatResourceableType.wiki)); + + ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLWIKI); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapWikiOres(ce.getOLATResourceable())); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); + addToHistory(ureq, bwControl); + + CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); + collabToolCtr = collabTools.createWikiController(ureq, bwControl); + listenTo(collabToolCtr); + mainPanel.setContent(collabToolCtr.getInitialComponent()); + return (Activateable2)collabToolCtr; + } + + private Activateable2 doPortfolio(UserRequest ureq) { + addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLPORTFOLIO, OlatResourceableType.portfolio)); + + ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLPORTFOLIO); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(ce.getOLATResourceable())); + addToHistory(ureq, bwControl); + + CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); + Controller collabToolCtr = collabTools.createPortfolioController(ureq, bwControl, businessGroup); + listenTo(collabToolCtr); + mainPanel.setContent(collabToolCtr.getInitialComponent()); + return (Activateable2)collabToolCtr; + } + + private void doOpenMeetings(UserRequest ureq) { + addLoggingResourceable(LoggingResourceable.wrap(ORES_TOOLOPENMEETINGS, OlatResourceableType.portfolio)); + + ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLOPENMEETINGS); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl()); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(ce.getOLATResourceable())); + addToHistory(ureq, bwControl); + + CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup); + collabToolCtr = collabTools.createOpenMeetingsController(ureq, bwControl, businessGroup, isAdmin); + listenTo(collabToolCtr); + mainPanel.setContent(collabToolCtr.getInitialComponent()); + } - private void doAdministration(UserRequest ureq) { + private Activateable2 doAdministration(UserRequest ureq) { removeAsListenerAndDispose(bgEditCntrllr); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ORES_TOOLADMIN)); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ORES_TOOLADMIN, null, getWindowControl()); + addToHistory(ureq, bwControl); + collabToolCtr = bgEditCntrllr = new BusinessGroupEditController(ureq, bwControl, toolbarPanel, businessGroup); listenTo(bgEditCntrllr); mainPanel.setContent(bgEditCntrllr.getInitialComponent()); + return bgEditCntrllr; } - private void doAccessControlHistory(UserRequest ureq) { + private Activateable2 doAccessControlHistory(UserRequest ureq) { removeAsListenerAndDispose(bgACHistoryCtrl); + + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ORES_TOOLBOOKING, null, getWindowControl()); + addToHistory(ureq, bwControl); + OLATResource resource = businessGroup.getResource(); - bgACHistoryCtrl = new OrdersAdminController(ureq, getWindowControl(), resource); + bgACHistoryCtrl = new OrdersAdminController(ureq, bwControl, resource); listenTo(bgACHistoryCtrl); mainPanel.setContent(bgACHistoryCtrl.getInitialComponent()); + return (Activateable2)bgACHistoryCtrl; } private void doContactForm(UserRequest ureq) { if (vc_sendToChooserForm == null) vc_sendToChooserForm = createVelocityContainer("cosendtochooser"); removeAsListenerAndDispose(sendToChooserForm); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ORES_TOOLCONTACT, null, getWindowControl()); + addToHistory(ureq, bwControl); + sendToChooserForm = new BusinessGroupSendToChooserForm(ureq, bwControl, businessGroup, isAdmin); listenTo(sendToChooserForm); vc_sendToChooserForm.put("vc_sendToChooserForm", sendToChooserForm.getInitialComponent()); @@ -842,24 +898,18 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im @Override public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) { - if(entries == null || entries.isEmpty()) return; + if(entries == null || entries.isEmpty() || needActivation) return; + + // release edit lock if available + removeAsListenerAndDispose(bgEditCntrllr); + removeAsListenerAndDispose(collabToolCtr); - if(needActivation) { - return; - } ContextEntry ce = entries.remove(0); - activate(ureq, ce); - if(collabToolCtr instanceof Activateable2) { - ((Activateable2)collabToolCtr).activate(ureq, entries, ce.getTransientState()); - } - } - - private void activate(UserRequest ureq, ContextEntry ce) { OLATResourceable ores = ce.getOLATResourceable(); if (OresHelper.equals(ores, ORES_TOOLFORUM)) { // start the forum if (nodeForum != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_FORUM); + doForum(ureq).activate(ureq, entries, ce.getTransientState()); bgTree.setSelectedNode(nodeForum); } else { // not enabled String text = translate("warn.forumnotavailable"); @@ -869,7 +919,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im } } else if (OresHelper.equals(ores, ORES_TOOLFOLDER)) { if (nodeFolder != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_FOLDER); + doFolder(ureq).activate(ureq, entries, ce.getTransientState()); bgTree.setSelectedNode(nodeFolder); } else { // not enabled String text = translate("warn.foldernotavailable"); @@ -879,7 +929,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im } } else if (OresHelper.equals(ores, ORES_TOOLWIKI)) { if (nodeWiki != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_WIKI); + doWiki(ureq).activate(ureq, entries, ce.getTransientState()); bgTree.setSelectedNode(nodeWiki); } else { // not enabled String text = translate("warn.wikinotavailable"); @@ -889,7 +939,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im } } else if (OresHelper.equals(ores, ORES_TOOLCAL)) { if (nodeCal != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_CALENDAR); + doCalendar(ureq).activate(ureq, entries, ce.getTransientState()); bgTree.setSelectedNode(nodeCal); } else { // not enabled String text = translate("warn.calnotavailable"); @@ -898,18 +948,18 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im mainPanel.setContent(mc.getInitialComponent()); } } else if (OresHelper.equals(ores, ORES_TOOLPORTFOLIO)) { - if (nodePortfolio != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_PORTFOLIO); - bgTree.setSelectedNode(nodePortfolio); - } else { // not enabled - String text = translate("warn.portfolionotavailable"); - Controller mc = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), null, text); - listenTo(mc); // cleanup on dispose - mainPanel.setContent(mc.getInitialComponent()); - } + if (nodePortfolio != null) { + doPortfolio(ureq).activate(ureq, entries, ce.getTransientState()); + bgTree.setSelectedNode(nodePortfolio); + } else { // not enabled + String text = translate("warn.portfolionotavailable"); + Controller mc = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), null, text); + listenTo(mc); // cleanup on dispose + mainPanel.setContent(mc.getInitialComponent()); + } } else if (OresHelper.equals(ores, ORES_TOOLOPENMEETINGS)) { if (nodeOpenMeetings != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_OPENMEETINGS); + doOpenMeetings(ureq); bgTree.setSelectedNode(nodeOpenMeetings); } else { // not enabled String text = translate("warn.portfolionotavailable"); @@ -918,28 +968,28 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im mainPanel.setContent(mc.getInitialComponent()); } } else if (OresHelper.equals(ores, ORES_TOOLADMIN)) { - if (this.nodeAdmin != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_ADMINISTRATION); + if (nodeAdmin != null) { + doAdministration(ureq).activate(ureq, entries, ce.getTransientState()); bgTree.setSelectedNode(nodeAdmin); } } else if (OresHelper.equals(ores, ORES_TOOLMSG)) { - if (this.nodeInformation != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_INFORMATION); + if (nodeInformation != null) { + doInformations(ureq); bgTree.setSelectedNode(nodeInformation); } } else if (OresHelper.equals(ores, ORES_TOOLCONTACT)) { - if (this.nodeContact != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_CONTACTFORM); + if (nodeContact != null) { + doContactForm(ureq); bgTree.setSelectedNode(nodeContact); } } else if (OresHelper.equals(ores, ORES_TOOLMEMBERS)) { - if (this.nodeGroupOwners != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_MEMBERSLIST); + if (nodeGroupOwners != null) { + doShowMembers(ureq); bgTree.setSelectedNode(nodeGroupOwners); } } else if (OresHelper.equals(ores, ORES_TOOLRESOURCES)) { - if (this.nodeResources != null) { - handleTreeActions(ureq, ACTIVITY_MENUSELECT_SHOW_RESOURCES); + if (nodeResources != null) { + doShowResources(ureq); bgTree.setSelectedNode(nodeResources); } } @@ -1161,7 +1211,7 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im gtnChild.setAltText(translate("menutree.openmeetings.alt")); gtnChild.setIconCssClass("o_openmeetings_icon"); root.addChild(gtnChild); - nodePortfolio = gtnChild; + nodeOpenMeetings = gtnChild; } if (isAdmin) { @@ -1186,8 +1236,6 @@ public class BusinessGroupMainRunController extends MainLayoutBasicController im root.addChild(gtnChild); } } - return gtm; } - } \ No newline at end of file diff --git a/src/main/java/org/olat/group/ui/wizard/BGEmailCompositionStep.java b/src/main/java/org/olat/group/ui/wizard/BGEmailCompositionStep.java index 176b8a83d663a7bac7fcfa9fa022cb6a7920cc1a..08c346e340ac273095d20d33a246f2638b8592d4 100644 --- a/src/main/java/org/olat/group/ui/wizard/BGEmailCompositionStep.java +++ b/src/main/java/org/olat/group/ui/wizard/BGEmailCompositionStep.java @@ -53,7 +53,7 @@ public class BGEmailCompositionStep extends BasicStep { @Override public StepFormController getStepController(UserRequest ureq, WindowControl windowControl, StepsRunContext stepsRunContext, Form form) { - form.setMultipartEnabled(true, Integer.MAX_VALUE); + form.setMultipartEnabled(true); BGEmailCompositionStepController selectForm = new BGEmailCompositionStepController(ureq, windowControl, form, stepsRunContext, groups); diff --git a/src/main/java/org/olat/group/ui/wizard/BGEmailSelectReceiversStep.java b/src/main/java/org/olat/group/ui/wizard/BGEmailSelectReceiversStep.java index 5ed8267701fe5027b7a3825f67fa370e5a29b3dc..d18cbe923fd9c2fb528203b295f0d06a92fab1f6 100644 --- a/src/main/java/org/olat/group/ui/wizard/BGEmailSelectReceiversStep.java +++ b/src/main/java/org/olat/group/ui/wizard/BGEmailSelectReceiversStep.java @@ -52,7 +52,7 @@ public class BGEmailSelectReceiversStep extends BasicStep { @Override public StepFormController getStepController(UserRequest ureq, WindowControl windowControl, StepsRunContext stepsRunContext, Form form) { - form.setMultipartEnabled(true, Integer.MAX_VALUE); + form.setMultipartEnabled(true); BGEmailSelectReceiversStepController selectForm = new BGEmailSelectReceiversStepController(ureq, windowControl, form, stepsRunContext); return selectForm; diff --git a/src/main/java/org/olat/gui/demo/guidemo/_content/calloutWindow.html b/src/main/java/org/olat/gui/demo/guidemo/_content/calloutWindow.html index 65769b3e7e7465ccb0b817cc22dfdaf7b2cc7956..322a6529ce0db8b6ac758760fe6d6a8ed287d7ff 100644 --- a/src/main/java/org/olat/gui/demo/guidemo/_content/calloutWindow.html +++ b/src/main/java/org/olat/gui/demo/guidemo/_content/calloutWindow.html @@ -31,7 +31,7 @@ jQuery(function() { ## Add click listener to trigger 3 via JavaScript, fire event on ## this velocity container back to java code when click is executed jQuery('#myspecialdomid').on("click",function() { - $r.javaScriptBgCommand('trigger3'); + $r.javaScriptCommand('trigger3'); }); }); /* ]]> */ diff --git a/src/main/java/org/olat/home/controllerCreators/_content/welcome.html b/src/main/java/org/olat/home/controllerCreators/_content/welcome.html deleted file mode 100644 index 0665b1a6d14485554a166706efe84e09876afe82..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/home/controllerCreators/_content/welcome.html +++ /dev/null @@ -1,95 +0,0 @@ -<div class="o_home_portaleditlink"> -#if ($portalEditMode) - $r.render("command.portal.back") -#else - $r.render("command.portal.edit") -#end -</div> -<div class="o_home_main"> - <h4>$r.translate("welcome.header")</h4> - #set ($intro = $r.translate("welcome.intro")) - #if ($intro != "") - $intro <br><br> - #end -</div> - -#if($isbaks) -<div id="baks_home_launcher"> - <img src="$r.staticLink("themes/baks/images/portal_launcher_bg.png")" onclick="gotoSite(event);"/> - <div id="baks_goto_repository" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Meine Veranstaltungen</a></div> - <div id="baks_goto_members" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Mitglieder</a></div> - <div id="baks_goto_library" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Bibliothek</a></div> - <div id="baks_goto_friends" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Freundeskreis</a></div> - <div id="baks_goto_network" class="baks_goto_wrapper" onclick="gotoSite(event);"><a href="#" onclick="gotoSite(event);">Netzwerk</a></div> -</div> - -<script type="text/javascript"> -/* <![CDATA[ */ -function gotoSite(event) { - var el = jQuery("#baks_home_launcher"); - var pos = el.position(); - var offsetLeft = pos.left; - var offsetTop = pos.top; - - var i=0; - for(var offsetParent = el.offsetParent(); offsetParent.attr('id') != 'o_body'; offsetParent = offsetParent.offsetParent()) { - var posn = offsetParent.position(); - if(offsetParent.attr('id') != "o_col3" && offsetParent.attr('id') != "o_page") {//ie give it an offset which is the same as _content - offsetLeft += posn.left; - offsetTop += posn.top; - } - if(i++==10) { break; }//security - } - - //inner square is difficult - var centerX = el.width() / 2; - var centerY = el.height() / 2; - //shift 0,0 coordinate to center - var px = event.pageX - offsetLeft - centerX; - var py = centerY - (event.pageY - offsetTop); - //calculate the x position on the line x = -y + centerY; - var theoy = (centerY - 5) - Math.abs(px); - if(Math.abs(py) < theoy) { - launchSite('site_demo_icon'); - } - else if(px > 0 && py < 0) { - launchSite('baks_friends'); - } - else if(px > 0 && py > 0) { - launchSite('fx_members'); - } - else if(px < 0 && py > 0) { - launchSite('o_site_repository'); - } - else { - launchSite('f_site_library'); - } -} - -function launchSite(site) { - var siteLinks = jQuery('li.' + site + ' a'); - if (siteLinks && siteLinks.length > 0) { - var siteLink = siteLinks[0]; - if (o2cl()) { - var target = siteLink.target; - if (target === 'oaa0') { - jQuery('#oaa0').attr('src',siteLink.href); - } else { - document.location.href=siteLink.href; - } - } - } else { - alert("Diese Funktion ist noch nicht vorhanden"); - } -} -/* ]]> */ -</script> - -#end ##end of baks-check - -$r.render("myPortal") - -<div class="o_home_rsslink"> - $r.contextHelp("Personal Menu#_rss") - <a class="o_home_rsslink" href="$rssLink" title="$r.translate("welcome.rss")" target="_blank"></a> -</div> \ No newline at end of file diff --git a/src/main/java/org/olat/ims/qti/editor/EssayItemController.java b/src/main/java/org/olat/ims/qti/editor/EssayItemController.java index 57c1e29aaf0a25e0d4fb5baf7f5edb890824d9d0..dd181f883d36b3e78207301b6b1b63af59f181e4 100644 --- a/src/main/java/org/olat/ims/qti/editor/EssayItemController.java +++ b/src/main/java/org/olat/ims/qti/editor/EssayItemController.java @@ -30,13 +30,12 @@ import org.olat.core.gui.components.Component; import org.olat.core.gui.components.velocity.VelocityContainer; import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.ControllerEventListener; -import org.olat.core.gui.control.DefaultController; import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.controller.BasicController; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; import org.olat.core.gui.translator.Translator; import org.olat.core.helpers.Settings; -import org.olat.core.util.Util; import org.olat.ims.qti.editor.beecom.objects.EssayQuestion; import org.olat.ims.qti.editor.beecom.objects.Item; import org.olat.ims.qti.editor.beecom.objects.Material; @@ -46,15 +45,10 @@ import org.olat.ims.qti.editor.beecom.objects.Material; * * @author mike */ -public class EssayItemController extends DefaultController implements ControllerEventListener { - /* - * Logging, Velocity - */ - private static final String PACKAGE = Util.getPackageName(EssayItemController.class); - private static final String VC_ROOT = Util.getPackageVelocityRoot(PACKAGE); +public class EssayItemController extends BasicController implements ControllerEventListener { - private VelocityContainer main; - private Translator trnsltr; + private final VelocityContainer main; + private final Translator trnsltr; private Item item; private EssayQuestion essayQuestion; @@ -69,14 +63,15 @@ public class EssayItemController extends DefaultController implements Controller * @param trnsltr * @param wControl */ - public EssayItemController(Item item, QTIEditorPackage qtiPackage, Translator trnsltr, WindowControl wControl, boolean restrictedEdit) { - super(wControl); + public EssayItemController(UserRequest ureq, WindowControl wControl, Item item, QTIEditorPackage qtiPackage, Translator trnsltr, boolean restrictedEdit) { + super(ureq, wControl); + setTranslator(trnsltr); this.restrictedEdit = restrictedEdit; this.item = item; this.qtiPackage = qtiPackage; this.trnsltr = trnsltr; - main = new VelocityContainer("essayitem", VC_ROOT + "/tab_essayItem.html", trnsltr, this); + main = createVelocityContainer("tab_essayItem.html"); essayQuestion = (EssayQuestion) item.getQuestion(); main.contextPut("question", essayQuestion); main.contextPut("response", essayQuestion.getEssayResponse()); @@ -87,14 +82,14 @@ public class EssayItemController extends DefaultController implements Controller main.contextPut("mediaBaseURL", mediaBaseUrl); main.contextPut("isRestrictedEdit", restrictedEdit ? Boolean.TRUE : Boolean.FALSE); main.contextPut("isSurveyMode", qtiPackage.getQTIDocument().isSurvey() ? "true" : "false"); - - setInitialComponent(main); + putInitialPanel(main); } /** * @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) */ + @Override public void event(UserRequest ureq, Component source, Event event) { if (source == main) { String cmd = event.getCommand(); @@ -102,6 +97,8 @@ public class EssayItemController extends DefaultController implements Controller displayMaterialFormController(ureq, item.getQuestion().getQuestion(), restrictedEdit); } else if (cmd.equals("sessay")) { // submit essay + main.setDirty(true); + // fetch columns String sColumns = ureq.getParameter("columns_q"); int iColumns; @@ -162,6 +159,7 @@ public class EssayItemController extends DefaultController implements Controller * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event) */ + @Override public void event(UserRequest ureq, Controller controller, Event event) { if (controller == matFormCtr) { if (event instanceof QTIObjectBeforeChangeEvent) { @@ -213,10 +211,9 @@ public class EssayItemController extends DefaultController implements Controller /** * @see org.olat.core.gui.control.DefaultController#doDispose(boolean) */ + @Override protected void doDispose() { - main = null; item = null; - trnsltr = null; if (dialogCtr != null) { dialogCtr.dispose(); dialogCtr = null; @@ -226,5 +223,4 @@ public class EssayItemController extends DefaultController implements Controller matFormCtr = null; } } - } \ No newline at end of file diff --git a/src/main/java/org/olat/ims/qti/editor/ItemNodeTabbedFormController.java b/src/main/java/org/olat/ims/qti/editor/ItemNodeTabbedFormController.java index 74a9fa28728b3a6e807bc5271597d43a1fda89ae..c7804c4b9bb53502577c84bb4e7f6533006887bc 100644 --- a/src/main/java/org/olat/ims/qti/editor/ItemNodeTabbedFormController.java +++ b/src/main/java/org/olat/ims/qti/editor/ItemNodeTabbedFormController.java @@ -72,19 +72,19 @@ public class ItemNodeTabbedFormController extends TabbableDefaultController { int questionType = item.getQuestion().getType(); switch (questionType) { case Question.TYPE_SC: - itemCtrl = new ChoiceItemController(ureq, getWindowControl(), item, qtiPackage, getTranslator(), restrictedEdit); + itemCtrl = new ChoiceItemController(ureq, getWindowControl(), item, qtiPackage, getTranslator(), restrictedEdit); break; case Question.TYPE_MC: - itemCtrl = new ChoiceItemController(ureq, getWindowControl(), item, qtiPackage, getTranslator(), restrictedEdit); + itemCtrl = new ChoiceItemController(ureq, getWindowControl(), item, qtiPackage, getTranslator(), restrictedEdit); break; case Question.TYPE_KPRIM: - itemCtrl = new ChoiceItemController(ureq, getWindowControl(), item, qtiPackage, getTranslator(), restrictedEdit); + itemCtrl = new ChoiceItemController(ureq, getWindowControl(), item, qtiPackage, getTranslator(), restrictedEdit); break; case Question.TYPE_FIB: itemCtrl = new FIBItemController(ureq, getWindowControl(), item, qtiPackage, getTranslator(), restrictedEdit); break; case Question.TYPE_ESSAY: - itemCtrl = new EssayItemController(item, qtiPackage, getTranslator(), getWindowControl(), restrictedEdit); + itemCtrl = new EssayItemController(ureq, getWindowControl(), item, qtiPackage, getTranslator(), restrictedEdit); break; } } diff --git a/src/main/java/org/olat/ims/qti/editor/_content/exitDialog.html b/src/main/java/org/olat/ims/qti/editor/_content/exitDialog.html index 825d542a9092d7305d032c60c0e2e77022f7cc25..1e330265f96722dc11dbd2885873baec27cfe900 100644 --- a/src/main/java/org/olat/ims/qti/editor/_content/exitDialog.html +++ b/src/main/java/org/olat/ims/qti/editor/_content/exitDialog.html @@ -1,6 +1,6 @@ <div class="modal-body">$r.translate("exit.message")</div> <div class="modal-footer"> - <a href="$r.commandURIbg("exit.save")" onclick="return o2cl()" onkeypress="return o2cl()" $r.bgTarget() title="$r.translateInAttribute("exit.save.tooltip")" class="btn btn-primary"><span>$r.translate("exit.save")</span></a> - <a href="$r.commandURIbg("exit.discard")" onclick="return o2cl()" onkeypress="return o2cl()" $r.bgTarget() title="$r.translateInAttribute("exit.discard.tooltip")" class="btn btn-default"><span>$r.translate("exit.discard")</span></a> - <a href="$r.commandURIbg("exit.cancel")" onclick="return o2cl()" onkeypress="return o2cl()" $r.bgTarget() title="$r.translateInAttribute("exit.cancel.tooltip")" class="btn btn-default"><span>$r.translate("exit.cancel")</span></a> + <a $r.hrefAndOnclick("exit.save",false,false) title="$r.translateInAttribute("exit.save.tooltip")" class="btn btn-primary"><span>$r.translate("exit.save")</span></a> + <a $r.hrefAndOnclick("exit.discard",false,false) title="$r.translateInAttribute("exit.discard.tooltip")" class="btn btn-default"><span>$r.translate("exit.discard")</span></a> + <a $r.hrefAndOnclick("exit.cancel",false,false) title="$r.translateInAttribute("exit.cancel.tooltip")" class="btn btn-default"><span>$r.translate("exit.cancel")</span></a> </div> diff --git a/src/main/java/org/olat/ims/qti/editor/_content/tab_assess.html b/src/main/java/org/olat/ims/qti/editor/_content/tab_assess.html index 03e5cfca068d804510b7f2070985e01fa810c750..ea14b85838c1576b6b8924b526379734058c1f9a 100644 --- a/src/main/java/org/olat/ims/qti/editor/_content/tab_assess.html +++ b/src/main/java/org/olat/ims/qti/editor/_content/tab_assess.html @@ -21,7 +21,7 @@ $r.contextHelpWithWrapper("org.olat.ims.qti.editor","qed-meta-surv.html","help.hover.survey") #end </legend> - <form class="clearfix" action="$r.formURIbg('sao')" id="ofo_assessform" name="assessform" $r.bgTarget() method="post"> + <form id="ofo_assessform" action="$r.formURIbg("sao")" method="post" onsubmit="o_XHRSubmit('ofo_assessform');"> <div class="form-group"> <label class="control-label col-sm-3">$r.translate("form.metadata.title")</label> <div class="col-sm-9"> @@ -136,8 +136,8 @@ <input type="radio" name="duration" value="No" $nochecked onclick="shadeFormElement('sec');shadeFormElement('min');return setFormDirty('ofo_assessform')" onkeypress="shadeFormElement('sec');shadeFormElement('min');return setFormDirty('ofo_assessform')" onchange="return setFormDirty('ofo_assessform')" />$r.translate("no") - <input id="min" type="text" name="duration_min" value="$minval" size="3" onchange="return setFormDirty('ofo_assessform')" onclick="return setFormDirty('ofo_assessform')" $!readonly class="$css"/>: - <input id="sec" type="text" name="duration_sec" value="$secval" size="3" maxlength="2" onchange="return setFormDirty('ofo_assessform')" onclick="return setFormDirty('ofo_assessform')" $!readonly class="$css"/> + <input id="min" type="text" name="duration_min" value="$minval" size="3" onchange="return setFormDirty('ofo_assessform')" onclick="return setFormDirty('ofo_assessform')" $!readonly class="$css" />: + <input id="sec" type="text" name="duration_sec" value="$secval" size="3" maxlength="2" onchange="return setFormDirty('ofo_assessform')" onclick="return setFormDirty('ofo_assessform')" $!readonly class="$css" /> <i>($r.translate("form.metadata.minutes"):$r.translate("form.metadata.seconds"))</i> </div> </div> @@ -302,12 +302,12 @@ <div class="form-group"> <label class="control-label col-sm-3">$r.translate("form.metadata.cutvalue")</label> <div class="col-sm-9"> - <input type="text" class="form-control" name="cutvalue" value="$!cutvalue" size="4" onchange="return setFormDirty('ofo_assessform')" onclick="return setFormDirty('ofo_assessform')"/> + <input type="text" class="form-control" name="cutvalue" value="$!cutvalue" size="4" onchange="return setFormDirty('ofo_assessform')" onclick="return setFormDirty('ofo_assessform')" /> </div> </div> #end #end <div class="col-sm-offset-3 col-sm-9 "><div class="btn-group"> - <input type="submit" value="$r.translateInAttribute("submit")" class="btn btn-primary" name="olat_fosm" /> + <button type="button" class="btn btn-primary" name="olat_fosm" onclick="o_IQEvent('ofo_assessform')"><span>$r.translateInAttribute("submit")</span></button> </div></div> </form></fieldset> \ No newline at end of file diff --git a/src/main/java/org/olat/ims/qti/editor/_content/tab_essayItem.html b/src/main/java/org/olat/ims/qti/editor/_content/tab_essayItem.html index 8aabc2e8b6c5224f649c1a58a86854c99a420708..8458f7265053792e28fd7ada3e22db029dbe2c10 100644 --- a/src/main/java/org/olat/ims/qti/editor/_content/tab_essayItem.html +++ b/src/main/java/org/olat/ims/qti/editor/_content/tab_essayItem.html @@ -11,7 +11,7 @@ <tr> <td>$r.formatLatexFormulas($question.getQuestion().renderAsHtml($mediaBaseURL))</td> <td align="center"> - <a title="$r.translateInAttribute("mat.edit.question")" href="$r.commandURIbg('editq')" $r.bgTarget()><img alt="$r.translateInAttribute("mat.edit.question")" src="$r.staticLink("images/qti/page_edit.png")"></a> + <a $r.hrefAndOnclick("editq",true,true) title="$r.translateInAttribute("mat.edit.question")"><i class="o_icon o_icon-lg o_icon_edit"> </i></a> </td> </tr> </tbody> @@ -21,7 +21,7 @@ <legend>$r.translate("fieldset.legend.answers") $r.contextHelpWithWrapper("org.olat.ims.qti.editor","qed-answer-surv-4.html","help.hover.qti-answer-4") </legend> - <form action="$r.formURIbg("sessay")" id="ofo_tab_essavitem" $r.bgTarget() method="post"> + <form action="$r.formURIbg("sessay")" id="ofo_tab_essavitem" name="ofo_tab_essavitem" method="post" onsubmit="o_XHRSubmit('ofo_tab_essavitem');"> <div class="row"><div class="col-sm-offset-3 col-sm-9"> <div class="o_desc">$r.translate("essay.dimension.header")</div> </div></div> @@ -45,13 +45,13 @@ #if($isRestrictedEdit) <p class="form-control-static">$question.getMaxValue()</p> #else - <input type="text" name="single_score" value="$question.getMaxValue()" class="form-control" size="4" onchange="return setFormDirty('ofo_tab_scitem')" onclick="return setFormDirty('ofo_tab_scitem')"/> + <input type="text" name="single_score" value="$question.getMaxValue()" class="form-control" size="4" onchange="return setFormDirty('ofo_tab_essavitem')" onclick="return setFormDirty('ofo_tab_essavitem')"/> #end </div> </div> #end <div class="col-sm-offset-3 col-sm-9 "><div class="btn-group"> - <input type="submit" value="$r.translateInAttribute("submit")" class="btn btn-primary" name="olat_fosm" /> + <button type="button" class="btn btn-primary" name="olat_fosm" onclick="o_IQEvent('ofo_tab_essavitem')"><span>$r.translateInAttribute("submit")</span></button> </div></div> </form> </fieldset> diff --git a/src/main/java/org/olat/ims/qti/editor/_content/tab_fibItem.html b/src/main/java/org/olat/ims/qti/editor/_content/tab_fibItem.html index b551a226bea58bec4ae1ddfd2b92dd04b80526f4..01049cc3dcc24ceb7cb909089c3a02707d84b614 100644 --- a/src/main/java/org/olat/ims/qti/editor/_content/tab_fibItem.html +++ b/src/main/java/org/olat/ims/qti/editor/_content/tab_fibItem.html @@ -7,7 +7,7 @@ #end </legend> - <form action="$r.formURIbg("sfib")" id="ofo_tab_fibitem" $r.bgTarget() method="post"> + <form action="$r.formURIbg("sfib")" id="ofo_tab_fibitem" name="ofo_tab_fibitem" method="post" onsubmit="o_XHRSubmit('ofo_tab_fibitem');"> #if ($question && $question.getResponses().size() > 0) <table class="table table-bordered"> <thead> @@ -32,9 +32,9 @@ <tr> <td> #if(!$isRestrictedEdit) - <a href="$r.commandURI("up", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.move_up")"><img src="$r.staticLink("images/qti/move_up.png")" alt="$r.translateInAttribute("mat.move_up")" border="0"></a> + <a $r.hrefAndOnclick("up",true,true,"posid","$count") title="$r.translateInAttribute("mat.move_up")"><i class="o_icon o_icon-lg o_icon_move_up"> </i></a> <br /> - <a href="$r.commandURI("down", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.move_down")"><img src="$r.staticLink("images/qti/move_down.png")" alt="$r.translateInAttribute("mat.move_down")" border="0"></a> + <a $r.hrefAndOnclick("down",true,true,"posid","$count") title="$r.translateInAttribute("mat.move_down")"><i class="o_icon o_icon-lg o_icon_move_down"> </i></a> #end </td> #if($content.getType().equals("CONTENT")) @@ -97,15 +97,13 @@ <td valign="middle" align="center"> #if($content.getType().equals("CONTENT")) - <a href="$r.commandURI("editr", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.edit.response")"> - <img src="$r.staticLink("images/qti/page_edit.png")" alt="$r.translateInAttribute("mat.edit.response")" border="0"></a> + <a $r.hrefAndOnclick("editr",true,true,"posid","$count") title="$r.translateInAttribute("mat.edit.response")"><i class="o_icon o_icon-lg o_icon_edit"> </i></a> #else <img src="$r.staticLink("images/qti/empty.gif")" alt "" border="0" width="16"> #end #if(!$isRestrictedEdit && ($question.getResponses().size() > 1) ) - <a href="$r.commandURI("del", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.edit.delete")"> - <img src="$r.staticLink("images/qti/delete.png")" alt="$r.translateInAttribute("mat.edit.delete")" border="0"></a> + <a $r.hrefAndOnclick("del",true,true,"posid","$count") title="$r.translateInAttribute("mat.edit.delete")"><i class="o_icon o_icon-lg o_icon_delete_item"> </i></a> #end </td> </tr> @@ -117,9 +115,9 @@ <p> <br /> #if(!$isRestrictedEdit) - <a href="$r.commandURIbg("addtext")" $r.bgTarget() onclick="return o2cl()" onkeypress="return o2cl()" class="btn btn-default"><span>$r.translate("add_text")</span></a> + <a $r.hrefAndOnclick("addtext",true,true) class="btn btn-default"><span>$r.translate("add_text")</span></a> - <a href="$r.commandURIbg("addblank")" $r.bgTarget() onclick="return o2cl()" onkeypress="return o2cl()" class="btn btn-default"><span>$r.translate("add_blank")</span></a> + <a $r.hrefAndOnclick("addblank",true,true) class="btn btn-default"><span>$r.translate("add_blank")</span></a> <br /> #end </p> @@ -191,6 +189,6 @@ </div> #end <div class="col-sm-offset-3 col-sm-9 "><div class="btn-group"> - <input type="submit" value="$r.translateInAttribute("submit")" class="btn btn-primary" name="olat_fosm"/> + <button type="button" class="btn btn-primary" name="olat_fosm" onclick="o_IQEvent('ofo_tab_fibitem')"><span>$r.translateInAttribute("submit")</span></button> </div> </form></fieldset> \ No newline at end of file diff --git a/src/main/java/org/olat/ims/qti/editor/_content/tab_kprimItem.html b/src/main/java/org/olat/ims/qti/editor/_content/tab_kprimItem.html index 9ab0835b9d6d1c211ca29b92ed18e82f96578a47..1592df66b44b1253da1b6f7c1a5ec1a2bea8824d 100644 --- a/src/main/java/org/olat/ims/qti/editor/_content/tab_kprimItem.html +++ b/src/main/java/org/olat/ims/qti/editor/_content/tab_kprimItem.html @@ -16,7 +16,7 @@ <tr> <td>$r.formatLatexFormulas($question.getQuestion().renderAsHtml($mediaBaseURL))</td> <td align="center"> - <a title="$r.translateInAttribute("mat.edit.question")" href="$r.commandURIbg('editq')" $r.bgTarget() onclick="return o2cl()"><img alt="$r.translateInAttribute("mat.edit.question")" src="$r.staticLink("images/qti/page_edit.png")"></a> + <a $r.hrefAndOnclick("editq",true,true) title="$r.translateInAttribute("mat.edit.question")"><i class="o_icon o_icon-lg o_icon_edit"> </i></a> </td> </tr> </tbody> @@ -31,7 +31,7 @@ #end </legend> - <form action="$r.formURIbg("skprim")" id="ofo_tab_kprimitem" $r.bgTarget() method="post"> + <form action="$r.formURIbg("skprim")" id="ofo_tab_kprimitem" name="ofo_tab_kprimitem" method="post" onsubmit="o_XHRSubmit('ofo_tab_kprimitem');"> #if ($question && $question.getResponses().size() > 0) <table class="table table-bordered" style="position:relative"> <thead> @@ -53,9 +53,9 @@ <tr> <td> #if(!$isRestrictedEdit) - <a href="$r.commandURI("up", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.move_up")"><img src="$r.staticLink("images/qti/move_up.png")" alt="$r.translateInAttribute("mat.move_up")" border="0"></a> + <a $r.hrefAndOnclick("up",true,true,"posid","$count") title="$r.translateInAttribute("mat.move_up")"><i class="o_icon o_icon-lg o_icon_move_up"> </i></a> <br /> - <a href="$r.commandURI("down", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.move_down")"><img src="$r.staticLink("images/qti/move_down.png")" alt="$r.translateInAttribute("mat.move_down")" border="0"></a> + <a $r.hrefAndOnclick("down",true,true,"posid","$count")" title="$r.translateInAttribute("mat.move_down")"><i class="o_icon o_icon-lg o_icon_move_down"> </i></a> #end </td> <td>$r.formatLatexFormulas($content.getContent().renderAsHtml($mediaBaseURL))</td> @@ -88,8 +88,7 @@ <td > </td> #end <td valign="middle" align="center"> - <a href="$r.commandURI("editr", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.edit.response")"> - <img src="$r.staticLink("images/qti/page_edit.png")" alt="$r.translateInAttribute("mat.edit.response")" border="0"></a> + <a $r.hrefAndOnclick("editr",true,true,"posid","$count") title="$r.translateInAttribute("mat.edit.response")"><i class="o_icon o_icon-lg o_icon_edit"> </i></a> </td> </tr> #end @@ -113,7 +112,7 @@ </div> #if(!$isRestrictedEdit) <div class="col-sm-offset-3 col-sm-9 "><div class="btn-group"> - <input type="submit" value="$r.translateInAttribute("submit")" class="btn btn-primary" name="olat_fosm" /> + <button type="button" class="btn btn-primary" name="olat_fosm" onclick="o_IQEvent('ofo_tab_kprimitem')"><span>$r.translateInAttribute("submit")</span></button> </div></div> #end #end diff --git a/src/main/java/org/olat/ims/qti/editor/_content/tab_mcItem.html b/src/main/java/org/olat/ims/qti/editor/_content/tab_mcItem.html index 2660c66f2d60068c72c5162609bfd00e6039f9c5..2853cfaef039a81560160f738e5f0df96503cae8 100644 --- a/src/main/java/org/olat/ims/qti/editor/_content/tab_mcItem.html +++ b/src/main/java/org/olat/ims/qti/editor/_content/tab_mcItem.html @@ -15,7 +15,7 @@ <tbody><tr> <td>$r.formatLatexFormulas($question.getQuestion().renderAsHtml($mediaBaseURL))</td> <td align="center"> - <a title="$r.translateInAttribute("mat.edit.question")" href="$r.commandURIbg('editq')" $r.bgTarget() onclick="return o2cl()"><img alt="$r.translateInAttribute("mat.edit.question")" src="$r.staticLink("images/qti/page_edit.png")"></a> + <a $r.hrefAndOnclick("editq",true,true) title="$r.translateInAttribute("mat.edit.question")"><i class="o_icon o_icon-lg o_icon_edit"> </i></a> </td> </tr></tbody> </table> @@ -29,7 +29,7 @@ #end </legend> - <form action="$r.formURIbg("smc")" id="ofo_tab_mcitem" $r.bgTarget() method="post"> + <form action="$r.formURIbg("smc")" id="ofo_tab_mcitem" name="ofo_tab_mcitem" method="post" onsubmit="o_XHRSubmit('ofo_tab_mcitem');"> #if ($question && $question.getResponses().size() > 0) <table class="table table-bordered" style="position:relative"> <thead><tr> @@ -51,9 +51,9 @@ <tr> <td> #if(!$isRestrictedEdit) - <a href="$r.commandURI("up", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.move_up")"><img src="$r.staticLink("images/qti/move_up.png")" alt="$r.translateInAttribute("mat.move_up")" border="0"></a> + <a $r.hrefAndOnclick("up",true,true,"posid","$count") title="$r.translateInAttribute("mat.move_up")"><i class="o_icon o_icon-lg o_icon_move_up"> </i></a> <br /> - <a href="$r.commandURI("down", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.move_down")"><img src="$r.staticLink("images/qti/move_down.png")" alt="$r.translateInAttribute("mat.move_down")" border="0"></a> + <a $r.hrefAndOnclick("down",true,true,"posid","$count") title="$r.translateInAttribute("mat.move_down")"><i class="o_icon o_icon-lg o_icon_move_down"> </i></a> #end </td> <td>$r.formatLatexFormulas($content.getContent().renderAsHtml($mediaBaseURL))</td> @@ -86,12 +86,10 @@ #end #end <td valign="middle" align="center"> - <a href="$r.commandURI("editr", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.edit.response")"> - <img src="$r.staticLink("images/qti/page_edit.png")" alt="$r.translateInAttribute("mat.edit.response")" border="0"></a> + <a $r.hrefAndOnclick("editr",true,true,"posid","$count") title="$r.translateInAttribute("mat.edit.response")"><i class="o_icon o_icon-lg o_icon_edit"> </i></a> #if(!$isRestrictedEdit) - <a href="$r.commandURI("del", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("delete")"> - <img src="$r.staticLink("images/qti/delete.png")" alt="$r.translateInAttribute("mat.edit.delete")" border="0"></a> + <a $r.hrefAndOnclick("del",true,true,"posid","$count") title="$r.translateInAttribute("delete")"><i class="o_icon o_icon-lg o_icon_delete_item"> </i></a> #end </td> </tr> @@ -101,7 +99,7 @@ #end #if(!$isRestrictedEdit) - <a href="$r.commandURI("addchoice")" onclick="return o2cl()" onkeypress="return o2cl()" class="btn btn-default"><span>$r.translate("add_answer")</span></a> + <a href="$r.commandURI("addchoice")" onclick="$r.commandURI("addchoice") return false;" class="btn btn-default"><span>$r.translate("add_answer")</span></a> #end #if($isSurveyMode.equals("false")) @@ -171,7 +169,7 @@ </div> #if(!$isRestrictedEdit) <div class="col-sm-offset-3 col-sm-9 "><div class="btn-group"> - <input type="submit" value="$r.translateInAttribute("submit")" class="btn btn-primary" name="olat_fosm" /> + <button type="button" class="btn btn-primary" name="olat_fosm" onclick="o_IQEvent('ofo_tab_mcitem')"><span>$r.translateInAttribute("submit")</span></button> </div></div> #end #end diff --git a/src/main/java/org/olat/ims/qti/editor/_content/tab_scItem.html b/src/main/java/org/olat/ims/qti/editor/_content/tab_scItem.html index d96017dceea492f726727037d34b75dbe90fc867..442aebac8f266d97cf9a59dc4d04b73aa5d2ea24 100644 --- a/src/main/java/org/olat/ims/qti/editor/_content/tab_scItem.html +++ b/src/main/java/org/olat/ims/qti/editor/_content/tab_scItem.html @@ -14,7 +14,7 @@ <tbody><tr> <td>$r.formatLatexFormulas($question.getQuestion().renderAsHtml($mediaBaseURL))</td> <td align="center"> - <a title="$r.translateInAttribute("mat.edit.question")" href="$r.commandURIbg('editq')" $r.bgTarget() onclick="return o2cl()"><img alt="$r.translateInAttribute("mat.edit.question")" src="$r.staticLink("images/qti/page_edit.png")"></a> + <a $r.hrefAndOnclick("editq",true,true) title="$r.translateInAttribute("mat.edit.question")"><i class="o_icon o_icon-lg o_icon_edit"> </i></a> </td> </tr></tbody> </table> @@ -29,7 +29,7 @@ </legend> #if ($question && $question.getResponses().size() > 0) - <form action="$r.formURIbg("ssc")" id="ofo_tab_scitem" $r.bgTarget() method="post"> + <form action="$r.formURIbg("ssc")" id="ofo_tab_scitem" method="post" onsubmit="o_XHRSubmit('ofo_tab_scitem');"> <table class="table table-bordered"> <thead><tr> <th width="5">Pos</th> @@ -49,9 +49,9 @@ #set ($count = ($velocityCount - 1)) <tr><td> #if(!$isRestrictedEdit) - <a href="$r.commandURI("up", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.move_up")"><img src="$r.staticLink("images/qti/move_up.png")" alt="$r.translateInAttribute("mat.move_up")" border="0"></a> + <a $r.hrefAndOnclick("up",true,true,"posid","$count") title="$r.translateInAttribute("mat.move_up")"><i class="o_icon o_icon-lg o_icon_move_up"> </i></a> <br> - <a href="$r.commandURI("down", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.move_down")"><img src="$r.staticLink("images/qti/move_down.png")" alt="$r.translateInAttribute("mat.move_down")" border="0"></a> + <a $r.hrefAndOnclick("down",true,true,"posid","$count") title="$r.translateInAttribute("mat.move_down")"><i class="o_icon o_icon-lg o_icon_move_down"> </i></a> #end </td><td>$r.formatLatexFormulas($content.getContent().renderAsHtml($mediaBaseURL))</td> @@ -74,19 +74,17 @@ #end <td valign="middle" align="center"> - <a href="$r.commandURI("editr", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.edit.response")"> - <img src="$r.staticLink("images/qti/page_edit.png")" alt="$r.translateInAttribute("mat.edit.response")" border="0"></a> + <a $r.hrefAndOnclick("editr",true,true,"posid","$count") title="$r.translateInAttribute("mat.edit.response")"><i class="o_icon o_icon-lg o_icon_edit"> </i></a> #if(!$isRestrictedEdit && ($question.getResponses().size() > 1) ) - <a href="$r.commandURI("del", "posid", "$count")" onclick="return o2cl()" onkeypress="return o2cl()" title="$r.translateInAttribute("mat.edit.delete")"> - <img src="$r.staticLink("images/qti/delete.png")" alt="$r.translateInAttribute("mat.edit.delete")" border="0"></a> + <a $r.hrefAndOnclick("del",true,true,"posid","$count") title="$r.translateInAttribute("mat.edit.delete")"><i class="o_icon o_icon-lg o_icon_delete_item"> </i></a> #end </td></tr> #end </tbody> </table> #if(!$isRestrictedEdit) - <a href='$r.commandURI("addchoice")' onclick="return o2cl()" onkeypress="return o2cl()" class="btn btn-default">$r.translate("add_answer")</a> + <a $r.hrefAndOnclick("addchoice",true,true) class="btn btn-default">$r.translate("add_answer")</a> #end #if($isSurveyMode.equals("false")) @@ -105,7 +103,7 @@ #if($isSurveyMode.equals("false") && !$isRestrictedEdit) <div class="col-sm-offset-3 col-sm-9 "><div class="btn-group"> - <input type="submit" value="$r.translateInAttribute("submit")" class="btn btn-primary" name="olat_fosm" /> + <button type="button" class="btn btn-primary" name="olat_fosm" onclick="o_IQEvent('ofo_tab_scitem')"><span>$r.translateInAttribute("submit")</span></button> </div></div> #end </form> diff --git a/src/main/java/org/olat/modules/coach/ui/CoachMainController.java b/src/main/java/org/olat/modules/coach/ui/CoachMainController.java index 585d238330b7286b483be3ffa464c1df7c2c4fe1..69dbcdb11ac49aa5a3075d532df64f4384089814 100644 --- a/src/main/java/org/olat/modules/coach/ui/CoachMainController.java +++ b/src/main/java/org/olat/modules/coach/ui/CoachMainController.java @@ -100,43 +100,55 @@ public class CoachMainController extends MainLayoutBasicController implements Ac @Override public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) { if(entries == null || entries.isEmpty()) { - selectMenuItem(ureq, "students"); + selectMenuItem(ureq, "Members"); } else { ContextEntry currentEntry = entries.get(0); String cmd = currentEntry.getOLATResourceable().getResourceableTypeName(); - Controller selectedCtrl = selectMenuItem(ureq, cmd); - if(selectedCtrl instanceof Activateable2) { + Activateable2 selectedCtrl = selectMenuItem(ureq, cmd); + if(selectedCtrl == null) { + selectMenuItem(ureq, "Members"); + } else { List<ContextEntry> subEntries = entries.subList(1, entries.size()); - ((Activateable2)selectedCtrl).activate(ureq, subEntries, currentEntry.getTransientState()); - } else if(selectedCtrl == null) { - selectMenuItem(ureq, "students"); - } + selectedCtrl.activate(ureq, subEntries, currentEntry.getTransientState()); + } } } - private Controller selectMenuItem(UserRequest ureq, String cmd) { + private Activateable2 selectMenuItem(UserRequest ureq, String cmd) { Controller selectedCtrl = null; - if("students".equals(cmd)) { + if("members".equalsIgnoreCase(cmd) || "students".equalsIgnoreCase(cmd)) { if(studentListCtrl == null) { - studentListCtrl = new StudentListController(ureq, getWindowControl()); + OLATResourceable ores = OresHelper.createOLATResourceableInstance("Members", 0l); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + studentListCtrl = new StudentListController(ureq, bwControl); listenTo(studentListCtrl); } selectedCtrl = studentListCtrl; - } else if("groups".equals(cmd)) { + } else if("groups".equalsIgnoreCase(cmd)) { if(groupListCtrl == null) { - groupListCtrl = new GroupListController(ureq, getWindowControl()); + OLATResourceable ores = OresHelper.createOLATResourceableInstance("Groups", 0l); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + groupListCtrl = new GroupListController(ureq, bwControl); listenTo(groupListCtrl); } selectedCtrl = groupListCtrl; - } else if("courses".equals(cmd)) { + } else if("courses".equalsIgnoreCase(cmd)) { if(courseListCtrl == null) { - courseListCtrl = new CourseListController(ureq, getWindowControl()); + OLATResourceable ores = OresHelper.createOLATResourceableInstance("Courses", 0l); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + courseListCtrl = new CourseListController(ureq, bwControl); listenTo(courseListCtrl); } selectedCtrl = courseListCtrl; - } else if("search".equals(cmd)) { + } else if("search".equalsIgnoreCase(cmd)) { if(userSearchCtrl == null) { - userSearchCtrl = new UserSearchController(ureq, getWindowControl()); + OLATResourceable ores = OresHelper.createOLATResourceableInstance("Search", 0l); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + userSearchCtrl = new UserSearchController(ureq, bwControl); listenTo(userSearchCtrl); } selectedCtrl = userSearchCtrl; @@ -148,14 +160,9 @@ public class CoachMainController extends MainLayoutBasicController implements Ac menu.setSelectedNodeId(selTreeNode.getIdent()); } columnLayoutCtr.setCol3(selectedCtrl.getInitialComponent()); - - //history - OLATResourceable ores = OresHelper.createOLATResourceableInstance(cmd, 0l); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); - WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); - addToHistory(ureq, bwControl); + addToHistory(ureq, selectedCtrl); } - return selectedCtrl; + return (Activateable2)selectedCtrl; } private TreeModel buildTreeModel(UserRequest ureq) { @@ -164,19 +171,19 @@ public class CoachMainController extends MainLayoutBasicController implements Ac gtm.setRootNode(root); GenericTreeNode students = new GenericTreeNode(); - students.setUserObject("students"); + students.setUserObject("Members"); students.setTitle(translate("students.menu.title")); students.setAltText(translate("students.menu.title.alt")); root.addChild(students); GenericTreeNode groups = new GenericTreeNode(); - groups.setUserObject("groups"); + groups.setUserObject("Groups"); groups.setTitle(translate("groups.menu.title")); groups.setAltText(translate("groups.menu.title.alt")); root.addChild(groups); GenericTreeNode courses = new GenericTreeNode(); - courses.setUserObject("courses"); + courses.setUserObject("Courses"); courses.setTitle(translate("courses.menu.title")); courses.setAltText(translate("courses.menu.title.alt")); root.addChild(courses); @@ -184,7 +191,7 @@ public class CoachMainController extends MainLayoutBasicController implements Ac Roles roles = ureq.getUserSession().getRoles(); if(roles.isUserManager() || roles.isOLATAdmin()) { GenericTreeNode search = new GenericTreeNode(); - search.setUserObject("search"); + search.setUserObject("Search"); search.setTitle(translate("search.menu.title")); search.setAltText(translate("search.menu.title.alt")); root.addChild(search); diff --git a/src/main/java/org/olat/modules/dialog/DialogElementsTableModel.java b/src/main/java/org/olat/modules/dialog/DialogElementsTableModel.java index a8aeddb3e2840fdadf162b5054606f74ed9336e5..b56940b20338b0b363792c4a6baf40e0dde24189 100644 --- a/src/main/java/org/olat/modules/dialog/DialogElementsTableModel.java +++ b/src/main/java/org/olat/modules/dialog/DialogElementsTableModel.java @@ -31,10 +31,13 @@ import java.util.Locale; import org.olat.core.gui.components.table.BaseTableDataModelWithoutFilter; import org.olat.core.gui.components.table.DefaultColumnDescriptor; -import org.olat.core.gui.components.table.HrefGenerator; import org.olat.core.gui.components.table.StaticColumnDescriptor; +import org.olat.core.gui.components.table.Table; import org.olat.core.gui.components.table.TableController; import org.olat.core.gui.components.table.TableDataModel; +import org.olat.core.gui.render.Renderer; +import org.olat.core.gui.render.StringOutput; +import org.olat.core.gui.render.URLBuilder; import org.olat.core.gui.translator.Translator; import org.olat.course.nodes.dialog.DialogConfigForm; import org.olat.course.nodes.dialog.DialogNodeForumCallback; @@ -114,17 +117,7 @@ public class DialogElementsTableModel extends BaseTableDataModelWithoutFilter<Di public void addColumnDescriptors(TableController tableCtr) { Locale loc = translator.getLocale(); if (callback != null) { - DefaultColumnDescriptor coldesc = new DefaultColumnDescriptor("table.header.filename", 0, DialogElementsController.ACTION_SHOW_FILE, - loc); - coldesc.setHrefGenerator(new HrefGenerator() { - public String generate(int row, String href) { - DialogElement entry = getEntryAt(row); - return "javascript:o_openPopUp('" + href + entry.getFilename() + "','fileview','600','700','no')"; - } - }); -// coldesc.setIsPopUpWindowAction(true, -// DefaultColumnDescriptor.DEFAULT_POPUP_ATTRIBUTES); - tableCtr.addColumnDescriptor(coldesc); + tableCtr.addColumnDescriptor(new FileDownloadColumnDescriptor("table.header.filename", 0, loc)); } else { tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.header.filename", 0, null, loc)); } @@ -157,5 +150,26 @@ public class DialogElementsTableModel extends BaseTableDataModelWithoutFilter<Di public void setEntries(List<DialogElement> entries) { this.entries = entries; } + + private static class FileDownloadColumnDescriptor extends DefaultColumnDescriptor { + + public FileDownloadColumnDescriptor(String headerKey, int dataColumn, Locale locale) { + super(headerKey, dataColumn, null, locale); + } + + @Override + public void renderValue(StringOutput sb, int row, Renderer renderer) { + URLBuilder ubu = renderer.getUrlBuilder(); + ubu = ubu.createCopyFor(getTable()); + + int sortedRow = table.getSortedRow(row); + Object entry = getTable().getTableDataModel().getValueAt(sortedRow, getDataColumn()); + StringOutput link = new StringOutput(); + ubu.buildURI(link, new String[] { Table.COMMANDLINK_ROWACTION_CLICKED, Table.COMMANDLINK_ROWACTION_ID }, new String[] { String.valueOf(row), DialogElementsController.ACTION_SHOW_FILE }); // url + sb.append("<a href=\"javascript:o_openPopUp('").append(link).append(entry.toString()).append("','fileview','600','700','no')\">") + .append(entry.toString()) + .append("</a>"); + } + } } diff --git a/src/main/java/org/olat/modules/iq/_content/qti.html b/src/main/java/org/olat/modules/iq/_content/qti.html index f132bf716e5142297f1629e4c0ceb82346ee8179..191079018024e9a6746db840274c07980934f380 100644 --- a/src/main/java/org/olat/modules/iq/_content/qti.html +++ b/src/main/java/org/olat/modules/iq/_content/qti.html @@ -295,15 +295,14 @@ function mark (it, title, title_marked) { m=!m; if (!o_info.linkbusy) { - o_beforeserver(); - $r.javaScriptBgCommand("mark")+'?id='+it.id+'&p='+m; + console.log(it.id); + $r.openJavaScriptCommand("mark"),'id',it.id,'p',m); } } function memo (id, s) { if (!o_info.linkbusy) { - o_beforeserver(); - $r.javaScriptBgCommand("memo")+'?id='+id+'&p='+encodeURIComponent(s); + $r.openJavaScriptCommand("memo"),'id',id,'p',encodeURIComponent(s)); } } diff --git a/src/main/java/org/olat/modules/qpool/ui/QuestionItemDataModel.java b/src/main/java/org/olat/modules/qpool/ui/QuestionItemDataModel.java index 4eec8609c0eaac2278e78135d4219cf58ff0c286..ae98a1abf8405743c7af0052723befa6fbd9531d 100644 --- a/src/main/java/org/olat/modules/qpool/ui/QuestionItemDataModel.java +++ b/src/main/java/org/olat/modules/qpool/ui/QuestionItemDataModel.java @@ -19,6 +19,8 @@ */ package org.olat.modules.qpool.ui; +import java.util.List; + import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableDataSourceModel; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataSourceDelegate; @@ -41,6 +43,16 @@ public class QuestionItemDataModel extends DefaultFlexiTableDataSourceModel<Item this.translator = translator; } + public ItemRow getObjectByKey(Long key) { + List<ItemRow> rows = getObjects(); + for(ItemRow row:rows) { + if(row != null && row.getKey().equals(key)) { + return row; + } + } + return null; + } + @Override public QuestionItemDataModel createCopyWithEmptyList() { return new QuestionItemDataModel(getTableColumnModel(), getSourceDelegate(), translator); diff --git a/src/main/java/org/olat/modules/qpool/ui/QuestionListController.java b/src/main/java/org/olat/modules/qpool/ui/QuestionListController.java index 488169881681e0d5e718bb10d43692a6e4a72890..b1cb15a20b17d1126e1461b87f3485de314d3ae9 100644 --- a/src/main/java/org/olat/modules/qpool/ui/QuestionListController.java +++ b/src/main/java/org/olat/modules/qpool/ui/QuestionListController.java @@ -40,6 +40,7 @@ import org.olat.core.gui.control.Event; import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController; import org.olat.core.gui.control.generic.closablewrapper.CloseableModalController; +import org.olat.core.gui.control.generic.dtabs.Activateable2; import org.olat.core.gui.control.generic.modal.DialogBoxController; import org.olat.core.gui.control.generic.modal.DialogBoxUIFactory; import org.olat.core.gui.control.generic.wizard.Step; @@ -49,6 +50,8 @@ import org.olat.core.gui.control.generic.wizard.StepsRunContext; import org.olat.core.gui.media.MediaResource; import org.olat.core.id.Identity; import org.olat.core.id.context.BusinessControlFactory; +import org.olat.core.id.context.ContextEntry; +import org.olat.core.id.context.StateEntry; import org.olat.core.util.resource.OresHelper; import org.olat.group.BusinessGroup; import org.olat.group.model.BusinessGroupSelectionEvent; @@ -97,7 +100,7 @@ import org.springframework.beans.factory.annotation.Autowired; * Initial date: 22.01.2013<br> * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com */ -public class QuestionListController extends AbstractItemListController implements BreadcrumbPanelAware { +public class QuestionListController extends AbstractItemListController implements BreadcrumbPanelAware, Activateable2 { private FormLink list, exportItem, shareItem, removeItem, newItem, copyItem, deleteItem, authorItem, importItem, bulkChange; @@ -182,6 +185,23 @@ public class QuestionListController extends AbstractItemListController implement } } + @Override + public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) { + if(entries == null || entries.isEmpty()) return; + + ContextEntry entry = entries.get(0); + String type = entry.getOLATResourceable().getResourceableTypeName(); + if("QuestionItem".equals(type)) { + Long itemKey = entry.getOLATResourceable().getResourceableId(); + ItemRow row = getModel().getObjectByKey(itemKey); + if(row == null) { + //TODO xhr + } else { + doSelect(ureq, row); + } + } + } + @Override protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { if(source instanceof FormLink) { @@ -910,7 +930,8 @@ public class QuestionListController extends AbstractItemListController implement removeAsListenerAndDispose(currentDetailsCtrl); removeAsListenerAndDispose(currentMainDetailsCtrl); - currentDetailsCtrl = new QuestionItemDetailsController(ureq, getWindowControl(), item, editable, getSource().isDeleteEnabled()); + WindowControl bwControl = addToHistory(ureq, item, null); + currentDetailsCtrl = new QuestionItemDetailsController(ureq, bwControl, item, editable, getSource().isDeleteEnabled()); currentDetailsCtrl.setBreadcrumbPanel(stackPanel); listenTo(currentDetailsCtrl); currentMainDetailsCtrl = new LayoutMain3ColsController(ureq, getWindowControl(), currentDetailsCtrl); diff --git a/src/main/java/org/olat/modules/qpool/ui/QuestionPoolMainEditorController.java b/src/main/java/org/olat/modules/qpool/ui/QuestionPoolMainEditorController.java index b5fae29e1ec81e4a79556cc05c5f49efa5d00446..e38bef43a03a7fb6ec91e79a978b773b26b183ec 100644 --- a/src/main/java/org/olat/modules/qpool/ui/QuestionPoolMainEditorController.java +++ b/src/main/java/org/olat/modules/qpool/ui/QuestionPoolMainEditorController.java @@ -249,7 +249,7 @@ public class QuestionPoolMainEditorController extends BasicController implements } else if(copyToMyCtrl == source) { if(DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) { QuestionItemShort item = (QuestionItemShort)copyToMyCtrl.getUserObject(); - doCopyToMy(ureq, item); + doCopyToMy(item); } } else if(cmc == source) { cleanUp(); @@ -332,11 +332,11 @@ public class QuestionPoolMainEditorController extends BasicController implements copyToMyCtrl.setUserObject(item); } - private void doCopyToMy(UserRequest ureq, QuestionItemShort item) { + private void doCopyToMy(QuestionItemShort item) { List<QuestionItem> copiedItems = qpoolService.copyItems(getIdentity(), singletonList(item)); showInfo("item.copied", Integer.toString(copiedItems.size())); if(myQuestionsCtrl != null) { - myQuestionsCtrl.updateSource(ureq); + myQuestionsCtrl.updateSource(); } } @@ -428,7 +428,7 @@ public class QuestionPoolMainEditorController extends BasicController implements myQuestionsCtrl.setBreadcrumbPanel(stackPanel); listenTo(myQuestionsCtrl); } else { - myQuestionsCtrl.updateSource(ureq, source); + myQuestionsCtrl.updateSource(source); } currentCtrl = myQuestionsCtrl; setContent(ureq, myQuestionsCtrl, entries, state); @@ -442,7 +442,7 @@ public class QuestionPoolMainEditorController extends BasicController implements markedQuestionsCtrl.setBreadcrumbPanel(stackPanel); listenTo(markedQuestionsCtrl); } else { - markedQuestionsCtrl.updateSource(ureq, source); + markedQuestionsCtrl.updateSource(source); } currentCtrl = markedQuestionsCtrl; setContent(ureq, markedQuestionsCtrl, entries, state); @@ -461,7 +461,7 @@ public class QuestionPoolMainEditorController extends BasicController implements listenTo(selectedPoolCtrl); cNode.setController(selectedPoolCtrl); } else { - selectedPoolCtrl.updateSource(ureq, source); + selectedPoolCtrl.updateSource(source); } currentCtrl = selectedPoolCtrl; setContent(ureq, selectedPoolCtrl, entries, state); @@ -491,7 +491,7 @@ public class QuestionPoolMainEditorController extends BasicController implements listenTo(sharedItemsCtrl); cNode.setController(sharedItemsCtrl); } else { - sharedItemsCtrl.updateSource(ureq, source); + sharedItemsCtrl.updateSource(source); } currentCtrl = sharedItemsCtrl; setContent(ureq, sharedItemsCtrl, entries, state); @@ -515,7 +515,7 @@ public class QuestionPoolMainEditorController extends BasicController implements listenTo(collItemsCtrl); cNode.setController(collItemsCtrl); } else { - collItemsCtrl.updateSource(ureq, source); + collItemsCtrl.updateSource(source); } collItemsCtrl.activate(ureq, entries, state); currentCtrl = collItemsCtrl; diff --git a/src/main/java/org/olat/modules/qpool/ui/QuestionsController.java b/src/main/java/org/olat/modules/qpool/ui/QuestionsController.java index 392d5488d505bafc5fbf35c9b227164e5e98b647..34755905d6a4761c4621d4840c696c22c691c0ba 100644 --- a/src/main/java/org/olat/modules/qpool/ui/QuestionsController.java +++ b/src/main/java/org/olat/modules/qpool/ui/QuestionsController.java @@ -19,35 +19,23 @@ */ package org.olat.modules.qpool.ui; -import java.util.Collection; -import java.util.Collections; import java.util.List; import org.olat.core.gui.UserRequest; 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.stack.BreadcrumbPanel; import org.olat.core.gui.components.stack.BreadcrumbPanelAware; -import org.olat.core.gui.components.velocity.VelocityContainer; 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.controller.BasicController; import org.olat.core.gui.control.generic.dtabs.Activateable2; -import org.olat.core.gui.control.generic.modal.DialogBoxController; -import org.olat.core.gui.control.generic.modal.DialogBoxUIFactory; import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.StateEntry; -import org.olat.core.util.StringHelper; -import org.olat.modules.qpool.QPoolService; import org.olat.modules.qpool.QuestionItem; import org.olat.modules.qpool.QuestionItemCollection; import org.olat.modules.qpool.QuestionItemShort; -import org.olat.modules.qpool.QuestionItemView; -import org.olat.modules.qpool.ui.events.QItemViewEvent; import org.olat.modules.qpool.ui.events.QPoolEvent; -import org.springframework.beans.factory.annotation.Autowired; /** * @@ -60,20 +48,9 @@ import org.springframework.beans.factory.annotation.Autowired; */ public class QuestionsController extends BasicController implements Activateable2, BreadcrumbPanelAware { - private static final String SPLIT_VIEW_NORTH_HEIGHT = "northHeight"; - private static final String SPLIT_VIEW_WEST_WIDTH = "westWidth"; - - private Link deleteItem, selectItem; private QuestionListController listCtrl; - private final QuestionItemPreviewController previewCtrl; - private final QuestionItemSummaryController detailsCtrl; - private BreadcrumbPanel stackPanel; - private final VelocityContainer mainVC; - private DialogBoxController confirmDeleteBox; - - @Autowired - private QPoolService qpoolService; + private QuestionItemsSource dataSource; public QuestionsController(UserRequest ureq, WindowControl wControl, QuestionItemsSource source, String key) { @@ -83,31 +60,8 @@ public class QuestionsController extends BasicController implements Activateable listCtrl = new QuestionListController(ureq, wControl, source, key); listenTo(listCtrl); - detailsCtrl = new QuestionItemSummaryController(ureq, wControl); - listenTo(detailsCtrl); - previewCtrl = new QuestionItemPreviewController(ureq, wControl); - listenTo(previewCtrl); - - mainVC = createVelocityContainer("items"); - - mainVC.put("items", listCtrl.getInitialComponent()); - mainVC.put("details", detailsCtrl.getInitialComponent()); - mainVC.put("preview", previewCtrl.getInitialComponent()); - mainVC.contextPut("tableId", listCtrl.getTableFormDispatchId()); - - if(source.isDeleteEnabled()) { - deleteItem = LinkFactory.createButton("delete.item", mainVC, this); - deleteItem.setEnabled(false); - } - selectItem = LinkFactory.createButton("select.item", mainVC, this); - selectItem.setEnabled(false); - - Object northHeight = ureq.getUserSession().getGuiPreferences().get(source.getClass(), SPLIT_VIEW_NORTH_HEIGHT); - Object westWidth = ureq.getUserSession().getGuiPreferences().get(source.getClass(), SPLIT_VIEW_WEST_WIDTH); - mainVC.contextPut(SPLIT_VIEW_NORTH_HEIGHT, northHeight == null ? "" : northHeight); - mainVC.contextPut(SPLIT_VIEW_WEST_WIDTH, westWidth == null ? "" : westWidth); - putInitialPanel(mainVC); + putInitialPanel(listCtrl.getInitialComponent()); } @Override @@ -119,33 +73,20 @@ public class QuestionsController extends BasicController implements Activateable public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) { if(entries == null || entries.isEmpty()) return; - ContextEntry entry = entries.get(0); - String type = entry.getOLATResourceable().getResourceableTypeName(); - if("QuestionItem".equals(type)) { - Collection<Long> key = Collections.singletonList(entry.getOLATResourceable().getResourceableId()); - List<QuestionItemView> items = dataSource.getItems(key); - if(!items.isEmpty()) { - doUpdateDetails(ureq, items.get(0)); - doSelect(ureq, detailsCtrl.getItem(), detailsCtrl.isCanEdit()); - } - } + listCtrl.activate(ureq, entries, state); } public void setQuestionItemCollection(QuestionItemCollection coll) { listCtrl.setItemCollection(coll); } - public void updateSource(UserRequest ureq, QuestionItemsSource source) { + public void updateSource(QuestionItemsSource source) { this.dataSource = source; listCtrl.updateSource(source); - detailsCtrl.refresh(); - previewCtrl.refresh(ureq); } - public void updateSource(UserRequest ureq) { + public void updateSource() { listCtrl.updateSource(dataSource); - detailsCtrl.refresh(); - previewCtrl.refresh(ureq); } public QuestionItemShort getQuestionAt(int index) { @@ -160,45 +101,12 @@ public class QuestionsController extends BasicController implements Activateable @Override protected void event(UserRequest ureq, Component source, Event event) { - if(selectItem == source) { - doSelect(ureq, detailsCtrl.getItem(), detailsCtrl.isCanEdit()); - } else if(deleteItem == source) { - doConfirmDelete(ureq, detailsCtrl.getItem()); - } else if(source == mainVC) { - String size = ureq.getModuleURI(); - if("saveNorthHeight".equals(event.getCommand()) && StringHelper.isLong(size)) { - ureq.getUserSession().getGuiPreferences().putAndSave(this.dataSource.getClass(), SPLIT_VIEW_NORTH_HEIGHT, size); - mainVC.contextPut(SPLIT_VIEW_NORTH_HEIGHT, size); - } else if("saveWestWidth".equals(event.getCommand()) && StringHelper.isLong(size)) { - ureq.getUserSession().getGuiPreferences().putAndSave(this.dataSource.getClass(), SPLIT_VIEW_WEST_WIDTH, size); - mainVC.contextPut(SPLIT_VIEW_WEST_WIDTH, size); - } - } + // } @Override protected void event(UserRequest ureq, Controller source, Event event) { if(source == listCtrl) { - if(event instanceof QItemViewEvent) { - QItemViewEvent se = (QItemViewEvent)event; - QuestionItemView item = se.getItem(); - doUpdateDetails(ureq, item); - } else if(event instanceof QPoolEvent) { - if(QPoolEvent.BULK_CHANGE.equals(event.getCommand())) { - updateSelectAfterChange(ureq); - } else if(QPoolEvent.ITEM_DELETED.equals(event.getCommand())) { - postDelete(ureq); - stackPanel.popUpToRootController(ureq); - } - fireEvent(ureq, event); - } - } else if(source == confirmDeleteBox) { - boolean delete = DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event); - if(delete) { - QuestionItem item = (QuestionItem)confirmDeleteBox.getUserObject(); - doDelete(ureq, item); - } - } else if (source instanceof QuestionItemDetailsController) { if(event instanceof QPoolEvent) { if(QPoolEvent.ITEM_DELETED.equals(event.getCommand())) { postDelete(ureq); @@ -210,50 +118,12 @@ public class QuestionsController extends BasicController implements Activateable super.event(ureq, source, event); } - protected void updateSelectAfterChange(UserRequest ureq) { - QuestionItem item = previewCtrl.getItem(); - if(item != null) { - Collection<Long> key = Collections.singletonList(item.getKey()); - List<QuestionItemView> items = dataSource.getItems(key); - if(items.size() > 0) { - QuestionItemView itemView = items.get(0); - doUpdateDetails(ureq, itemView); - } - } - } - protected void doSelect(UserRequest ureq, QuestionItem item, boolean editable) { listCtrl.doSelect(ureq, item, editable); } - private void doConfirmDelete(UserRequest ureq, QuestionItem item) { - confirmDeleteBox = activateYesNoDialog(ureq, null, translate("confirm.delete"), confirmDeleteBox); - confirmDeleteBox.setUserObject(item); - } - - private void doUpdateDetails(UserRequest ureq, QuestionItemView itemView) { - if(deleteItem != null) { - deleteItem.setVisible(itemView.isEditable()); - deleteItem.setEnabled(true); - } - QuestionItem item = qpoolService.loadItemById(itemView.getKey()); - detailsCtrl.updateItem(item, itemView.isEditable()); - previewCtrl.updateItem(ureq, item); - - selectItem.setEnabled(true); - - mainVC.contextPut("details", Boolean.TRUE); - } - - private void doDelete(UserRequest ureq, QuestionItemShort item) { - qpoolService.deleteItems(Collections.singletonList(item)); - postDelete(ureq); - } - private void postDelete(UserRequest ureq) { listCtrl.reset(); - detailsCtrl.reset(); - previewCtrl.reset(); fireEvent(ureq, new QPoolEvent(QPoolEvent.ITEM_DELETED)); showInfo("item.deleted"); diff --git a/src/main/java/org/olat/modules/qpool/ui/_content/items.html b/src/main/java/org/olat/modules/qpool/ui/_content/items.html index 621431199e26006f26049c4bcead4ef9903c33db..2080441007de98e5d94c5761e9474c8feb89ddfb 100644 --- a/src/main/java/org/olat/modules/qpool/ui/_content/items.html +++ b/src/main/java/org/olat/modules/qpool/ui/_content/items.html @@ -1,15 +1,3 @@ -#if($details) - <div class="container-fluid"> - <div class="row"> - <div class="col-sm-4"> - $r.render("items") - </div> - <div class="col-sm-8"> - $r.render("details") - $r.render("preview") - </div> - </div> - </div> -#else + $r.render("items") -#end + diff --git a/src/main/java/org/olat/modules/scorm/ScormAPIandDisplayController.java b/src/main/java/org/olat/modules/scorm/ScormAPIandDisplayController.java index b52734b127d937cd574de972556ad1fa77c10b37..1a9808b77172e281e9c57d8871d51d516ae4aebf 100644 --- a/src/main/java/org/olat/modules/scorm/ScormAPIandDisplayController.java +++ b/src/main/java/org/olat/modules/scorm/ScormAPIandDisplayController.java @@ -232,12 +232,12 @@ public class ScormAPIandDisplayController extends MainLayoutBasicController impl if (previewMode) { LayoutMain3ColsPreviewController ctr = new LayoutMain3ColsPreviewController(ureq, getWindowControl(), (showMenu ? menuTree : null), myContent, "scorm" + scormResourceId); if(fullWindow) - ctr.setAsFullscreen(ureq); + ctr.setAsFullscreen(); columnLayoutCtr = ctr; } else { LayoutMain3ColsBackController ctr = new LayoutMain3ColsBackController(ureq, getWindowControl(), (showMenu ? menuTree : null), myContent, "scorm" + scormResourceId); if(fullWindow) - ctr.setAsFullscreen(ureq); + ctr.setAsFullscreen(); columnLayoutCtr = ctr; } } else { diff --git a/src/main/java/org/olat/modules/wiki/_content/breadcrump.html b/src/main/java/org/olat/modules/wiki/_content/breadcrump.html deleted file mode 100644 index 5e6bc229678955393663480cf6794cbb7e48230c..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/modules/wiki/_content/breadcrump.html +++ /dev/null @@ -1,7 +0,0 @@ -#if($queue && $queue.size() > 0) - <ul> - #foreach($crumb in $queue) - <li><a title="$r.escapeHtml($crumb.getName())" href="$r.commandURIbg("go")$crumb.getName()" onclick="return o2cl()" onkeypress="return o2cl()" $r.bgTarget()>$crumb.getDescription()</a></li> - #end - </ul> -#end \ No newline at end of file diff --git a/src/main/java/org/olat/modules/wiki/gui/components/wikiToHtml/WikiMarkupRenderer.java b/src/main/java/org/olat/modules/wiki/gui/components/wikiToHtml/WikiMarkupRenderer.java index ffa72f4466f0220f4cbe090319000594e2ccf480..85d1d0cee066ed9774691f03584e75ed59912d6e 100644 --- a/src/main/java/org/olat/modules/wiki/gui/components/wikiToHtml/WikiMarkupRenderer.java +++ b/src/main/java/org/olat/modules/wiki/gui/components/wikiToHtml/WikiMarkupRenderer.java @@ -88,14 +88,13 @@ public class WikiMarkupRenderer extends DefaultComponentRenderer { String uri = out.toString(); ParserDocument parsedDoc = null; - String uniqueId = "o_wiki"+wikiComp.getDispatchID(); + String uniqueId = "o_wiki".concat(wikiComp.getDispatchID()); try { uri = URLDecoder.decode(uri, "utf-8"); input.setVirtualWiki(uri.substring(1, uri.length()-1)); if (iframePostEnabled) { - StringOutput so = new StringOutput(); - ubu.appendTarget(so); - input.setURLTarget(so.toString()); + String targetUrl = " onclick='o_XHREvent(jQuery(this).attr(\"href\"),false,true); return false;'"; + input.setURLTarget(targetUrl); } sb.append("<div style=\"min-height:"+ wikiComp.getMinHeight() +"px\" id=\""); sb.append(uniqueId); diff --git a/src/main/java/org/olat/portfolio/EPUIFactory.java b/src/main/java/org/olat/portfolio/EPUIFactory.java index da60fd94bd6fe6752cbf770e4e082481f9505088..168d8ebda3bf2ba39ab5e14a63a7512e2ea63762 100755 --- a/src/main/java/org/olat/portfolio/EPUIFactory.java +++ b/src/main/java/org/olat/portfolio/EPUIFactory.java @@ -84,7 +84,7 @@ public class EPUIFactory { return new EPMapViewController(ureq, wControl, map, false, true, secCallback); } - public static Controller createMapViewController(UserRequest ureq, WindowControl wControl, + public static EPMapViewController createMapViewController(UserRequest ureq, WindowControl wControl, PortfolioStructureMap map, EPSecurityCallback secCallback) { EPMapViewController mapViewController = new EPMapViewController(ureq, wControl, map, false, false, secCallback); diff --git a/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java b/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java index dbf051d677ecf40307ecf058841aea7f54b82d6b..2710c9c4c9947ead65f5439481a41c6eb7f3ef8c 100644 --- a/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java +++ b/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java @@ -48,6 +48,7 @@ import org.olat.core.gui.control.generic.wizard.StepsMainRunController; import org.olat.core.gui.media.MediaResource; import org.olat.core.id.OLATResourceable; import org.olat.core.id.Roles; +import org.olat.core.id.context.BusinessControlFactory; import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.HistoryPoint; import org.olat.core.id.context.StateEntry; @@ -435,7 +436,7 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController doCatalog(ureq); } else if("Infos".equalsIgnoreCase(type)) { doDetails(ureq); - } else if("EditDescription".equalsIgnoreCase(type)) { + } else if("EditDescription".equalsIgnoreCase(type) || "Settings".equalsIgnoreCase(type)) { doEditSettings(ureq); } else if("MembersMgmt".equalsIgnoreCase(type)) { doMembers(ureq); @@ -460,6 +461,12 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController } return entries; } + + protected WindowControl getSubWindowControl(String name) { + OLATResourceable ores = OresHelper.createOLATResourceableInstance(name, 0l); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); + return BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + } @Override protected void doDispose() { @@ -624,7 +631,8 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController * @param ureq */ protected void doAccess(UserRequest ureq) { - AuthoringEditAccessController ctrl = new AuthoringEditAccessController(ureq, getWindowControl(), re); + WindowControl bwControl = getSubWindowControl("Access"); + AuthoringEditAccessController ctrl = new AuthoringEditAccessController(ureq, addToHistory(ureq, bwControl), re); listenTo(ctrl); accessCtrl = pushController(ureq, translate("tab.accesscontrol"), ctrl); setActiveTool(accessLink); @@ -650,7 +658,8 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController } protected void doDetails(UserRequest ureq) { - RepositoryEntryDetailsController ctrl = new RepositoryEntryDetailsController(ureq, getWindowControl(), re); + WindowControl bwControl = getSubWindowControl("Infos"); + RepositoryEntryDetailsController ctrl = new RepositoryEntryDetailsController(ureq, addToHistory(ureq, bwControl), re); listenTo(ctrl); detailsCtrl = pushController(ureq, translate("details.header"), ctrl); currentToolCtr = detailsCtrl; @@ -663,7 +672,9 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController protected void doEditSettings(UserRequest ureq) { if(!reSecurity.isEntryAdmin()) return; - RepositoryEditDescriptionController ctrl = new RepositoryEditDescriptionController(ureq, getWindowControl(), re); + WindowControl bwControl = getSubWindowControl("Settings"); + RepositoryEditDescriptionController ctrl + = new RepositoryEditDescriptionController(ureq, addToHistory(ureq, bwControl), re); listenTo(ctrl); descriptionCtrl = pushController(ureq, translate("settings.editor"), ctrl); currentToolCtr = descriptionCtrl; @@ -678,7 +689,9 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController if(!reSecurity.isEntryAdmin()) return; popToRoot(ureq).cleanUp(); - catalogCtlr = new CatalogSettingsController(ureq, getWindowControl(), toolbarPanel, re); + + WindowControl bwControl = getSubWindowControl("Catalog"); + catalogCtlr = new CatalogSettingsController(ureq, addToHistory(ureq, bwControl), toolbarPanel, re); listenTo(catalogCtlr); catalogCtlr.initToolbar(); currentToolCtr = catalogCtlr; @@ -688,7 +701,8 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController protected Activateable2 doMembers(UserRequest ureq) { if(!reSecurity.isEntryAdmin()) return null; - RepositoryMembersController ctrl = new RepositoryMembersController(ureq, getWindowControl(), toolbarPanel ,re); + WindowControl bwControl = getSubWindowControl("MembersMgmt"); + RepositoryMembersController ctrl = new RepositoryMembersController(ureq, addToHistory(ureq, bwControl), toolbarPanel ,re); listenTo(ctrl); membersEditController = pushController(ureq, translate("details.members"), ctrl); currentToolCtr = membersEditController; @@ -699,7 +713,8 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController protected void doOrders(UserRequest ureq) { if(!reSecurity.isEntryAdmin()) return; - OrdersAdminController ctrl = new OrdersAdminController(ureq, getWindowControl(), re.getOlatResource()); + WindowControl bwControl = getSubWindowControl("Booking"); + OrdersAdminController ctrl = new OrdersAdminController(ureq, addToHistory(ureq, bwControl), re.getOlatResource()); listenTo(ctrl); ordersCtlr = pushController(ureq, translate("details.orders"), ctrl); currentToolCtr = ordersCtlr; diff --git a/src/main/java/org/olat/repository/ui/author/OverviewAuthoringController.java b/src/main/java/org/olat/repository/ui/author/OverviewAuthoringController.java index 72c31af13e28953182d641f7067406492e6dae15..f5c4e17bb88d7f19749fcfd59b904babc521eaa5 100644 --- a/src/main/java/org/olat/repository/ui/author/OverviewAuthoringController.java +++ b/src/main/java/org/olat/repository/ui/author/OverviewAuthoringController.java @@ -152,69 +152,60 @@ public class OverviewAuthoringController extends BasicController implements Acti } } } - - private void cleanUp() { - removeAsListenerAndDispose(markedCtrl); - removeAsListenerAndDispose(myEntriesCtrl); - removeAsListenerAndDispose(searchEntriesCtrl); - markedCtrl = null; - myEntriesCtrl = null; - searchEntriesCtrl = null; - } private AuthorListController doOpenMark(UserRequest ureq) { - cleanUp(); + if(markedCtrl == null) { + SearchAuthorRepositoryEntryViewParams searchParams + = new SearchAuthorRepositoryEntryViewParams(getIdentity(), ureq.getUserSession().getRoles()); + searchParams.setMarked(Boolean.TRUE); + searchParams.setOwnedResourcesOnly(false); + + OLATResourceable ores = OresHelper.createOLATResourceableInstance("Favorits", 0l); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + markedCtrl = new AuthorListController(ureq, bwControl, "search.mark", searchParams, false); + listenTo(markedCtrl); + } - SearchAuthorRepositoryEntryViewParams searchParams - = new SearchAuthorRepositoryEntryViewParams(getIdentity(), ureq.getUserSession().getRoles()); - searchParams.setMarked(Boolean.TRUE); - searchParams.setOwnedResourcesOnly(false); - - OLATResourceable ores = OresHelper.createOLATResourceableInstance("Favorits", 0l); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); - WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); - markedCtrl = new AuthorListController(ureq, bwControl, "search.mark", searchParams, false); - listenTo(markedCtrl); currentCtrl = markedCtrl; - addToHistory(ureq, markedCtrl); mainVC.put("segmentCmp", markedCtrl.getStackPanel()); return markedCtrl; } private AuthorListController doOpenMyEntries(UserRequest ureq) { - cleanUp(); - - SearchAuthorRepositoryEntryViewParams searchParams - = new SearchAuthorRepositoryEntryViewParams(getIdentity(), ureq.getUserSession().getRoles()); - searchParams.setOwnedResourcesOnly(true); - - OLATResourceable ores = OresHelper.createOLATResourceableInstance("My", 0l); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); - WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); - myEntriesCtrl = new AuthorListController(ureq, bwControl, "search.my", searchParams, false); - listenTo(myEntriesCtrl); + if(myEntriesCtrl == null) { + SearchAuthorRepositoryEntryViewParams searchParams + = new SearchAuthorRepositoryEntryViewParams(getIdentity(), ureq.getUserSession().getRoles()); + searchParams.setOwnedResourcesOnly(true); + + OLATResourceable ores = OresHelper.createOLATResourceableInstance("My", 0l); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + myEntriesCtrl = new AuthorListController(ureq, bwControl, "search.my", searchParams, false); + listenTo(myEntriesCtrl); + } + currentCtrl = myEntriesCtrl; - addToHistory(ureq, myEntriesCtrl); mainVC.put("segmentCmp", myEntriesCtrl.getStackPanel()); return myEntriesCtrl; } private AuthorListController doSearchEntries(UserRequest ureq) { - cleanUp(); - - SearchAuthorRepositoryEntryViewParams searchParams - = new SearchAuthorRepositoryEntryViewParams(getIdentity(), ureq.getUserSession().getRoles()); - searchParams.setOwnedResourcesOnly(false); - - OLATResourceable ores = OresHelper.createOLATResourceableInstance("Search", 0l); - ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); - WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); - searchEntriesCtrl = new AuthorListController(ureq, bwControl, "search.generic", searchParams, true); - listenTo(searchEntriesCtrl); - currentCtrl = searchEntriesCtrl; + if(searchEntriesCtrl == null) { + SearchAuthorRepositoryEntryViewParams searchParams + = new SearchAuthorRepositoryEntryViewParams(getIdentity(), ureq.getUserSession().getRoles()); + searchParams.setOwnedResourcesOnly(false); + + OLATResourceable ores = OresHelper.createOLATResourceableInstance("Search", 0l); + ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + searchEntriesCtrl = new AuthorListController(ureq, bwControl, "search.generic", searchParams, true); + listenTo(searchEntriesCtrl); + } + currentCtrl = searchEntriesCtrl; addToHistory(ureq, searchEntriesCtrl); mainVC.put("segmentCmp", searchEntriesCtrl.getStackPanel()); return searchEntriesCtrl; diff --git a/src/main/java/org/olat/repository/ui/catalog/CatalogManagerController.java b/src/main/java/org/olat/repository/ui/catalog/CatalogManagerController.java index 25fbf8993302d984692aff9872b4478086e726dd..e870a22832ad406570753a1318b284be2296f914 100644 --- a/src/main/java/org/olat/repository/ui/catalog/CatalogManagerController.java +++ b/src/main/java/org/olat/repository/ui/catalog/CatalogManagerController.java @@ -63,7 +63,7 @@ public class CatalogManagerController extends BasicController implements Activat List<CatalogEntry> rootNodes = catalogManager.getRootCatalogEntries(); if(rootNodes.size() == 1) { - catalogCtrl = new CatalogNodeManagerController(ureq, getWindowControl(), rootNodes.get(0), toolbarPanel, false); + catalogCtrl = new CatalogNodeManagerController(ureq, getWindowControl(), getWindowControl(), rootNodes.get(0), toolbarPanel, false); listenTo(catalogCtrl); toolbarPanel.pushController("Catalog", catalogCtrl); catalogCtrl.initToolbar(); diff --git a/src/main/java/org/olat/repository/ui/catalog/CatalogNodeManagerController.java b/src/main/java/org/olat/repository/ui/catalog/CatalogNodeManagerController.java index 09df1e365dadc4e846ebc10842253c40663f9d05..8e6b22ddc7b05580299e9de056f3fd7f9e940718 100644 --- a/src/main/java/org/olat/repository/ui/catalog/CatalogNodeManagerController.java +++ b/src/main/java/org/olat/repository/ui/catalog/CatalogNodeManagerController.java @@ -138,6 +138,7 @@ public class CatalogNodeManagerController extends FormBasicController implements private LockResult catModificationLock; private final MapperKey mapperThumbnailKey; + private final WindowControl rootwControl; private final boolean isGuest; private final boolean isAuthor; @@ -165,13 +166,14 @@ public class CatalogNodeManagerController extends FormBasicController implements @Autowired private RepositoryManager repositoryManager; - public CatalogNodeManagerController(UserRequest ureq, WindowControl wControl, + public CatalogNodeManagerController(UserRequest ureq, WindowControl wControl, WindowControl rootwControl, CatalogEntry catalogEntry, TooledStackedPanel stackPanel, boolean localTreeAdmin) { super(ureq, wControl, "node"); setTranslator(Util.createPackageTranslator(RepositoryService.class, ureq.getLocale(), getTranslator())); this.toolbarPanel = stackPanel; this.catalogEntry = catalogEntry; + this.rootwControl = rootwControl; mapperThumbnailKey = mapperService.register(null, "catalogentryImage", new CatalogEntryImageMapper()); isAuthor = ureq.getUserSession().getRoles().isAuthor(); @@ -407,7 +409,12 @@ public class CatalogNodeManagerController extends FormBasicController implements ContextEntry entry = entries.get(0); String type = entry.getOLATResourceable().getResourceableTypeName(); - if("Node".equalsIgnoreCase(type)) { + if("CatalogEntry".equalsIgnoreCase(type)) { + Long entryKey = entry.getOLATResourceable().getResourceableId(); + if(entryKey != null && entryKey.longValue() > 0) { + activateRoot(ureq, entryKey); + } + } else if("Node".equalsIgnoreCase(type)) { //the "Node" is only for internal usage StateEntry stateEntry = entry.getTransientState(); if(stateEntry instanceof CatalogStateEntry) { @@ -419,6 +426,25 @@ public class CatalogNodeManagerController extends FormBasicController implements } } } + + /** + * Build an internal business path made of "Node" with the category + * as state entry to prevent loading several times the same entries. + * + * @param ureq + * @param entryKey + */ + private void activateRoot(UserRequest ureq, Long entryKey) { + List<ContextEntry> parentLine = new ArrayList<>(); + for(CatalogEntry node = catalogManager.getCatalogEntryByKey(entryKey); node.getParent() != null; node=node.getParent()) { + OLATResourceable nodeRes = OresHelper.createOLATResourceableInstance("Node", node.getKey()); + ContextEntry ctxEntry = BusinessControlFactory.getInstance().createContextEntry(nodeRes); + ctxEntry.setTransientState(new CatalogStateEntry(node)); + parentLine.add(ctxEntry); + } + Collections.reverse(parentLine); + activate(ureq, parentLine, null); + } @Override protected void formOK(UserRequest ureq) { @@ -603,9 +629,9 @@ public class CatalogNodeManagerController extends FormBasicController implements OLATResourceable ores = OresHelper.createOLATResourceableInstance("CatalogEntry", entry.getKey()); ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores)); - WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl()); + WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, rootwControl); - childNodeCtrl = new CatalogNodeManagerController(ureq, bwControl, entry, toolbarPanel, isLocalTreeAdmin); + childNodeCtrl = new CatalogNodeManagerController(ureq, bwControl, rootwControl, entry, toolbarPanel, isLocalTreeAdmin); listenTo(childNodeCtrl); toolbarPanel.pushController(entry.getName(), childNodeCtrl); childNodeCtrl.initToolbar(); diff --git a/src/main/java/org/olat/repository/ui/catalog/_content/node.html b/src/main/java/org/olat/repository/ui/catalog/_content/node.html index 4e15bcfeca8499ce7dce420a2ee5cf0389f10968..d35c91eef9cfb1f2483ffbfc9279248996458928 100644 --- a/src/main/java/org/olat/repository/ui/catalog/_content/node.html +++ b/src/main/java/org/olat/repository/ui/catalog/_content/node.html @@ -31,7 +31,7 @@ #set($imgId = "image_${id}") #set($catId = "kcat_${id}") <div class="o_sublevel" > - <div class="o_visual" ><a href='$r.commandURIbg("img_select","node","${r.get($catId)}")' onclick="return o2cl()" onkeypress="return o2cl()" $r.bgTarget()> + <div class="o_visual" ><a $r.hrefAndOnclick("img_select",false,false,"node","$r.get($catId)")> <div class="o_visual_not_available" #if($r.get($imgId)) style="background-image:url('$mapperThumbnailUrl/${r.get($imgId)}');" #end></div> </a></div> <div class="o_meta"> @@ -52,7 +52,7 @@ #set($imgId = "image_${id}") #set($catId = "kcat_${id}") <div class="o_sublevel"> - <div class="o_visual"><a href='$r.commandURIbg("img_select","node","${r.get($catId)}")' onclick="return o2cl()" onkeypress="return o2cl()" $r.bgTarget()> + <div class="o_visual"><a $r.hrefAndOnclick("img_select",false,false,"node","$r.get($catId)")> <div class="o_visual_not_available" #if($r.get($imgId)) style="background-image:url('$mapperThumbnailUrl/${r.get($imgId)}');" #end></div> </a></div> <div class="o_meta"> diff --git a/src/main/java/org/olat/shibboleth/MessageWindowController.java b/src/main/java/org/olat/shibboleth/MessageWindowController.java index 70f9318ac91c6bca603edfb39a8008cf0d860b52..3c4bf8ed621f1ea2524d73526988af36a8bf4d37 100644 --- a/src/main/java/org/olat/shibboleth/MessageWindowController.java +++ b/src/main/java/org/olat/shibboleth/MessageWindowController.java @@ -97,6 +97,11 @@ public class MessageWindowController extends DefaultChiefController { setWindow(w); } + @Override + public String getWindowTitle() { + return null; + } + @Override public boolean hasStaticSite(Class<? extends SiteInstance> type) { return false; diff --git a/src/main/java/org/olat/social/shareLink/_content/shareLink.html b/src/main/java/org/olat/social/shareLink/_content/shareLink.html index 00ae2bd00c6f143b9f748e2ba6c29c979a94abaa..f498bd1a1875876512d1abbb49d4cdd136473c58 100644 --- a/src/main/java/org/olat/social/shareLink/_content/shareLink.html +++ b/src/main/java/org/olat/social/shareLink/_content/shareLink.html @@ -83,7 +83,7 @@ #end ## always show the 'set as landing page' button #if ($isUser) - <a id="o_landingpage" href="$r.commandURIbg("setLandingPage")" $r.bgTarget() title="$r.translateInAttribute("landingpage.set.current")"> + <a id="o_landingpage" $r.hrefAndOnclick("setLandingPage", false, false) title="$r.translateInAttribute("landingpage.set.current")"> <i class="o_icon o_icon_landingpage o_icon-lg"></i> </a> #end diff --git a/src/main/java/org/olat/user/ChangePrefsController.java b/src/main/java/org/olat/user/ChangePrefsController.java index f6fbcc56d4aae7a51d853a5f8141b3e5af6ce1e3..4b5ae2f733550ea27ea68f98423b2ea877cba2e7 100644 --- a/src/main/java/org/olat/user/ChangePrefsController.java +++ b/src/main/java/org/olat/user/ChangePrefsController.java @@ -161,16 +161,10 @@ class SpecialPrefsForm extends FormBasicController { private Identity tobeChangedIdentity; private Preferences prefs; - private MultipleSelectionElement prefsElement; + private SingleSelection resumeElement; - private SingleSelection backElement; private TextElement landingPageEl; - private String[] keys, values; - private boolean useAjaxCheckbox = false; private String[] resumeKeys, resumeValues; - /** The keys for yes/no back. */ - private String[] yesNoKeys; - private String[] yesNoValues; @Autowired private HistoryModule historyModule; @@ -187,15 +181,6 @@ class SpecialPrefsForm extends FormBasicController { } else { prefs = PreferencesFactory.getInstance().getPreferencesFor(tobeChangedIdentity, false); } - // The ajax configuration is only for user manager (technical stuff) - useAjaxCheckbox = ureq.getUserSession().getRoles().isUserManager(); - // initialize checkbox keys depending on useAjaxCheckbox flag - if (useAjaxCheckbox) { - keys = new String[]{"ajax"}; - values = new String[] { - translate("ajaxon.label"), - }; - } resumeKeys = new String[]{"none", "auto", "ondemand"}; resumeValues = new String[] { @@ -203,8 +188,7 @@ class SpecialPrefsForm extends FormBasicController { translate("resume.auto"), translate("resume.ondemand"), }; - yesNoKeys = new String[]{"yes", "no"}; - yesNoValues = new String[] { translate("back.on"), translate("back.off") }; + initForm(ureq); } @@ -215,21 +199,13 @@ class SpecialPrefsForm extends FormBasicController { if (sessionManager.isSignedOnIdentity(tobeChangedIdentity.getKey())) { String fullName = CoreSpringFactory.getImpl(UserManager.class).getUserDisplayName(tobeChangedIdentity); showError("error.user.logged.in",fullName); - prefsElement.reset(); return; } } - - if (useAjaxCheckbox) { - prefs.put(WindowManager.class, "ajax-beta-on", prefsElement.getSelectedKeys().contains("ajax")); - } if(resumeElement != null) { prefs.put(WindowManager.class, "resume-prefs", resumeElement.getSelectedKey()); } - if(backElement != null) { - prefs.put(WindowManager.class, "back-enabled", backElement.isSelected(0)); - } String landingPage = landingPageEl.isVisible() ? landingPageEl.getValue() : ""; prefs.put(WindowManager.class, "landing-page", landingPage); @@ -260,11 +236,6 @@ class SpecialPrefsForm extends FormBasicController { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { setFormTitle("title.prefs.special"); setFormContextHelp("Configuration#_specifics"); - - if(keys != null) { - prefsElement = uifactory.addCheckboxesHorizontal("prefs", "title.prefs.accessibility", formLayout, keys, values); - prefsElement.setElementCssClass("o_sel_home_settings_accessibility"); - } if(historyModule.isResumeEnabled()) { resumeElement = uifactory.addRadiosVertical("resume", "resume.label", formLayout, resumeKeys, resumeValues); @@ -274,10 +245,6 @@ class SpecialPrefsForm extends FormBasicController { landingPageEl = uifactory.addTextElement("landingpages", "landing.pages", 256, "", formLayout); - if(historyModule.isBackEnabled()) { - backElement = uifactory.addRadiosVertical("back-enabling", "back.label", formLayout, yesNoKeys, yesNoValues); - backElement.setElementCssClass("o_sel_home_settings_back_enabling"); - } update(); final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator()); @@ -288,10 +255,6 @@ class SpecialPrefsForm extends FormBasicController { } private void update() { - Boolean ajax = (Boolean) prefs.get(WindowManager.class, "ajax-beta-on"); - if (useAjaxCheckbox) { - prefsElement.select("ajax", ajax == null ? true: ajax.booleanValue()); - } boolean landingPageVisible = true; if(resumeElement != null) { String resumePrefs = (String)prefs.get(WindowManager.class, "resume-prefs"); @@ -310,18 +273,6 @@ class SpecialPrefsForm extends FormBasicController { landingPageVisible = !resumeElement.getSelectedKey().equals("auto"); } } - if(backElement != null) { - Boolean be = (Boolean)prefs.get(WindowManager.class, "back-enabled"); - String selected; - if (be != null) { - selected = (be.booleanValue() ? "yes" : "no"); - } - else { - selected = (historyModule.isBackDefaultSetting() ? "yes" : "no"); - } - - backElement.select(selected, true); - } String landingPage = (String)prefs.get(WindowManager.class, "landing-page"); landingPageEl.setValue(landingPage); diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_ar.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_ar.properties index 7f684eba57a5275b68015d576340ec2a3c32222a..d481a2fc603b1b9bcf43e60570174e6309148adb 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_ar.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_ar.properties @@ -3,8 +3,6 @@ Failed=\u0641\u0634\u0644 \u0641\u0649 \u062A\u062D\u0645\u064A\u0644 \u0627\u06 NoImage=\u0644\u0627 \u064A\u0645\u0643\u0646 \u062A\u062D\u0645\u064A\u0644 \u0647\u0630\u0627 \u0627\u0644\u0645\u0644\u0641 \u0643\u0635\u0648\u0631\u0629. ULLimitExceeded=\u064A\u062C\u0628 \u0623\u0646 \u0644\u0627 \u062A\u062A\u062C\u0627\u0648\u0632 \u0627\u0644\u0635\u0648\u0631\u0629 {0} \u0643\u064A\u0644\u0648 \u0628\u0627\u064A\u062A. action.choose=\u0627\u062E\u062A\u064A\u0627\u0631 -ajaxon.global.label=\u0639\u0644\u0649 \u0645\u0633\u062A\u0648\u0649 \u0627\u0644\u0646\u0638\u0627\u0645 AJAX \u062A\u0646\u0634\u064A\u0637 \u0637\u0631\u064A\u0642\u0629 -ajaxon.label=\u0639\u0644\u0649 \u0645\u0633\u062A\u0648\u0649 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645 AJAX \u062A\u0646\u0634\u064A\u0637 change=\u062A\u063A\u064A\u064A\u0631 command.closehp=\u0627\u063A\u0644\u0627\u0642 \u0627\u0644\u0645\u0639\u0627\u064A\u0646\u0629 command.delete=\u062D\u0630\u0641 @@ -96,7 +94,6 @@ title.password=\u062A\u063A\u064A\u064A\u0631 \u0643\u0644\u0645\u0629 \u0627\u0 title.password.aai=\u0628\u064A\u0627\u0646\u0627\u062A \u0648\u0635\u0648\u0644 \u0627\u0644\u062C\u0627\u0645\u0639\u0629 title.password.olat=\u062A\u063A\u064A\u064A\u0631 \u0643\u0644\u0645\u0629 \u0627\u0644\u0645\u0631\u0648\u0631 \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643 title.prefs=\u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0646\u0638\u0627\u0645 \u0627\u0644\u0639\u0627\u0645\u0629 -title.prefs.accessibility=\u0633\u0647\u0648\u0644\u0629 \u0627\u0644\u0648\u0635\u0648\u0644 title.prefs.ajax=WEB 2.0/AJAX title.prefs.replay=\u0637\u0631\u064A\u0642\u0629 \u0627\u0644\u0625\u0639\u0627\u062F\u0629 title.profile=\u0627\u0644\u0645\u0644\u0641 \u0627\u0644\u0634\u062E\u0635\u0649 \u0644\u0644\u0645\u0633\u062A\u062E\u062F\u0645 diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_bg.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_bg.properties index 7d31ffd0c09951e0c7386685b9d668c76ce0d9e4..63c1e78f84ce21f6b6c7d463bb049b3a07183736 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_bg.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_bg.properties @@ -3,8 +3,6 @@ Failed=\u041A\u0430\u0447\u0432\u0430\u043D\u0435\u0442\u043E \u043D\u0430 \u044 NoImage=\u0422\u043E\u0437\u0438 \u0444\u0430\u0439\u043B\u043E\u0432 \u0444\u043E\u0440\u043C\u0430\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0434\u0430 \u0431\u044A\u0434\u0435 \u043A\u0430\u0447\u0435\u043D \u043A\u0430\u0442\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435. ULLimitExceeded=\u0412\u0430\u0448\u0435\u0442\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043D\u0435 \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u043D\u0430\u0434\u0432\u0438\u0448\u0430\u0432\u0430 {0} \u043A\u0438\u043B\u043E\u0431\u0430\u0439\u0442\u0430. action.choose=\u0418\u0437\u0431\u0435\u0440\u0435\u0442\u0435 -ajaxon.global.label=\u0420\u0435\u0436\u0438\u043C\u044A\u0442 AJAX \u0435 \u0430\u043A\u0442\u0438\u0432\u0435\u043D \u043D\u0430 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u043E \u043D\u0438\u0432\u043E -ajaxon.label=\u0420\u0435\u0436\u0438\u043C\u044A\u0442 AJAX \u0435 \u0430\u043A\u0442\u0438\u0432\u0435\u043D \u043D\u0430 \u043F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u0441\u043A\u043E \u043D\u0438\u0432\u043E change=\u041F\u0440\u043E\u043C\u0435\u043D\u0435\u0442\u0435 command.closehp=\u0417\u0430\u0442\u0432\u043E\u0440\u0435\u0442\u0435 \u043F\u0440\u0435\u0433\u043B\u0435\u0434 command.delete=\u0418\u0437\u0442\u0440\u0438\u0439\u0442\u0435 @@ -85,9 +83,6 @@ title.password=\u041F\u0440\u043E\u043C\u0435\u043D\u0435\u0442\u0435 \u043F\u04 title.password.aai=\u0414\u0430\u043D\u043D\u0438 \u0437\u0430 \u0434\u043E\u0441\u0442\u044A\u043F \u043D\u0430 \u0438\u043D\u0441\u0442\u0438\u0442\u0443\u0446\u0438\u044F\u0442\u0430 title.password.olat=\u041F\u0440\u043E\u043C\u0435\u043D\u0435\u0442\u0435 \u0432\u0430\u0448\u0430\u0442\u0430 \u043F\u0430\u0440\u043E\u043B\u0430 \u0437\u0430 \u0441\u0438\u0441\u0442\u0435\u043C\u0430\u0442\u0430 title.prefs=\u041E\u0431\u0449\u0438 \u0441\u0438\u0441\u0442\u0435\u043C\u043D\u0438 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 -title.prefs.accessibility=\u0414\u043E\u0441\u0442\u044A\u043F\u043D\u043E\u0441\u0442 -title.prefs.ajax=\u0423\u0415\u0411 2.0 / AJAX -title.prefs.replay=\u0420\u0435\u0436\u0438\u043C Replay title.profile=\u041F\u043E\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043B\u0441\u043A\u0438 \u043F\u0440\u043E\u0444\u0438\u043B ul.header=\u041F\u0443\u0431\u043B\u0438\u043A\u0443\u0432\u0430\u043D\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 (\u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C 500kB \u0438 \u0444\u043E\u0440\u043C\u0430\u0442\u0438 .jpg .jpeg .png .gif \u0441\u0430\u043C\u043E) ul.select=\u0418\u0437\u0431\u0435\u0440\u0435\u0442\u0435 \u0444\u0430\u0439\u043B diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_cs.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_cs.properties index 0f39f6614e26b6ffd8d3ff584f2ff549efa31bd6..2985ef4a216a0a1ad01c8705db11af927c015595 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_cs.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_cs.properties @@ -3,8 +3,6 @@ Failed=P\u0159id\u00E1n\u00ED souboru selhalo. NoImage=Tento typ souboru nem\u016F\u017Ee b\u00FDt p\u0159id\u00E1n jako obr\u00E1zek. ULLimitExceeded=Velikost obr\u00E1zku nesm\u00ED p\u0159ekro\u010Dit {0} kByte. action.choose=Vybrat -ajaxon.global.label=AJAX m\u00F3d automaticky aktivov\u00E1n -ajaxon.label=AJAX beta verze (rychlej\u0161\u00ED zobrazov\u00E1n\u00ED str\u00E1nek) change=Upravit command.closehp=Zav\u0159\u00EDt n\u00E1hled command.delete=Smazat @@ -71,9 +69,6 @@ title.password=Zm\u011Bnit heslo title.password.aai=P\u0159\u00EDstupov\u00E9 \u00FAdaje do OLATu title.password.olat=Zm\u011Bnit heslo do OLATu title.prefs=Obecn\u00E1 nastaven\u00ED syst\u00E9mu -title.prefs.accessibility=Dostupnost -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=Replay mode title.profile=U\u017Eivatelsk\u00FD profil ul.header=Va\u0161e foto/obr\u00E1zek (.jpg .jpeg .png .gif) ul.upload=Potvrdit diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_da.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_da.properties index 7f51649b1fdea0b08c1ff255f2a6a99ec8d26a39..d305ffa010a15f9a75f957c9b1d71b4648a3ddcf 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_da.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_da.properties @@ -3,8 +3,6 @@ Failed=Fil upload er fejlet NoImage=Denne fil kan ikke uploades som et billede ULLimitExceeded=Billedet m\u00E5 ikke overstige {0} kByte. action.choose=V\u00E6lg -ajaxon.global.label=AJAX mode aktiv p\u00E5 systemniveau -ajaxon.label=AJAX mode aktiv p\u00E5 brugerniveau change=Tilret command.closehp=Luk forh\u00E5ndsvisning command.delete=Slet @@ -66,7 +64,6 @@ title.password=Skift kodeord title.password.aai=Universitets adgangsdata title.password.olat=Skift dit OLAT kodeord title.prefs=Generelle systemindstillinger -title.prefs.ajax=WEB 2.0 / AJAX title.profile=Brugerprofil ul.header=Dit billede (.jpg .jpeg .png .gif) ul.upload=Afsend diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_de.properties index 6860e831a37130880a8c6d6c614c234dfb0f5d1a..c3e5420fc20878f4d6db38d1fee398b6b028cc36 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_de.properties @@ -3,11 +3,6 @@ Failed=Die \u00DCbermittlung der Datei ist fehlgeschlagen. NoImage=Dieses Dateiformat kann nicht als Bild hochgeladen werden. ULLimitExceeded=Das Bild darf nicht gr\u00F6sser als {0} kByte sein. action.choose=W\u00E4hlen -ajaxon.global.label=AJAX-Modus ist auf Systemebene eingeschaltet -ajaxon.label=AJAX-Modus -back.label=Unterst\u00FCtzung "Browser Zur\u00FCck" -back.off=Aus -back.on=Ein (Experimental) change=\u00C4ndern command.closehp=Vorschau schliessen command.delete=L\u00F6schen @@ -141,9 +136,6 @@ title.password=Passwort \u00E4ndern title.password.aai=Zugangsdaten der Universit\u00E4t title.password.olat=OLAT-Passwort \u00E4ndern title.prefs=Allgemeine Systemeinstellungen -title.prefs.accessibility=Zug\u00E4nglichkeit -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=Replay-Modus title.prefs.special=Spezielle Systemeinstellungen title.profile=Benutzerprofil ul.header=Publiziertes Bild (Formate .jpg .jpeg .png .gif) diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_el.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_el.properties index fc686c300d81be971dab876397b2ae268dfc18fe..b56aab4ab2644cdece85b452ac3b3eeaf37d4e07 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_el.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_el.properties @@ -3,8 +3,6 @@ Failed=\u03A4\u03BF \u03B1\u03BD\u03AD\u03B2\u03B1\u03C3\u03BC\u03B1 \u03C4\u03B NoImage=\u0391\u03C5\u03C4\u03CC \u03C4\u03BF \u03B1\u03C1\u03C7\u03B5\u03AF\u03BF \u03B4\u03B5\u03BD \u03BC\u03C0\u03BF\u03C1\u03B5\u03AF \u03BD\u03B1 \u03B1\u03BD\u03AD\u03B2\u03B5\u03B9 \u03C9\u03C2 \u03B5\u03B9\u03BA\u03CC\u03BD\u03B1. ULLimitExceeded=\u03A4\u03BF \u03BC\u03AD\u03B3\u03B5\u03B8\u03BF\u03C2 \u03C4\u03B7\u03C2 \u03B5\u03B9\u03BA\u03CC\u03BD\u03B1\u03C2 \u03B4\u03B5\u03BD \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03C5\u03C0\u03B5\u03C1\u03B2\u03B1\u03AF\u03BD\u03B5\u03B9 \u03C4\u03B1 {0} kByte. action.choose=\u0395\u03C0\u03B9\u03BB\u03BF\u03B3\u03AE -ajaxon.global.label=\u039B\u03B5\u03B9\u03C4\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1 AJAX \u03B5\u03BD\u03B5\u03C1\u03B3\u03AE \u03C3\u03B5 \u03B5\u03C0\u03AF\u03C0\u03B5\u03B4\u03BF \u03C3\u03C5\u03C3\u03C4\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2 -ajaxon.label=\u039B\u03B5\u03B9\u03C4\u03BF\u03C5\u03C1\u03B3\u03AF\u03B1 AJAX \u03B5\u03BD\u03B5\u03C1\u03B3\u03AE \u03C3\u03B5 \u03B5\u03C0\u03AF\u03C0\u03B5\u03B4\u03BF \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7 change=\u03A4\u03C1\u03BF\u03C0\u03BF\u03C0\u03BF\u03AF\u03B7\u03C3\u03B7 command.closehp=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF \u03C0\u03C1\u03BF\u03B5\u03C0\u03B9\u03C3\u03BA\u03CC\u03C0\u03B9\u03C3\u03B7\u03C2 command.delete=\u0394\u03B9\u03B1\u03B3\u03C1\u03B1\u03C6\u03AE @@ -111,9 +109,6 @@ title.password=\u0391\u03BB\u03BB\u03B1\u03B3\u03AE \u03BA\u03C9\u03B4\u03B9\u03 title.password.aai=\u0394\u03B5\u03B4\u03BF\u03BC\u03AD\u03BD\u03B1 \u03C0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2 \u03C0\u03B1\u03BD\u03B5\u03C0\u03B9\u03C3\u03C4\u03B7\u03BC\u03AF\u03BF\u03C5 title.password.olat=\u0391\u03BB\u03BB\u03B1\u03B3\u03AE \u03C4\u03BF\u03C5 \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03CD \u03C0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03AE\u03C2 \u03C3\u03B1\u03C2 \u03C3\u03C4\u03BF OLAT title.prefs=\u0393\u03B5\u03BD\u03B9\u03BA\u03AD\u03C2 \u03C1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2 \u03C3\u03C5\u03C3\u03C4\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2 -title.prefs.accessibility=\u03A0\u03C1\u03BF\u03C3\u03B2\u03B1\u03C3\u03B9\u03BC\u03CC\u03C4\u03B7\u03C4\u03B1 -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=\u0395\u03C0\u03B1\u03BD\u03AC\u03BB\u03B7\u03C8\u03B7 (Replay) title.prefs.special=\u0395\u03B9\u03B4\u03B9\u03BA\u03AD\u03C2 \u03C1\u03C5\u03B8\u03BC\u03AF\u03C3\u03B5\u03B9\u03C2 \u03C3\u03C5\u03C3\u03C4\u03AE\u03BC\u03B1\u03C4\u03BF\u03C2 title.profile=\u03A0\u03C1\u03BF\u03C6\u03AF\u03BB \u03C7\u03C1\u03AE\u03C3\u03C4\u03B7 ul.header=\u0397 \u03B5\u03B9\u03BA\u03CC\u03BD\u03B1 \u03C3\u03B1\u03C2 (max. 10.2 MB \u03C3\u03B5 .jpg .jpeg .png .gif \u03BC\u03CC\u03BD\u03BF) diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_en.properties index 2b37d15e7a448c30daf2bd7672939e0f77da7650..93dfcc53ffed1dd427afc78542d2dde0553d137b 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_en.properties @@ -3,11 +3,6 @@ Failed=File upload failed. NoImage=This file format cannot be uploaded as image. ULLimitExceeded=Your image must not exceed {0} kByte. action.choose=Select -ajaxon.global.label=AJAX mode active on system level -ajaxon.label=AJAX mode -back.label=Support for "browser back" -back.off=Off -back.on=On (experimental) change=Modify command.closehp=Close preview command.delete=Delete @@ -141,9 +136,6 @@ title.password=Change password title.password.aai=University access data title.password.olat=Change your OpenOLAT password title.prefs=General system settings -title.prefs.accessibility=Accessibility -title.prefs.ajax=WEB 2.0/AJAX -title.prefs.replay=Replay mode title.prefs.special=Specific system settings title.profile=User profile ul.header=Published image (Formats .jpg .jpeg .png .gif only) diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_es.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_es.properties index 64247cf404a967d48d0efa515ce2ba48b6a6093b..f0fe4de587493d0cac255c89fce749a5c129118c 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_es.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_es.properties @@ -3,8 +3,6 @@ Failed=Fallo en la carga del archivo NoImage=Este formato de archivo no puede subirse como imagen. ULLimitExceeded=La imagen no puede sobrepasar los {0} kByte. action.choose=Seleccionar -ajaxon.global.label=Modo AJAX seleccionado para el sistema entero -ajaxon.label=Modo AJAX seleccionado por este usuario change=Modificar command.closehp=Cerrar vista previa command.delete=Eliminar @@ -85,9 +83,6 @@ title.password=Cambiar contrase\u00F1a title.password.aai=Datos de acceso a la universidad title.password.olat=Cambiar tu contrase\u00F1a OLAT title.prefs=Opciones generales del sistema -title.prefs.accessibility=Accesibilidad -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=Modo Replay title.profile=Perfil del usuario ul.header=Tu foto (.jpg .jpeg .png .gif) ul.select=Seleccione el archivo diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_et_EE.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_et_EE.properties index 31dc7f8561e234d3f9d9fc89030f0647a92b44af..54c70e3cbd98586aef58d40e85baf797fcda5e91 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_et_EE.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_et_EE.properties @@ -30,7 +30,6 @@ title.homepage=Visiitkaardi konfigureerimine title.password=Muuda salas\u00F5na title.password.olat=Muuda enda OLATi salas\u00F5na title.prefs=\u00DCldised s\u00FCsteemiseaded -title.prefs.ajax=WEB 2.0 / AJAX title.profile=Kasutaja profiil ul.header=Avaldatud pilt (max. 10.2 MB ning ainult .jpg .jpeg .png .gif formaatides) ul.select=Vali fail diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_fr.properties index b5a48f406e6f5b7e704252810b47a23944fd5107..94540ef547c3c48f6f3babfd78a8527c24ba6656 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_fr.properties @@ -3,11 +3,6 @@ Failed=La transmission du fichier a \u00E9chou\u00E9. NoImage=L'image ne peut pas \u00EAtre transmise sous ce format de fichier. ULLimitExceeded=L'image ne doit pas d\u00E9passer {0} KB. action.choose=S\u00E9lectionner -ajaxon.global.label=Le mode AJAX est activ\u00E9 au niveau syst\u00E8me -ajaxon.label=Mode AJAX -back.label=Support "Page pr\u00E9c\u00E9dente du navigateur" -back.off=Off -back.on=On (exp\u00E9rimental) change=Modifier command.closehp=Fermer aper\u00E7u command.delete=Effacer @@ -141,9 +136,6 @@ title.password=<h1>Modifier le mot de passe</h1> title.password.aai=<h4>Code d'acc\u00E8s de l'Universit\u00E9</h4> title.password.olat=<h4>Modifier le mot de passe OLAT</h4> title.prefs=R\u00E9glages de syst\u00E8me g\u00E9n\u00E9raux -title.prefs.accessibility=Accessibilit\u00E9 -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=Mode Replay title.prefs.special=Configurations sp\u00E9cifiques du syst\u00E8me title.profile=Profil d'utilisateur ul.header=Image publi\u00E9e (.jpg .jpeg .png .gif) diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_it.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_it.properties index 64f98870d0da71a9cc1abffee302fc36d698fde2..977cfeea76607d78ba002dbbfa57f08bf86b1a12 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_it.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_it.properties @@ -3,8 +3,6 @@ Failed=Il caricamento del file non \u00E8 riuscito. NoImage=Il formato del file non ne permette il caricamento come immagine. ULLimitExceeded=L'immagine non pu\u00F2 superare i {0} kByte. action.choose=Selezionare -ajaxon.global.label=La modalit\u00E0 AJAX \u00E8 attivata come standard -ajaxon.label=Modalit\u00E0 AJAX change=Modificare command.closehp=Chiudere anteprima command.delete=Eliminare @@ -113,10 +111,7 @@ title.homepage=Profilo d'utente e biglietto da visita title.password=Modificare la password title.password.aai=Dati d'accesso universitari title.password.olat=Modificare la password OLAT -title.prefs=Preferenze generali del sistema -title.prefs.accessibility=accessibilt\u00E0 -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=Modalit\u00E0 replay +title.prefs=Preferenze generali del sistema title.prefs.special=Configurazioni specifiche del sistema title.profile=Profilo d'utente ul.header=Immagine pubblicata (.jpg .jpeg .png .gif) diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_jp.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_jp.properties index 4c002123ecf452a8ea8a4a5f35361a7fdf22dd9b..db5fcf2312f108d40a8cb0e53203884294811d1d 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_jp.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_jp.properties @@ -3,8 +3,6 @@ Failed=\u30D5\u30A1\u30A4\u30EB\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\ NoImage=\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u306F\u3001\u30A4\u30E1\u30FC\u30B8\u3068\u3057\u3066\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3067\u304D\u307E\u305B\u3093\u3002 ULLimitExceeded=\u3042\u306A\u305F\u306E\u30A4\u30E1\u30FC\u30B8\u30B5\u30A4\u30BA\u306F\u3001{0} \u30AD\u30ED\u30D0\u30A4\u30C8\u3092\u8D8A\u3055\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002 action.choose=\u9078\u629E -ajaxon.global.label=\u30B7\u30B9\u30C6\u30E0\u30EC\u30D9\u30EB\u3067AJAX\u30E2\u30FC\u30C9\u3092\u6709\u52B9\u306B\u3059\u308B -ajaxon.label=\u30E6\u30FC\u30B6\u30EC\u30D9\u30EB\u3067AJAX\u30E2\u30FC\u30C9\u3092\u6709\u52B9\u306B\u3059\u308B change=\u4FEE\u6B63 command.closehp=\u30D7\u30EC\u30D3\u30E5\u30FC\u3092\u9589\u3058\u308B command.delete=\u524A\u9664 @@ -77,9 +75,6 @@ title.password=\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3059\u308B title.password.aai=\u5927\u5B66\u30A2\u30AF\u30BB\u30B9\u30C7\u30FC\u30BF title.password.olat=\u3042\u306A\u305F\u306EOLAT\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u5909\u66F4\u3059\u308B title.prefs=\u4E00\u822C\u30B7\u30B9\u30C6\u30E0\u8A2D\u5B9A -title.prefs.accessibility=\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3 -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=\u30EA\u30D7\u30EC\u30A4\u30E2\u30FC\u30C9 title.profile=\u30E6\u30FC\u30B6\u30D7\u30ED\u30D5\u30A1\u30A4\u30EB ul.header=\u516C\u958B\u30A4\u30E1\u30FC\u30B8 (\u6700\u5927\:500kB / \u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\:.jpg .jpeg .png .gif\u306E\u307F) ul.select=\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3059\u308B diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_lt.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_lt.properties index 51c268010d262db76b151f954675fba049e7dbf0..e44e5bec563ec2ce322ae6b627df89c21e34cb7a 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_lt.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_lt.properties @@ -62,7 +62,6 @@ title.password=Pakeisti slapta\u017Eod\u012F title.password.aai=Universiteto prieigos duomenys title.password.olat=Pakeisti slapta\u017Eod\u012F title.prefs=Bendros sistemos nuostatos -title.prefs.ajax=WEB 2.0 / AJAX title.profile=Vartotojo profilis ul.header=J\u016Bs\u0173 paveiksliukas (.jpg .jpeg .png .gif) ul.upload=Pateikti diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_nl_NL.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_nl_NL.properties index 1b59539cf0845bb0a25cef3066b83a4f5a18ddc3..8b34b8793393c7210d8a8e2d9b2bc5d2f4df0cf4 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_nl_NL.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_nl_NL.properties @@ -3,8 +3,6 @@ Failed=Uploaden bestand mislukt. NoImage=Deze bestandsindeling kan niet worden ge\u00FCpload als afbeelding. ULLimitExceeded=Uw afbeelding mag niet groter zijn dan {0} kByte. action.choose=Kies -ajaxon.global.label=AJAX-modus is actief op systeemniveau -ajaxon.label=AJAX-modus is actief op gebruikersniveau change=Wijzig command.closehp=Sluit voorbeeld command.delete=Verwijder @@ -114,9 +112,6 @@ title.password=Wijzig wachtwoord title.password.aai=Toegangsgegevens van de universiteit title.password.olat=Wijzig uw OLAT-wachtwoord title.prefs=Algemene systeeminstellingen -title.prefs.accessibility=Toegankelijkheid -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=Replay-modus title.prefs.special=Specifieke systeeminstellingen title.profile=Gebruikersprofiel ul.header=Weergegeven afbeelding (max. 10.2 MB en alleen de indelingen .jpg .jpeg .png .gif) diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_pl.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_pl.properties index 2f80e0d0be8dd62919a843d6fb401fa98ada5657..3434d55969c30387719e4cbae24e05013556a552 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_pl.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_pl.properties @@ -3,11 +3,6 @@ Failed=Nie uda\u0142o si\u0119 przekaza\u0107 pliku. NoImage=Ten format pliku nie mo\u017Ce zosta\u0107 przekazany jako obrazek. ULLimitExceeded=Rozmiar obrazka nie mo\u017Ce przekracza\u0107 {0} KB. action.choose=Wybierz -ajaxon.global.label=Tryb AJAX jest aktywny dla ca\u0142ego systemu -ajaxon.label=Tryb AJAX jest aktywny na poziomie u\u017Cytkownika -back.label=Obs\u0142uga przycisku "Wstecz" w przegl\u0105darce internetowej -back.off=Wy\u0142\u0105czone -back.on=W\u0142\u0105czone (testowo) change=Zmie\u0144 command.closehp=Zamknij podgl\u0105d command.delete=Usu\u0144 @@ -136,9 +131,6 @@ title.password=Zmie\u0144 has\u0142o title.password.aai=Dane dost\u0119pu instytucji title.password.olat=Zmie\u0144 has\u0142o title.prefs=Og\u00F3lne ustawienia systemu -title.prefs.accessibility=Dost\u0119pno\u015B\u0107 -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=Tryb powtarzania title.prefs.special=Specyficzne ustawienia systemu title.profile=Profil u\u017Cytkownika ul.header=Tw\u00F3j obrazek (.jpg, .jpeg, .png, .gif, max. 500 kB) diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_pt_BR.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_pt_BR.properties index 0bab6598fb731e25f77c7b3b4fb3143f065fbd34..569d6c4ffbbb506453f016326188c2d79074e780 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_pt_BR.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_pt_BR.properties @@ -3,11 +3,6 @@ Failed=Falha na carga do arquivo. NoImage=Este formato de arquivo n\u00E3o pode ser carregado como imagem. ULLimitExceeded=A imagem n\u00E3o pode exceder {0} kByte. action.choose=Selecionar -ajaxon.global.label=Modo AJAX ativo em todo o sistema -ajaxon.label=Modo AJAX ativo \u00E0 nivel de usu\u00E1rio -back.label=Suporte para "Voltar do navegador" -back.off=Desligado -back.on=Ligado (experimental) change=Modificar command.closehp=Fechar command.delete=Apagar @@ -141,9 +136,6 @@ title.password=Alterar senha title.password.aai=Acesso a dados da Universidade title.password.olat=Alterar sua senha OLAT title.prefs=Configura\u00E7\u00F5es gerais do sistema -title.prefs.accessibility=Acessibilidade -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=Modo de Reprodu\u00E7\u00E3o title.prefs.special=Configura\u00E7\u00F5es espec\u00EDficas do sistema title.profile=Perfil do Usu\u00E1rio ul.header=Sua imagem (.jpg .jpeg .png .gif) diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_pt_PT.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_pt_PT.properties index d34ed346e71b084634a52a031c831ae1ed370e9b..b5fb27859528c22db32b6a03e08e63a2c57e70e7 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_pt_PT.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_pt_PT.properties @@ -3,7 +3,6 @@ Failed=Falha na carga do arquivo. NoImage=Este formato de arquivo n\u00E3o pode ser carregado como imagem. ULLimitExceeded=A imagem n\u00E3o pode exceder {0} kByte. action.choose=Selecionar -ajaxon.label=Vers\u00E3o beta AJAX (reprodu\u00E7\u00E3o r\u00E1pida de p\u00E1ginas) change=Modificar command.closehp=Fechar command.delete=Apagar @@ -65,7 +64,6 @@ title.password=Alterar senha title.password.aai=Acesso a dados da Universidade title.password.olat=Alterar sua senha OLAT title.prefs=Configura\u00E7\u00F5es gerais do sistema -title.prefs.ajax=WEB 2.0 / AJAX title.profile=Perfil do Usu\u00E1rio ul.header=Sua imagem (.jpg .jpeg .png .gif) ul.upload=Salvar diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_ru.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_ru.properties index cb63e188221c8d84a106a6490a0c78d4b0cb44b9..a16d66bfd890923120d4c0b1495e57517eb98bd8 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_ru.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_ru.properties @@ -3,8 +3,6 @@ Failed=\u041F\u0435\u0440\u0435\u0441\u044B\u043B\u043A\u0430 \u0444\u0430\u0439 NoImage=\u0424\u0430\u0439\u043B \u0432 \u0434\u0430\u043D\u043D\u043E\u043C \u0444\u043E\u0440\u043C\u0430\u0442\u0435 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D \u0432 \u043A\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F. ULLimitExceeded=\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u043D\u0435 \u0434\u043E\u043B\u0436\u043D\u043E \u043F\u0440\u0435\u0432\u044B\u0448\u0430\u0442\u044C {0} \u041A\u0431\u0430\u0439\u0442. action.choose=\u0412\u044B\u0431\u0440\u0430\u0442\u044C -ajaxon.global.label=AJAX-\u043C\u043E\u0434\u0443\u0441 \u0430\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D \u043D\u0430 \u0443\u0440\u043E\u0432\u043D\u0435 \u0441\u0438\u0441\u0442\u0435\u043C\u044B -ajaxon.label=AJAX-\u043C\u043E\u0434\u0443\u0441 \u0430\u043A\u0442\u0438\u0432\u0438\u0440\u043E\u0432\u0430\u043D \u043D\u0430 \u0443\u0440\u043E\u0432\u043D\u0435 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F change=\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C command.closehp=\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u043F\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 command.delete=\u0423\u0434\u0430\u043B\u0438\u0442\u044C @@ -96,9 +94,6 @@ title.password=\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043F\u0430\u04 title.password.aai=\u0414\u0430\u043D\u043D\u044B\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0430 \u0443\u043D\u0438\u0432\u0435\u0440\u0441\u0438\u0442\u0435\u0442\u0430 title.password.olat=\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C OLAT-\u043F\u0430\u0440\u043E\u043B\u044C title.prefs=\u041E\u0431\u0449\u0438\u0435 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0441\u0438\u0441\u0442\u0435\u043C\u044B -title.prefs.accessibility=\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u044C -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=\u041C\u043E\u0434\u0443\u0441 \u0432\u043E\u0441\u043F\u0440\u043E\u0438\u0437\u0432\u0435\u0434\u0435\u043D\u0438\u044F title.profile=\u041F\u0440\u043E\u0444\u0438\u043B\u044C \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044F ul.header=\u041E\u043F\u0443\u0431\u043B\u0438\u043A\u043E\u0432\u0430\u043D\u043D\u043E\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 (\u043C\u0430\u043A\u0441.500\u043A\u0411 \u0438 \u0444\u043E\u0440\u043C\u0430\u0442\u044B .jpg .jpeg .png .gif) ul.select=\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0444\u0430\u0439\u043B diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_sq.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_sq.properties index b3c20bebd0f12c14af6059b418bae8a0859dd724..eaa465e2fe02a185f2fffaf1efaf39bfb3400b97 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_sq.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_sq.properties @@ -3,7 +3,6 @@ Failed=Ngarkimi i imazhit d\u00EBshtoi. NoImage=Ky format i skedarit nuk mund t\u00EB ngarkohet si imazh. ULLimitExceeded=Imazhi nuk duhet t\u00EB tejkaloj\u00EB {0} kB. action.choose=P\u00EBrgjedh -ajaxon.label=AJAX beta versioni (ri-prodhim m\u00EB i shpejt\u00EB i faqes) change=Modifiko command.closehp=Mbylle paraafishimin command.delete=Fshij @@ -65,7 +64,6 @@ title.password=Ndrro fjal\u00EBkalimin title.password.aai=T\u00EB dh\u00EBnat hyr\u00EBse t\u00EB Universitetit title.password.olat=Nd\u00EBrro fjal\u00EBkalimin tuaj t\u00EB OLAT-it title.prefs=Parap\u00EBlqimet kryesore t\u00EB sistemit -title.prefs.ajax=WEB 2.0 / AJAX title.profile=Profili i shfryt\u00EBzuesit ul.header=Imazhet tuaja (.jpg .jpeg .png .gif) ul.upload=Paraqit diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_zh_CN.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_zh_CN.properties index 671fc64bafebf1da93a0a9485c2a67df4e1aa722..923fe66a95943f161c330dc3835e5c2fb71fb4d9 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_zh_CN.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_zh_CN.properties @@ -3,8 +3,6 @@ Failed=\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25 NoImage=\u8BE5\u683C\u5F0F\u7684\u56FE\u7247\u4E0D\u80FD\u4E0A\u4F20 ULLimitExceeded=\u56FE\u7247\u4E0D\u80FD\u8D85\u8FC7 {0} kByte\u3002 action.choose=\u8BF7\u9009\u62E9 -ajaxon.global.label=\u7CFB\u7EDF\u4E2DAJAX\u6A21\u5F0F\u5F00\u542F -ajaxon.label=AJAX\u6A21\u5F0F change=\u4FEE\u6539 command.closehp=\u5173\u95ED\u9884\u89C8 command.delete=\u5220\u9664 @@ -96,9 +94,6 @@ title.password=\u4FEE\u6539\u5BC6\u7801 title.password.aai=\u5927\u5B66\u8BBF\u95EE\u6570\u636E title.password.olat=\u4FEE\u6539\u4F60\u7684OLAT\u5BC6\u7801 title.prefs=\u7CFB\u7EDF\u57FA\u672C\u8BBE\u7F6E -title.prefs.accessibility=\u53EF\u8BBF\u95EE\u6027 -title.prefs.ajax=Web2.0 / AJAX -title.prefs.replay=\u91CD\u64AD\u6A21\u5F0F title.profile=\u7528\u6237\u4FE1\u606F ul.header=\u4F60\u7684\u9753\u7167(\u6700\u5927\u4E0D\u8D85\u8FC7500kb.\u683C\u5F0F\u4E3Ajpg .jpeg .png .gif) ul.select=\u9009\u62E9\u6587\u4EF6\u5939 diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_zh_TW.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_zh_TW.properties index c2f403b3514ecd1a57dd4f5ee9df45182b9065b1..ba66803d9c2ef378193e9a7294c44f1e5596dfc9 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_zh_TW.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_zh_TW.properties @@ -3,8 +3,6 @@ Failed=\u6A94\u6848\u4E0A\u50B3\u5931\u6557\u3002 NoImage=\u9019\u500B\u6A94\u6848\u683C\u5F0F\u4E0D\u80FD\u88AB\u7576\u6210\u5716\u7247\u4E0A\u50B3\u3002 ULLimitExceeded=\u60A8\u7684\u5716\u7247\u4E0D\u80FD\u8D85\u904E {0} kByte\u3002 action.choose=\u9078\u64C7 -ajaxon.global.label=AJAX \u6A21\u5F0F\u555F\u7528\u5728\u7CFB\u7D71\u5C64\u7D1A -ajaxon.label=AJAX \u6A21\u5F0F change=\u4FEE\u6539 command.closehp=\u95DC\u9589\u9810\u89BD command.delete=\u522A\u9664 @@ -96,10 +94,6 @@ title.homepage=\u540D\u7247\u8A2D\u5B9A title.password=\u8B8A\u66F4\u5BC6\u78BC title.password.aai=\u5927\u5B78\u5B58\u53D6\u8CC7\u6599 title.password.olat=\u8B8A\u66F4\u60A8\u7684 OLAT \u5BC6\u78BC -title.prefs=\u4E00\u822C\u7CFB\u7D71\u8A2D\u5B9A -title.prefs.accessibility=\u7121\u969C\u7919 -title.prefs.ajax=WEB 2.0 / AJAX -title.prefs.replay=\u91CD\u64AD\u6A21\u5F0F title.prefs.special=\u7279\u6B8A\u7684\u7CFB\u7D71\u8A2D\u5B9A title.profile=\u4F7F\u7528\u8005\u500B\u4EBA\u6A94\u6848 ul.header=\u7167\u7247(\u6700\u5927 500kB \u4E26\u4E14\u53EA\u80FD\u662F .jpg .jpeg .png .gif \u683C\u5F0F) diff --git a/src/main/resources/serviceconfig/olat.properties b/src/main/resources/serviceconfig/olat.properties index 4edf019c67bcf2315656cfda0d82d7cf5d4ac0ba..bdd54ccb78bfd9696da6164ab3d340ebba447f00 100644 --- a/src/main/resources/serviceconfig/olat.properties +++ b/src/main/resources/serviceconfig/olat.properties @@ -89,11 +89,8 @@ defaultcharset=UTF-8 # true to prevent accidental startup with another encoding which leads to a big data mess enforce.utf8.filesystem=true -# global on/off config for back and resume -history.back.enabled=true +# global on/off config for resume history.resume.enabled=true -# default settings for the back function in case feature is available -history.back.enabled.default=true # default settings for the resume function in case feature is available history.resume.enabled.default=ondemand history.resume.enabled.default.values=none,auto,ondemand diff --git a/src/main/webapp/static/js/functions.js b/src/main/webapp/static/js/functions.js index 050bba5b7318b20fb9acca6417c63778a268a5ce..da069c57bbfd4ec3410a44552616b8d21a7cfb4b 100644 --- a/src/main/webapp/static/js/functions.js +++ b/src/main/webapp/static/js/functions.js @@ -285,12 +285,17 @@ function o_afterserver() { } function o2cl() { - if (o_info.linkbusy) { + try { + if (o_info.linkbusy) { + return false; + } else { + var doreq = (o2c==0 || confirm(o_info.dirty_form)); + if (doreq) o_beforeserver(); + return doreq; + } + } catch(e) { + if(window.console) console.log(e); return false; - } else { - var doreq = (o2c==0 || confirm(o_info.dirty_form)); - if (doreq) o_beforeserver(); - return doreq; } } //for flexi tree @@ -302,18 +307,6 @@ function o2cl_noDirtyCheck() { return true; } } -//for tree and Firefox -function o2cl_secure() { - try { - if(o2cl()) { - return true; - } else { - return false; - } - } catch(e){ - return false - } -} function o3cl(formId) { if (o_info.linkbusy) { @@ -680,7 +673,6 @@ function o_ainvoke(r) { BDebugger.logDOMCount(); BDebugger.logGlobalObjCount(); BDebugger.logGlobalOLATObjects(); - BDebugger.logManagedOLATObjects(); */ } /** @@ -828,6 +820,8 @@ function gotonode(nodeid) { function o_openUriInMainWindow(uri) { + if(!o2cl()) return false; + // get the "olatmain" window try { var w = o_getMainWin(); @@ -1146,7 +1140,7 @@ function showerror(e) { // parameter submitted is the action value triggering the submit. // A 'submit' is not the same as 'submit and validate'. if the form should validate // is defined by the triggered component. -function o_ffEvent (formNam, dispIdField, dispId, eventIdField, eventInt){ +function o_ffEvent(formNam, dispIdField, dispId, eventIdField, eventInt){ //set hidden fields and submit form var dispIdEl, defDispId,eventIdEl,defEventId; @@ -1157,20 +1151,105 @@ function o_ffEvent (formNam, dispIdField, dispId, eventIdField, eventInt){ defEventId = eventIdEl.value; eventIdEl.value=eventInt; // manually execute onsubmit method - calling submit itself does not trigger onsubmit event! - if (document.forms[formNam].onsubmit()) { + var form = jQuery('#' + formNam); + var enctype = form.attr('enctype'); + if(enctype && enctype.indexOf("multipart") == 0) { + o_XHRSubmitMultipart(formNam); + } else if (document.forms[formNam].onsubmit()) { document.forms[formNam].submit(); } + dispIdEl.value = defDispId; eventIdEl.value = defEventId; } -function o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt) { +function o_IQEvent(formNam){ + if (document.forms[formNam].onsubmit()) { + document.forms[formNam].submit(); + } +} + +function o_TableMultiActionEvent(formNam, action){ + var mActionIdEl = jQuery('#o_mai_' + formNam); + mActionIdEl.val(action); + if (document.forms[formNam].onsubmit()) { + document.forms[formNam].submit(); + } + mActionIdEl.val(''); +} + +function o_XHRSubmit(formNam) { + if(o_info.linkbusy) { + return false; + } + + o_beforeserver(); + var push = true; + var form = jQuery('#' + formNam); + var enctype = form.attr('enctype'); + if(enctype && enctype.indexOf("multipart") == 0) { + return true; + } else { + var data = form.serializeArray(); + var targetUrl = form.attr("action"); + jQuery.ajax(targetUrl,{ + type:'POST', + data: data, + cache: false, + dataType: 'json', + success: function(data, textStatus, jqXHR) { + o_afterserver(); + o_ainvoke(data); + if(push) { + var businessPath = data['businessPath']; + var documentTitle = data['documentTitle']; + var historyPointId = data['historyPointId']; + if(businessPath) { + o_pushState(historyPointId, documentTitle, businessPath); + } + } + }, + error: function(jqXHR, textStatus, errorThrown) { + o_afterserver(); + if(window.console) console.log('Error status', textStatus); + } + }); + return false; + } +} + +function o_XHRSubmitMultipart(formNam) { + var form = jQuery('#' + formNam); + var iframeName = "openolat-submit-" + ("" + Math.random()).substr(2); + var iframe = createIFrame(iframeName); + document.body.appendChild(iframe); + form.attr('target', iframe.name); + form.submit(); + form.attr('target',''); +} + +createIFrame = function (iframeName) { + var $iframe = jQuery('<iframe name="'+iframeName+'" id="'+iframeName+'" src="about:blank" style="position: absolute; top: -9999px; left: -9999px;" onload="clearAfterAjaxIframeCall();">'); + return $iframe[0]; +} + +function o_removeIframe(id) { + jQuery('#' + id).remove(); +} + +function o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt, dirtyCheck, push) { + if(dirtyCheck) { + if(!o2cl()) return false; + } else { + if(!o2cl_noDirtyCheck()) return false; + } + var data = new Object(); data['dispatchuri'] = dispId; data['dispatchevent'] = eventInt; - if(arguments.length > 5) { + if(arguments.length > 7) { var argLength = arguments.length; - for(var i=5; i<argLength; i=i+2) { + for(var i=7; i<argLength; i=i+2) { if(argLength > i+1) { data[arguments[i]] = arguments[i+1]; } @@ -1185,22 +1264,94 @@ function o_ffXHREvent(formNam, dispIdField, dispId, eventIdField, eventInt) { dataType: 'json', success: function(data, textStatus, jqXHR) { o_ainvoke(data); + if(push) { + var businessPath = data['businessPath']; + var documentTitle = data['documentTitle']; + var historyPointId = data['historyPointId']; + if(businessPath) { + o_pushState(historyPointId, documentTitle, businessPath); + } + } }, error: function(jqXHR, textStatus, errorThrown) { + o_afterserver(); if(window.console) console.log('Error status', textStatus); } }) } -function o_ffXHRNFEvent(targetUrl) { +function o_XHREvent(targetUrl, dirtyCheck, push) { + if(dirtyCheck) { + if(!o2cl()) return false; + } else { + if(!o2cl_noDirtyCheck()) return false; + } + + var data = new Object(); + if(arguments.length > 3) { + var argLength = arguments.length; + for(var i=3; i<argLength; i=i+2) { + if(argLength > i+1) { + data[arguments[i]] = arguments[i+1]; + } + } + } + + jQuery.ajax(targetUrl,{ + type:'POST', + data: data, + cache: false, + dataType: 'json', + success: function(data, textStatus, jqXHR) { + try { + o_afterserver(); + o_ainvoke(data); + if(push) { + var businessPath = data['businessPath']; + var documentTitle = data['documentTitle']; + var historyPointId = data['historyPointId']; + if(businessPath) { + o_pushState(historyPointId, documentTitle, businessPath); + } + } + } catch(e) { + if(window.console) console.log(e); + } + }, + error: function(jqXHR, textStatus, errorThrown) { + o_afterserver(); + if(401 == jqXHR.status) { + window.location.reload(true); + } else if(window.console) { + console.log('Error status', textStatus, errorThrown, jqXHR.responseText); + } + } + }) + + return false; +} + + +//by pass every check and don't wait a response from the response +//typically used to send GUI settings back to the server +function o_XHRNFEvent(targetUrl) { var data = new Object(); + if(arguments.length > 1) { + var argLength = arguments.length; + for(var i=1; i<argLength; i=i+2) { + if(argLength > i+1) { + data[arguments[i]] = arguments[i+1]; + } + } + } + jQuery.ajax(targetUrl,{ - type:'GET', + type:'POST', data: data, cache: false, dataType: 'json', success: function(data, textStatus, jqXHR) { - if(window.console) console.log('Hourra'); + //ok }, error: function(jqXHR, textStatus, errorThrown) { if(window.console) console.log('Error status', textStatus); @@ -1208,6 +1359,23 @@ function o_ffXHRNFEvent(targetUrl) { }) } +function o_pushState(historyPointId, title, url) { + try { + var data = new Object(); + data['businessPath'] = url; + data['historyPointId'] = historyPointId; + o_info.businessPath=url; + o_shareActiveSocialUrl(); + if(window.history && !(typeof window.history === "undefined") && window.history.pushState) { + window.history.pushState(data, title, url); + } else { + window.location.hash = historyPointId; + } + } catch(e) { + if(window.console) console.log(e, url); + } +} + // // param formId a String with flexi form id function setFlexiFormDirtyByListener(e){ @@ -1309,15 +1477,6 @@ function showMessageBox(type, title, message, buttonCallback) { } } -/* - * For standard tables - */ -function tableFormInjectCommandAndSubmit(formName, cmd, param) { - document.forms[formName].elements["cmd"].value = cmd; - document.forms[formName].elements["param"].value = param; - document.forms[formName].submit(); -} - /* * For standard tables */ @@ -1364,8 +1523,10 @@ function onTreeDrop(event, ui) { } else if(droppableId.indexOf('dt') == 0) { url += '%3Asne%3Aend'; } - jQuery('.ui-droppable').each(function(index, el) { jQuery(el).droppable( "disable" ); }); - frames['oaa0'].location.href = url + '/'; + jQuery('.ui-droppable').each(function(index, el) { + jQuery(el).droppable( "disable" ); + }); + o_XHREvent(url + '/', false, false); } function treeAcceptDrop(el) { @@ -1646,19 +1807,6 @@ var BDebugger = { console.log("\t" + typeof window[o] + " \t" + o); }); } - }, - - logManagedOLATObjects : function() { - var self = BDebugger; - if (o_info.objectMap.length > 0) { - console.log(o_info.objectMap.length + " managed OLAT objects found:"); - o_info.objectMap.eachKey(function(key){ - var item=o_info.objectMap.get(key); - console.log("\t" + typeof item + " \t" + key); - return true; - }); - } } } - \ No newline at end of file diff --git a/src/main/webapp/static/js/js.plugins.min.js b/src/main/webapp/static/js/js.plugins.min.js index cc1997ba71c457661109f7d5a09a4a3c61d96da0..899f0fa88ba211f291eccea2dd117ad882a24fff 100644 --- a/src/main/webapp/static/js/js.plugins.min.js +++ b/src/main/webapp/static/js/js.plugins.min.js @@ -5,7 +5,7 @@ * Dual licensed under the MIT or GPL Version 2 licenses. * */ -jQuery.periodic=function(l,h){if(jQuery.isFunction(l)){h=l;l={}}var c=jQuery.extend({},jQuery.periodic.defaults,{ajax_complete:j,increment:g,reset:f,cancel:i},l);c.cur_period=c.period;c.tid=false;var e="";b();return c;function b(){i();c.tid=setTimeout(function(){h.call(c);g();if(c.tid){b()}},c.cur_period)}function j(n,m){if(m==="success"&&e!==n.responseText){e=n.responseText;f()}}function g(){c.cur_period*=c.decay;if(c.cur_period<c.period){f()}else{if(c.cur_period>c.max_period){c.cur_period=c.max_period;if(c.on_max!==undefined){c.on_max.call(c)}}}}function f(){c.cur_period=c.period;b()}function i(){clearTimeout(c.tid);c.tid=null}function k(){}function a(){}function d(){}};jQuery.periodic.defaults={period:4000,max_period:1800000,decay:1.5,on_max:undefined};var Hashtable=(function(){var p="function";var n=(typeof Array.prototype.splice==p)?function(s,r){s.splice(r,1)}:function(u,t){var s,v,r;if(t===u.length-1){u.length=t}else{s=u.slice(t+1);u.length=t;for(v=0,r=s.length;v<r;++v){u[t+v]=s[v]}}};function a(t){var r;if(typeof t=="string"){return t}else{if(typeof t.hashCode==p){r=t.hashCode();return(typeof r=="string")?r:a(r)}else{if(typeof t.toString==p){return t.toString()}else{try{return String(t)}catch(s){return Object.prototype.toString.call(t)}}}}}function g(r,s){return r.equals(s)}function e(r,s){return(typeof s.equals==p)?s.equals(r):(r===s)}function c(r){return function(s){if(s===null){throw new Error("null is not a valid "+r)}else{if(typeof s=="undefined"){throw new Error(r+" must not be undefined")}}}}var q=c("key"),l=c("value");function d(u,s,t,r){this[0]=u;this.entries=[];this.addEntry(s,t);if(r!==null){this.getEqualityFunction=function(){return r}}}var h=0,j=1,f=2;function o(r){return function(t){var s=this.entries.length,v,u=this.getEqualityFunction(t);while(s--){v=this.entries[s];if(u(t,v[0])){switch(r){case h:return true;case j:return v;case f:return[s,v[1]]}}}return false}}function k(r){return function(u){var v=u.length;for(var t=0,s=this.entries.length;t<s;++t){u[v+t]=this.entries[t][r]}}}d.prototype={getEqualityFunction:function(r){return(typeof r.equals==p)?g:e},getEntryForKey:o(j),getEntryAndIndexForKey:o(f),removeEntryForKey:function(s){var r=this.getEntryAndIndexForKey(s);if(r){n(this.entries,r[0]);return r[1]}return null},addEntry:function(r,s){this.entries[this.entries.length]=[r,s]},keys:k(0),values:k(1),getEntries:function(s){var u=s.length;for(var t=0,r=this.entries.length;t<r;++t){s[u+t]=this.entries[t].slice(0)}},containsKey:o(h),containsValue:function(s){var r=this.entries.length;while(r--){if(s===this.entries[r][1]){return true}}return false}};function m(s,t){var r=s.length,u;while(r--){u=s[r];if(t===u[0]){return r}}return null}function i(r,s){var t=r[s];return(t&&(t instanceof d))?t:null}function b(t,r){var w=this;var v=[];var u={};var x=(typeof t==p)?t:a;var s=(typeof r==p)?r:null;this.put=function(B,C){q(B);l(C);var D=x(B),E,A,z=null;E=i(u,D);if(E){A=E.getEntryForKey(B);if(A){z=A[1];A[1]=C}else{E.addEntry(B,C)}}else{E=new d(D,B,C,s);v[v.length]=E;u[D]=E}return z};this.get=function(A){q(A);var B=x(A);var C=i(u,B);if(C){var z=C.getEntryForKey(A);if(z){return z[1]}}return null};this.containsKey=function(A){q(A);var z=x(A);var B=i(u,z);return B?B.containsKey(A):false};this.containsValue=function(A){l(A);var z=v.length;while(z--){if(v[z].containsValue(A)){return true}}return false};this.clear=function(){v.length=0;u={}};this.isEmpty=function(){return !v.length};var y=function(z){return function(){var A=[],B=v.length;while(B--){v[B][z](A)}return A}};this.keys=y("keys");this.values=y("values");this.entries=y("getEntries");this.remove=function(B){q(B);var C=x(B),z,A=null;var D=i(u,C);if(D){A=D.removeEntryForKey(B);if(A!==null){if(!D.entries.length){z=m(v,C);n(v,z);delete u[C]}}}return A};this.size=function(){var A=0,z=v.length;while(z--){A+=v[z].entries.length}return A};this.each=function(C){var z=w.entries(),A=z.length,B;while(A--){B=z[A];C(B[0],B[1])}};this.putAll=function(H,C){var B=H.entries();var E,F,D,z,A=B.length;var G=(typeof C==p);while(A--){E=B[A];F=E[0];D=E[1];if(G&&(z=w.get(F))){D=C(F,z,D)}w.put(F,D)}};this.clone=function(){var z=new b(t,r);z.putAll(w);return z}}return b})();(function(b){b.fn.ooLog=function(f,d,e){var c=null;b(this).each(function(){c=b(this).data("_ooLog");if(c==undefined){c=new a();b(this).data("_ooLog",c)}});if(f==undefined){return c}else{if(typeof f==="string"){if(c){c.log(f,d,e)}}}};function a(){return this}a.prototype={isDebugEnabled:function(){return o_info.JSTracingLogDebugEnabled},log:function(e,c,d){if(!this.isDebugEnabled()){return}jQuery.post(o_info.JSTracingUri,{level:e,logMsg:c,jsFile:d})}}})(jQuery);(function(b){b.fn.ooTranslator=function(){var d=null;b(document).each(function(){d=b(document).data("_ooTranslator");if(d==undefined){d=new a();b(document).data("_ooTranslator",d)}});return d};function a(){return this}a.prototype={mapperUrl:null,translators:null,initialize:function(d){this.mapperUrl=d;this.translators=new Object()},getTranslator:function(d,f){if(this.translators[d]==null){this.translators[d]=new Object()}if(this.translators[d][f]==null){var e=this.mapperUrl+"/"+d+"/"+f+"/translations.js";jQuery.ajax(e,{async:false,dataType:"json",success:function(g,i,h){jQuery(document).ooTranslator()._createTranslator(g,d,f)}})}return this.translators[d][f]},_createTranslator:function(e,d,f){this.translators[d][f]=new c().initialize(e,d,f)}};function c(){return this}c.prototype={localizationData:null,bundle:null,locale:null,initialize:function(f,d,e){this.bundle=e;this.locale=d;this.localizationData=f;return this},translate:function(d){if(this.localizationData[d]){return this.localizationData[d]}else{return this.bundle+":"+d}}}})(jQuery);+function(b){var a=function(){this.addExtraElements();this.state={busy:false,brandW:0,sitesW:0,sitesDirty:false,sites:{collapsed:this.isSitesCollapsed(),extended:this.isSitesExtended},tabsW:0,tabsDirty:false,tabs:{collapsed:this.isTabsCollapsed(),extended:this.isTabsExtended()},toolsW:0,toolsDirty:false,tools:{collapsed:this.isToolsCollapsed(),extended:this.isToolsExtended()},offCanvasWidth:0,moreW:0};var c=b("#o_offcanvas_right").css("width");if(c){this.state.offCanvasWidth=parseInt(c.replace(/[^\d.]/g,""));this.initListners();this.calculateWidth();this.optimize()}};a.prototype.initListners=function(){b(window).resize(b.proxy(this.onResizeCallback,this));b(document).on("oo.nav.sites.modified",b.proxy(function(){this.state.sitesDirty=true},this));b(document).on("oo.nav.tabs.modified",b.proxy(function(){this.state.tabsDirty=true},this));b(document).on("oo.nav.tools.modified",b.proxy(function(){this.state.toolsDirty=true},this));b(document).on("oo.dom.replacement.after",b.proxy(this.onDOMreplacementCallback,this));b(window).on("orientationchange",b.proxy(this.hideRight,this));b("#o_navbar_right-toggle").on("click",b.proxy(this.toggleRight,this));b("#o_offcanvas_right .o_offcanvas_close").on("click",b.proxy(this.hideRight,this));b("#o_navbar_more").on("shown.bs.dropdown",this.onDropdownShown);b("#o_navbar_more").on("hidden.bs.dropdown",this.onDropdownHidden)};a.prototype.onResizeCallback=function(){if(!this.state.busy){this.state.busy=true;this.calculateWidth();this.optimize();this.state.busy=false}};a.prototype.onDOMreplacementCallback=function(){if(!this.state.busy&&(this.state.sitesDirty||this.state.tabsDirty||this.state.toolsDirty)){this.state.busy=true;this.cleanupMoreDropdown();this.calculateWidth();this.optimize();this.state.sitesDirty=false;this.state.tabsDirty=false;this.state.toolsDirty=false;this.state.busy=false}};a.prototype.onDropdownShown=function(c){var f=b("#o_navbar_more .dropdown-menu");if(f.length){var d=f.offset().left;if(d<0){f.removeClass("dropdown-menu-right")}}};a.prototype.onDropdownHidden=function(c){var d=b("#o_navbar_more .dropdown-menu");d.addClass("dropdown-menu-right")};a.prototype.calculateWidth=function(){var c=b("#o_navbar_container .o_navbar-collapse");this.state.navbarW=c.innerWidth();this.state.brandW=b(".o_navbar-brand").outerWidth(true);this.state.sitesW=this.getSites().outerWidth(true);this.state.tabsW=this.getTabs().outerWidth(true);this.state.toolsW=this.getTools().outerWidth(false);this.state.moreW=b("#o_navbar_more:visible").outerWidth(true)};a.prototype.getOverflow=function(c){var d=this.state.navbarW;d-=this.state.sitesW;d-=this.state.tabsW;d-=this.state.toolsW;d-=this.state.brandW;d-=this.state.moreW;d-=25;return -d};a.prototype.optimize=function(h){var c=this.getOverflow();var k=this.getSites();var l=this.getTabs();var g=this.getTools();var n=this.getMoreDropdown();var f=this.getOffcanvasRight();this.updateState();while(c>0&&(!this.state.tabs.collapsed||!this.state.sites.collapsed||!this.state.tools.collapsed)){if(!this.state.tabs.collapsed){this.collapse(l,n,"li","o_dropdown_tab")}else{if(!this.state.sites.collapsed){this.collapse(k,n,"li","o_dropdown_site")}else{if(!this.state.tools.collapsed){this.collapse(g,f,".o_navbar_tool:not(#o_navbar_imclient, #o_navbar_search_opener, #o_navbar_my_menu)","o_tool_right")}}}this.calculateWidth();c=this.getOverflow();this.updateState()}while(c<0&&(!this.state.tabs.extended||!this.state.sites.extended||!this.state.tools.extended)){if(!this.state.tools.extended){var m=this.extend(f,g.children("#o_navbar_imclient, #o_navbar_search_opener, #o_navbar_my_menu").first(),".o_tool_right","o_tool_right",true);if(!m){break}}if(!this.state.sites.extended){var j=this.extend(n,k,"li","o_dropdown_site");if(!j){break}}else{if(!this.state.tabs.extended){var d=this.extend(n,l,"li","o_dropdown_tab");if(!d){break}}}this.calculateWidth();c=this.getOverflow();this.updateState()}if(this.state.sites.extended&&this.state.tabs.extended){var i=b("#o_navbar_more");i.css("display","none")}this.checkToolsOrder()};a.prototype.updateState=function(){this.state.sites.collapsed=this.isSitesCollapsed();this.state.sites.extended=this.isSitesExtended();this.state.tabs.collapsed=this.isTabsCollapsed();this.state.tabs.extended=this.isTabsExtended();this.state.tools.collapsed=this.isToolsCollapsed();this.state.tools.extended=this.isToolsExtended()};a.prototype.collapse=function(g,d,c,f){var e=g.find(c);if(e.length){e=e.last()}if(e.length){f&&e.addClass(f);if(d){e.prependTo(d)}}this.updateDropdownToggle(g)};a.prototype.extend=function(g,d,c,i,f){var e=g.find(c);if(e.length){e=e.first()}var j=false;if(e.length){if(d){if(f){d.before(e)}else{e.appendTo(d)}this.updateDropdownToggle(g);this.calculateWidth();var h=this.getOverflow();if(h>0){e.prependTo(g)}else{i&&e.removeClass(i);j=true}}}this.updateDropdownToggle(g);return j};a.prototype.updateDropdownToggle=function(c){var d=c.parents(".o_dropdown_toggle");if(!d.length){return}if(c.children().length){d.css("display","block")}else{d.css("display","none")}};a.prototype.addExtraElements=function(){var d=b("#o_navbar_container .o_navbar-collapse");var c=b("#o_navbar_more");if(c.length==0){c=b('<ul id="o_navbar_more" class="nav o_navbar-nav o_dropdown_toggle"><li><a class="dropdown-toggle" data-toggle="dropdown" href="#"">'+o_info.i18n_topnav_more+' <b class="caret"></b></a><ul class="dropdown-menu dropdown-menu-right"></ul></li></ul>');c.appendTo(d)}this.getSites().append('<li class="divider o_dropdown_site"></li>');b("#o_navbar_help .o_icon, #o_navbar_print .o_icon").addClass("o_icon-fw")};a.prototype.cleanupMoreDropdown=function(){if(!this.state.sitesDirty){var f=this.getSites();var d=this.getMoreDropdown().children(".o_dropdown_site");d.appendTo(f)}else{this.getSites().append('<li class="divider o_dropdown_site"></li>')}if(!this.state.tabsDirty){var e=this.getTabs();var c=this.getMoreDropdown().children(".o_dropdown_tab");c.prependTo(e)}this.getMoreDropdown().empty()};a.prototype.checkToolsOrder=function(){var f=this.getTools();var e=f.find("#o_navbar_help");var d=f.find("#o_navbar_print");var c=f.find("#o_navbar_imclient");if(c&&d){c.after(d)}if(c&&e){c.after(e)}};a.prototype.showRight=function(){if(!this.isOffcanvasVisible()&&!this.offcanvasTransitioning){this.offcanvasTransitioning=true;var d=this;var c=b("#o_offcanvas_right");c.show().transition({x:-d.state.offCanvasWidth},function(){d.offcanvasTransitioning=false;b("body").addClass("o_offcanvas_right_visible");var e=b.proxy(d.hideRightOnClick,d);setTimeout(function(){b("html").on("click",e)},10)})}};a.prototype.hideRightOnClick=function(c){if("INPUT"!=c.target.nodeName){this.hideRight()}};a.prototype.hideRight=function(){if(this.isOffcanvasVisible()&&!this.offcanvasTransitioning){this.offcanvasTransitioning=true;b("html").off("click",b.proxy(this.hideRight,this));var d=this;var c=b("#o_offcanvas_right");c.transition({x:d.state.offCanvasWidth},function(){d.offcanvasTransitioning=false;c.hide();b("body").removeClass("o_offcanvas_right_visible")})}};a.prototype.toggleRight=function(){if(this.isOffcanvasVisible()){this.hideRight()}else{this.showRight()}};a.prototype.isOffcanvasVisible=function(){return b("#o_offcanvas_right:visible").length};a.prototype.getSites=function(){return b("#o_navbar_container .o_navbar_sites")};a.prototype.getTabs=function(){return b("#o_navbar_container .o_navbar_tabs")};a.prototype.getTools=function(){return b("#o_navbar_container #o_navbar_tools_permanent")};a.prototype.getMoreDropdown=function(){return b("#o_navbar_more .dropdown-menu")};a.prototype.getOffcanvasRight=function(){return b("#o_offcanvas_right_container .o_navbar-right")};a.prototype.isSitesCollapsed=function(){return !this.getSites().children("li").not(".divider").length};a.prototype.isSitesExtended=function(){return !this.getMoreDropdown().children(".o_dropdown_site").not(".divider").length};a.prototype.isTabsCollapsed=function(){return !this.getTabs().children("li").length};a.prototype.isTabsExtended=function(){return !this.getMoreDropdown().children(".o_dropdown_tab").length};a.prototype.isToolsCollapsed=function(){return !this.getTools().children(".o_navbar_tool").not("#o_navbar_imclient, #o_navbar_search_opener, #o_navbar_my_menu").length};a.prototype.isToolsExtended=function(){return !this.getOffcanvasRight().children(".o_tool_right").length};b(document).ready(function(){var d=b("#o_navbar_wrapper");if(d){var c=new a();window.OPOL.navbar=c}})}(jQuery);+function(b){b.fn.ooBgCarrousel=function(){return new a()};var a=function(){};a.prototype.initCarrousel=function(g){this.settings=b.extend({query:null,images:[],shuffle:false,shuffleFirst:false,durationshow:5000,durationout:500,durationin:500,easeout:"ease",easein:"ease"},g);this.pos=null;if(this.settings.query==null||this.settings.images.length==0){return}this.initialImage=this.settings.images[0];if(this.settings.shuffle){var f=this.settings.images;for(var d,c,e=f.length;e;d=parseInt(Math.random()*e),c=f[--e],f[e]=f[d],f[d]=c){}}if(this.settings.shuffleFirst){this._replaceImage()}this.rotate()};a.prototype.rotate=function(){setTimeout(b.proxy(this._hideCurrent,this),this.settings.durationshow)};a.prototype._hideCurrent=function(){var c=b(this.settings.query);if(c&&c.size()>0){c.transition({opacity:0,duration:this.settings.durationout,easing:this.settings.easeout},b.proxy(this._showNext,this))}};a.prototype._replaceImage=function(d){if(!d){d=b(this.settings.query)}if(d&&d.size()>0){this.newImg="";this.oldImg="";if(this.pos==null){this.pos=1;this.oldImg=this.initialImage}else{this.oldImg=this.settings.images[this.pos];this.pos++;if(this.settings.images.length==this.pos){this.pos=0}}this.newImg=this.settings.images[this.pos];var c=d.css("background-image");if(c.indexOf(this.oldImg)==-1){d.transition({opacity:1,duration:0});return}var e=c.replace(this.oldImg,this.newImg);d.css("background-image",e)}};a.prototype._showNext=function(){var c=b(this.settings.query);this._replaceImage(c);c.transition({opacity:1,duration:this.settings.durationin,easing:this.settings.easein},b.proxy(this.rotate,this))}}(jQuery);!function(a){function b(){function b(a){"remove"===a&&this.each(function(a,b){var c=e(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var c=tinymce.get(b.id.replace(/_parent$/,""));c&&c.remove()})}function d(a){var c,d=this;if(null!=a)b.call(d),d.each(function(b,c){var d;(d=tinymce.get(c.id))&&d.setContent(a)});else if(d.length>0&&(c=tinymce.get(d[0].id)))return c.getContent()}function e(a){var b=null;return a&&a.id&&g.tinymce&&(b=tinymce.get(a.id)),b}function f(a){return!!(a&&a.length&&g.tinymce&&a.is(":tinymce"))}var h={};a.each(["text","html","val"],function(b,g){var i=h[g]=a.fn[g],j="text"===g;a.fn[g]=function(b){var g=this;if(!f(g))return i.apply(g,arguments);if(b!==c)return d.call(g.filter(":tinymce"),b),i.apply(g.not(":tinymce"),arguments),g;var h="",k=arguments;return(j?g:g.eq(0)).each(function(b,c){var d=e(c);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(a(c),k)}),h}}),a.each(["append","prepend"],function(b,d){var g=h[d]=a.fn[d],i="prepend"===d;a.fn[d]=function(a){var b=this;return f(b)?a!==c?("string"==typeof a&&b.filter(":tinymce").each(function(b,c){var d=e(c);d&&d.setContent(i?a+d.getContent():d.getContent()+a)}),g.apply(b.not(":tinymce"),arguments),b):void 0:g.apply(b,arguments)}}),a.each(["remove","replaceWith","replaceAll","empty"],function(c,d){var e=h[d]=a.fn[d];a.fn[d]=function(){return b.call(this,d),e.apply(this,arguments)}}),h.attr=a.fn.attr,a.fn.attr=function(b,g){var i=this,j=arguments;if(!b||"value"!==b||!f(i))return g!==c?h.attr.apply(i,j):h.attr.apply(i,j);if(g!==c)return d.call(i.filter(":tinymce"),g),h.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=e(k);return l?l.getContent({save:!0}):h.attr.apply(a(k),j)}}var c,d,e,f=[],g=window;a.fn.tinymce=function(c){function h(){var d=[],f=0;e||(b(),e=!0),l.each(function(a,b){var e,g=b.id,h=c.oninit;g||(b.id=g=tinymce.DOM.uniqueId()),tinymce.get(g)||(e=new tinymce.Editor(g,c,tinymce.EditorManager),d.push(e),e.on("init",function(){var a,b=h;l.css("visibility",""),h&&++f==d.length&&("string"==typeof b&&(a=-1===b.indexOf(".")?null:tinymce.resolve(b.replace(/\.\w+$/,"")),b=tinymce.resolve(b)),b.apply(a||tinymce,d))}))}),a.each(d,function(a,b){b.render()})}var i,j,k,l=this,m="";if(!l.length)return l;if(!c)return window.tinymce?tinymce.get(l[0].id):null;if(l.css("visibility","hidden"),g.tinymce||d||!(i=c.script_url))1===d?f.push(h):h();else{d=1,j=i.substring(0,i.lastIndexOf("/")),-1!=i.indexOf(".min")&&(m=".min"),g.tinymce=g.tinyMCEPreInit||{base:j,suffix:m},-1!=i.indexOf("gzip")&&(k=c.language||"en",i=i+(/\?/.test(i)?"&":"?")+"js=true&core=true&suffix="+escape(m)+"&themes="+escape(c.theme||"modern")+"&plugins="+escape(c.plugins||"")+"&languages="+(k||""),g.tinyMCE_GZ||(g.tinyMCE_GZ={start:function(){function b(a){tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(a))}b("langs/"+k+".js"),b("themes/"+c.theme+"/theme"+m+".js"),b("themes/"+c.theme+"/langs/"+k+".js"),a.each(c.plugins.split(","),function(a,c){c&&(b("plugins/"+c+"/plugin"+m+".js"),b("plugins/"+c+"/langs/"+k+".js"))})},end:function(){}}));var n=document.createElement("script");n.type="text/javascript",n.onload=n.onreadystatechange=function(b){b=b||window.event,2===d||"load"!=b.type&&!/complete|loaded/.test(n.readyState)||(tinymce.dom.Event.domLoaded=1,d=2,c.script_loaded&&c.script_loaded(),h(),a.each(f,function(a,b){b()}))},n.src=i,document.body.appendChild(n)}return l},a.extend(a.expr[":"],{tinymce:function(a){var b;return a.id&&"tinymce"in window&&(b=tinymce.get(a.id),b&&b.editorManager===tinymce)?!0:!1}})}(jQuery);OPOL={};var o2c=0;var o3c=new Array();o_info.guibusy=false;o_info.linkbusy=false;o_info.debug=true;var BLoader={_ajaxLoadedJS:new Array(),_isAlreadyLoadedJS:function(b){var a=true;jQuery("head script[src]").each(function(d,c){if(jQuery(c).attr("src").indexOf(b)!=-1){a=false}});if(jQuery.inArray(b,this._ajaxLoadedJS)!=-1){a=false}return !a},loadJS:function(b,c,a){if(!this._isAlreadyLoadedJS(b)){if(o_info.debug){o_log("BLoader::loadJS: loading ajax::"+a+" url::"+b)}if(a){jQuery.ajax(b,{async:false,dataType:"script",cache:true,success:function(d,f,e){}});this._ajaxLoadedJS.push(b)}else{jQuery.getScript(b)}if(o_info.debug){o_log("BLoader::loadJS: loading DONE url::"+b)}}else{if(o_info.debug){o_log("BLoader::loadJS: already loaded url::"+b)}}},executeGlobalJS:function(jsString,contextDesc){try{if(window.execScript){window.execScript(jsString)}else{window.eval(jsString)}}catch(e){if(window.console){console.log(contextDesc,"cannot execute js",jsString)}if(o_info.debug){o_logerr("BLoader::executeGlobalJS: Error when executing JS code in contextDesc::"+contextDesc+' error::"'+showerror(e)+" for: "+escape(jsString))}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","BLoader::executeGlobalJS: Error when executing JS code in contextDesc::"+contextDesc+' error::"'+showerror(e)+" for: "+escape(jsString),"functions.js::BLoader::executeGlobalJS::"+contextDesc)}if(window.location.href.indexOf("o_winrndo")!=-1){window.location.reload()}else{window.location.href=window.location.href+(window.location.href.indexOf("?")!=-1?"&":"?")+"o_winrndo=1"}}},loadCSS:function(b,o,q){var r=window.document;try{if(r.createStyleSheet){var j=r.styleSheets;var d=0;var p=0;for(i=0;i<j.length;i++){var m=j[i];var g=m.href;if(g==b){d++;if(m.disabled){m.disabled=false;return}else{if(o_info.debug){o_logwarn("BLoader::loadCSS: style: "+b+" already in document and not disabled! (duplicate add)")}return}}if(m.id=="o_theme_css"){p=i}}if(d>1&&o_info.debug){o_logwarn("BLoader::loadCSS: apply styles: num of stylesheets found was not 0 or 1:"+d)}if(q){p=j.length}var f=r.createStyleSheet(b,p)}else{var c=jQuery("#"+o);if(c&&c.size()>0){if(o_info.debug){o_logwarn("BLoader::loadCSS: stylesheet already found in doc when trying to add:"+b+", with id "+o)}return}else{var a=jQuery('<link id="'+o+'" rel="stylesheet" type="text/css" href="'+b+'">');if(q){a.insertBefore(jQuery("#o_fontSize_css"))}else{a.insertBefore(jQuery("#o_theme_css"))}}}}catch(n){if(window.console){console.log(n)}if(o_info.debug){o_logerr("BLoader::loadCSS: Error when loading CSS from URL::"+b)}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","BLoader::loadCSS: Error when loading CSS from URL::"+b,"functions.js::BLoader::loadCSS")}}},unLoadCSS:function(a,m){var n=window.document;try{if(n.createStyleSheet){var f=n.styleSheets;var d=0;var o=a;var b=window.location.href.substring(0,window.location.href.indexOf("/",8));if(a.indexOf(b)==0){o=a.substring(b.length)}for(i=0;i<f.length;i++){var g=f[i].href;if(g==a||g==o){d++;if(!f[i].disabled){f[i].disabled=true}else{if(o_info.debug){o_logwarn("stylesheet: when removing: matching url, but already disabled! url:"+g)}}}}if(d!=1&&o_info.debug){o_logwarn("stylesheet: when removeing: num of stylesheets found was not 1:"+d)}}else{var c=jQuery("#"+m);if(c){c.href="";c.remove();c=null;return}else{if(o_info.debug){o_logwarn("no link with id found to remove, id:"+m+", url "+a)}}}}catch(j){if(o_info.debug){o_logerr("BLoader::unLoadCSS: Error when unloading CSS from URL::"+a)}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","BLoader::unLoadCSS: Error when unloading CSS from URL::"+a,"functions.js::BLoader::loadCSS")}}}};var BFormatter={formatLatexFormulas:function(b){try{if(window.jsMath){if(jsMath.loaded&&jsMath.tex2math&&jsMath.tex2math.loaded){jsMath.Process()}else{jsMath.Autoload.LoadJsMath();setTimeout(function(){BFormatter.formatLatexFormulas(b)},100)}}}catch(a){if(window.console){console.log("error in BFormatter.formatLatexFormulas: ",a)}}}};function o_init(){try{o_getMainWin().o_afterserver()}catch(a){if(o_info.debug){o_log("error in o_init: "+showerror(a))}}}function o_initEmPxFactor(){o_info.emPxFactor=jQuery("#o_width_1em").width();if(o_info.emPxFactor==0||o_info.emPxFactor=="undefined"){o_info.emPxFactor=12;if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Could not read with of element b_width_1em, set o_info.emPxFactor to 12","functions.js")}}}function o_getMainWin(){try{if(window.OPOL){return window}else{if(window.opener&&window.opener.OPOL){return window.opener}}}catch(a){if(o_info.debug){o_logerr('Exception while getting main window. rror::"'+showerror(a))}if(window.console){console.log('Exception while getting main window. rror::"'+showerror(a),"functions.js");console.log(a)}}throw"Can not find main OpenOLAT window"}function o_beforeserver(){o_info.linkbusy=true;showAjaxBusy();if(window.suppressOlatOnUnloadOnce){window.suppressOlatOnUnloadOnce=false}else{if(window.olatonunload){olatonunload()}}}function o_afterserver(){o2c=0;o_info.linkbusy=false;removeAjaxBusy()}function o2cl(){if(o_info.linkbusy){return false}else{var a=(o2c==0||confirm(o_info.dirty_form));if(a){o_beforeserver()}return a}}function o2cl_noDirtyCheck(){if(o_info.linkbusy){return false}else{o_beforeserver();return true}}function o2cl_secure(){try{if(o2cl()){return true}else{return false}}catch(a){return false}}function o3cl(d){if(o_info.linkbusy){return false}else{var b=o3c1.indexOf(d)>-1;var a=(b&&o3c1.length>1)||o3c1.length>0;var c=(!a||confirm(o_info.dirty_form));if(c){o_beforeserver()}return c}}function o_onc(a){var b=a.responseText;BLoader.executeGlobalJS("o_info.last_o_onc="+b+";","o_onc");o_ainvoke(o_info.last_o_onc,false)}function o_allowNextClick(){o_info.linkbusy=false;removeAjaxBusy()}function removeBusyAfterDownload(c,b,a){o2c=0;o_afterserver()}Array.prototype.search=function(c,d){var a=this.length;for(var b=0;b<a;b++){if(this[b].constructor==Array){if(this[b].search(c,d)){return true;break}}else{if(d){if(this[b].indexOf(c)!=-1){return true;break}}else{if(this[b]==c){return true;break}}}}return false};if(!Function.prototype.curry){Function.prototype.curry=function(){if(arguments.length<1){return this}var a=this;var b=Array.prototype.slice.call(arguments);return function(){return a.apply(this,b.concat(Array.prototype.slice.call(arguments)))}}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(c){if(this==null){throw new TypeError()}var d=Object(this);var a=d.length>>>0;if(a===0){return -1}var e=0;if(arguments.length>1){e=Number(arguments[1]);if(e!=e){e=0}else{if(e!=0&&e!=Infinity&&e!=-Infinity){e=(e>0||-1)*Math.floor(Math.abs(e))}}}if(e>=a){return -1}var b=e>=0?e:Math.max(a-Math.abs(e),0);for(;b<a;b++){if(b in d&&d[b]===c){return b}}return -1}}var b_onDomReplacementFinished_callbacks=new Array();function b_AddOnDomReplacementFinishedCallback(a){var b=jQuery(document).ooLog().isDebugEnabled();if(b){jQuery(document).ooLog("debug","callback stack size: "+b_onDomReplacementFinished_callbacks.length,"functions.js ADD")}if(b&&b_onDomReplacementFinished_callbacks.toSource){jQuery(document).ooLog("debug","stack content"+b_onDomReplacementFinished_callbacks.toSource(),"functions.js ADD")}b_onDomReplacementFinished_callbacks.push(a);if(b){jQuery(document).ooLog("debug","push to callback stack, func: "+a,"functions.js ADD")}}var b_changedDomEl=new Array();function b_AddOnDomReplacementFinishedUniqueCallback(a){if(a.constructor==Array){if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","add: its an ARRAY! ","functions.js ADD")}if(b_onDomReplacementFinished_callbacks.search(a[0])){if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","push to callback stack, already there!!: "+a[0],"functions.js ADD")}return}}b_AddOnDomReplacementFinishedCallback(a)}var o_debug_trid=0;function o_ainvoke(N){if(N==undefined){return}o_info.inainvoke=true;var I=N.cmdcnt;if(I>0){jQuery(document).trigger("oo.dom.replacement.before");b_changedDomEl=new Array();if(o_info.debug){o_debug_trid++}var y=N.cmds;for(var T=0;T<I;T++){var J=y[T];var A=J.cmd;var R=J.cda;var U=J.w;var c=this.window;var K;if(c){switch(A){case 1:var M=R.e;BLoader.executeGlobalJS(M,"o_ainvoker::jsexec");if(o_info.debug){o_log("c1: execute jscode: "+M)}case 2:var u=R.cc;var F=R.cps;for(var Q=0;Q<u;Q++){var m=F[Q];var h=m.cid;var P=m.cidvis;var H=m.cw;var x=m.hfrag;var O=m.jsol;var g=m.hdr;if(o_info.debug){o_log("c2: redraw: "+m.cname+" ("+h+") "+m.hfragsize+" bytes, listener(s): "+m.clisteners)}var W=g+"\n\n"+x;var C="";var S=false;var E="o_c"+h;var B=jQuery("#"+E);if(B==null||B.length==0){E="o_fi"+h;B=jQuery("#"+E);S=true}if(B!=null){var w=jQuery("div.o_richtext_mce textarea",B);for(var L=0;L<w.length;L++){try{var a=jQuery(w.get(L)).attr("id");if(typeof top.tinymce!=undefined){top.tinymce.remove("#"+a)}}catch(Z){if(window.console){console.log(Z)}}}if(P){B.css("display","")}else{B.css("display","none")}if(S||!H){B.replaceWith(W)}else{try{B.empty().html(W);if(W.length>0&&B.get(0).innerHTML==""){B.get(0).innerHTML=W}}catch(Z){if(window.console){console.log(Z)}if(window.console){console.log("Fragment",W)}}b_changedDomEl.push(E)}B=null;if(C!=""){C.each(function(e){BLoader.executeGlobalJS(e,"o_ainvoker::inscripts")})}if(O!=""){BLoader.executeGlobalJS(O,"o_ainvoker::jsol")}}}break;case 3:c.o2c=0;var X=R.rurl;c.o_afterserver();c.document.location.replace(X);break;case 5:c.o2c=0;var X=R.rurl;c.o_afterserver();c.document.location.replace(X);break;case 6:c.o2c=0;c.o_afterserver();break;case 7:var o=c.document.location;var z=o.protocol+"//"+o.hostname;if(o.port!=""){z+=":"+o.port}var v=R.cssrm;for(Q=0;Q<v.length;Q++){var D=v[Q];var G=D.id;var f=z+D.url;BLoader.unLoadCSS(f,G);if(o_info.debug){o_log("c7: rm css: id:"+G+" ,url:'"+f+"'")}}var V=R.cssadd;for(k=0;k<V.length;k++){var D=V[k];var G=D.id;var f=z+D.url;var n=D.pt;BLoader.loadCSS(f,G,n);if(o_info.debug){o_log("c7: add css: id:"+G+" ,url:'"+f+"'")}}var p=R.jsadd;for(l=0;l<p.length;l++){var D=p[l];var Y=D.before;if(jQuery.type(Y)==="string"){BLoader.executeGlobalJS(Y,"o_ainvoker::preJsAdd")}var f=D.url;var q=D.enc;if(jQuery.type(f)==="string"){BLoader.loadJS(f,q,true)}if(o_info.debug){o_log("c7: add js: "+f)}}break;default:if(o_info.debug){o_log("?: unknown command "+A)}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in o_ainvoke(), ?: unknown command "+A,"functions.js")}break}}else{if(o_info.debug){o_log("could not find window??")}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in o_ainvoke(), could not find window??","functions.js")}}}var b=b_onDomReplacementFinished_callbacks.length;if(b_onDomReplacementFinished_callbacks.toSource&&jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","stack content"+b_onDomReplacementFinished_callbacks.toSource(),"functions.js")}for(mycounter=0;b>mycounter;mycounter++){if(mycounter>50){if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Stopped executing DOM replacement callback functions - to many functions::"+b_onDomReplacementFinished_callbacks.length,"functions.js")}break}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Stacksize before shift: "+b_onDomReplacementFinished_callbacks.length,"functions.js")}var s=b_onDomReplacementFinished_callbacks.shift();if(typeof s.length==="number"){if(s[0]=="glosshighlighter"){var d=s[1];if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","arr fct: "+d,"functions.js")}s=d}}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Executing DOM replacement callback function #"+mycounter+" with timeout funct::"+s,"functions.js")}s();if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Stacksize after timeout: "+b_onDomReplacementFinished_callbacks.length,"functions.js")}}jQuery(document).trigger("oo.dom.replacement.after")}o_info.inainvoke=false}function clearAfterAjaxIframeCall(){if(o_info.linkbusy){o_afterserver();showMessageBox("info",o_info.i18n_noresponse_title,o_info.i18n_noresponse,undefined)}}function showAjaxBusy(){setTimeout(function(){if(o_info.linkbusy){try{if(jQuery("#o_ajax_busy_backdrop").length==0){jQuery("#o_body").addClass("o_ajax_busy");jQuery("#o_ajax_busy").modal({show:true,backdrop:"static",keyboard:"false"});jQuery("#o_ajax_busy").after('<div id="o_ajax_busy_backdrop" class="modal-backdrop in"></div>');jQuery("#o_ajax_busy>.modal-backdrop").remove();jQuery("#o_ajax_busy_backdrop").css({"z-index":1200})}}catch(a){if(window.console){console.log(a)}}}},700)}function removeAjaxBusy(){try{jQuery("#o_body").removeClass("o_ajax_busy");jQuery("#o_ajax_busy_backdrop").remove();jQuery("#o_ajax_busy").modal("hide")}catch(a){if(window.console){console.log(a)}}}function setFormDirty(c){o2c=1;var a=document.getElementById(c);if(a!=null){var b=a.olat_fosm_0;if(b==null){b=a.olat_fosm}if(b){b.className="btn o_button_dirty"}}else{if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in setFormDirty, myForm was null for formId="+c,"functions.js")}}}function contextHelpWindow(a){helpWindow=window.open(a,"HelpWindow","height=760, width=940, left=0, top=0, location=no, menubar=no, resizable=yes, scrollbars=yes, toolbar=no");helpWindow.focus()}function o_openPopUp(b,d,c,a,e){attributes="height="+a+", width="+c+", resizable=yes, scrollbars=yes, left=100, top=100, ";if(e){attributes+="location=yes, menubar=yes, status=yes, toolbar=yes"}else{attributes+="location=no, menubar=no, status=no, toolbar=no"}var f=window.open(b,d,attributes);f.focus();if(o_info.linkbusy){o_afterserver()}}function b_handleFileUploadFormChange(e,b,d){var f=e.value;slashPos=f.lastIndexOf("/");if(slashPos!=-1){f=f.substring(slashPos+1)}slashPos=f.lastIndexOf("\\");if(slashPos!=-1){f=f.substring(slashPos+1)}b.value=f;if(d){d.className="o_button_dirty"}var c=e.form.elements;for(i=0;i<c.length;i++){var a=c[i];if(a.name==b.name&&i+1<c.length){c[i+1].focus()}}}function gotonode(a){try{if(typeof o_activateCourseNode!="undefined"){o_activateCourseNode(a)}else{if(opener&&typeof opener.o_activateCourseNode!="undefined"){opener.o_activateCourseNode(a)}else{if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in gotonode(), could not find main window","functions.js")}}}}catch(b){alert("Goto node error:"+b);if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in gotonode()::"+b.message,"functions.js")}}}function o_openUriInMainWindow(b){try{var a=o_getMainWin();a.focus();a.location.replace(b)}catch(c){showMessageBox("error","Error","Can not find main OpenOLAT window to open URL.")}}function o_viewportHeight(){var a=jQuery(document).height();if(a>0){return a}else{return 600}}OPOL.getMainColumnsMaxHeight=function(){var j=0,f=0,a=0,c=0,h=0,b,g=jQuery("#o_main_left_content"),e=jQuery("#o_main_right_content"),d=jQuery("#o_main_center_content");if(g!="undefined"&&g!=null){j=g.outerHeight(true)}if(e!="undefined"&&e!=null){f=e.outerHeight(true)}if(d!="undefined"&&d!=null){a=d.outerHeight(true)}c=(j>f?j:f);c=(c>a?c:a);if(c>0){return c}b=jQuery("#o_main");if(b!="undefined"&&b!=null){h=b.height()}if(b>0){return b}return o_viewportHeight()};OPOL.adjustHeight=function(){try{var a=0;col1=jQuery("#o_main_left_content").outerHeight(true);col2=jQuery("#o_main_right_content").outerHeight(true);col3=jQuery("#o_main_center_content").outerHeight(true);a=Math.max(col1,col2,col3);if(col1!=null){jQuery("#o_main_left").css({"min-height":a+"px"})}if(col2!=null){jQuery("#o_main_right").css({"min-height":a+"px"})}if(col3!=null){jQuery("#o_main_center").css({"min-height":a+"px"})}}catch(b){if(window.console){console.log(b)}}};jQuery(window).resize(function(){clearTimeout(o_info.resizeId);o_info.resizeId=setTimeout(function(){jQuery(document).trigger("oo.window.resize.after")},500)});jQuery(document).on("oo.window.resize.after",OPOL.adjustHeight);jQuery(document).on("oo.dom.replacement.after",OPOL.adjustHeight);jQuery().ready(OPOL.adjustHeight);function o_scrollToElement(a){try{jQuery("html, body").animate({scrollTop:jQuery(a).offset().top},333)}catch(b){}}function o_popover(c,b,a){if(typeof(a)==="undefined"){a="bottom"}jQuery("#"+c).popover({placement:a,html:true,trigger:"click",container:"body",content:function(){return jQuery("#"+b).clone().html()}}).on("shown.bs.popover",function(){var d=function(f){jQuery("#"+c).popover("hide");jQuery("body").unbind("click",d)};setTimeout(function(){jQuery("body").on("click",d)},5)})}function o_popoverWithTitle(d,c,b,a){if(typeof(a)==="undefined"){a="bottom"}return jQuery("#"+d).popover({placement:a,html:true,title:b,trigger:"click",container:"body",content:function(){return jQuery("#"+c).clone().html()}}).on("shown.bs.popover",function(){var e=function(f){jQuery("#"+d).popover("destroy");jQuery("body").unbind("click",e)};setTimeout(function(){jQuery("body").on("click",e)},5)})}function o_shareLinkPopup(d,c,b){if(typeof(b)==="undefined"){b="top"}var a=jQuery("#"+d);a.popover({placement:b,html:true,trigger:"click",container:"body",content:c}).on("shown.bs.popover",function(){var e=function(f){if(jQuery(f.target).data("toggle")!=="popover"&&jQuery(f.target).parents(".popover.in").length===0){jQuery("#"+d).popover("hide");jQuery("body").unbind("click",e)}};setTimeout(function(){jQuery("body").on("click",e)},5)});a.attr("title",a.attr("data-original-title"))}function o_QRCodePopup(d,c,b){if(typeof(b)==="undefined"){b="top"}var a=jQuery("#"+d);a.popover({placement:b,html:true,trigger:"click",container:"body",content:'<div id="'+d+'_pop" class="o_qrcode"></div>'}).on("shown.bs.popover",function(){o_info.qr=o_QRCode(d+"_pop",(jQuery.isFunction(c)?c():c));var e=function(f){if(jQuery(f.target).data("toggle")!=="popover"&&jQuery(f.target).parents(".popover.in").length===0){jQuery("#"+d).popover("hide");jQuery("body").unbind("click",e)}};setTimeout(function(){jQuery("body").on("click",e)},5)}).on("hidden.bs.popover",function(){try{o_info.qr.clear();delete o_info.qr}catch(f){}});a.attr("title",a.attr("data-original-title"))}function o_QRCode(c,b){try{BLoader.loadJS(o_info.o_baseURI+"/js/jquery/qrcodejs/qrcode.min.js","utf8",true);return new QRCode(document.getElementById(c),b)}catch(a){return null}}function b_resizeIframeToMainMaxHeight(f){var d=jQuery("#"+f);if(d!="undefined"&&d!=null){var c=OPOL.getMainColumnsMaxHeight()-110;var b=o_viewportHeight()-100;b=b-d.offset().top;var e=jQuery("#b_footer");if(e!="undefined"&&e!=null){b=b-e.outerHeight(true)}var a=(b>c?b:c);d.height(a)}}var o_debu_oldcn,o_debu_oldtt;function o_debu_show(b,a){if(o_debu_oldcn){o_debu_hide(o_debu_oldcn,o_debu_oldtt)}jQuery(b).addClass("o_dev_m");jQuery(a).show();o_debu_oldtt=a;o_debu_oldcn=b}function o_debu_hide(b,a){jQuery(a).hide();jQuery(b).removeClass("o_dev_m")}function o_dbg_mark(a){var b=jQuery("#"+a);if(b){b.css("background-color","#FCFCB8");b.css("border","3px solid #00F")}}function o_dbg_unmark(a){var b=jQuery("#"+a);if(b){b.css("border","");b.css("background-color","")}}function o_clearConsole(){o_log_all="";o_log(null)}var o_log_all="";function o_log(b){if(b){o_log_all="\n"+o_debug_trid+"> "+b+o_log_all;o_log_all=o_log_all.substr(0,4000)}var a=jQuery("#o_debug_cons");if(a){if(o_log_all.length==4000){o_log_all=o_log_all+"\n... (stripped: to long)... "}a.value=o_log_all}if(!jQuery.type(window.console)==="undefined"){window.console.log(b)}}function o_logerr(a){o_log("ERROR:"+a)}function o_logwarn(a){o_log("WARN:"+a)}function showerror(c){var a="";for(var b in c){a+=b+": "+c[b]+"\n"}return"error detail:\n"+a}function o_ffEvent(e,d,c,h,j){var f,g,b,a;f=document.getElementById(d);g=f.value;f.value=c;b=document.getElementById(h);a=b.value;b.value=j;if(document.forms[e].onsubmit()){document.forms[e].submit()}f.value=g;b.value=a}function o_ffXHREvent(f,e,a,h,j){var c=new Object();c.dispatchuri=a;c.dispatchevent=j;if(arguments.length>5){var g=arguments.length;for(var d=5;d<g;d=d+2){if(g>d+1){c[arguments[d]]=arguments[d+1]}}}var b=jQuery("#"+f).attr("action");jQuery.ajax(b,{type:"GET",data:c,cache:false,dataType:"json",success:function(n,o,m){o_ainvoke(n)},error:function(m,o,n){if(window.console){console.log("Error status",o)}}})}function o_ffXHRNFEvent(b){var a=new Object();jQuery.ajax(b,{type:"GET",data:a,cache:false,dataType:"json",success:function(d,e,c){if(window.console){console.log("Hourra")}},error:function(c,e,d){if(window.console){console.log("Error status",e)}}})}function setFlexiFormDirtyByListener(a){setFlexiFormDirty(a.data.formId)}function setFlexiFormDirty(b){var a=o3c.indexOf(b)>-1;if(!a){o3c.push(b)}jQuery("#"+b).each(function(){var c=jQuery(this).data("FlexiSubmit");if(c!=null){jQuery("#"+c).addClass("btn o_button_dirty");o2c=1}})}function o_ffRegisterSubmit(b,a){jQuery("#"+b).data("FlexiSubmit",a)}function showInfoBox(g,d){var c=Math.floor(Math.random()*65536).toString(16);var f='<div id="'+c+'" class="o_alert_info "><div class="alert alert-info clearfix o_sel_info_message"><i class="o_icon o_icon_close"></i><h3><i class="o_icon o_icon_info"></i> '+g+"</h3><p>"+d+"</p></div></div>";var a=jQuery("#o_messages").prepend(f);var e=(d.length>150)?8000:((d.length>70)?6000:4000);var b=function(){jQuery("#"+c).transition({top:"-100%"},333,function(){jQuery("#"+c).remove()})};jQuery("#"+c).show().transition({top:0},333);jQuery("#"+c).click(function(h){b()});o_scrollToElement("#o_top");g=null;d=null;a=null;e=null;setTimeout(function(){try{b()}catch(h){}},8000)}function showMessageBox(b,f,d,a){if(b=="info"){showInfoBox(f,d);return null}else{var c='<div id="myFunctionalModal" class="modal fade" role="dialog"><div class="modal-dialog"><div class="modal-content">';c+='<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>';c+='<h4 class="modal-title">'+f+"</h4></div>";c+='<div class="modal-body alert ';if("warn"==b){c+="alert-warning"}else{if("error"==b){c+="alert-danger"}else{c+="alert-info"}}c+='"><p>'+d+"</p></div></div></div></div>";jQuery("#myFunctionalModal").remove();jQuery("body").append(c);var e=jQuery("#myFunctionalModal").modal("show").on("hidden.bs.modal",function(g){jQuery("#myFunctionalModal").remove()});o_scrollToElement("#o_top");return e}}function tableFormInjectCommandAndSubmit(a,b,c){document.forms[a].elements.cmd.value=b;document.forms[a].elements.param.value=c;document.forms[a].submit()}function o_table_toggleCheck(d,c){var a=document.forms[d].elements.tb_ms;len=a.length;if(typeof(len)=="undefined"){a.checked=c}else{var b;for(b=0;b<len;b++){a[b].checked=c}}}function onTreeStartDrag(a,b){jQuery(a.target).addClass("o_dnd_proxy")}function onTreeStopDrag(a,b){jQuery(a.target).removeClass("o_dnd_proxy")}function onTreeDrop(g,h){var a=jQuery(h.draggable[0]);var f=jQuery(this);f.css({position:"",width:""});var c=f.droppable("option","endUrl");if(c.lastIndexOf("/")==(c.length-1)){c=c.substring(0,c.length-1)}var e=a.attr("id");var b=e.substring(2,e.length);c+="%3Atnidle%3A"+b;var d=f.attr("id");if(d.indexOf("ds")==0){c+="%3Asne%3Ayes"}else{if(d.indexOf("dt")==0){c+="%3Asne%3Aend"}}jQuery(".ui-droppable").each(function(j,m){jQuery(m).droppable("disable")});frames.oaa0.location.href=c+"/"}function treeAcceptDrop(a){return true}function treeAcceptDrop_notWithChildren(a){var c=false;var b=jQuery(a);var e=b.attr("id");if(e!=undefined&&(e.indexOf("dd")==0||e.indexOf("ds")==0||e.indexOf("dt")==0||e.indexOf("da")==0||e.indexOf("row")==0)){var g=jQuery(this);var j=g.attr("id");var d=e.substring(2,e.length);var f=j.substring(2,j.length);if(d!=f){var h=jQuery("#dd"+d).parents("li");if(h.length>0&&jQuery(h.get(0)).find("#dd"+f).length==0){c=true}}}return c}function treeAcceptDrop_portfolio(b){var d=false;var c=jQuery(b);var f=c.attr("id");if(treeNode_isDragNode(f)){var h=jQuery(this);var n=h.attr("id");var e=f.substring(2,f.length);var g=n.substring(2,n.length);var m=f.indexOf("ds")==0||f.indexOf("dt")==0;if(e!=g){var j=treeNode_portfolioType(c);var a=treeNode_portfolioType(h);if(j=="artefact"){if(a=="page"||a=="struct"||a=="artefact"){d=true}}else{if(j=="struct"){if(a=="page"||a=="struct"){d=true}}else{if(j=="page"){if(a=="map"||a=="page"){d=true}}}}}}return d}function treeNode_portfolioType(e){var c=jQuery(e.get(0));var d=treeNode_portfolioTypes(c);if(d==null){var a=c.parent("a");if(a.length>0){d=treeNode_portfolioTypes(jQuery(a.get(0)))}else{if(c.attr("id").indexOf("ds")==0){var b=c.prev("div");if(b.length>0){d=treeNode_portfolioTypes(b)}}else{if(c.attr("id").indexOf("dt")==0){var b=c.next("div");if(b.length>0){d=treeNode_portfolioTypes(b)}}}}}return d}function treeNode_portfolioTypes(a){if(a.find===undefined){return null}else{if(a.find(".o_ep_icon_struct").length>0||a.hasClass("o_ep_icon_struct")){return"struct"}else{if(a.find(".o_ep_icon_page").length>0||a.hasClass("o_ep_icon_page")){return"page"}else{if(a.find(".o_ep_icon_map").length>0||a.hasClass("o_ep_icon_map")){return"map"}else{if(a.find(".o_ep_artefact").length>0||a.hasClass("o_ep_artefact")){return"artefact"}}}}}return null}function treeNode_isDragNode(a){if(a!=undefined&&(a.indexOf("dd")==0||a.indexOf("ds")==0||a.indexOf("dt")==0||a.indexOf("da")==0||a.indexOf("row")==0)){return true}return false}function o_choice_toggleCheck(c,b){var d=document.forms[c].elements;len=d.length;if(typeof(len)=="undefined"){d.checked=b}else{var a;for(a=0;a<len;a++){if(d[a].type=="checkbox"&&d[a].getAttribute("class")=="o_checkbox"){d[a].checked=b}}}}function b_briefcase_isChecked(c,e){var b;var a=document.getElementById(c);var d=0;for(b=0;a.elements[b];b++){if(a.elements[b].type=="checkbox"&&a.elements[b].name=="paths"&&a.elements[b].checked){d++}}if(d<1){alert(e);return false}return true}function b_briefcase_toggleCheck(d,c){var a=document.getElementById(d);len=a.elements.length;var b;for(b=0;b<len;b++){if(a.elements[b].name=="paths"){a.elements[b].checked=c}}}function o_doPrint(){var d=jQuery("div.o_iframedisplay iframe");if(d.length>0){try{var a=d[0];frames[a.name].focus();frames[a.name].print();return}catch(c){for(i=0;frames.length>i;i++){a=frames[i];if(a.name=="oaa0"){continue}var b=document.getElementsByName(a.name)[0];if(b&&b.getAttribute("class")=="ext-shim"){continue}if(a.name!=""){try{frames[a.name].focus();frames[a.name].print()}catch(c){window.print()}return}}window.print()}}else{window.print()}}function b_attach_i18n_inline_editing(){jQuery("span.o_translation_i18nitem").hover(function(){jQuery(this.firstChild).show();if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Entered i18nitem::"+this.firstChild,"functions.js:b_attach_i18n_inline_editing()")}},function(){jQuery("a.o_translation_i18nitem_launcher").hide();if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Leaving i18nitem::"+this,"functions.js:b_attach_i18n_inline_editing()")}});jQuery("a.o_translation_i18nitem_launcher").hover(function(){var a=jQuery(this).parent("span.o_translation_i18nitem");a.effect("highlight")});b_AddOnDomReplacementFinishedCallback(b_attach_i18n_inline_editing)}function b_hideExtMessageBox(){}var BDebugger={_lastDOMCount:0,_lastObjCount:0,_knownGlobalOLATObjects:["o_afterserver","o_onc","o_getMainWin","o_ainvoke","o_info","o_beforeserver","o_ffEvent","o_openPopUp","o_debu_show","o_logwarn","o_dbg_unmark","o_ffRegisterSubmit","o_clearConsole","o_init","o_log","o_allowNextClick","o_dbg_mark","o_debu_hide","o_logerr","o_debu_oldcn","o_debu_oldtt","o_openUriInMainWindow","o_debug_trid","o_log_all"],_countDOMElements:function(){return document.getElementsByTagName("*").length},_countGlobalObjects:function(){var a=0;for(prop in window){a++}return a},logDOMCount:function(){var b=BDebugger;var a=b._countDOMElements();var c=a-b._lastDOMCount;console.log((c>0?"+":"")+c+" \t"+a+" \tDOM element count after DOM replacement");b._lastDOMCount=a;a=null},logGlobalObjCount:function(){var b=BDebugger;var a=b._countGlobalObjects();var c=a-b._lastObjCount;console.log((c>0?"+":"")+c+" \t"+a+" \tGlobal object count after DOM replacement");b._lastObjCount=a;a=null},logGlobalOLATObjects:function(){var b=BDebugger;var a=new Array();for(prop in window){if(prop.indexOf("o_")==0&&b._knownGlobalOLATObjects.indexOf(prop)==-1){a.push(prop)}}if(a.length>0){console.log(a.length+" global OLAT objects found:");a.each(function(c){console.log("\t"+typeof window[c]+" \t"+c)})}},logManagedOLATObjects:function(){var a=BDebugger;if(o_info.objectMap.length>0){console.log(o_info.objectMap.length+" managed OLAT objects found:");o_info.objectMap.eachKey(function(b){var c=o_info.objectMap.get(b);console.log("\t"+typeof c+" \t"+b);return true})}}};/*! +jQuery.periodic=function(l,h){if(jQuery.isFunction(l)){h=l;l={}}var c=jQuery.extend({},jQuery.periodic.defaults,{ajax_complete:j,increment:g,reset:f,cancel:i},l);c.cur_period=c.period;c.tid=false;var e="";b();return c;function b(){i();c.tid=setTimeout(function(){h.call(c);g();if(c.tid){b()}},c.cur_period)}function j(n,m){if(m==="success"&&e!==n.responseText){e=n.responseText;f()}}function g(){c.cur_period*=c.decay;if(c.cur_period<c.period){f()}else{if(c.cur_period>c.max_period){c.cur_period=c.max_period;if(c.on_max!==undefined){c.on_max.call(c)}}}}function f(){c.cur_period=c.period;b()}function i(){clearTimeout(c.tid);c.tid=null}function k(){}function a(){}function d(){}};jQuery.periodic.defaults={period:4000,max_period:1800000,decay:1.5,on_max:undefined};var Hashtable=(function(){var p="function";var n=(typeof Array.prototype.splice==p)?function(s,r){s.splice(r,1)}:function(u,t){var s,v,r;if(t===u.length-1){u.length=t}else{s=u.slice(t+1);u.length=t;for(v=0,r=s.length;v<r;++v){u[t+v]=s[v]}}};function a(t){var r;if(typeof t=="string"){return t}else{if(typeof t.hashCode==p){r=t.hashCode();return(typeof r=="string")?r:a(r)}else{if(typeof t.toString==p){return t.toString()}else{try{return String(t)}catch(s){return Object.prototype.toString.call(t)}}}}}function g(r,s){return r.equals(s)}function e(r,s){return(typeof s.equals==p)?s.equals(r):(r===s)}function c(r){return function(s){if(s===null){throw new Error("null is not a valid "+r)}else{if(typeof s=="undefined"){throw new Error(r+" must not be undefined")}}}}var q=c("key"),l=c("value");function d(u,s,t,r){this[0]=u;this.entries=[];this.addEntry(s,t);if(r!==null){this.getEqualityFunction=function(){return r}}}var h=0,j=1,f=2;function o(r){return function(t){var s=this.entries.length,v,u=this.getEqualityFunction(t);while(s--){v=this.entries[s];if(u(t,v[0])){switch(r){case h:return true;case j:return v;case f:return[s,v[1]]}}}return false}}function k(r){return function(u){var v=u.length;for(var t=0,s=this.entries.length;t<s;++t){u[v+t]=this.entries[t][r]}}}d.prototype={getEqualityFunction:function(r){return(typeof r.equals==p)?g:e},getEntryForKey:o(j),getEntryAndIndexForKey:o(f),removeEntryForKey:function(s){var r=this.getEntryAndIndexForKey(s);if(r){n(this.entries,r[0]);return r[1]}return null},addEntry:function(r,s){this.entries[this.entries.length]=[r,s]},keys:k(0),values:k(1),getEntries:function(s){var u=s.length;for(var t=0,r=this.entries.length;t<r;++t){s[u+t]=this.entries[t].slice(0)}},containsKey:o(h),containsValue:function(s){var r=this.entries.length;while(r--){if(s===this.entries[r][1]){return true}}return false}};function m(s,t){var r=s.length,u;while(r--){u=s[r];if(t===u[0]){return r}}return null}function i(r,s){var t=r[s];return(t&&(t instanceof d))?t:null}function b(t,r){var w=this;var v=[];var u={};var x=(typeof t==p)?t:a;var s=(typeof r==p)?r:null;this.put=function(B,C){q(B);l(C);var D=x(B),E,A,z=null;E=i(u,D);if(E){A=E.getEntryForKey(B);if(A){z=A[1];A[1]=C}else{E.addEntry(B,C)}}else{E=new d(D,B,C,s);v[v.length]=E;u[D]=E}return z};this.get=function(A){q(A);var B=x(A);var C=i(u,B);if(C){var z=C.getEntryForKey(A);if(z){return z[1]}}return null};this.containsKey=function(A){q(A);var z=x(A);var B=i(u,z);return B?B.containsKey(A):false};this.containsValue=function(A){l(A);var z=v.length;while(z--){if(v[z].containsValue(A)){return true}}return false};this.clear=function(){v.length=0;u={}};this.isEmpty=function(){return !v.length};var y=function(z){return function(){var A=[],B=v.length;while(B--){v[B][z](A)}return A}};this.keys=y("keys");this.values=y("values");this.entries=y("getEntries");this.remove=function(B){q(B);var C=x(B),z,A=null;var D=i(u,C);if(D){A=D.removeEntryForKey(B);if(A!==null){if(!D.entries.length){z=m(v,C);n(v,z);delete u[C]}}}return A};this.size=function(){var A=0,z=v.length;while(z--){A+=v[z].entries.length}return A};this.each=function(C){var z=w.entries(),A=z.length,B;while(A--){B=z[A];C(B[0],B[1])}};this.putAll=function(H,C){var B=H.entries();var E,F,D,z,A=B.length;var G=(typeof C==p);while(A--){E=B[A];F=E[0];D=E[1];if(G&&(z=w.get(F))){D=C(F,z,D)}w.put(F,D)}};this.clone=function(){var z=new b(t,r);z.putAll(w);return z}}return b})();(function(b){b.fn.ooLog=function(f,d,e){var c=null;b(this).each(function(){c=b(this).data("_ooLog");if(c==undefined){c=new a();b(this).data("_ooLog",c)}});if(f==undefined){return c}else{if(typeof f==="string"){if(c){c.log(f,d,e)}}}};function a(){return this}a.prototype={isDebugEnabled:function(){return o_info.JSTracingLogDebugEnabled},log:function(e,c,d){if(!this.isDebugEnabled()){return}jQuery.post(o_info.JSTracingUri,{level:e,logMsg:c,jsFile:d})}}})(jQuery);(function(b){b.fn.ooTranslator=function(){var d=null;b(document).each(function(){d=b(document).data("_ooTranslator");if(d==undefined){d=new a();b(document).data("_ooTranslator",d)}});return d};function a(){return this}a.prototype={mapperUrl:null,translators:null,initialize:function(d){this.mapperUrl=d;this.translators=new Object()},getTranslator:function(d,f){if(this.translators[d]==null){this.translators[d]=new Object()}if(this.translators[d][f]==null){var e=this.mapperUrl+"/"+d+"/"+f+"/translations.js";jQuery.ajax(e,{async:false,dataType:"json",success:function(g,i,h){jQuery(document).ooTranslator()._createTranslator(g,d,f)}})}return this.translators[d][f]},_createTranslator:function(e,d,f){this.translators[d][f]=new c().initialize(e,d,f)}};function c(){return this}c.prototype={localizationData:null,bundle:null,locale:null,initialize:function(f,d,e){this.bundle=e;this.locale=d;this.localizationData=f;return this},translate:function(d){if(this.localizationData[d]){return this.localizationData[d]}else{return this.bundle+":"+d}}}})(jQuery);+function(b){var a=function(){this.addExtraElements();this.state={busy:false,brandW:0,sitesW:0,sitesDirty:false,sites:{collapsed:this.isSitesCollapsed(),extended:this.isSitesExtended},tabsW:0,tabsDirty:false,tabs:{collapsed:this.isTabsCollapsed(),extended:this.isTabsExtended()},toolsW:0,toolsDirty:false,tools:{collapsed:this.isToolsCollapsed(),extended:this.isToolsExtended()},offCanvasWidth:0,moreW:0};var c=b("#o_offcanvas_right").css("width");if(c){this.state.offCanvasWidth=parseInt(c.replace(/[^\d.]/g,""));this.initListners();this.calculateWidth();this.optimize()}};a.prototype.initListners=function(){b(window).resize(b.proxy(this.onResizeCallback,this));b(document).on("oo.nav.sites.modified",b.proxy(function(){this.state.sitesDirty=true},this));b(document).on("oo.nav.tabs.modified",b.proxy(function(){this.state.tabsDirty=true},this));b(document).on("oo.nav.tools.modified",b.proxy(function(){this.state.toolsDirty=true},this));b(document).on("oo.dom.replacement.after",b.proxy(this.onDOMreplacementCallback,this));b(window).on("orientationchange",b.proxy(this.hideRight,this));b("#o_navbar_right-toggle").on("click",b.proxy(this.toggleRight,this));b("#o_offcanvas_right .o_offcanvas_close").on("click",b.proxy(this.hideRight,this));b("#o_navbar_more").on("shown.bs.dropdown",this.onDropdownShown);b("#o_navbar_more").on("hidden.bs.dropdown",this.onDropdownHidden)};a.prototype.onResizeCallback=function(){if(!this.state.busy){this.state.busy=true;this.calculateWidth();this.optimize();this.state.busy=false}};a.prototype.onDOMreplacementCallback=function(){if(!this.state.busy&&(this.state.sitesDirty||this.state.tabsDirty||this.state.toolsDirty)){this.state.busy=true;this.cleanupMoreDropdown();this.calculateWidth();this.optimize();this.state.sitesDirty=false;this.state.tabsDirty=false;this.state.toolsDirty=false;this.state.busy=false}};a.prototype.onDropdownShown=function(c){var f=b("#o_navbar_more .dropdown-menu");if(f.length){var d=f.offset().left;if(d<0){f.removeClass("dropdown-menu-right")}}};a.prototype.onDropdownHidden=function(c){var d=b("#o_navbar_more .dropdown-menu");d.addClass("dropdown-menu-right")};a.prototype.calculateWidth=function(){var c=b("#o_navbar_container .o_navbar-collapse");this.state.navbarW=c.innerWidth();this.state.brandW=b(".o_navbar-brand").outerWidth(true);this.state.sitesW=this.getSites().outerWidth(true);this.state.tabsW=this.getTabs().outerWidth(true);this.state.toolsW=this.getTools().outerWidth(false);this.state.moreW=b("#o_navbar_more:visible").outerWidth(true)};a.prototype.getOverflow=function(c){var d=this.state.navbarW;d-=this.state.sitesW;d-=this.state.tabsW;d-=this.state.toolsW;d-=this.state.brandW;d-=this.state.moreW;d-=25;return -d};a.prototype.optimize=function(h){var c=this.getOverflow();var k=this.getSites();var l=this.getTabs();var g=this.getTools();var n=this.getMoreDropdown();var f=this.getOffcanvasRight();this.updateState();while(c>0&&(!this.state.tabs.collapsed||!this.state.sites.collapsed||!this.state.tools.collapsed)){if(!this.state.tabs.collapsed){this.collapse(l,n,"li","o_dropdown_tab")}else{if(!this.state.sites.collapsed){this.collapse(k,n,"li","o_dropdown_site")}else{if(!this.state.tools.collapsed){this.collapse(g,f,".o_navbar_tool:not(#o_navbar_imclient, #o_navbar_search_opener, #o_navbar_my_menu)","o_tool_right")}}}this.calculateWidth();c=this.getOverflow();this.updateState()}while(c<0&&(!this.state.tabs.extended||!this.state.sites.extended||!this.state.tools.extended)){if(!this.state.tools.extended){var m=this.extend(f,g.children("#o_navbar_imclient, #o_navbar_search_opener, #o_navbar_my_menu").first(),".o_tool_right","o_tool_right",true);if(!m){break}}if(!this.state.sites.extended){var j=this.extend(n,k,"li","o_dropdown_site");if(!j){break}}else{if(!this.state.tabs.extended){var d=this.extend(n,l,"li","o_dropdown_tab");if(!d){break}}}this.calculateWidth();c=this.getOverflow();this.updateState()}if(this.state.sites.extended&&this.state.tabs.extended){var i=b("#o_navbar_more");i.css("display","none")}this.checkToolsOrder()};a.prototype.updateState=function(){this.state.sites.collapsed=this.isSitesCollapsed();this.state.sites.extended=this.isSitesExtended();this.state.tabs.collapsed=this.isTabsCollapsed();this.state.tabs.extended=this.isTabsExtended();this.state.tools.collapsed=this.isToolsCollapsed();this.state.tools.extended=this.isToolsExtended()};a.prototype.collapse=function(g,d,c,f){var e=g.find(c);if(e.length){e=e.last()}if(e.length){f&&e.addClass(f);if(d){e.prependTo(d)}}this.updateDropdownToggle(g)};a.prototype.extend=function(g,d,c,i,f){var e=g.find(c);if(e.length){e=e.first()}var j=false;if(e.length){if(d){if(f){d.before(e)}else{e.appendTo(d)}this.updateDropdownToggle(g);this.calculateWidth();var h=this.getOverflow();if(h>0){e.prependTo(g)}else{i&&e.removeClass(i);j=true}}}this.updateDropdownToggle(g);return j};a.prototype.updateDropdownToggle=function(c){var d=c.parents(".o_dropdown_toggle");if(!d.length){return}if(c.children().length){d.css("display","block")}else{d.css("display","none")}};a.prototype.addExtraElements=function(){var d=b("#o_navbar_container .o_navbar-collapse");var c=b("#o_navbar_more");if(c.length==0){c=b('<ul id="o_navbar_more" class="nav o_navbar-nav o_dropdown_toggle"><li><a class="dropdown-toggle" data-toggle="dropdown" href="#"">'+o_info.i18n_topnav_more+' <b class="caret"></b></a><ul class="dropdown-menu dropdown-menu-right"></ul></li></ul>');c.appendTo(d)}this.getSites().append('<li class="divider o_dropdown_site"></li>');b("#o_navbar_help .o_icon, #o_navbar_print .o_icon").addClass("o_icon-fw")};a.prototype.cleanupMoreDropdown=function(){if(!this.state.sitesDirty){var f=this.getSites();var d=this.getMoreDropdown().children(".o_dropdown_site");d.appendTo(f)}else{this.getSites().append('<li class="divider o_dropdown_site"></li>')}if(!this.state.tabsDirty){var e=this.getTabs();var c=this.getMoreDropdown().children(".o_dropdown_tab");c.prependTo(e)}this.getMoreDropdown().empty()};a.prototype.checkToolsOrder=function(){var f=this.getTools();var e=f.find("#o_navbar_help");var d=f.find("#o_navbar_print");var c=f.find("#o_navbar_imclient");if(c&&d){c.after(d)}if(c&&e){c.after(e)}};a.prototype.showRight=function(){if(!this.isOffcanvasVisible()&&!this.offcanvasTransitioning){this.offcanvasTransitioning=true;var d=this;var c=b("#o_offcanvas_right");c.show().transition({x:-d.state.offCanvasWidth},function(){d.offcanvasTransitioning=false;b("body").addClass("o_offcanvas_right_visible");var e=b.proxy(d.hideRightOnClick,d);setTimeout(function(){b("html").on("click",e)},10)})}};a.prototype.hideRightOnClick=function(c){if("INPUT"!=c.target.nodeName){this.hideRight()}};a.prototype.hideRight=function(){if(this.isOffcanvasVisible()&&!this.offcanvasTransitioning){this.offcanvasTransitioning=true;b("html").off("click",b.proxy(this.hideRight,this));var d=this;var c=b("#o_offcanvas_right");c.transition({x:d.state.offCanvasWidth},function(){d.offcanvasTransitioning=false;c.hide();b("body").removeClass("o_offcanvas_right_visible")})}};a.prototype.toggleRight=function(){if(this.isOffcanvasVisible()){this.hideRight()}else{this.showRight()}};a.prototype.isOffcanvasVisible=function(){return b("#o_offcanvas_right:visible").length};a.prototype.getSites=function(){return b("#o_navbar_container .o_navbar_sites")};a.prototype.getTabs=function(){return b("#o_navbar_container .o_navbar_tabs")};a.prototype.getTools=function(){return b("#o_navbar_container #o_navbar_tools_permanent")};a.prototype.getMoreDropdown=function(){return b("#o_navbar_more .dropdown-menu")};a.prototype.getOffcanvasRight=function(){return b("#o_offcanvas_right_container .o_navbar-right")};a.prototype.isSitesCollapsed=function(){return !this.getSites().children("li").not(".divider").length};a.prototype.isSitesExtended=function(){return !this.getMoreDropdown().children(".o_dropdown_site").not(".divider").length};a.prototype.isTabsCollapsed=function(){return !this.getTabs().children("li").length};a.prototype.isTabsExtended=function(){return !this.getMoreDropdown().children(".o_dropdown_tab").length};a.prototype.isToolsCollapsed=function(){return !this.getTools().children(".o_navbar_tool").not("#o_navbar_imclient, #o_navbar_search_opener, #o_navbar_my_menu").length};a.prototype.isToolsExtended=function(){return !this.getOffcanvasRight().children(".o_tool_right").length};b(document).ready(function(){var d=b("#o_navbar_wrapper");if(d){var c=new a();window.OPOL.navbar=c}})}(jQuery);+function(b){b.fn.ooBgCarrousel=function(){return new a()};var a=function(){};a.prototype.initCarrousel=function(g){this.settings=b.extend({query:null,images:[],shuffle:false,shuffleFirst:false,durationshow:5000,durationout:500,durationin:500,easeout:"ease",easein:"ease"},g);this.pos=null;if(this.settings.query==null||this.settings.images.length==0){return}this.initialImage=this.settings.images[0];if(this.settings.shuffle){var f=this.settings.images;for(var d,c,e=f.length;e;d=parseInt(Math.random()*e),c=f[--e],f[e]=f[d],f[d]=c){}}if(this.settings.shuffleFirst){this._replaceImage()}this.rotate()};a.prototype.rotate=function(){setTimeout(b.proxy(this._hideCurrent,this),this.settings.durationshow)};a.prototype._hideCurrent=function(){var c=b(this.settings.query);if(c&&c.size()>0){c.transition({opacity:0,duration:this.settings.durationout,easing:this.settings.easeout},b.proxy(this._showNext,this))}};a.prototype._replaceImage=function(d){if(!d){d=b(this.settings.query)}if(d&&d.size()>0){this.newImg="";this.oldImg="";if(this.pos==null){this.pos=1;this.oldImg=this.initialImage}else{this.oldImg=this.settings.images[this.pos];this.pos++;if(this.settings.images.length==this.pos){this.pos=0}}this.newImg=this.settings.images[this.pos];var c=d.css("background-image");if(c.indexOf(this.oldImg)==-1){d.transition({opacity:1,duration:0});return}var e=c.replace(this.oldImg,this.newImg);d.css("background-image",e)}};a.prototype._showNext=function(){var c=b(this.settings.query);this._replaceImage(c);c.transition({opacity:1,duration:this.settings.durationin,easing:this.settings.easein},b.proxy(this.rotate,this))}}(jQuery);!function(a){function b(){function b(a){"remove"===a&&this.each(function(a,b){var c=e(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var c=tinymce.get(b.id.replace(/_parent$/,""));c&&c.remove()})}function d(a){var c,d=this;if(null!=a)b.call(d),d.each(function(b,c){var d;(d=tinymce.get(c.id))&&d.setContent(a)});else if(d.length>0&&(c=tinymce.get(d[0].id)))return c.getContent()}function e(a){var b=null;return a&&a.id&&g.tinymce&&(b=tinymce.get(a.id)),b}function f(a){return!!(a&&a.length&&g.tinymce&&a.is(":tinymce"))}var h={};a.each(["text","html","val"],function(b,g){var i=h[g]=a.fn[g],j="text"===g;a.fn[g]=function(b){var g=this;if(!f(g))return i.apply(g,arguments);if(b!==c)return d.call(g.filter(":tinymce"),b),i.apply(g.not(":tinymce"),arguments),g;var h="",k=arguments;return(j?g:g.eq(0)).each(function(b,c){var d=e(c);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(a(c),k)}),h}}),a.each(["append","prepend"],function(b,d){var g=h[d]=a.fn[d],i="prepend"===d;a.fn[d]=function(a){var b=this;return f(b)?a!==c?("string"==typeof a&&b.filter(":tinymce").each(function(b,c){var d=e(c);d&&d.setContent(i?a+d.getContent():d.getContent()+a)}),g.apply(b.not(":tinymce"),arguments),b):void 0:g.apply(b,arguments)}}),a.each(["remove","replaceWith","replaceAll","empty"],function(c,d){var e=h[d]=a.fn[d];a.fn[d]=function(){return b.call(this,d),e.apply(this,arguments)}}),h.attr=a.fn.attr,a.fn.attr=function(b,g){var i=this,j=arguments;if(!b||"value"!==b||!f(i))return g!==c?h.attr.apply(i,j):h.attr.apply(i,j);if(g!==c)return d.call(i.filter(":tinymce"),g),h.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=e(k);return l?l.getContent({save:!0}):h.attr.apply(a(k),j)}}var c,d,e,f=[],g=window;a.fn.tinymce=function(c){function h(){var d=[],f=0;e||(b(),e=!0),l.each(function(a,b){var e,g=b.id,h=c.oninit;g||(b.id=g=tinymce.DOM.uniqueId()),tinymce.get(g)||(e=new tinymce.Editor(g,c,tinymce.EditorManager),d.push(e),e.on("init",function(){var a,b=h;l.css("visibility",""),h&&++f==d.length&&("string"==typeof b&&(a=-1===b.indexOf(".")?null:tinymce.resolve(b.replace(/\.\w+$/,"")),b=tinymce.resolve(b)),b.apply(a||tinymce,d))}))}),a.each(d,function(a,b){b.render()})}var i,j,k,l=this,m="";if(!l.length)return l;if(!c)return window.tinymce?tinymce.get(l[0].id):null;if(l.css("visibility","hidden"),g.tinymce||d||!(i=c.script_url))1===d?f.push(h):h();else{d=1,j=i.substring(0,i.lastIndexOf("/")),-1!=i.indexOf(".min")&&(m=".min"),g.tinymce=g.tinyMCEPreInit||{base:j,suffix:m},-1!=i.indexOf("gzip")&&(k=c.language||"en",i=i+(/\?/.test(i)?"&":"?")+"js=true&core=true&suffix="+escape(m)+"&themes="+escape(c.theme||"modern")+"&plugins="+escape(c.plugins||"")+"&languages="+(k||""),g.tinyMCE_GZ||(g.tinyMCE_GZ={start:function(){function b(a){tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(a))}b("langs/"+k+".js"),b("themes/"+c.theme+"/theme"+m+".js"),b("themes/"+c.theme+"/langs/"+k+".js"),a.each(c.plugins.split(","),function(a,c){c&&(b("plugins/"+c+"/plugin"+m+".js"),b("plugins/"+c+"/langs/"+k+".js"))})},end:function(){}}));var n=document.createElement("script");n.type="text/javascript",n.onload=n.onreadystatechange=function(b){b=b||window.event,2===d||"load"!=b.type&&!/complete|loaded/.test(n.readyState)||(tinymce.dom.Event.domLoaded=1,d=2,c.script_loaded&&c.script_loaded(),h(),a.each(f,function(a,b){b()}))},n.src=i,document.body.appendChild(n)}return l},a.extend(a.expr[":"],{tinymce:function(a){var b;return a.id&&"tinymce"in window&&(b=tinymce.get(a.id),b&&b.editorManager===tinymce)?!0:!1}})}(jQuery);OPOL={};var o2c=0;var o3c=new Array();o_info.guibusy=false;o_info.linkbusy=false;o_info.debug=true;var BLoader={_ajaxLoadedJS:new Array(),_isAlreadyLoadedJS:function(b){var a=true;jQuery("head script[src]").each(function(d,c){if(jQuery(c).attr("src").indexOf(b)!=-1){a=false}});if(jQuery.inArray(b,this._ajaxLoadedJS)!=-1){a=false}return !a},loadJS:function(b,c,a){if(!this._isAlreadyLoadedJS(b)){if(o_info.debug){o_log("BLoader::loadJS: loading ajax::"+a+" url::"+b)}if(a){jQuery.ajax(b,{async:false,dataType:"script",cache:true,success:function(d,f,e){}});this._ajaxLoadedJS.push(b)}else{jQuery.getScript(b)}if(o_info.debug){o_log("BLoader::loadJS: loading DONE url::"+b)}}else{if(o_info.debug){o_log("BLoader::loadJS: already loaded url::"+b)}}},executeGlobalJS:function(jsString,contextDesc){try{if(window.execScript){window.execScript(jsString)}else{window.eval(jsString)}}catch(e){if(window.console){console.log(contextDesc,"cannot execute js",jsString)}if(o_info.debug){o_logerr("BLoader::executeGlobalJS: Error when executing JS code in contextDesc::"+contextDesc+' error::"'+showerror(e)+" for: "+escape(jsString))}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","BLoader::executeGlobalJS: Error when executing JS code in contextDesc::"+contextDesc+' error::"'+showerror(e)+" for: "+escape(jsString),"functions.js::BLoader::executeGlobalJS::"+contextDesc)}if(window.location.href.indexOf("o_winrndo")!=-1){window.location.reload()}else{window.location.href=window.location.href+(window.location.href.indexOf("?")!=-1?"&":"?")+"o_winrndo=1"}}},loadCSS:function(b,o,q){var r=window.document;try{if(r.createStyleSheet){var j=r.styleSheets;var d=0;var p=0;for(i=0;i<j.length;i++){var m=j[i];var g=m.href;if(g==b){d++;if(m.disabled){m.disabled=false;return}else{if(o_info.debug){o_logwarn("BLoader::loadCSS: style: "+b+" already in document and not disabled! (duplicate add)")}return}}if(m.id=="o_theme_css"){p=i}}if(d>1&&o_info.debug){o_logwarn("BLoader::loadCSS: apply styles: num of stylesheets found was not 0 or 1:"+d)}if(q){p=j.length}var f=r.createStyleSheet(b,p)}else{var c=jQuery("#"+o);if(c&&c.size()>0){if(o_info.debug){o_logwarn("BLoader::loadCSS: stylesheet already found in doc when trying to add:"+b+", with id "+o)}return}else{var a=jQuery('<link id="'+o+'" rel="stylesheet" type="text/css" href="'+b+'">');if(q){a.insertBefore(jQuery("#o_fontSize_css"))}else{a.insertBefore(jQuery("#o_theme_css"))}}}}catch(n){if(window.console){console.log(n)}if(o_info.debug){o_logerr("BLoader::loadCSS: Error when loading CSS from URL::"+b)}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","BLoader::loadCSS: Error when loading CSS from URL::"+b,"functions.js::BLoader::loadCSS")}}},unLoadCSS:function(a,m){var n=window.document;try{if(n.createStyleSheet){var f=n.styleSheets;var d=0;var o=a;var b=window.location.href.substring(0,window.location.href.indexOf("/",8));if(a.indexOf(b)==0){o=a.substring(b.length)}for(i=0;i<f.length;i++){var g=f[i].href;if(g==a||g==o){d++;if(!f[i].disabled){f[i].disabled=true}else{if(o_info.debug){o_logwarn("stylesheet: when removing: matching url, but already disabled! url:"+g)}}}}if(d!=1&&o_info.debug){o_logwarn("stylesheet: when removeing: num of stylesheets found was not 1:"+d)}}else{var c=jQuery("#"+m);if(c){c.href="";c.remove();c=null;return}else{if(o_info.debug){o_logwarn("no link with id found to remove, id:"+m+", url "+a)}}}}catch(j){if(o_info.debug){o_logerr("BLoader::unLoadCSS: Error when unloading CSS from URL::"+a)}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","BLoader::unLoadCSS: Error when unloading CSS from URL::"+a,"functions.js::BLoader::loadCSS")}}}};var BFormatter={formatLatexFormulas:function(b){try{if(window.jsMath){if(jsMath.loaded&&jsMath.tex2math&&jsMath.tex2math.loaded){jsMath.Process()}else{jsMath.Autoload.LoadJsMath();setTimeout(function(){BFormatter.formatLatexFormulas(b)},100)}}}catch(a){if(window.console){console.log("error in BFormatter.formatLatexFormulas: ",a)}}}};function o_init(){try{o_getMainWin().o_afterserver()}catch(a){if(o_info.debug){o_log("error in o_init: "+showerror(a))}}}function o_initEmPxFactor(){o_info.emPxFactor=jQuery("#o_width_1em").width();if(o_info.emPxFactor==0||o_info.emPxFactor=="undefined"){o_info.emPxFactor=12;if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Could not read with of element b_width_1em, set o_info.emPxFactor to 12","functions.js")}}}function o_getMainWin(){try{if(window.OPOL){return window}else{if(window.opener&&window.opener.OPOL){return window.opener}}}catch(a){if(o_info.debug){o_logerr('Exception while getting main window. rror::"'+showerror(a))}if(window.console){console.log('Exception while getting main window. rror::"'+showerror(a),"functions.js");console.log(a)}}throw"Can not find main OpenOLAT window"}function o_beforeserver(){o_info.linkbusy=true;showAjaxBusy();if(window.suppressOlatOnUnloadOnce){window.suppressOlatOnUnloadOnce=false}else{if(window.olatonunload){olatonunload()}}}function o_afterserver(){o2c=0;o_info.linkbusy=false;removeAjaxBusy()}function o2cl(){try{if(o_info.linkbusy){return false}else{var b=(o2c==0||confirm(o_info.dirty_form));if(b){o_beforeserver()}return b}}catch(a){if(window.console){console.log(a)}return false}}function o2cl_noDirtyCheck(){if(o_info.linkbusy){return false}else{o_beforeserver();return true}}function o3cl(d){if(o_info.linkbusy){return false}else{var b=o3c1.indexOf(d)>-1;var a=(b&&o3c1.length>1)||o3c1.length>0;var c=(!a||confirm(o_info.dirty_form));if(c){o_beforeserver()}return c}}function o_onc(a){var b=a.responseText;BLoader.executeGlobalJS("o_info.last_o_onc="+b+";","o_onc");o_ainvoke(o_info.last_o_onc,false)}function o_allowNextClick(){o_info.linkbusy=false;removeAjaxBusy()}function removeBusyAfterDownload(c,b,a){o2c=0;o_afterserver()}Array.prototype.search=function(c,d){var a=this.length;for(var b=0;b<a;b++){if(this[b].constructor==Array){if(this[b].search(c,d)){return true;break}}else{if(d){if(this[b].indexOf(c)!=-1){return true;break}}else{if(this[b]==c){return true;break}}}}return false};if(!Function.prototype.curry){Function.prototype.curry=function(){if(arguments.length<1){return this}var a=this;var b=Array.prototype.slice.call(arguments);return function(){return a.apply(this,b.concat(Array.prototype.slice.call(arguments)))}}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(c){if(this==null){throw new TypeError()}var d=Object(this);var a=d.length>>>0;if(a===0){return -1}var e=0;if(arguments.length>1){e=Number(arguments[1]);if(e!=e){e=0}else{if(e!=0&&e!=Infinity&&e!=-Infinity){e=(e>0||-1)*Math.floor(Math.abs(e))}}}if(e>=a){return -1}var b=e>=0?e:Math.max(a-Math.abs(e),0);for(;b<a;b++){if(b in d&&d[b]===c){return b}}return -1}}var b_onDomReplacementFinished_callbacks=new Array();function b_AddOnDomReplacementFinishedCallback(a){var b=jQuery(document).ooLog().isDebugEnabled();if(b){jQuery(document).ooLog("debug","callback stack size: "+b_onDomReplacementFinished_callbacks.length,"functions.js ADD")}if(b&&b_onDomReplacementFinished_callbacks.toSource){jQuery(document).ooLog("debug","stack content"+b_onDomReplacementFinished_callbacks.toSource(),"functions.js ADD")}b_onDomReplacementFinished_callbacks.push(a);if(b){jQuery(document).ooLog("debug","push to callback stack, func: "+a,"functions.js ADD")}}var b_changedDomEl=new Array();function b_AddOnDomReplacementFinishedUniqueCallback(a){if(a.constructor==Array){if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","add: its an ARRAY! ","functions.js ADD")}if(b_onDomReplacementFinished_callbacks.search(a[0])){if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","push to callback stack, already there!!: "+a[0],"functions.js ADD")}return}}b_AddOnDomReplacementFinishedCallback(a)}var o_debug_trid=0;function o_ainvoke(N){if(N==undefined){return}o_info.inainvoke=true;var I=N.cmdcnt;if(I>0){jQuery(document).trigger("oo.dom.replacement.before");b_changedDomEl=new Array();if(o_info.debug){o_debug_trid++}var y=N.cmds;for(var T=0;T<I;T++){var J=y[T];var A=J.cmd;var R=J.cda;var U=J.w;var c=this.window;var K;if(c){switch(A){case 1:var M=R.e;BLoader.executeGlobalJS(M,"o_ainvoker::jsexec");if(o_info.debug){o_log("c1: execute jscode: "+M)}case 2:var u=R.cc;var F=R.cps;for(var Q=0;Q<u;Q++){var m=F[Q];var h=m.cid;var P=m.cidvis;var H=m.cw;var x=m.hfrag;var O=m.jsol;var g=m.hdr;if(o_info.debug){o_log("c2: redraw: "+m.cname+" ("+h+") "+m.hfragsize+" bytes, listener(s): "+m.clisteners)}var W=g+"\n\n"+x;var C="";var S=false;var E="o_c"+h;var B=jQuery("#"+E);if(B==null||B.length==0){E="o_fi"+h;B=jQuery("#"+E);S=true}if(B!=null){var w=jQuery("div.o_richtext_mce textarea",B);for(var L=0;L<w.length;L++){try{var a=jQuery(w.get(L)).attr("id");if(typeof top.tinymce!=undefined){top.tinymce.remove("#"+a)}}catch(Z){if(window.console){console.log(Z)}}}if(P){B.css("display","")}else{B.css("display","none")}if(S||!H){B.replaceWith(W)}else{try{B.empty().html(W);if(W.length>0&&B.get(0).innerHTML==""){B.get(0).innerHTML=W}}catch(Z){if(window.console){console.log(Z)}if(window.console){console.log("Fragment",W)}}b_changedDomEl.push(E)}B=null;if(C!=""){C.each(function(e){BLoader.executeGlobalJS(e,"o_ainvoker::inscripts")})}if(O!=""){BLoader.executeGlobalJS(O,"o_ainvoker::jsol")}}}break;case 3:c.o2c=0;var X=R.rurl;c.o_afterserver();c.document.location.replace(X);break;case 5:c.o2c=0;var X=R.rurl;c.o_afterserver();c.document.location.replace(X);break;case 6:c.o2c=0;c.o_afterserver();break;case 7:var o=c.document.location;var z=o.protocol+"//"+o.hostname;if(o.port!=""){z+=":"+o.port}var v=R.cssrm;for(Q=0;Q<v.length;Q++){var D=v[Q];var G=D.id;var f=z+D.url;BLoader.unLoadCSS(f,G);if(o_info.debug){o_log("c7: rm css: id:"+G+" ,url:'"+f+"'")}}var V=R.cssadd;for(k=0;k<V.length;k++){var D=V[k];var G=D.id;var f=z+D.url;var n=D.pt;BLoader.loadCSS(f,G,n);if(o_info.debug){o_log("c7: add css: id:"+G+" ,url:'"+f+"'")}}var p=R.jsadd;for(l=0;l<p.length;l++){var D=p[l];var Y=D.before;if(jQuery.type(Y)==="string"){BLoader.executeGlobalJS(Y,"o_ainvoker::preJsAdd")}var f=D.url;var q=D.enc;if(jQuery.type(f)==="string"){BLoader.loadJS(f,q,true)}if(o_info.debug){o_log("c7: add js: "+f)}}break;default:if(o_info.debug){o_log("?: unknown command "+A)}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in o_ainvoke(), ?: unknown command "+A,"functions.js")}break}}else{if(o_info.debug){o_log("could not find window??")}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in o_ainvoke(), could not find window??","functions.js")}}}var b=b_onDomReplacementFinished_callbacks.length;if(b_onDomReplacementFinished_callbacks.toSource&&jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","stack content"+b_onDomReplacementFinished_callbacks.toSource(),"functions.js")}for(mycounter=0;b>mycounter;mycounter++){if(mycounter>50){if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Stopped executing DOM replacement callback functions - to many functions::"+b_onDomReplacementFinished_callbacks.length,"functions.js")}break}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Stacksize before shift: "+b_onDomReplacementFinished_callbacks.length,"functions.js")}var s=b_onDomReplacementFinished_callbacks.shift();if(typeof s.length==="number"){if(s[0]=="glosshighlighter"){var d=s[1];if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","arr fct: "+d,"functions.js")}s=d}}if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Executing DOM replacement callback function #"+mycounter+" with timeout funct::"+s,"functions.js")}s();if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Stacksize after timeout: "+b_onDomReplacementFinished_callbacks.length,"functions.js")}}jQuery(document).trigger("oo.dom.replacement.after")}o_info.inainvoke=false}function clearAfterAjaxIframeCall(){if(o_info.linkbusy){o_afterserver();showMessageBox("info",o_info.i18n_noresponse_title,o_info.i18n_noresponse,undefined)}}function showAjaxBusy(){setTimeout(function(){if(o_info.linkbusy){try{if(jQuery("#o_ajax_busy_backdrop").length==0){jQuery("#o_body").addClass("o_ajax_busy");jQuery("#o_ajax_busy").modal({show:true,backdrop:"static",keyboard:"false"});jQuery("#o_ajax_busy").after('<div id="o_ajax_busy_backdrop" class="modal-backdrop in"></div>');jQuery("#o_ajax_busy>.modal-backdrop").remove();jQuery("#o_ajax_busy_backdrop").css({"z-index":1200})}}catch(a){if(window.console){console.log(a)}}}},700)}function removeAjaxBusy(){try{jQuery("#o_body").removeClass("o_ajax_busy");jQuery("#o_ajax_busy_backdrop").remove();jQuery("#o_ajax_busy").modal("hide")}catch(a){if(window.console){console.log(a)}}}function setFormDirty(c){o2c=1;var a=document.getElementById(c);if(a!=null){var b=a.olat_fosm_0;if(b==null){b=a.olat_fosm}if(b){b.className="btn o_button_dirty"}}else{if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in setFormDirty, myForm was null for formId="+c,"functions.js")}}}function contextHelpWindow(a){helpWindow=window.open(a,"HelpWindow","height=760, width=940, left=0, top=0, location=no, menubar=no, resizable=yes, scrollbars=yes, toolbar=no");helpWindow.focus()}function o_openPopUp(b,d,c,a,e){attributes="height="+a+", width="+c+", resizable=yes, scrollbars=yes, left=100, top=100, ";if(e){attributes+="location=yes, menubar=yes, status=yes, toolbar=yes"}else{attributes+="location=no, menubar=no, status=no, toolbar=no"}var f=window.open(b,d,attributes);f.focus();if(o_info.linkbusy){o_afterserver()}}function b_handleFileUploadFormChange(e,b,d){var f=e.value;slashPos=f.lastIndexOf("/");if(slashPos!=-1){f=f.substring(slashPos+1)}slashPos=f.lastIndexOf("\\");if(slashPos!=-1){f=f.substring(slashPos+1)}b.value=f;if(d){d.className="o_button_dirty"}var c=e.form.elements;for(i=0;i<c.length;i++){var a=c[i];if(a.name==b.name&&i+1<c.length){c[i+1].focus()}}}function gotonode(a){try{if(typeof o_activateCourseNode!="undefined"){o_activateCourseNode(a)}else{if(opener&&typeof opener.o_activateCourseNode!="undefined"){opener.o_activateCourseNode(a)}else{if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in gotonode(), could not find main window","functions.js")}}}}catch(b){alert("Goto node error:"+b);if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Error in gotonode()::"+b.message,"functions.js")}}}function o_openUriInMainWindow(b){if(!o2cl()){return false}try{var a=o_getMainWin();a.focus();a.location.replace(b)}catch(c){showMessageBox("error","Error","Can not find main OpenOLAT window to open URL.")}}function o_viewportHeight(){var a=jQuery(document).height();if(a>0){return a}else{return 600}}OPOL.getMainColumnsMaxHeight=function(){var j=0,f=0,a=0,c=0,h=0,b,g=jQuery("#o_main_left_content"),e=jQuery("#o_main_right_content"),d=jQuery("#o_main_center_content");if(g!="undefined"&&g!=null){j=g.outerHeight(true)}if(e!="undefined"&&e!=null){f=e.outerHeight(true)}if(d!="undefined"&&d!=null){a=d.outerHeight(true)}c=(j>f?j:f);c=(c>a?c:a);if(c>0){return c}b=jQuery("#o_main");if(b!="undefined"&&b!=null){h=b.height()}if(b>0){return b}return o_viewportHeight()};OPOL.adjustHeight=function(){try{var a=0;col1=jQuery("#o_main_left_content").outerHeight(true);col2=jQuery("#o_main_right_content").outerHeight(true);col3=jQuery("#o_main_center_content").outerHeight(true);a=Math.max(col1,col2,col3);if(col1!=null){jQuery("#o_main_left").css({"min-height":a+"px"})}if(col2!=null){jQuery("#o_main_right").css({"min-height":a+"px"})}if(col3!=null){jQuery("#o_main_center").css({"min-height":a+"px"})}}catch(b){if(window.console){console.log(b)}}};jQuery(window).resize(function(){clearTimeout(o_info.resizeId);o_info.resizeId=setTimeout(function(){jQuery(document).trigger("oo.window.resize.after")},500)});jQuery(document).on("oo.window.resize.after",OPOL.adjustHeight);jQuery(document).on("oo.dom.replacement.after",OPOL.adjustHeight);jQuery().ready(OPOL.adjustHeight);function o_scrollToElement(a){try{jQuery("html, body").animate({scrollTop:jQuery(a).offset().top},333)}catch(b){}}function o_popover(c,b,a){if(typeof(a)==="undefined"){a="bottom"}jQuery("#"+c).popover({placement:a,html:true,trigger:"click",container:"body",content:function(){return jQuery("#"+b).clone().html()}}).on("shown.bs.popover",function(){var d=function(f){jQuery("#"+c).popover("hide");jQuery("body").unbind("click",d)};setTimeout(function(){jQuery("body").on("click",d)},5)})}function o_popoverWithTitle(d,c,b,a){if(typeof(a)==="undefined"){a="bottom"}return jQuery("#"+d).popover({placement:a,html:true,title:b,trigger:"click",container:"body",content:function(){return jQuery("#"+c).clone().html()}}).on("shown.bs.popover",function(){var e=function(f){jQuery("#"+d).popover("destroy");jQuery("body").unbind("click",e)};setTimeout(function(){jQuery("body").on("click",e)},5)})}function o_shareLinkPopup(d,c,b){if(typeof(b)==="undefined"){b="top"}var a=jQuery("#"+d);a.popover({placement:b,html:true,trigger:"click",container:"body",content:c}).on("shown.bs.popover",function(){var e=function(f){if(jQuery(f.target).data("toggle")!=="popover"&&jQuery(f.target).parents(".popover.in").length===0){jQuery("#"+d).popover("hide");jQuery("body").unbind("click",e)}};setTimeout(function(){jQuery("body").on("click",e)},5)});a.attr("title",a.attr("data-original-title"))}function o_QRCodePopup(d,c,b){if(typeof(b)==="undefined"){b="top"}var a=jQuery("#"+d);a.popover({placement:b,html:true,trigger:"click",container:"body",content:'<div id="'+d+'_pop" class="o_qrcode"></div>'}).on("shown.bs.popover",function(){o_info.qr=o_QRCode(d+"_pop",(jQuery.isFunction(c)?c():c));var e=function(f){if(jQuery(f.target).data("toggle")!=="popover"&&jQuery(f.target).parents(".popover.in").length===0){jQuery("#"+d).popover("hide");jQuery("body").unbind("click",e)}};setTimeout(function(){jQuery("body").on("click",e)},5)}).on("hidden.bs.popover",function(){try{o_info.qr.clear();delete o_info.qr}catch(f){}});a.attr("title",a.attr("data-original-title"))}function o_QRCode(c,b){try{BLoader.loadJS(o_info.o_baseURI+"/js/jquery/qrcodejs/qrcode.min.js","utf8",true);return new QRCode(document.getElementById(c),b)}catch(a){return null}}function b_resizeIframeToMainMaxHeight(f){var d=jQuery("#"+f);if(d!="undefined"&&d!=null){var c=OPOL.getMainColumnsMaxHeight()-110;var b=o_viewportHeight()-100;b=b-d.offset().top;var e=jQuery("#b_footer");if(e!="undefined"&&e!=null){b=b-e.outerHeight(true)}var a=(b>c?b:c);d.height(a)}}var o_debu_oldcn,o_debu_oldtt;function o_debu_show(b,a){if(o_debu_oldcn){o_debu_hide(o_debu_oldcn,o_debu_oldtt)}jQuery(b).addClass("o_dev_m");jQuery(a).show();o_debu_oldtt=a;o_debu_oldcn=b}function o_debu_hide(b,a){jQuery(a).hide();jQuery(b).removeClass("o_dev_m")}function o_dbg_mark(a){var b=jQuery("#"+a);if(b){b.css("background-color","#FCFCB8");b.css("border","3px solid #00F")}}function o_dbg_unmark(a){var b=jQuery("#"+a);if(b){b.css("border","");b.css("background-color","")}}function o_clearConsole(){o_log_all="";o_log(null)}var o_log_all="";function o_log(b){if(b){o_log_all="\n"+o_debug_trid+"> "+b+o_log_all;o_log_all=o_log_all.substr(0,4000)}var a=jQuery("#o_debug_cons");if(a){if(o_log_all.length==4000){o_log_all=o_log_all+"\n... (stripped: to long)... "}a.value=o_log_all}if(!jQuery.type(window.console)==="undefined"){window.console.log(b)}}function o_logerr(a){o_log("ERROR:"+a)}function o_logwarn(a){o_log("WARN:"+a)}function showerror(c){var a="";for(var b in c){a+=b+": "+c[b]+"\n"}return"error detail:\n"+a}function o_ffEvent(f,e,d,m,n){var g,h,b,a;g=document.getElementById(e);h=g.value;g.value=d;b=document.getElementById(m);a=b.value;b.value=n;var c=jQuery("#"+f);var j=c.attr("enctype");if(j&&j.indexOf("multipart")==0){o_XHRSubmitMultipart(f)}else{if(document.forms[f].onsubmit()){document.forms[f].submit()}}g.value=h;b.value=a}function o_IQEvent(a){if(document.forms[a].onsubmit()){document.forms[a].submit()}}function o_TableMultiActionEvent(a,c){var b=jQuery("#o_mai_"+a);b.val(c);if(document.forms[a].onsubmit()){document.forms[a].submit()}b.val("")}function o_XHRSubmit(a){if(o_info.linkbusy){return false}o_beforeserver();var b=true;var c=jQuery("#"+a);var e=c.attr("enctype");if(e&&e.indexOf("multipart")==0){return true}else{var d=c.serializeArray();var f=c.attr("action");jQuery.ajax(f,{type:"POST",data:d,cache:false,dataType:"json",success:function(m,o,j){o_afterserver();o_ainvoke(m);if(b){var g=m.businessPath;var h=m.documentTitle;var n=m.historyPointId;if(g){o_pushState(n,h,g)}}},error:function(g,j,h){o_afterserver();if(window.console){console.log("Error status",j)}}});return false}}function o_XHRSubmitMultipart(a){var c=jQuery("#"+a);var d="openolat-submit-"+(""+Math.random()).substr(2);var b=createIFrame(d);document.body.appendChild(b);c.attr("target",b.name);c.submit();c.attr("target","")}createIFrame=function(b){var a=jQuery('<iframe name="'+b+'" id="'+b+'" src="about:blank" style="position: absolute; top: -9999px; left: -9999px;" onload="clearAfterAjaxIframeCall();">');return a[0]};function o_removeIframe(a){jQuery("#"+a).remove()}function o_ffXHREvent(f,e,a,h,m,n,j){if(n){if(!o2cl()){return false}}else{if(!o2cl_noDirtyCheck()){return false}}var d=new Object();d.dispatchuri=a;d.dispatchevent=m;if(arguments.length>7){var g=arguments.length;for(var c=7;c<g;c=c+2){if(g>c+1){d[arguments[c]]=arguments[c+1]}}}var b=jQuery("#"+f).attr("action");jQuery.ajax(b,{type:"GET",data:d,cache:false,dataType:"json",success:function(r,t,q){o_ainvoke(r);if(j){var o=r.businessPath;var p=r.documentTitle;var s=r.historyPointId;if(o){o_pushState(s,p,o)}}},error:function(o,q,p){o_afterserver();if(window.console){console.log("Error status",q)}}})}function o_XHREvent(f,d,a){if(d){if(!o2cl()){return false}}else{if(!o2cl_noDirtyCheck()){return false}}var c=new Object();if(arguments.length>3){var e=arguments.length;for(var b=3;b<e;b=b+2){if(e>b+1){c[arguments[b]]=arguments[b+1]}}}jQuery.ajax(f,{type:"POST",data:c,cache:false,dataType:"json",success:function(m,p,j){try{o_afterserver();o_ainvoke(m);if(a){var g=m.businessPath;var h=m.documentTitle;var o=m.historyPointId;if(g){o_pushState(o,h,g)}}}catch(n){if(window.console){console.log(n)}}},error:function(g,j,h){o_afterserver();if(401==g.status){window.location.reload(true)}else{if(window.console){console.log("Error status",j,h,g.status)}}}});return false}function o_XHRNFEvent(d){var b=new Object();if(arguments.length>1){var c=arguments.length;for(var a=1;a<c;a=a+2){if(c>a+1){b[arguments[a]]=arguments[a+1]}}}jQuery.ajax(d,{type:"POST",data:b,cache:false,dataType:"json",success:function(f,g,e){},error:function(e,g,f){if(window.console){console.log("Error status",g)}}})}function o_pushState(d,f,a){try{var b=new Object();b.businessPath=a;b.historyPointId=d;o_info.businessPath=a;o_shareActiveSocialUrl();if(window.history){history.pushState(b,f,a)}}catch(c){if(window.console){console.log(c)}}}function setFlexiFormDirtyByListener(a){setFlexiFormDirty(a.data.formId)}function setFlexiFormDirty(b){var a=o3c.indexOf(b)>-1;if(!a){o3c.push(b)}jQuery("#"+b).each(function(){var c=jQuery(this).data("FlexiSubmit");if(c!=null){jQuery("#"+c).addClass("btn o_button_dirty");o2c=1}})}function o_ffRegisterSubmit(b,a){jQuery("#"+b).data("FlexiSubmit",a)}function showInfoBox(g,d){var c=Math.floor(Math.random()*65536).toString(16);var f='<div id="'+c+'" class="o_alert_info "><div class="alert alert-info clearfix o_sel_info_message"><i class="o_icon o_icon_close"></i><h3><i class="o_icon o_icon_info"></i> '+g+"</h3><p>"+d+"</p></div></div>";var a=jQuery("#o_messages").prepend(f);var e=(d.length>150)?8000:((d.length>70)?6000:4000);var b=function(){jQuery("#"+c).transition({top:"-100%"},333,function(){jQuery("#"+c).remove()})};jQuery("#"+c).show().transition({top:0},333);jQuery("#"+c).click(function(h){b()});o_scrollToElement("#o_top");g=null;d=null;a=null;e=null;setTimeout(function(){try{b()}catch(h){}},8000)}function showMessageBox(b,f,d,a){if(b=="info"){showInfoBox(f,d);return null}else{var c='<div id="myFunctionalModal" class="modal fade" role="dialog"><div class="modal-dialog"><div class="modal-content">';c+='<div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>';c+='<h4 class="modal-title">'+f+"</h4></div>";c+='<div class="modal-body alert ';if("warn"==b){c+="alert-warning"}else{if("error"==b){c+="alert-danger"}else{c+="alert-info"}}c+='"><p>'+d+"</p></div></div></div></div>";jQuery("#myFunctionalModal").remove();jQuery("body").append(c);var e=jQuery("#myFunctionalModal").modal("show").on("hidden.bs.modal",function(g){jQuery("#myFunctionalModal").remove()});o_scrollToElement("#o_top");return e}}function o_table_toggleCheck(d,c){var a=document.forms[d].elements.tb_ms;len=a.length;if(typeof(len)=="undefined"){a.checked=c}else{var b;for(b=0;b<len;b++){a[b].checked=c}}}function onTreeStartDrag(a,b){jQuery(a.target).addClass("o_dnd_proxy")}function onTreeStopDrag(a,b){jQuery(a.target).removeClass("o_dnd_proxy")}function onTreeDrop(g,h){var a=jQuery(h.draggable[0]);var f=jQuery(this);f.css({position:"",width:""});var c=f.droppable("option","endUrl");if(c.lastIndexOf("/")==(c.length-1)){c=c.substring(0,c.length-1)}var e=a.attr("id");var b=e.substring(2,e.length);c+="%3Atnidle%3A"+b;var d=f.attr("id");if(d.indexOf("ds")==0){c+="%3Asne%3Ayes"}else{if(d.indexOf("dt")==0){c+="%3Asne%3Aend"}}jQuery(".ui-droppable").each(function(j,m){jQuery(m).droppable("disable")});o_XHREvent(c+"/",false,false)}function treeAcceptDrop(a){return true}function treeAcceptDrop_notWithChildren(a){var c=false;var b=jQuery(a);var e=b.attr("id");if(e!=undefined&&(e.indexOf("dd")==0||e.indexOf("ds")==0||e.indexOf("dt")==0||e.indexOf("da")==0||e.indexOf("row")==0)){var g=jQuery(this);var j=g.attr("id");var d=e.substring(2,e.length);var f=j.substring(2,j.length);if(d!=f){var h=jQuery("#dd"+d).parents("li");if(h.length>0&&jQuery(h.get(0)).find("#dd"+f).length==0){c=true}}}return c}function treeAcceptDrop_portfolio(b){var d=false;var c=jQuery(b);var f=c.attr("id");if(treeNode_isDragNode(f)){var h=jQuery(this);var n=h.attr("id");var e=f.substring(2,f.length);var g=n.substring(2,n.length);var m=f.indexOf("ds")==0||f.indexOf("dt")==0;if(e!=g){var j=treeNode_portfolioType(c);var a=treeNode_portfolioType(h);if(j=="artefact"){if(a=="page"||a=="struct"||a=="artefact"){d=true}}else{if(j=="struct"){if(a=="page"||a=="struct"){d=true}}else{if(j=="page"){if(a=="map"||a=="page"){d=true}}}}}}return d}function treeNode_portfolioType(e){var c=jQuery(e.get(0));var d=treeNode_portfolioTypes(c);if(d==null){var a=c.parent("a");if(a.length>0){d=treeNode_portfolioTypes(jQuery(a.get(0)))}else{if(c.attr("id").indexOf("ds")==0){var b=c.prev("div");if(b.length>0){d=treeNode_portfolioTypes(b)}}else{if(c.attr("id").indexOf("dt")==0){var b=c.next("div");if(b.length>0){d=treeNode_portfolioTypes(b)}}}}}return d}function treeNode_portfolioTypes(a){if(a.find===undefined){return null}else{if(a.find(".o_ep_icon_struct").length>0||a.hasClass("o_ep_icon_struct")){return"struct"}else{if(a.find(".o_ep_icon_page").length>0||a.hasClass("o_ep_icon_page")){return"page"}else{if(a.find(".o_ep_icon_map").length>0||a.hasClass("o_ep_icon_map")){return"map"}else{if(a.find(".o_ep_artefact").length>0||a.hasClass("o_ep_artefact")){return"artefact"}}}}}return null}function treeNode_isDragNode(a){if(a!=undefined&&(a.indexOf("dd")==0||a.indexOf("ds")==0||a.indexOf("dt")==0||a.indexOf("da")==0||a.indexOf("row")==0)){return true}return false}function o_choice_toggleCheck(c,b){var d=document.forms[c].elements;len=d.length;if(typeof(len)=="undefined"){d.checked=b}else{var a;for(a=0;a<len;a++){if(d[a].type=="checkbox"&&d[a].getAttribute("class")=="o_checkbox"){d[a].checked=b}}}}function b_briefcase_isChecked(c,e){var b;var a=document.getElementById(c);var d=0;for(b=0;a.elements[b];b++){if(a.elements[b].type=="checkbox"&&a.elements[b].name=="paths"&&a.elements[b].checked){d++}}if(d<1){alert(e);return false}return true}function b_briefcase_toggleCheck(d,c){var a=document.getElementById(d);len=a.elements.length;var b;for(b=0;b<len;b++){if(a.elements[b].name=="paths"){a.elements[b].checked=c}}}function o_doPrint(){var d=jQuery("div.o_iframedisplay iframe");if(d.length>0){try{var a=d[0];frames[a.name].focus();frames[a.name].print();return}catch(c){for(i=0;frames.length>i;i++){a=frames[i];if(a.name=="oaa0"){continue}var b=document.getElementsByName(a.name)[0];if(b&&b.getAttribute("class")=="ext-shim"){continue}if(a.name!=""){try{frames[a.name].focus();frames[a.name].print()}catch(c){window.print()}return}}window.print()}}else{window.print()}}function b_attach_i18n_inline_editing(){jQuery("span.o_translation_i18nitem").hover(function(){jQuery(this.firstChild).show();if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Entered i18nitem::"+this.firstChild,"functions.js:b_attach_i18n_inline_editing()")}},function(){jQuery("a.o_translation_i18nitem_launcher").hide();if(jQuery(document).ooLog().isDebugEnabled()){jQuery(document).ooLog("debug","Leaving i18nitem::"+this,"functions.js:b_attach_i18n_inline_editing()")}});jQuery("a.o_translation_i18nitem_launcher").hover(function(){var a=jQuery(this).parent("span.o_translation_i18nitem");a.effect("highlight")});b_AddOnDomReplacementFinishedCallback(b_attach_i18n_inline_editing)}function b_hideExtMessageBox(){}var BDebugger={_lastDOMCount:0,_lastObjCount:0,_knownGlobalOLATObjects:["o_afterserver","o_onc","o_getMainWin","o_ainvoke","o_info","o_beforeserver","o_ffEvent","o_openPopUp","o_debu_show","o_logwarn","o_dbg_unmark","o_ffRegisterSubmit","o_clearConsole","o_init","o_log","o_allowNextClick","o_dbg_mark","o_debu_hide","o_logerr","o_debu_oldcn","o_debu_oldtt","o_openUriInMainWindow","o_debug_trid","o_log_all"],_countDOMElements:function(){return document.getElementsByTagName("*").length},_countGlobalObjects:function(){var a=0;for(prop in window){a++}return a},logDOMCount:function(){var b=BDebugger;var a=b._countDOMElements();var c=a-b._lastDOMCount;console.log((c>0?"+":"")+c+" \t"+a+" \tDOM element count after DOM replacement");b._lastDOMCount=a;a=null},logGlobalObjCount:function(){var b=BDebugger;var a=b._countGlobalObjects();var c=a-b._lastObjCount;console.log((c>0?"+":"")+c+" \t"+a+" \tGlobal object count after DOM replacement");b._lastObjCount=a;a=null},logGlobalOLATObjects:function(){var b=BDebugger;var a=new Array();for(prop in window){if(prop.indexOf("o_")==0&&b._knownGlobalOLATObjects.indexOf(prop)==-1){a.push(prop)}}if(a.length>0){console.log(a.length+" global OLAT objects found:");a.each(function(c){console.log("\t"+typeof window[c]+" \t"+c)})}},logManagedOLATObjects:function(){var a=BDebugger;if(o_info.objectMap.length>0){console.log(o_info.objectMap.length+" managed OLAT objects found:");o_info.objectMap.eachKey(function(b){var c=o_info.objectMap.get(b);console.log("\t"+typeof c+" \t"+b);return true})}}};/*! * jQuery Transit - CSS3 transitions and transformations * (c) 2011-2014 Rico Sta. Cruz * MIT Licensed. diff --git a/src/test/java/org/olat/core/util/i18n/I18nTest.java b/src/test/java/org/olat/core/util/i18n/I18nTest.java index 0ee05d08dda89c9a1321ee3e961bd9a291b1d48a..c47a0e29704680dd3031345e4adea1d092350a19 100644 --- a/src/test/java/org/olat/core/util/i18n/I18nTest.java +++ b/src/test/java/org/olat/core/util/i18n/I18nTest.java @@ -802,12 +802,10 @@ public class I18nTest extends OlatTestCase { */ private class jUnitURLBuilder extends URLBuilder { public jUnitURLBuilder() { - super(null, null, null, null); + super(null, null, null); } public void buildURI(StringOutput buf, String[] keys, String[] values) { - buf.append("http://do.test.com"); + buf.append("http://do.test.com"); } - } - } diff --git a/src/test/java/org/olat/selenium/page/NavigationPage.java b/src/test/java/org/olat/selenium/page/NavigationPage.java index 5426d067ea44330d24cc2b9d40a1bf3870938aa0..43e0cb0acc2ca8941366982757686c9de7296158 100644 --- a/src/test/java/org/olat/selenium/page/NavigationPage.java +++ b/src/test/java/org/olat/selenium/page/NavigationPage.java @@ -59,7 +59,7 @@ public class NavigationPage { private By catalogAdministrationBy = By.cssSelector("li.o_site_catalog_admin > a"); private By groupsBy = By.cssSelector("li.o_site_groups > a"); - public static final By myCoursesAssertBy = By.xpath("//div[contains(@class,'o_segments')]//a[contains(@href,'search.mycourses.student')]"); + public static final By myCoursesAssertBy = By.xpath("//div[contains(@class,'o_segments')]//a[contains(@onclick,'search.mycourses.student')]"); public static final By portalAssertBy = By.className("o_portal"); public NavigationPage() { diff --git a/src/test/java/org/olat/selenium/page/core/AdministrationPage.java b/src/test/java/org/olat/selenium/page/core/AdministrationPage.java index e93ded84fdd8dcf2c2b1f6226956fa8e80cedc2e..730508b7ae94bbbb59b69283fea1faf5438eb77c 100644 --- a/src/test/java/org/olat/selenium/page/core/AdministrationPage.java +++ b/src/test/java/org/olat/selenium/page/core/AdministrationPage.java @@ -52,7 +52,7 @@ public class AdministrationPage { } public AdministrationPage selectSystemInfo() { - By systemLinkby = By.xpath("//div[contains(@class,'o_tree')]//a[contains(@href,'systemParent/')]"); + By systemLinkby = By.xpath("//div[contains(@class,'o_tree')]//a[contains(@onclick,'systemParent')]"); browser.findElement(systemLinkby).click(); OOGraphene.waitBusy(browser); return this; diff --git a/src/test/java/org/olat/selenium/page/core/FolderPage.java b/src/test/java/org/olat/selenium/page/core/FolderPage.java index 505ebdf77c9c5e4610ae18e3c4d7dfd3d64126d5..c41ce3bbf39a45818c604aeb5fecd1e6e39759cb 100644 --- a/src/test/java/org/olat/selenium/page/core/FolderPage.java +++ b/src/test/java/org/olat/selenium/page/core/FolderPage.java @@ -72,8 +72,8 @@ public class FolderPage { } public FolderPage assertOnDirectory(String name) { - String escapedName = name.replace(" ", "%20"); - By directoryBy = By.xpath("//table[contains(@class,'o_bc_table')]//a[contains(@href,'" + escapedName + "')]"); + String escapedName = name;//TODO xhr .replace(" ", "%20"); + By directoryBy = By.xpath("//table[contains(@class,'o_bc_table')]//a[contains(@onclick,'" + escapedName + "')]"); List<WebElement> directoryEls = browser.findElements(directoryBy); Assert.assertFalse(directoryEls.isEmpty()); return this; diff --git a/src/test/java/org/olat/selenium/page/course/AssessmentModePage.java b/src/test/java/org/olat/selenium/page/course/AssessmentModePage.java index 6d4b31897aa782565350c8843f4bbca9a0817d52..607a2b541fe196d2092186c5a5ed435f5e8bfeb5 100644 --- a/src/test/java/org/olat/selenium/page/course/AssessmentModePage.java +++ b/src/test/java/org/olat/selenium/page/course/AssessmentModePage.java @@ -123,7 +123,7 @@ public class AssessmentModePage { List<WebElement> linksEl = row.findElements(linkBy); for(WebElement linkEl:linksEl) { String href = linkEl.getAttribute("href"); - if(href != null && href.contains("','start','")) { + if(href != null && href.contains(",'start',")) { startEl = linkEl; } } @@ -173,7 +173,7 @@ public class AssessmentModePage { List<WebElement> linksEl = row.findElements(linkBy); for(WebElement linkEl:linksEl) { String href = linkEl.getAttribute("href"); - if(href != null && href.contains("','stop','")) { + if(href != null && href.contains(",'stop',")) { startEl = linkEl; } } diff --git a/src/test/java/org/olat/selenium/page/group/GroupPage.java b/src/test/java/org/olat/selenium/page/group/GroupPage.java index 92671a1add10d4be5889bd549810d97c7996c8c3..393ddee294610135434ba1b6392993c7a46b6f05 100644 --- a/src/test/java/org/olat/selenium/page/group/GroupPage.java +++ b/src/test/java/org/olat/selenium/page/group/GroupPage.java @@ -65,7 +65,7 @@ public class GroupPage { } public GroupPage openAdministration() { - By adminBy = By.xpath("//div[contains(@class,'o_tree')]//a[contains(@href,'MENU_ADMINISTRATION')]"); + By adminBy = By.xpath("//div[contains(@class,'o_tree')]//a[contains(@onclick,'MENU_ADMINISTRATION')]"); WebElement adminLink = browser.findElement(adminBy); adminLink.click(); OOGraphene.waitBusy(browser);