svn commit: r744675 - in /ofbiz/trunk: framework/common/webcommon/WEB-INF/actions/includes/ framework/common/widget/ framework/example/widget/example/ framework/widget/dtd/ framework/widget/src/org/ofbiz/widget/menu/ specialpurpose/myportal/data/ speci...

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

svn commit: r744675 - in /ofbiz/trunk: framework/common/webcommon/WEB-INF/actions/includes/ framework/common/widget/ framework/example/widget/example/ framework/widget/dtd/ framework/widget/src/org/ofbiz/widget/menu/ specialpurpose/myportal/data/ speci...

hansbak-2
Author: hansbak
Date: Sun Feb 15 15:10:50 2009
New Revision: 744675

URL: http://svn.apache.org/viewvc?rev=744675&view=rev
Log:
improved menu widget for portal pages, reactivated menuitem override and various other improvements

Added:
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy   (with props)
Removed:
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ShowPortalPage.groovy
    ofbiz/trunk/specialpurpose/myportal/templates/appheader.ftl
Modified:
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy
    ofbiz/trunk/framework/common/widget/PortalPageScreens.xml
    ofbiz/trunk/framework/example/widget/example/CommonScreens.xml
    ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml
    ofbiz/trunk/framework/widget/dtd/widget-menu.xsd
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
    ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml
    ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml
    ofbiz/trunk/specialpurpose/myportal/widget/MyPortalMenus.xml

