diff --git a/gadgets/core/src/main/javascript/gatein-features/gatein-container/Gadgets.js b/gadgets/core/src/main/javascript/gatein-features/gatein-container/Gadgets.js index 1ee1b09cb..73eb6205d 100644 --- a/gadgets/core/src/main/javascript/gatein-features/gatein-container/Gadgets.js +++ b/gadgets/core/src/main/javascript/gatein-features/gatein-container/Gadgets.js @@ -798,7 +798,7 @@ gadgets.IfrGadget.prototype.setNoCache = function(value) { * @constructor */ gadgets.Container = function() { - this.name_ = "default"; + this.name_ = "default"; this.gadgets_ = {}; this.parentUrl_ = document.location.href + '://' + document.location.host; this.country_ = 'ALL'; diff --git a/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl b/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl index 642153194..67eb012b9 100644 --- a/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl +++ b/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl @@ -19,8 +19,7 @@ def noCache = uicomponent.getParent().isNoCache(); def isDebug = uicomponent.getParent().isDebug(); JavascriptManager jsmanager = rcontext.getJavascriptManager(); - def pContainer = PortalContainer.getInstance().getName(); - def requireJS = jsmanager.require("SHARED/gadget", "gadget").addScripts("gadget.UIGadget.createGadget('$url','$id', $metadata, $userPref, 'canvas', '$hostName', " + (isDebug ? 1 : 0) + ", " + (noCache ? 1 : 0) + ",'" + pContainer + "');"); + def requireJS = jsmanager.require("SHARED/gadget", "gadget").addScripts("gadget.UIGadget.createGadget('$url','$id', $metadata, $userPref, 'canvas', '$hostName', " + (isDebug ? 1 : 0) + ", " + (noCache ? 1 : 0) + ");"); if(UIPortlet.getCurrentUIPortlet().getHeight() == null && uicomponent.getParent().isFillUpFreeSpace()) { requireJS.addScripts("gadget.UIGadget.resizeFullHeight('$id')"); diff --git a/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js b/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js index b36051c58..789333eb0 100644 --- a/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js +++ b/web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js @@ -30,23 +30,24 @@ * @param {boolean} debug normal or debug mode (0, 1) * @param {String} nocache value indicate cache or nocache at shindig level (0, 1) */ - createGadget : function(url, id, metadata, userPref, view, hostName, debug, nocache, container) + createGadget : function(url, id, metadata, userPref, view, hostName, debug, nocache) { window.gadgets = window.gadgets || {}; eXo.gadgets = window.gadgets; gadgets.pubsubURL = hostName + '/js/gatein-container.js?c=1' + (debug ? "&debug=1": "") + (nocache ? "&nocache=1" : "&nocache=0"); var args = arguments; - window.require([gadgets.pubsubURL], function() { - //Make sure that 2 modules in shindig-patch has been loaded already - window.require(["eXo.gadget.Gadgets", "eXo.gadget.ExoBasedUserPrefStore"], function() {eXoGadget.createCallback.apply(window, args)}); - }); + window.require([gadgets.pubsubURL], function() { + //Make sure that 2 modules of gadget container have been loaded already + window.require(["eXo.gadget.Gadgets", "eXo.gadget.ExoBasedUserPrefStore"], function() { + gadgets.container.setName(eXo.env.portal.containerName); + gadgets.container.setLanguage(eXo.core.I18n.getLanguage()); + eXoGadget.createCallback.apply(window, args); + }); + }); }, - createCallback : function(url, id, metadata, userPref, view, hostName, debug, nocache, container) + createCallback : function(url, id, metadata, userPref, view, hostName, debug, nocache) { - var language = eXo.core.I18n.getLanguage(); - gadgets.container.setName(container); - gadgets.container.setLanguage(language); var gadget; if (metadata != null) { diff --git a/web/portal/src/main/webapp/groovy/portal/webui/application/UIGadget.gtmpl b/web/portal/src/main/webapp/groovy/portal/webui/application/UIGadget.gtmpl index f4a1214b1..2ce311d63 100644 --- a/web/portal/src/main/webapp/groovy/portal/webui/application/UIGadget.gtmpl +++ b/web/portal/src/main/webapp/groovy/portal/webui/application/UIGadget.gtmpl @@ -1,7 +1,6 @@ <% import org.exoplatform.web.application.JavascriptManager; import org.exoplatform.portal.webui.application.GadgetUtil; - import org.exoplatform.container.PortalContainer; def rcontext = _ctx.getRequestContext(); JavascriptManager jsmanager = rcontext.getJavascriptManager(); @@ -26,8 +25,7 @@ userPref = uicomponent.getUserPref(); def noCache = uicomponent.isNoCache(); def isDebug = uicomponent.isDebug(); - def pContainer = PortalContainer.getInstance().getName(); - reqJS.addScripts("gadget.UIGadget.createGadget('$url','content-$id', $metadata, $userPref, '$view', '$hostName', " + (isDebug ? 1 : 0) + ", " + (noCache ? 1 : 0) + ",'" + pContainer + "');"); + reqJS.addScripts("gadget.UIGadget.createGadget('$url','content-$id', $metadata, $userPref, '$view', '$hostName', " + (isDebug ? 1 : 0) + ", " + (noCache ? 1 : 0) + ");"); } boolean isMini = Boolean.parseBoolean(uicomponent.getProperties().get("minimized")); diff --git a/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplication.gtmpl b/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplication.gtmpl index 048a25532..22a64b9a6 100644 --- a/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplication.gtmpl +++ b/web/portal/src/main/webapp/groovy/portal/webui/workspace/UIPortalApplication.gtmpl @@ -8,7 +8,8 @@ import org.exoplatform.portal.webui.portal.UIPortal ; import org.exoplatform.portal.config.model.PortalProperties ; import org.json.JSONArray; - + import org.exoplatform.container.PortalContainer; + def rcontext = _ctx.getRequestContext() ; String docBase = rcontext.getRequestContextPath() ; String skin = uicomponent.getSkin(); @@ -73,6 +74,7 @@ else {%>eXo.env.portal.accessMode = "private" ;<%}%> eXo.env.portal.portalName = "<%=rcontext.getPortalOwner()%>" ; + eXo.env.portal.containerName = "<%=PortalContainer.getInstance().getName()%>" ; eXo.env.server.context = "<%=docBase%>" ; eXo.env.server.portalBaseURL = "<%=rcontext.getRequest().getRequestURI()%>" ; eXo.env.server.portalURLTemplate = "<%=uicomponent.getPortalURLTemplate()%>" ;