Author: jleroux
Date: Wed Mar 12 20:37:56 2014 New Revision: 1576891 URL: http://svn.apache.org/r1576891 Log: A slightly modified patch from Rong Nguyen for "Render multiMenu problem when linktype="hidden-form"" https://issues.apache.org/jira/browse/OFBIZ-5557 Scenario: 1. Go to Content webapp 2. Go to CompDoc menuitem 3. Search 4. Go to 'Tree' view 5. We can not use 'Up' and 'Down' function When menu with linktype="hidden-form" was render for each menu, they has the same name for form element, so it cause error. My solution is add extra attribute(extra-index) for Menu, and then in menu definition we provide this attribute and the forms with different name will be rendered. My implement was tested in this bug for Content webapp jleroux: I have simply amended the up and down labels to have them more legible. I'd have preferred to not have all uppercased, but ran out of time for such a trivial change Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml ofbiz/trunk/applications/content/widget/compdoc/CompDocMenus.xml ofbiz/trunk/framework/widget/dtd/widget-menu.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/ContentUiLabels.xml?rev=1576891&r1=1576890&r2=1576891&view=diff ============================================================================== --- ofbiz/trunk/applications/content/config/ContentUiLabels.xml (original) +++ ofbiz/trunk/applications/content/config/ContentUiLabels.xml Wed Mar 12 20:37:56 2014 @@ -704,15 +704,15 @@ <value xml:lang="zh_TW">åæææªç¶åç¯æ¬</value> </property> <property key="ContentCompDocDown"> - <value xml:lang="da">vNed</value> - <value xml:lang="en">vDn</value> - <value xml:lang="fr">vBas</value> - <value xml:lang="it">vGiù</value> - <value xml:lang="ja">vä¸</value> - <value xml:lang="pt">vDn</value> - <value xml:lang="vi">Tải vá» (vDn)</value> - <value xml:lang="zh">vä¸</value> - <value xml:lang="zh_TW">vä¸</value> + <value xml:lang="da">v Ned</value> + <value xml:lang="en">v Dn</value> + <value xml:lang="fr">v Bas</value> + <value xml:lang="it">v Giù</value> + <value xml:lang="ja">v ä¸</value> + <value xml:lang="pt">v Dn</value> + <value xml:lang="vi">Tải vá» (v Dn)</value> + <value xml:lang="zh">v ä¸</value> + <value xml:lang="zh_TW">v ä¸</value> </property> <property key="ContentCompDocGeneratePDF"> <value xml:lang="da">Generer sammensat PDF</value> @@ -832,15 +832,15 @@ <value xml:lang="zh_TW">åæææªç¯æ¬å稱</value> </property> <property key="ContentCompDocUp"> - <value xml:lang="da">^Op</value> - <value xml:lang="en">^Up</value> - <value xml:lang="fr">^Haut</value> - <value xml:lang="it">^Sù</value> - <value xml:lang="ja">^ä¸</value> - <value xml:lang="pt">^Cima</value> - <value xml:lang="vi">Tải lên (^Up)</value> - <value xml:lang="zh">^ä¸</value> - <value xml:lang="zh_TW">^ä¸</value> + <value xml:lang="da">^ Op</value> + <value xml:lang="en">^ Up</value> + <value xml:lang="fr">^ Haut</value> + <value xml:lang="it">^ Sù</value> + <value xml:lang="ja">^ ä¸</value> + <value xml:lang="pt">^ Cima</value> + <value xml:lang="vi">Tải lên (^ Up)</value> + <value xml:lang="zh">^ ä¸</value> + <value xml:lang="zh_TW">^ ä¸</value> </property> <property key="ContentCompDocViewInstances"> <value xml:lang="da">Se instanser</value> Modified: ofbiz/trunk/applications/content/widget/compdoc/CompDocMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/compdoc/CompDocMenus.xml?rev=1576891&r1=1576890&r2=1576891&view=diff ============================================================================== --- ofbiz/trunk/applications/content/widget/compdoc/CompDocMenus.xml (original) +++ ofbiz/trunk/applications/content/widget/compdoc/CompDocMenus.xml Wed Mar 12 20:37:56 2014 @@ -162,7 +162,7 @@ under the License. --> </menu> - <menu name="childTemplateLine" menu-container-style="button-bar button-style-1" default-menu-item-name="content" selected-menuitem-context-field-name="currentMenuItemName" title="" type="simple"> + <menu extra-index="${contentId}" name="childTemplateLine" menu-container-style="button-bar button-style-1" default-menu-item-name="content" selected-menuitem-context-field-name="currentMenuItemName" title="" type="simple"> <menu-item name="edit-inplace" title="${contentName} [${contentId}]"> <link target="EditChildCompDoc"> <parameter param-name="contentId"/> Modified: ofbiz/trunk/framework/widget/dtd/widget-menu.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-menu.xsd?rev=1576891&r1=1576890&r2=1576891&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-menu.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-menu.xsd Wed Mar 12 20:37:56 2014 @@ -49,6 +49,7 @@ under the License. <xs:attribute type="xs:string" name="default-tooltip-style" /> <xs:attribute type="xs:string" name="default-selected-style" /> <xs:attribute type="xs:string" name="default-align-style" /> + <xs:attribute type="xs:string" name="extra-index" /> <xs:attribute name="orientation" default="horizontal"> <xs:simpleType> <xs:restriction base="xs:token"> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java?rev=1576891&r1=1576890&r2=1576891&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MacroMenuRenderer.java Wed Mar 12 20:37:56 2014 @@ -202,6 +202,9 @@ public class MacroMenuRenderer implement parameters.put("text", link.getText(context)); parameters.put("targetWindow", link.getTargetWindow(context)); String uniqueItemName = menuItem.getModelMenu().getName() + "_" + menuItem.getName() + "_LF_" + UtilMisc.<String> addToBigDecimalInMap(context, "menuUniqueItemIndex", BigDecimal.ONE); + if(menuItem.getModelMenu().getExtraIndex(context) != null){ + uniqueItemName += "_" + menuItem.getModelMenu().getExtraIndex(context); + } parameters.put("uniqueItemName", uniqueItemName); String linkType = ""; if (UtilValidate.isNotEmpty(target)) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=1576891&r1=1576890&r2=1576891&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Wed Mar 12 20:37:56 2014 @@ -73,6 +73,7 @@ public class ModelMenu extends ModelWidg protected String defaultAlign; protected String defaultAlignStyle; protected String fillStyle; + protected FlexibleStringExpander extraIndex; /** This List will contain one copy of each item for each item name in the order * they were encountered in the service, entity, or menu definition; item definitions @@ -158,6 +159,7 @@ public class ModelMenu extends ModelWidg this.defaultAlign = parent.defaultAlign; this.defaultAlignStyle = parent.defaultAlignStyle; this.fillStyle = parent.fillStyle; + this.extraIndex = parent.extraIndex; this.selectedMenuItemContextFieldName = parent.selectedMenuItemContextFieldName; this.menuContainerStyleExdr = parent.menuContainerStyleExdr; if (parent.actions != null) { @@ -225,6 +227,8 @@ public class ModelMenu extends ModelWidg this.defaultAlignStyle = menuElement.getAttribute("default-align-style"); if (this.fillStyle == null || menuElement.hasAttribute("fill-style")) this.fillStyle = menuElement.getAttribute("fill-style"); + if (this.extraIndex == null || menuElement.hasAttribute("extra-index")) + this.setExtraIndex(menuElement.getAttribute("extra-index")); // read all actions under the "actions" element Element actionsElement = UtilXml.firstChildElement(menuElement, "actions"); @@ -659,5 +663,15 @@ public class ModelMenu extends ModelWidg public List<ModelMenuItem> getMenuItemList() { return menuItemList; } + public String getExtraIndex(Map<String, Object> context) { + try { + return extraIndex.expandString(context); + } catch (Exception ex) { + return ""; + } + } + public void setExtraIndex(String extraIndex) { + this.extraIndex = FlexibleStringExpander.getInstance(extraIndex); + } } |
Free forum by Nabble | Edit this page |