Skip to content

Commit

Permalink
Set portal container name as global variable eXo.env.portal.container…
Browse files Browse the repository at this point in the history
…Name
  • Loading branch information
kiennguyen authored and phuong_vu committed Oct 18, 2012
1 parent 0ada4d4 commit efcc837
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')");
Expand Down
19 changes: 10 additions & 9 deletions web/eXoResources/src/main/webapp/javascript/eXo/gadget/UIGadget.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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()%>" ;
Expand Down

0 comments on commit efcc837

Please sign in to comment.