Added: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy?rev=744675&view=auto
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy (added)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy Sun Feb 15 15:10:50 2009
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.entity.*;
+import org.ofbiz.base.util.*;
+import org.ofbiz.entity.condition.*;
+
+// executes only on startup when no parameters.portalPageId is available
+if (parameters.parentPortalPageId && !parameters.portalPageId) {
+ // look for system page according the current securitygroup
+ //get the security group
+ userLoginSecurityGroupId = null;
+ condSec = EntityCondition.makeCondition([
+ EntityCondition.makeCondition("groupId", EntityOperator.LIKE, parameters.parentPortalPageId + "%"),
+ EntityCondition.makeCondition("userLoginId", EntityOperator.EQUALS, parameters.userLogin.userLoginId)
+ ],EntityOperator.AND);
+ userLoginSecurityGroups = delegator.findList("UserLoginSecurityGroup", condSec, null, null, null, false);
+ if (UtilValidate.isNotEmpty(userLoginSecurityGroups)) {
+ userLoginSecurityGroupId = userLoginSecurityGroups.get(0).get("groupId");
+ }
+ Debug.log("=====security group found: " + userLoginSecurityGroupId);
+ //get the portal page
+ cond1 = EntityCondition.makeCondition([
+ EntityCondition.makeCondition("portalPageId", EntityOperator.LIKE, parameters.parentPortalPageId + "%"),
+ EntityCondition.makeCondition("securityGroupId", EntityOperator.EQUALS, userLoginSecurityGroupId),
+ EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_"),
+ EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, null)
+ ],EntityOperator.AND);
+ portalMainPages = delegator.findList("PortalPage", cond1, null, null, null, false);
+ if (portalMainPages) {
+ portalPage = portalMainPages.get(0);
+ Debug.log("=====page found: " + portalPage.portalPageId);
+ if ("_NA_".equals(portalPage.ownerUserLoginId)) {
+ context.parameters.parentPortalPageId = portalPage.portalPageId;
+ } else {
+ context.parameters.parentPortalPageId = portalPage.orginalPortalPageId;
+ }
+ context.parameters.portalPageId = portalPage.portalPageId; //make sure we have a starting portalPageId
+ context.headerItem = portalPage.portalPageId; // and the menu item is highlighted
+ }
+}

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy?rev=744675&r1=744674&r2=744675&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy (original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy Sun Feb 15 15:10:50 2009
@@ -22,7 +22,6 @@
 import org.ofbiz.entity.condition.*;
 // only execute when a user is logged in
 if (parameters.userLogin) {
-    // find
     userLoginSecurityGroupId = null;
     condSec = EntityCondition.makeCondition([
                   EntityCondition.makeCondition("groupId", EntityOperator.LIKE, parameters.parentPortalPageId + "%"),
@@ -34,7 +33,7 @@
         userLoginSecurityGroupId = userLoginSecurityGroups.get(0).get("groupId");
     }
 
-    //get the portal page
+    //get the portal mainpage
     cond1 = EntityCondition.makeCondition([
             EntityCondition.makeCondition("portalPageId", EntityOperator.LIKE, parameters.parentPortalPageId + "%"),
             EntityCondition.makeCondition("securityGroupId", EntityOperator.EQUALS, userLoginSecurityGroupId),
@@ -45,7 +44,7 @@
     if (portalMainPages) {
         parentPortalPageId = portalMainPages.get(0).portalPageId;
     }
-
+    // get user and system pages
     ppCond =
             EntityCondition.makeCondition([
                 EntityCondition.makeCondition([
@@ -72,6 +71,5 @@
     
     context.portalPages = portalPages;
     context.userLoginSecurityGroupId = userLoginSecurityGroupId;
-    parameters.parentPortalPageId = parentPortalPageId
 }
 

Modified: ofbiz/trunk/framework/common/widget/PortalPageScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortalPageScreens.xml?rev=744675&r1=744674&r2=744675&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/PortalPageScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/PortalPageScreens.xml Sun Feb 15 15:10:50 2009
@@ -25,18 +25,28 @@
         <section>
             <actions>
                 <set field="headerItem" from-field="parameters.portalPageId"/>
-                <script location="component://common/webcommon/WEB-INF/actions/includes/ShowPortalPage.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
-                        <platform-specific><html><html-template location="component://common/webcommon/portal/showPortalPage.ftl"/></html></platform-specific>
+                        <section>
+                            <actions>
+                                <entity-one entity-name="PortalPage" value-field="portalPage"/>
+                                <get-related value-field="portalPage" relation-name="PortalPageColumn" list="portalPageColumns"/>
+                                <entity-and entity-name="PortalPagePortletView" list="portalPagePortlets">
+                                    <field-map field-name="portalPageId" from-field="portalPage.portalPageId"/>
+                                </entity-and>
+                            </actions>
+                            <widgets>
+                                <platform-specific><html><html-template location="component://common/webcommon/portal/showPortalPage.ftl"/></html></platform-specific>
+                            </widgets>
+                        </section>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
         </section>
     </screen>
-    
+
     <screen name="ManagePortalPages">
         <section>
             <actions>

Modified: ofbiz/trunk/framework/example/widget/example/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/CommonScreens.xml?rev=744675&r1=744674&r2=744675&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/CommonScreens.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/CommonScreens.xml Sun Feb 15 15:10:50 2009
@@ -43,8 +43,8 @@
                 <set field="applicationMenuName" value="ExampleAppBar" global="true"/>
                 <set field="applicationMenuLocation" value="component://example/widget/example/ExampleMenus.xml" global="true"/>
                 <!--set field="appheaderTemplate" value="component://example/webapp/appheader.ftl"/-->
-                <set field="parameters.parentPortalPageId" value="EXAMPLE"/>
-                <script location="component://common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy"/>
+                <set field="parameters.parentPortalPageId" from-field="parameters.parentPortalPageId" default-value="EXAMPLE"/>
+                <script location="component://common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy"/>
                 <set field="applicationTitle" value="${uiLabelMap.ExampleApplication}" global="true"/>
             </actions>
             <widgets>
@@ -180,7 +180,11 @@
         <section>
             <actions>
                 <set field="parameters.portalPageId" value="EXAMPLE"/>
-                <script location="component://common/webcommon/WEB-INF/actions/includes/ShowPortalPage.groovy"/>
+                <entity-one entity-name="PortalPage" value-field="portalPage"/>
+                <get-related value-field="portalPage" relation-name="PortalPageColumn" list="portalPageColumns"/>
+                <entity-and entity-name="PortalPagePortletView" list="portalPagePortlets">
+                    <field-map field-name="portalPageId" from-field="portalPage.portalPageId"/>
+                </entity-and>
             </actions>
             <widgets>
                  <include-screen name="FindExample" location="component://example/widget/example/ExampleScreens.xml"/>

Modified: ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml?rev=744675&r1=744674&r2=744675&view=diff
==============================================================================
--- ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml (original)
+++ ofbiz/trunk/framework/example/widget/example/ExampleMenus.xml Sun Feb 15 15:10:50 2009
@@ -19,14 +19,13 @@
 -->
 
 <menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-menu.xsd">      
-
+    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-menu.xsd">          
     <menu name="ExampleAppBar" title="${uiLabelMap.ExampleApplication}" extends="CommonAppBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
         <menu-item name="Example" title="${uiLabelMap.ExampleExample}"><link target="FindExample"/></menu-item>
         <menu-item name="ExampleFeature" title="${uiLabelMap.ExampleFeature}"><link target="FindExampleFeature"/></menu-item>
         <menu-item name="FormWidgetExamples" title="${uiLabelMap.ExampleFormWidgetExamples}"><link target="FormWidgetExamples"/></menu-item>
         <menu-item name="AjaxExample" title="Ajax Examples"><link target="authview/findExampleAjax"/></menu-item>
-        <menu-item portal-page="EXAMPLE"/>
+        <menu-item name="portalPage" parent-portal-page-value="${parameters.parentPortalPageId}"/>
         <menu-item name="Dashboard" title="Dashboard" align-style="opposed"><link target="ManagePortalPages?portalPageId=${currentPortalPage.portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}"/></menu-item>
     </menu>
 

Modified: ofbiz/trunk/framework/widget/dtd/widget-menu.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-menu.xsd?rev=744675&r1=744674&r2=744675&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-menu.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-menu.xsd Sun Feb 15 15:10:50 2009
@@ -45,7 +45,6 @@
             </xs:simpleType>
         </xs:attribute>
         <xs:attribute type="xs:string" name="id"/>
-        <xs:attribute type="xs:string" name="portal-page"/>
         <xs:attribute type="xs:string" name="title"/>
         <xs:attribute type="xs:string" name="tooltip"/>
         <xs:attribute type="xs:string" name="default-entity-name"/>
@@ -105,6 +104,7 @@
     <xs:attributeGroup name="attlist.menu-item">
         <xs:attribute type="xs:string" name="name" use="required"/>
         <xs:attribute type="xs:string" name="title"/>
+        <xs:attribute type="xs:string" name="parent-portal-page-value"><xs:annotation><xs:documentation>an expanded value of the parentPortalPageId in the Portal entity, will insert buttons using the portalId as the menuitem name portalPageName as the buttom title</xs:documentation></xs:annotation></xs:attribute>
         <xs:attribute type="xs:string" name="tooltip"/>
         <xs:attribute type="xs:string" name="title-style"/>
         <xs:attribute type="xs:string" name="widget-style"/>

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=744675&r1=744674&r2=744675&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 Sun Feb 15 15:10:50 2009
@@ -36,6 +36,7 @@
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.condition.EntityCondition;
 import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.widget.ModelWidget;
 import org.ofbiz.widget.menu.ModelMenuItem.Link;
@@ -138,7 +139,7 @@
                     }
                 }
                 if (parent == null) {
-                    Debug.logError("Failed to find parent menu defenition '" + parentMenu + "' in same document.", module);
+                    Debug.logError("Failed to find parent menu definition '" + parentMenu + "' in same document.", module);
                 }
             }
 
@@ -148,7 +149,6 @@
                 this.id = parent.id;
                 this.title = parent.title;
                 this.tooltip = parent.tooltip;
-                this.tooltip = parent.tooltip;
                 this.defaultEntityName = parent.defaultEntityName;
                 this.defaultTitleStyle = parent.defaultTitleStyle;
                 this.defaultSelectedStyle = parent.defaultSelectedStyle;
@@ -250,34 +250,11 @@
             }
         }
 
-        // read in add item defs, add/override one by one using the menuItemList and menuItemMap and add portal pages
+        // read in add item defs, add/override one by one using the menuItemList
         List<? extends Element> itemElements = UtilXml.childElementList(menuElement, "menu-item");
         for (Element itemElement : itemElements) {
-            String portalResource = itemElement.getAttribute("portal-page");
-         if (UtilValidate.isNotEmpty(portalResource)) {
-              ModelMenuItem modelMenuItem = new ModelMenuItem(itemElement, this);
-         List <GenericValue> portalPages = null;
-                List exprs = UtilMisc.toList(EntityCondition.makeCondition("portalPageId", EntityOperator.EQUALS, portalResource),
-                        EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, portalResource));
-                EntityCondition cond = EntityCondition.makeCondition(exprs, EntityOperator.OR);
-         try {
-         portalPages = delegator.findList("PortalPage", cond, null, UtilMisc.toList("sequenceNum"), null, false);
-                } catch (GenericEntityException e) {
-                    Debug.logError("Could not retrieve portalpages in the menu:" + e.getMessage(), module);
-                }
-         for (GenericValue portalPage : portalPages) {
-         if (UtilValidate.isNotEmpty(portalPage.getString("portalPageName"))) {
-         modelMenuItem.setName(portalPage.getString("portalPageName"));        
-         modelMenuItem.setTitle(portalPage.getString("portalPageName"));        
-         modelMenuItem.link = new Link(itemElement, modelMenuItem);
-         modelMenuItem.link.setTarget("showPortalPage?portalPageId=" + portalPage.getString("portalPageId"));
-         modelMenuItem = this.addUpdateMenuItem(modelMenuItem);
-         }
-         }
-         } else {
-                ModelMenuItem modelMenuItem = new ModelMenuItem(itemElement, this);
-         modelMenuItem = this.addUpdateMenuItem(modelMenuItem);
-         }
+            ModelMenuItem modelMenuItem = new ModelMenuItem(itemElement, this);
+            modelMenuItem = this.addUpdateMenuItem(modelMenuItem);
         }
     }
     /**
@@ -363,11 +340,61 @@
         // render formatting wrapper open
         menuStringRenderer.renderFormatSimpleWrapperOpen(writer, context, this);
 
-            //Debug.logInfo("in ModelMenu, menuItemList:" + menuItemList, module);
+        //Debug.logInfo("in ModelMenu, menuItemList:" + menuItemList, module);
         // render each menuItem row, except hidden & ignored rows
+        // include portal pages if specified
         //menuStringRenderer.renderFormatSimpleWrapperRows(writer, context, this);
         for (ModelMenuItem item : this.menuItemList) {
-            item.renderMenuItemString(writer, context, menuStringRenderer);
+            String parentPortalPageId = item.getParentPortalPageId(context);
+            if (UtilValidate.isNotEmpty(parentPortalPageId)) {
+                List <GenericValue> portalPages = null;
+                try {
+                    // first get public pages
+                    EntityCondition cond =
+                        EntityCondition.makeCondition(UtilMisc.toList(
+                            EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, "_NA_"),
+                            EntityCondition.makeCondition(UtilMisc.toList(
+                                    EntityCondition.makeCondition("portalPageId", EntityOperator.EQUALS, parentPortalPageId),
+                                    EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
+                                    EntityOperator.OR)),
+                            EntityOperator.AND);
+                    portalPages = delegator.findList("PortalPage", cond, null, null, null, false);
+                    String userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId");
+                    // replace with private pages
+                       for (GenericValue portalPage : portalPages) {
+                           cond = EntityCondition.makeCondition(UtilMisc.toList(
+                                      EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
+                                      EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPage.getString("portalPageId"))),
+                                   EntityOperator.AND);
+                           List <GenericValue> privatePortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
+                        if (UtilValidate.isNotEmpty(privatePortalPages)) {
+                            portalPages.remove(portalPage);
+                            portalPages.add(privatePortalPages.get(0));
+                        }
+                    }
+                    // add any other created private pages
+                        cond = EntityCondition.makeCondition(UtilMisc.toList(
+                                   EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
+                                   EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, null),
+                                   EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
+                                EntityOperator.AND);
+                        portalPages.addAll(delegator.findList("PortalPage", cond, null, null, null, false));
+                    portalPages = EntityUtil.orderBy(portalPages, UtilMisc.toList("sequenceNum"));
+                } catch (GenericEntityException e) {
+                    Debug.logError("Could not retrieve portalpages in the menu:" + e.getMessage(), module);
+                }
+                for (GenericValue portalPage : portalPages) {
+                    if (UtilValidate.isNotEmpty(portalPage.getString("portalPageName"))) {
+                        item.setName(portalPage.getString("portalPageId"));                    
+                        item.setTitle(portalPage.getString("portalPageName"));                    
+                        item.link = new Link(item);
+                        item.link.setTarget("showPortalPage?portalPageId=" + portalPage.getString("portalPageId") + "&parentPortalPageId=" + parentPortalPageId);
+                        item.renderMenuItemString(writer, context, menuStringRenderer);
+                    }
+                }
+            } else {
+                item.renderMenuItemString(writer, context, menuStringRenderer);
+            }
         }
         // render formatting wrapper close
         menuStringRenderer.renderFormatSimpleWrapperClose(writer, context, this);

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=744675&r1=744674&r2=744675&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 Sun Feb 15 15:10:50 2009
@@ -50,6 +50,7 @@
     protected String entityName;
     protected FlexibleStringExpander title;
     protected FlexibleStringExpander tooltip;
+    protected FlexibleStringExpander parentPortalPageId;
     protected String titleStyle;
     protected String disabledTitleStyle;
     protected String widgetStyle;
@@ -102,6 +103,7 @@
         this.entityName = fieldElement.getAttribute("entity-name");
         this.setTitle(fieldElement.getAttribute("title"));
         this.setTooltip(fieldElement.getAttribute("tooltip"));
+        this.setParentPortalPageId(fieldElement.getAttribute("parent-portal-page-value"));
         this.titleStyle = fieldElement.getAttribute("title-style");
         this.disabledTitleStyle = fieldElement.getAttribute("disabled-title-style");
         this.widgetStyle = fieldElement.getAttribute("widget-style");
@@ -217,19 +219,17 @@
          return this.disabled;  
     }
 
-    public void mergeOverrideModelMenuItem(ModelMenuItem overrideModelMenuItem) {
-        if (overrideModelMenuItem == null)
+    public void mergeOverrideModelMenuItem(ModelMenuItem overrideMenuItem) {
+        if (overrideMenuItem == null)
             return;
-/*
+
         // incorporate updates for values that are not empty in the overrideMenuItem
         if (UtilValidate.isNotEmpty(overrideMenuItem.name))
             this.name = overrideMenuItem.name;
         if (UtilValidate.isNotEmpty(overrideMenuItem.entityName))
             this.entityName = overrideMenuItem.entityName;
-        if (overrideMenuItem.entryAcsr != null && !overrideMenuItem.entryAcsr.isEmpty())
-            this.entryAcsr = overrideMenuItem.entryAcsr;
-        if (UtilValidate.isNotEmpty(overrideMenuItem.attributeName))
-            this.attributeName = overrideMenuItem.attributeName;
+        if (UtilValidate.isNotEmpty(overrideMenuItem.parentPortalPageId))
+            this.parentPortalPageId = overrideMenuItem.parentPortalPageId;
         if (overrideMenuItem.title != null && !overrideMenuItem.title.isEmpty())
             this.title = overrideMenuItem.title;
         if (overrideMenuItem.tooltip != null && !overrideMenuItem.tooltip.isEmpty())
@@ -242,7 +242,7 @@
             this.widgetStyle = overrideMenuItem.widgetStyle;
         if (overrideMenuItem.position != null)
             this.position = overrideMenuItem.position;
-*/
+
     }
 
     public void renderMenuItemString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
