Author: thomas.heute(a)jboss.com
Date: 2010-10-27 07:03:35 -0400 (Wed, 27 Oct 2010)
New Revision: 4857
Modified:
epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java
epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl
Log:
JBEPP-584: Misleading error message when Gadget does not exist
Modified:
epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java
===================================================================
---
epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java 2010-10-27
11:03:25 UTC (rev 4856)
+++
epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/src/main/java/org/exoplatform/gadget/webui/component/UIGadgetPortlet.java 2010-10-27
11:03:35 UTC (rev 4857)
@@ -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:
epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl
===================================================================
---
epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl 2010-10-27
11:03:25 UTC (rev 4856)
+++
epp/portal/branches/EPP_5_1_Branch/portlet/dashboard/src/main/webapp/groovy/gadget/webui/component/UIGadgetViewMode.gtmpl 2010-10-27
11:03:35 UTC (rev 4857)
@@ -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