Author: trong.tran
Date: 2010-10-07 06:50:31 -0400 (Thu, 07 Oct 2010)
New Revision: 4578
Modified:
exo/portal/branches/3.1.x/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java
exo/portal/branches/3.1.x/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl
Log:
Misleading error message when Gadget does not exist
Modified:
exo/portal/branches/3.1.x/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java
===================================================================
---
exo/portal/branches/3.1.x/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java 2010-10-07
10:03:42 UTC (rev 4577)
+++
exo/portal/branches/3.1.x/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java 2010-10-07
10:50:31 UTC (rev 4578)
@@ -75,6 +75,14 @@
{
return GadgetUtil.reproduceUrl(gadget.getUrl(), gadget.isLocal());
}
+ else
+ {
+ if (log.isWarnEnabled())
+ {
+ log.warn("The local gadget '" + gadgetName + "'
was not found, nothing rendered");
+ }
+ return null;
+ }
}
catch (Exception e)
{
@@ -94,6 +102,11 @@
uiApplication.addMessage(new
ApplicationMessage("UIGadgetPortlet.msg.url-invalid", null));
}
+ return getMetadata(url);
+ }
+
+ public String getMetadata(String url)
+ {
String metadata_ = GadgetUtil.fetchGagdetMetadata(url);
try
{
Modified:
exo/portal/branches/3.1.x/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl
===================================================================
---
exo/portal/branches/3.1.x/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl 2010-10-07
10:03:42 UTC (rev 4577)
+++
exo/portal/branches/3.1.x/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl 2010-10-07
10:50:31 UTC (rev 4578)
@@ -5,19 +5,23 @@
import org.exoplatform.webui.application.portlet.PortletRequestContext;
def hostName = GadgetUtil.getRelGadgetServerUrl();
- def rcontext = _ctx.getRequestContext() ;
- def windowId = rcontext.getWindowId();
- def id = uicomponent.getId() + "-" + windowId ;
- def url = uicomponent.getParent().getUrl();
- def metadata = uicomponent.getParent().getMetadata();
- def userPref = null;//uicomponent.getUserPref() ;
- JavascriptManager jsmanager = rcontext.getJavascriptManager();
- jsmanager.importJavascript("eXo.gadget.UIGadget") ;
- jsmanager.addCustomizedOnLoadScript("eXo.gadget.UIGadget.createGadget('$url','$id',
$metadata, $userPref, 'canvas', '$hostName');") ;
- java.util.Map<String, String> metadataMap = GadgetUtil.getMapMetadata(url) ;
- String height = "auto" ;
- if(metadataMap.containsKey("height") &&
Integer.parseInt(metadataMap.get("height")) > 0)
- height = (Integer.parseInt(metadataMap.get("height")) + 10) + "px"
;
+ def rcontext = _ctx.getRequestContext() ;
+ def windowId = rcontext.getWindowId();
+ def id = uicomponent.getId() + "-" + windowId ;
+ def url = uicomponent.getParent().getUrl();
+ def height = "auto" ;
+
+ if(url != null) {
+ def metadata = uicomponent.getParent().getMetadata(url);
+ def userPref = null;
+ JavascriptManager jsmanager = rcontext.getJavascriptManager();
+ jsmanager.importJavascript("eXo.gadget.UIGadget") ;
+
jsmanager.addCustomizedOnLoadScript("eXo.gadget.UIGadget.createGadget('$url','$id',
$metadata, $userPref, 'canvas', '$hostName');") ;
+ java.util.Map<String, String> metadataMap = GadgetUtil.getMapMetadata(url) ;
+
+ if(metadataMap.containsKey("height") &&
Integer.parseInt(metadataMap.get("height")) > 0)
+ height = (Integer.parseInt(metadataMap.get("height")) + 10) +
"px" ;
+ }
%>
<div class="UIGadgetViewMode" id="$id" style="height:
<%=height%>;"></div>
Show replies by date