@@ -345,6 +345,13 @@
         }
     }
 
+    public void setParentPortalPageId(String string) {
+        this.parentPortalPageId = FlexibleStringExpander.getInstance(string);
+    }
+
+    public String getParentPortalPageId(Map<String, Object> context) {
+     return this.parentPortalPageId.expandString(context);
+    }
 
     public String getWidgetStyle() {
         if (UtilValidate.isNotEmpty(this.widgetStyle)) {
@@ -419,7 +426,6 @@
         this.tooltip = FlexibleStringExpander.getInstance(string);
     }
 
-
     /**
      * @param string
      */
@@ -541,13 +547,23 @@
             if (imageElement != null) {
                 this.image = new Image(imageElement);
             }
-
         }
 
-        // create link only for portal page
         public Link(ModelMenuItem parentMenuItem) {
+
             this.linkMenuItem = parentMenuItem;
-        }        
+            setText("");
+            setId("");
+            setStyle("");
+            setTarget("");
+            setTargetWindow("");
+            setPrefix("");
+            setUrlMode("");
+            setFullPath("");
+            setSecure("");
+            setEncode("");
+            setName("");
+        }
 
         public void renderLinkString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException {
             menuStringRenderer.renderLink(writer, context, this);

Modified: ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml?rev=744675&r1=744674&r2=744675&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml Sun Feb 15 15:10:50 2009
@@ -30,26 +30,26 @@
     <!-- no security group -->
     <PortalPage portalPageId="MYPORTAL_NONE" portalPageName="Main" description="The default OFBiz portal page" ownerUserLoginId="_NA_"/><!-- user belonging to no portal security group -->
     
-    <PortalPage portalPageId="MYPORTAL_EMPLOYEE" sequenceNum="00" portalPageName="Main" description="The OFBiz My Portal Main page" ownerUserLoginId="_NA_" securityGroupId="MYPORTAL_EMPLOYEE" />
-    <PortalPage portalPageId="MYPORTAL_EMPLOYEE1" sequenceNum="01" portalPageName="My Profile" description="The OFBiz My Portal Profile page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
-    <PortalPage portalPageId="MYPORTAL_EMPLOYEE2" sequenceNum="03" portalPageName="Other Communications" description="The OFBiz My Portal other commmunication page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
-    <PortalPage portalPageId="MYPORTAL_EMPLOYEE3" sequenceNum="04" portalPageName="Company Events" description="The OFBiz My Portal Company Events page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
-    <PortalPage portalPageId="MYPORTAL_EMPLOYEE4" sequenceNum="05" portalPageName="My Time Sheets" description="The OFBiz My Portal Timesheet page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
-    <PortalPage portalPageId="MYPORTAL_EMPLOYEE5" sequenceNum="06" portalPageName="My Tasks" description="The OFBiz My Portal My Task page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
-    
-    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML" sequenceNum="00" portalPageName="Main" description="The default OFBiz portal page" ownerUserLoginId="_NA_" securityGroupId="MYPORTAL_EMPL-NOEML" />
-    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML1" sequenceNum="01" portalPageName="My Profile" description="The OFBiz My Portal Profile page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
-    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML2" sequenceNum="03" portalPageName="Other Communications" description="The OFBiz My Portal other commmunication page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
-    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML3" sequenceNum="04" portalPageName="Company Events" description="The OFBiz My Portal Company Events page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
-    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML4" sequenceNum="05" portalPageName="My Time Sheets" description="The OFBiz My Portal Timesheet page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
-    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML5" sequenceNum="06" portalPageName="My Tasks" description="The OFBiz My Portal My Task page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
-    
-    <PortalPage portalPageId="MYPORTAL_CUSTOMER" sequenceNum="00" portalPageName="Main" description="The default OFBiz portal page for a customers" ownerUserLoginId="_NA_" securityGroupId="MYPORTAL_CUSTOMER" />
-    <PortalPage portalPageId="MYPORTAL_CUSTOMER1" sequenceNum="01" portalPageName="My Profile" description="The OFBiz My Portal Profile page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_CUSTOMER" />
-    <PortalPage portalPageId="MYPORTAL_CUSTOMER2" sequenceNum="02" portalPageName="Invoices" description="The OFBiz My Portal Invoices page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_CUSTOMER" />
-    <PortalPage portalPageId="MYPORTAL_CUSTOMER3" sequenceNum="03" portalPageName="Projects" description="The OFBiz My Portal Project page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_CUSTOMER" />
+    <PortalPage portalPageId="MYPORTAL_EMPLOYEE" sequenceNum="0" portalPageName="Main" description="The OFBiz My Portal Main page" ownerUserLoginId="_NA_" securityGroupId="MYPORTAL_EMPLOYEE" />
+    <PortalPage portalPageId="MYPORTAL_EMPLOYEE1" sequenceNum="100" portalPageName="My Profile" description="The OFBiz My Portal Profile page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
+    <PortalPage portalPageId="MYPORTAL_EMPLOYEE2" sequenceNum="200" portalPageName="Other Communications" description="The OFBiz My Portal other commmunication page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
+    <PortalPage portalPageId="MYPORTAL_EMPLOYEE3" sequenceNum="300" portalPageName="Company Events" description="The OFBiz My Portal Company Events page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
+    <PortalPage portalPageId="MYPORTAL_EMPLOYEE4" sequenceNum="400" portalPageName="My Time Sheets" description="The OFBiz My Portal Timesheet page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
+    <PortalPage portalPageId="MYPORTAL_EMPLOYEE5" sequenceNum="500" portalPageName="My Tasks" description="The OFBiz My Portal My Task page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPLOYEE"/>
+    
+    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML" sequenceNum="0" portalPageName="Main" description="The default OFBiz portal page" ownerUserLoginId="_NA_" securityGroupId="MYPORTAL_EMPL-NOEML" />
+    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML1" sequenceNum="100" portalPageName="My Profile" description="The OFBiz My Portal Profile page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
+    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML2" sequenceNum="200" portalPageName="Other Communications" description="The OFBiz My Portal other commmunication page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
+    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML3" sequenceNum="300" portalPageName="Company Events" description="The OFBiz My Portal Company Events page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
+    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML4" sequenceNum="400" portalPageName="My Time Sheets" description="The OFBiz My Portal Timesheet page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
+    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML5" sequenceNum="500" portalPageName="My Tasks" description="The OFBiz My Portal My Task page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
+    
+    <PortalPage portalPageId="MYPORTAL_CUSTOMER" sequenceNum="0" portalPageName="Main" description="The default OFBiz portal page for a customers" ownerUserLoginId="_NA_" securityGroupId="MYPORTAL_CUSTOMER" />
+    <PortalPage portalPageId="MYPORTAL_CUSTOMER1" sequenceNum="100" portalPageName="My Profile" description="The OFBiz My Portal Profile page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_CUSTOMER" />
+    <PortalPage portalPageId="MYPORTAL_CUSTOMER2" sequenceNum="200" portalPageName="Invoices" description="The OFBiz My Portal Invoices page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_CUSTOMER" />
+    <PortalPage portalPageId="MYPORTAL_CUSTOMER3" sequenceNum="300" portalPageName="Projects" description="The OFBiz My Portal Project page" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_CUSTOMER" />
     
-    <PortalPageColumn portalPageId="MYPORTAL_NONE" columnSeqId="00001" />
+    <PortalPageColumn portalPageId="MYPORTAL_NONE" sequenceNum="0" columnSeqId="00001" />
     
     <PortalPageColumn portalPageId="MYPORTAL_EMPLOYEE" columnSeqId="00001" />
     <PortalPageColumn portalPageId="MYPORTAL_EMPLOYEE1" columnSeqId="00001" columnWidthPercentage="50" />

Modified: ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml?rev=744675&r1=744674&r2=744675&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/webapp/myportal/WEB-INF/controller.xml Sun Feb 15 15:10:50 2009
@@ -27,6 +27,10 @@
     
     <description>Show personal information in the system</description>
     
+    <request-map uri="main">
+        <security https="true" auth="true"/>
+        <response name="success" type="request-redirect-noparam" value="showPortalPage"/>
+    </request-map>
     <request-map uri="newRegisterLogin">
         <security https="true" auth="false"/>
         <event type="java" invoke="getCodeCaptcha" path="org.ofbiz.common.Captcha"/>
@@ -105,7 +109,7 @@
         <security https="true" auth="true"/>
         <event type="service" invoke="createCommunicationEvent"/>
         <response name="success" type="request" value="myCommunications"/>
-        <response name="error" type="view" value="main"/>
+        <response name="error" type="request-redirect" value="showPortalPage"/>
     </request-map>
     <request-map uri="deletePartyCommunicationEvent">
         <security https="true" auth="true"/>
@@ -140,7 +144,7 @@
         <security https="true" auth="true"/>
         <event type="service" invoke="setCommunicationEventRoleStatus"/>
         <response name="success" type="request" value="getToNextDonePage"/>
-        <response name="error" type="view" value="main"/>
+        <response name="error" type="request-redirect-noparam" value="showPortalPage"/>
     </request-map>
     <request-map uri="ViewCommunicationEvent">
         <security https="true" auth="true"/>
@@ -161,19 +165,19 @@
         <security https="true" auth="true"/>
         <event type="simple" invoke="createCommunicationEventRoles" path="org/ofbiz/myportal/Events.xml"/>
         <response name="success" type="request" value="getToNextDonePage"/>
-        <response name="error" type="view" value="main"/>
+        <response name="error" type="request-redirect-noparam" value="showPortalPage"/>
     </request-map>
     
     <request-map uri="getToNextDonePage">
         <security https="true" auth="true"/>
         <event type="simple" invoke="getToNextDonePage" path="org/ofbiz/myportal/Events.xml"/>
-        <response name="main" type="request" value="main"/>
+        <response name="main" type="request-redirect" value="showPortalPage"/>
         <response name="ViewCommunicationEvent" type="request" value="ViewCommunicationEvent"/>
         <response name="otherCommunications" type="request" value="otherCommunications"/>
         <response name="myTimesheet" type="request" value="myTimesheet"/>
         <response name="myTasks" type="request" value="myTasks"/>
         <response name="myCompanyComms" type="request" value="myCompanyComms"/>
-        <response name="error" type="view" value="main"/>
+        <response name="error" type="request-redirect-noparam" value="showPortalPage"/>
     </request-map>
     
     <!-- Create Customer Request-->
@@ -184,7 +188,7 @@
     <request-map uri="createrequest">
         <security https="true" auth="true"/>
         <event type="service" invoke="createCustRequest"/>
-        <response name="success" type="view" value="main"/>
+        <response name="error" type="request-redirect-noparam" value="showPortalPage"/>
         <response name="error" type="view" value="EditRequest"/>
     </request-map>
     <request-map uri="updateRequest">

Modified: ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml?rev=744675&r1=744674&r2=744675&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/widget/CommonScreens.xml Sun Feb 15 15:10:50 2009
@@ -34,22 +34,12 @@
                 <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="ProjectMgrUiLabels" map-name="uiLabelMap" global="true"/>
                 <property-map resource="HumanResUiLabels" map-name="uiLabelMap" global="true"/>
-                
                 <set field="layoutSettings.companyName" from-field="uiLabelMap.MyPortalInformation" global="true"/>
                 <set field="layoutSettings.companySubtitle" from-field="uiLabelMap.PartyCompanySubtitle" global="true"/>
-                <!-- layoutSettings.headerImageUrl can be used to specify an application specific logo; if not set,
-                    then the global layoutSettings.commonHeaderImageUrl (specified in GlobalDecorator) will be used. -->
-                <!--<set field="layoutSettings.headerImageUrl" value="/images/ofbiz_logo.jpg" global="true"/>-->
-                
-                <!-- <set field="layoutSettings.headerMiddleBackgroundUrl" value="" global="true"/> -->
-                <!-- <set field="layoutSettings.headerRightBackgroundUrl" value="" global="true"/> -->
-                <!-- TODO: Use transform to specify component URI -->
-                <!--set field="applicationMenuName" value="ExampleAppBar" global="true"/>
-                    <set field="applicationMenuLocation" value="component://example/widget/example/ExampleMenus.xml" global="true"/-->
-                <set field="appheaderTemplate" value="component://myportal/templates/appheader.ftl"/>
-                <set field="parameters.parentPortalPageId" value="MYPORTAL"/>
-                <set field="parameters.userLogin.userLoginId" from-field="userLogin.userLoginId"/>
-                <script location="component://common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy"/>
+                <set field="applicationMenuName" value="MyPortalAppBar" global="true"/>
+                <set field="applicationMenuLocation" value="component://myportal/widget/MyPortalMenus.xml" global="true"/>
+                <set field="parameters.parentPortalPageId" from-field="parameters.parentPortalPageId" default-value="MYPORTAL" global="true"/>
+                <script location="component://common/webcommon/WEB-INF/actions/includes/GetParentPortalPageId.groovy"/>
                 <entity-one entity-name="PartyNameView" value-field="partyNameView">
                     <field-map field-name="partyId" from-field="userLogin.partyId"/>
                 </entity-one>
@@ -155,15 +145,10 @@
 
     <screen name="main">
         <section>
-            <actions>
-                <set field="parameters.parentPortalPageId" value="MYPORTAL"/>
-                <script location="component://common/webcommon/WEB-INF/actions/includes/ShowPortalPage.groovy"/>
-                <set field="headerItem" from-field="parameters.portalPageId"/>
-            </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
-                        <platform-specific><html><html-template location="component://common/webcommon/portal/showPortalPage.ftl"/></html></platform-specific>
+                        <include-screen name="showPortalPageInclude" location="component://common/widget/PortalPageScreens.xml"/>
                     </decorator-section>
                 </decorator-screen>
             </widgets>

Modified: ofbiz/trunk/specialpurpose/myportal/widget/MyPortalMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/widget/MyPortalMenus.xml?rev=744675&r1=744674&r2=744675&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/widget/MyPortalMenus.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/widget/MyPortalMenus.xml Sun Feb 15 15:10:50 2009
@@ -18,8 +18,18 @@
 under the License.
 -->
 
-<menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-menu.xsd">
+<menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-menu.xsd">      
+    <menu name="MyPortalAppBar" title="${uiLabelMap.PageTitleMyPortal} ${partyNameView.personalTitle?if_exists} ${partyNameView.firstName?if_exists} ${partyNameView.middleName?if_exists} ${partyNameView.lastName?if_exists} ${partyNameView.groupName?if_exists}"
+        extends="CommonAppBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
+        <menu-item name="main" parent-portal-page-value="${parameters.parentPortalPageId}"/>
+        <menu-item name="Help" title="${uiLabelMap.CommonHelp}" align-style="opposed">
+            <link target="http://docs.ofbiz.org/display/OFBENDUSER/My+Portal?decorator=printable" target-window="new"/>
+        </menu-item>
+        <menu-item name="Preferences" title="${uiLabelMap.CommonPreferences}" align-style="opposed">
+            <link target="ManagePortalPages?parentPortalPageId=${parameters.parentPortalPageId}"/>
+        </menu-item>
+    </menu>
     <menu name="MyCompanyCommsMenu">
         <menu-item name="newEvent" title="${uiLabelMap.WorkEffortNewEvent}">
             <link target="newEvent?portalPageId=${parameters.portalPageId}"/>