Author: theute
Date: 2011-09-15 07:03:11 -0400 (Thu, 15 Sep 2011)
New Revision: 7437
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIGadget.gtmpl
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/GadgetUtil.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
Log:
JBEPP-1178: When add gadget to dashboard, it display source
Modified:
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIGadget.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIGadget.gtmpl 2011-09-15
11:00:59 UTC (rev 7436)
+++
epp/portal/branches/EPP_5_2_Branch/web/portal/src/main/webapp/groovy/portal/webui/application/UIGadget.gtmpl 2011-09-15
11:03:11 UTC (rev 7437)
@@ -2,25 +2,32 @@
import org.exoplatform.web.application.JavascriptManager;
import org.exoplatform.portal.webui.application.GadgetUtil;
- def rcontext = _ctx.getRequestContext();
- JavascriptManager jsmanager = rcontext.getJavascriptManager();
- def hostName = GadgetUtil.getRelGadgetServerUrl();
- def url = uicomponent.getUrl();
- def metadata = uicomponent.getRpcMetadata();
- def posX = uicomponent.getProperties().getIntValue("locationX") +
"px";
- def posY = uicomponent.getProperties().getIntValue("locationY") +
"px";
- def zIndex = uicomponent.getProperties().getIntValue("zIndex");
- def id = uicomponent.getId();
- def isDev = uicomponent.isGadgetDeveloper();
- def noCache = uicomponent.isNoCache();
- def isDebug = uicomponent.isDebug();
- def view = uicomponent.getView();
- def userPref = uicomponent.getUserPref();
- jsmanager.importJavascript("eXo.gadget.UIGadget");
- rcontext.getJavascriptManager().addCustomizedOnLoadScript("eXo.gadget.UIGadget.confirmDeleteGadget
= '" + _ctx.appRes("UIGadgetContainerManagement.confirm.DeleteGadget")
+ "';");
- jsmanager.addCustomizedOnLoadScript("eXo.gadget.UIGadget.createGadget('$url','content-$id',
$metadata, $userPref, '$view', '$hostName', " + (isDev ? 1 : 0)
- + ", " + (isDebug ? 1 : 0) + ",
" + (noCache ? 1 : 0) + ");");
-
+ def rcontext = _ctx.getRequestContext();
+ JavascriptManager jsmanager = rcontext.getJavascriptManager();
+ def hostName = GadgetUtil.getRelGadgetServerUrl();
+ def url = null;
+ def metadata = "";
+ def posX = uicomponent.getProperties().getIntValue("locationX") +
"px";
+ def posY = uicomponent.getProperties().getIntValue("locationY") +
"px";
+ def zIndex = uicomponent.getProperties().getIntValue("zIndex");
+ def id = uicomponent.getId() != null ? uicomponent.getId() : "UIGadget";
+ def isDev = uicomponent.isGadgetDeveloper();
+ def noCache = uicomponent.isNoCache();
+ def isDebug = uicomponent.isDebug();
+ def view = uicomponent.getView();
+ def userPref = null;
+
+ def isLossData = uicomponent.isLossData();
+ if(!isLossData) {
+ url = uicomponent.getUrl();
+ metadata = uicomponent.getRpcMetadata();
+ userPref = uicomponent.getUserPref();
+ jsmanager.importJavascript("eXo.gadget.UIGadget");
+
rcontext.getJavascriptManager().addCustomizedOnLoadScript("eXo.gadget.UIGadget.confirmDeleteGadget
= '" + _ctx.appRes("UIGadgetContainerManagement.confirm.DeleteGadget")
+ "';");
+
jsmanager.addCustomizedOnLoadScript("eXo.gadget.UIGadget.createGadget('$url','content-$id',
$metadata, $userPref, '$view', '$hostName', " + (isDev ? 1 : 0)
+ + ", " + (isDebug ? 1 : 0) +
", " + (noCache ? 1 : 0) + ");");
+ }
+
boolean isMini =
Boolean.parseBoolean(uicomponent.getProperties().get("minimized"));
String miniTitle = _ctx.appRes("UIGadget.tooltip.Minimize");
String unminiTitle = _ctx.appRes("UIGadget.tooltip.Unminimize");
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/GadgetUtil.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/GadgetUtil.java 2011-09-15
11:00:59 UTC (rev 7436)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/GadgetUtil.java 2011-09-15
11:03:11 UTC (rev 7437)
@@ -88,6 +88,7 @@
"{\"context\":{\"country\":\"" +
gadgetService.getCountry() + "\",\"language\":\""
+ gadgetService.getLanguage() +
"\"},\"gadgets\":[" + "{\"moduleId\":" +
gadgetService.getModuleId()
+ ",\"url\":\"" + urlStr +
"\",\"prefs\":[]}]}";
+
// Send data
String gadgetServer = getGadgetServerUrl();
URL url = new URL(gadgetServer + (gadgetServer.endsWith("/") ?
"" : "/") + "metadata");
@@ -148,6 +149,7 @@
}
return result;
}
+
public static String createToken(String gadgetURL, Long moduleId)
{
SecurityTokenGenerator tokenGenerator =
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2011-09-15
11:00:59 UTC (rev 7436)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2011-09-15
11:03:11 UTC (rev 7437)
@@ -231,6 +231,7 @@
return null;
}
}
+
public String getRpcMetadata()
{
try
@@ -250,6 +251,7 @@
return null;
}
}
+
/**
* Check if content of gadget has <UserPref>? (Content is parsed from gadget
specification in .xml file)
* @return boolean
Show replies by date