svn commit: r883239 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r883239 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java

lektran
Author: lektran
Date: Mon Nov 23 04:06:27 2009
New Revision: 883239

URL: http://svn.apache.org/viewvc?rev=883239&view=rev
Log:
Allow a target and additional parameters to be specified when defining a portal page menu item, for example:
<menu-item name="main" parent-portal-page-value="${parameters.parentPortalPageId}"/>

can now be customized to point to a specific target rather than the default "showPortalPage":
<menu-item name="main" parent-portal-page-value="${parameters.parentPortalPageId}">
    <link target="MyCustomRequest">
        <parameter param-name="myCustomParam" from-field="parameters.myCustomParam"/>
    </link>
</menu-item>

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=883239&r1=883238&r2=883239&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Mon Nov 23 04:06:27 2009
@@ -277,7 +277,15 @@
                         localItem.name =  portalPage.getString("portalPageId");
                         localItem.setTitle(portalPage.getString("portalPageName"));
                         localItem.link = new Link(this);
-                        localItem.link.setTarget("showPortalPage?portalPageId=" + portalPage.getString("portalPageId") + "&parentPortalPageId=" + parentPortalPageId);
+                        List<WidgetWorker.Parameter> linkParams = localItem.link.getParameterList();
+                        linkParams.add(new WidgetWorker.Parameter("portalPageId", portalPage.getString("portalPageId"), false));
+                        linkParams.add(new WidgetWorker.Parameter("parentPortalPageId", parentPortalPageId, false));
+                        if (link != null) {
+                            localItem.link.setTarget(link.targetExdr.getOriginal());
+                            linkParams.addAll(link.parameterList);
+                        } else {
+                            localItem.link.setTarget("showPortalPage");
+                        }
                         localItem.link.setText(portalPage.getString("portalPageName"));
                         menuStringRenderer.renderMenuItem(writer, context, localItem);
                     }