Author: ndkhoiits
Date: 2010-05-26 23:44:43 -0400 (Wed, 26 May 2010)
New Revision: 3206
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_de.properties
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_en.properties
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_vi.xml
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl
Log:
GTNPORTAL-918 Portlet'll be added into categories if it isn't component of any
categories.
Add some localizations into UIPortletInfo and UIGadgetInfo
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2010-05-26
22:04:46 UTC (rev 3205)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UICategorySelector.java 2010-05-27
03:44:43 UTC (rev 3206)
@@ -7,6 +7,7 @@
import org.exoplatform.commons.serialization.api.annotations.Serialized;
import org.exoplatform.webui.config.annotation.ComponentConfig;
import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.core.UIContainer;
import org.exoplatform.webui.core.lifecycle.UIFormLifecycle;
import org.exoplatform.webui.event.Event;
import org.exoplatform.webui.event.EventListener;
@@ -137,12 +138,12 @@
appRegService.save(category, newApp);
}
}
- UIGadgetInfo gadgetInfo = selector.getParent();
- gadgetInfo.getChild(UICategorySelector.class).setRendered(false);
- UIApplicationRegistryPortlet uiPortlet =
gadgetInfo.getAncestorOfType(UIApplicationRegistryPortlet.class);
+ UIContainer appInfo = selector.getParent();
+ appInfo.getChild(UICategorySelector.class).setRendered(false);
+ UIApplicationRegistryPortlet uiPortlet =
appInfo.getAncestorOfType(UIApplicationRegistryPortlet.class);
UIApplicationOrganizer uiOrganizer =
uiPortlet.getChild(UIApplicationOrganizer.class);
uiOrganizer.reload();
- event.getRequestContext().addUIComponentToUpdateByAjax(gadgetInfo);
+ event.getRequestContext().addUIComponentToUpdateByAjax(appInfo);
}
private Application cloneApplication(Application app)
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java 2010-05-26
22:04:46 UTC (rev 3205)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletInfo.java 2010-05-27
03:44:43 UTC (rev 3206)
@@ -19,10 +19,19 @@
package org.exoplatform.applicationregistry.webui.component;
+import java.util.ArrayList;
+import java.util.List;
+import org.exoplatform.application.registry.Application;
+import org.exoplatform.application.registry.ApplicationCategory;
+import org.exoplatform.application.registry.ApplicationRegistryService;
import
org.exoplatform.applicationregistry.webui.component.UIPortletManagement.PortletExtra;
import org.exoplatform.commons.serialization.api.annotations.Serialized;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.portal.webui.container.UIContainer;
import org.exoplatform.webui.config.annotation.ComponentConfig;
-import org.exoplatform.webui.core.UIComponent;
+import org.exoplatform.webui.config.annotation.EventConfig;
+import org.exoplatform.webui.event.Event;
+import org.exoplatform.webui.event.EventListener;
/**
* Created by The eXo Platform SAS
@@ -30,13 +39,18 @@
* thanhtungty(a)gmail.com
* Sep 11, 2008
*/
-@ComponentConfig(template =
"app:/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl")
+@ComponentConfig(template =
"app:/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl", events =
{
+ @EventConfig(listeners = UIPortletInfo.ShowCategoriesActionListener.class)})
@Serialized
-public class UIPortletInfo extends UIComponent
+public class UIPortletInfo extends UIContainer
{
-
private PortletExtra portlet_;
+ public UIPortletInfo() throws Exception
+ {
+ addChild(UICategorySelector.class, null, null);
+ }
+
public void setPortlet(PortletExtra portlet)
{
portlet_ = portlet;
@@ -47,4 +61,49 @@
return portlet_;
}
+ public static class ShowCategoriesActionListener extends
EventListener<UIPortletInfo>
+ {
+
+ @Override
+ public void execute(Event<UIPortletInfo> event) throws Exception
+ {
+ UIPortletInfo uiPortletInfo = event.getSource();
+ PortletExtra portlet = uiPortletInfo.getPortlet();
+ uiPortletInfo.removeChild(UICategorySelector.class);
+ UICategorySelector selector = uiPortletInfo.addChild(UICategorySelector.class,
null, null);
+ Application app = new Application();
+ app.setApplicationName(portlet.getName());
+ app.setType(ApplicationType.PORTLET);
+ app.setDisplayName(portlet.getDisplayName());
+ app.setContentId(portlet.getId());
+ app.setAccessPermissions(new ArrayList<String>());
+
+ selector.setApplication(app);
+ selector.setRendered(true);
+ }
+
+ }
+
+ private String getCategorieNames() throws Exception
+ {
+ ApplicationRegistryService appRegService =
getApplicationComponent(ApplicationRegistryService.class);
+ List<ApplicationCategory> allCategories =
appRegService.getApplicationCategories();
+ List<String> nameList = new ArrayList<String>();
+
+ for (ApplicationCategory category : allCategories)
+ {
+ if (appRegService.getApplication(category.getName(), portlet_.getName()) !=
null)
+ {
+ nameList.add(category.getDisplayName());
+ }
+ }
+ StringBuffer names = new StringBuffer("");
+ for (String name : nameList)
+ {
+ names.append(name);
+ if (!name.equals(nameList.get(nameList.size() - 1)))
+ names.append(", ");
+ }
+ return names.toString();
+ }
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java 2010-05-26
22:04:46 UTC (rev 3205)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/applicationregistry/webui/component/UIPortletManagement.java 2010-05-27
03:44:43 UTC (rev 3206)
@@ -200,6 +200,7 @@
uiPortletInfo = addChild(UIPortletInfo.class, null, null);
}
uiPortletInfo.setPortlet(selectedPorlet);
+ uiPortletInfo.getChild(UICategorySelector.class).setRendered(false);
}
public void setSelectedPortlet(String id) throws Exception
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_de.properties
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_de.properties 2010-05-26
22:04:46 UTC (rev 3205)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_de.properties 2010-05-27
03:44:43 UTC (rev 3206)
@@ -100,6 +100,9 @@
UIPortletInfo.label.description=#{label.description}
UIPortletInfo.title.portletPreferences=Portlet-Präferenzen
UIPortletInfo.msg.noPortletPreferences=Keine Portlet-Präferenzen
+UIPortletInfo.label.categories=Kategorien:
+UIPortletInfo.label.categories.guide=Sie müssen dieses Portlet zu einer
Kategorie hinzufügen, um es im Page nutzen zu können.
+UIPortletInfo.label.categories.clickHere=Klicken Sie hier, um das Portlet zu einer
Kategorie hinuzuzufügen.
## org.exoplatform.portletregistry.webui.component.UIGadgetManagement
UIGadgetManagement.label.addRemote=Ein Remote-Gadget hinzufügen
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_en.properties
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_en.properties 2010-05-26
22:04:46 UTC (rev 3205)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_en.properties 2010-05-27
03:44:43 UTC (rev 3206)
@@ -102,6 +102,9 @@
UIPortletInfo.label.description=#{label.description}
UIPortletInfo.title.portletPreferences=Portlet Preferences
UIPortletInfo.msg.noPortletPreferences=No Portlet Preferences
+UIPortletInfo.label.categories=Categories:
+UIPortletInfo.label.categories.guide=You must add this portlet into categories to be able
used in Page.
+UIPortletInfo.label.categories.clickHere=Click here to add into categories
## org.exoplatform.portletregistry.webui.component.UIGadgetManagement
UIGadgetManagement.label.addRemote=Add a remote gadget
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_vi.xml
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_vi.xml 2010-05-26
22:04:46 UTC (rev 3205)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/WEB-INF/classes/locale/portlet/exoadmin/ApplicationRegistryPortlet_vi.xml 2010-05-27
03:44:43 UTC (rev 3206)
@@ -193,13 +193,18 @@
<name>Tên Portlet:</name>
<display>#{label.displayName}</display>
<description>#{label.description}</description>
+ <categories>Danh mục:</categories>
+ <categories>
+ <guide>Bạn phải thêm portlet này vào danh mục để có thể sử dụng trong trang
web</guide>
+ <clickHere>Click vào đây để thêm vào danh mục</clickHere>
+ </categories>
</label>
<title>
<portletPreferences>Portlet Preferences</portletPreferences>
</title>
<msg>
<noPortletPreferences>No Portlet Preferences</noPortletPreferences>
- </msg>
+ </msg>
</UIPortletInfo>
<!--
## org.exoplatform.portletregistry.webui.component.UIGadgetManagement
@@ -230,6 +235,11 @@
<viewUrl>Xem mã nguồn tại:</viewUrl>
<editUrl>Chỉnh sửa mã nguồn tại:</editUrl>
<reference>Tham khảo:</reference>
+ <categories>Danh mục:</categories>
+ <categories>
+ <guide>Bạn phải thêm gadget này vào danh mục để có thể sử dụng trong
Dashboard</guide>
+ <clickHere>Click vào đây để thêm vào danh mục</clickHere>
+ </categories>
</label>
<title>
<refresh> Làm mới thông tin</refresh>
Modified:
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl 2010-05-26
22:04:46 UTC (rev 3205)
+++
portal/trunk/portlet/exoadmin/src/main/webapp/groovy/applicationregistry/webui/component/UIPortletInfo.gtmpl 2010-05-27
03:44:43 UTC (rev 3206)
@@ -1,7 +1,10 @@
<%
import java.util.Iterator;
- import java.util.Map.Entry
-
+ import java.util.Map.Entry;
+ import org.exoplatform.applicationregistry.webui.component.UICategorySelector;
+
+ boolean selectorRender = uicomponent.getChild(UICategorySelector.class).isRendered();
+ String categoryNames = uicomponent.getCategorieNames();
def portlet = uicomponent.getPortlet();
def portletPreferences = portlet.getPortletPreferences();
String srcBG = "/" + portlet.getPortletGroup() +
"/skin/DefaultSkin/portletIcons/" + portlet.getName() + ".png";
@@ -59,8 +62,24 @@
<td
class="LeftLabel"><%=_ctx.appRes("UIPortletInfo.label.description")%></td>
<td class="RightLabel" title="<%= portlet.getDisplayName()
%>"><%= portlet.getDescription() %></td>
</tr>
+ <tr>
+ <td class="LeftLabel"><%=
_ctx.appRes("UIPortletInfo.label.categories") %></td>
+ <td class="RightLabel">$categoryNames
+ <% if (categoryNames.equals("")) { %>
+
<%=_ctx.appRes("UIPortletInfo.label.categories.guide")%><br/>
+ <% if (!selectorRender) { %>
+ <a href="#" onclick="<%=
uicomponent.event("ShowCategories") %>"
style="color:red;text-decoration:underline;">
+
<%=_ctx.appRes("UIPortletInfo.label.categories.clickHere")%>
+ </a>
+ <% } %>
+ <%}%>
+ </td>
+ </tr>
</table>
</div>
+ <div><% if(selectorRender) {
+ uicomponent.renderChildren();
+ }%></div>
</div>
<% if(portletPreferences.getKeys().size() != 0) {%>
Show replies by date