From 4e5d5791b3e9ab032be5970f5120dc0f2b778947 Mon Sep 17 00:00:00 2001 From: Jacopo Cappellato Date: Mon, 24 Mar 2008 04:07:34 +0000 Subject: [PATCH] New attributes for the webapp element in the ofbiz-component.xml files: description, menu-name and position. menu-name is used to separate the menu items in different menus, the position element che be used to sort them (alphanumerically) in the group. There are now two menu groups: "main", for the main applications, in the top bar, and "secondary" for applications (specialized or not still 'mature'), in the footer. Thanks to Bilgim Ibryam for the patch OFBIZ-1714, that I have committed with a few changes. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@640307 13f79535-47bb-0310-9956-ffa450edef68 --- applications/accounting/ofbiz-component.xml | 1 + applications/content/ofbiz-component.xml | 1 + applications/humanres/ofbiz-component.xml | 1 + .../manufacturing/ofbiz-component.xml | 1 + applications/marketing/ofbiz-component.xml | 2 + applications/order/ofbiz-component.xml | 1 + applications/party/ofbiz-component.xml | 1 + applications/product/ofbiz-component.xml | 4 +- applications/workeffort/ofbiz-component.xml | 1 + framework/base/dtd/ofbiz-component.xsd | 10 ++++ .../ofbiz/base/component/ComponentConfig.java | 46 ++++++++++++++--- framework/common/config/CommonUiLabels.xml | 3 ++ .../common/webcommon/includes/appbar.ftl | 4 +- .../common/webcommon/includes/footer.ftl | 36 +++++++++++++ framework/example/ofbiz-component.xml | 2 + framework/exampleext/ofbiz-component.xml | 2 +- framework/images/webapp/images/maincss.css | 51 +++++++++++++++++++ framework/webtools/ofbiz-component.xml | 1 + specialpurpose/bi/ofbiz-component.xml | 2 + specialpurpose/ebay/ofbiz-component.xml | 1 + specialpurpose/googlebase/ofbiz-component.xml | 1 + specialpurpose/oagis/ofbiz-component.xml | 1 + specialpurpose/projectmgr/ofbiz-component.xml | 1 + 23 files changed, 162 insertions(+), 12 deletions(-) diff --git a/applications/accounting/ofbiz-component.xml b/applications/accounting/ofbiz-component.xml index 39da7c209b..0022c21c3a 100644 --- a/applications/accounting/ofbiz-component.xml +++ b/applications/accounting/ofbiz-component.xml @@ -74,6 +74,7 @@ under the License. - - diff --git a/applications/workeffort/ofbiz-component.xml b/applications/workeffort/ofbiz-component.xml index a0ce377806..f269849b4d 100644 --- a/applications/workeffort/ofbiz-component.xml +++ b/applications/workeffort/ofbiz-component.xml @@ -40,6 +40,7 @@ under the License. + + + + + + + + + + diff --git a/framework/base/src/base/org/ofbiz/base/component/ComponentConfig.java b/framework/base/src/base/org/ofbiz/base/component/ComponentConfig.java index 6d1d85b087..9edc710607 100644 --- a/framework/base/src/base/org/ofbiz/base/component/ComponentConfig.java +++ b/framework/base/src/base/org/ofbiz/base/component/ComponentConfig.java @@ -253,11 +253,15 @@ public class ComponentConfig { } public static List getAppBarWebInfos(String serverName) { - return ComponentConfig.getAppBarWebInfos(serverName, null); + return ComponentConfig.getAppBarWebInfos(serverName, null, null); } - - public static List getAppBarWebInfos(String serverName, Comparator comp) { - List webInfos = serverWebApps.get(serverName); + + public static List getAppBarWebInfos(String serverName, String menuName) { + return ComponentConfig.getAppBarWebInfos(serverName, null, menuName); + } + + public static List getAppBarWebInfos(String serverName, Comparator comp, String menuName) { + List webInfos = serverWebApps.get(serverName + menuName); if (webInfos == null) { synchronized (ComponentConfig.class) { if (webInfos == null) { @@ -272,14 +276,21 @@ public class ComponentConfig { for (ComponentConfig cc: getAllComponents()) { for (WebappInfo wInfo: cc.getWebappInfos()) { + String key = UtilValidate.isNotEmpty(wInfo.position)? wInfo.position: wInfo.title; if (serverName.equals(wInfo.server) && wInfo.appBarDisplay) { - tm.put(wInfo.title, wInfo); + if (UtilValidate.isNotEmpty(menuName)) { + if (menuName.equals(wInfo.menuName)) { + tm.put(key, wInfo); + } + } else { + tm.put(key, wInfo); + } } } } List webInfoList = FastList.newInstance(); webInfoList.addAll(tm.values()); - serverWebApps.put(serverName, webInfoList); + serverWebApps.put(serverName + menuName, webInfoList); return webInfoList; } } @@ -660,10 +671,13 @@ public class ComponentConfig { public Map initParameters; public String name; public String title; + public String description; + public String menuName; public String server; public String mountPoint; public String location; public String[] basePermission; + public String position; public boolean appBarDisplay; public WebappInfo(ComponentConfig componentConfig, Element element) { @@ -672,6 +686,7 @@ public class ComponentConfig { this.componentConfig = componentConfig; this.name = element.getAttribute("name"); this.title = element.getAttribute("title"); + this.description = element.getAttribute("description"); this.server = element.getAttribute("server"); this.mountPoint = element.getAttribute("mount-point"); this.location = element.getAttribute("location"); @@ -696,7 +711,20 @@ public class ComponentConfig { if (UtilValidate.isEmpty(this.title)) { this.title = Character.toUpperCase(name.charAt(0)) + name.substring(1).toLowerCase(); } - + + if (UtilValidate.isEmpty(this.description)) { + this.description = this.title; + } + + String menuNameStr = element.getAttribute("menu-name"); + if (UtilValidate.isNotEmpty(menuNameStr)) { + this.menuName = menuNameStr; + } else { + this.menuName = "main"; + } + + this.position = element.getAttribute("position"); + // default mount point is name if none specified if (UtilValidate.isEmpty(this.mountPoint)) { this.mountPoint = this.name; @@ -754,6 +782,10 @@ public class ComponentConfig { public String getTitle() { return title; } + + public String getDescription() { + return description; + } public List getVirtualHosts() { return virtualHosts; diff --git a/framework/common/config/CommonUiLabels.xml b/framework/common/config/CommonUiLabels.xml index 5b03296232..178716410b 100644 --- a/framework/common/config/CommonUiLabels.xml +++ b/framework/common/config/CommonUiLabels.xml @@ -6951,6 +6951,9 @@ Risorse Umane ฝ่ายบุคคล + + Human Resource Application + Handheld Facility Gestione Stabilimenti su Handheld diff --git a/framework/common/webcommon/includes/appbar.ftl b/framework/common/webcommon/includes/appbar.ftl index ebc0b7c5aa..0320387555 100644 --- a/framework/common/webcommon/includes/appbar.ftl +++ b/framework/common/webcommon/includes/appbar.ftl @@ -21,7 +21,7 @@ under the License. <#if (externalLoginKey)?exists><#assign externalKeyParam = "?externalLoginKey=" + requestAttributes.externalLoginKey?if_exists> <#assign ofbizServerName = application.getAttribute("_serverId")?default("default-server")> <#assign contextPath = request.getContextPath()> -<#assign displayApps = Static["org.ofbiz.base.component.ComponentConfig"].getAppBarWebInfos(ofbizServerName)> +<#assign displayApps = Static["org.ofbiz.base.component.ComponentConfig"].getAppBarWebInfos(ofbizServerName, "main")> <#if userLogin?has_content>