ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hans...@apache.org
Subject svn commit: r745438 - in /ofbiz/trunk/framework/common: script/org/ofbiz/common/PortalPageServices.xml servicedef/services.xml webcommon/WEB-INF/actions/includes/ListPortalPages.groovy webcommon/WEB-INF/portal-controller.xml widget/PortalPageForms.xml
Date Wed, 18 Feb 2009 08:55:20 GMT
Author: hansbak
Date: Wed Feb 18 08:55:20 2009
New Revision: 745438

URL: http://svn.apache.org/viewvc?rev=745438&view=rev
Log:
allow changing the order of the portal pages, currently only for private pages(click first
on 'edit' to make the movement pictures show)

Modified:
    ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml
    ofbiz/trunk/framework/common/servicedef/services.xml
    ofbiz/trunk/framework/common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy
    ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml
    ofbiz/trunk/framework/common/widget/PortalPageForms.xml

Modified: ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml?rev=745438&r1=745437&r2=745438&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml (original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml Wed Feb 18
08:55:20 2009
@@ -105,23 +105,44 @@
     </simple-method>
     
     <simple-method method-name="createPortalPage" short-description="Create a new Portal
Page">
-        <make-value entity-name="PortalPage" value-field="newPortalPage"/>
-        <set-pk-fields map="parameters" value-field="newPortalPage"/>
-        <if-empty field="newPortalPage.portalPageId">
-            <sequenced-id sequence-name="PortalPage" field="newPortalPage.portalPageId"/>
-        </if-empty>
-        <set-nonpk-fields map="parameters" value-field="newPortalPage"/>
-        <set field="newPortalPage.ownerUserLoginId" from-field="parameters.userLogin.userLoginId"/>
-        <if-empty field="parameters.sequenceNum">
-            <make-next-seq-id value-field="newPortalPage" seq-field-name="sequenceNum"/>
-        </if-empty>
-        <create-value value-field="newPortalPage"/>  
-        <set field="newPortalPageColumn.portalPageId" from-field="newPortalPage.portalPageId"/>
-        <call-service service-name="addPortalPageColumn" in-map-name="newPortalPageColumn"/>
-        <field-to-result field="newPortalPage.portalPageId" result-name="portalPageId"/>
+        <if-not-empty field="parameters.portalPageName">
+            <make-value entity-name="PortalPage" value-field="newPortalPage"/>
+            <set-pk-fields map="parameters" value-field="newPortalPage"/>
+            <if-empty field="newPortalPage.portalPageId">
+                <sequenced-id sequence-name="PortalPage" field="newPortalPage.portalPageId"/>
+            </if-empty>
+            <set-nonpk-fields map="parameters" value-field="newPortalPage"/>
+            <set field="newPortalPage.ownerUserLoginId" from-field="parameters.userLogin.userLoginId"/>
+            <if-empty field="parameters.sequenceNum">
+                <make-next-seq-id value-field="newPortalPage" seq-field-name="sequenceNum"/>
+            </if-empty>
+            <create-value value-field="newPortalPage"/>  
+            <set field="newPortalPageColumn.portalPageId" from-field="newPortalPage.portalPageId"/>
+            <call-service service-name="addPortalPageColumn" in-map-name="newPortalPageColumn"/>
+            <field-to-result field="newPortalPage.portalPageId" result-name="portalPageId"/>
+        </if-not-empty>
     </simple-method>
     
     <simple-method method-name="deletePortalPage" short-description="Delete a Portal Page">
+        <entity-one entity-name="PortalPage" value-field="getPortalPage"/>
+        <if-not-empty field="getPortalPage.originalPortalPageId">
+            <entity-one entity-name="PortalPage" value-field="getOldSequenceNum">
+                <field-map field-name="portalPageId" from-field="getPortalPage.originalPortalPageId"/>
+            </entity-one>
+            <entity-condition entity-name="PortalPage" list="checkSequenceNums">
+                <condition-list combine="and">
+                    <condition-expr field-name="sequenceNum" operator="equals" from-field="getOldSequenceNum.sequenceNum"/>
+                    <condition-expr field-name="ownerUserLoginId" operator="equals" from-field="userLogin.userLoginId"/>
+                    <condition-expr field-name="parentPortalPageId" operator="equals"
from-field="parameters.parentPortalPageId"/>
+                </condition-list>
+            </entity-condition>
+            <first-from-list entry="checkSequenceNum" list="checkSequenceNums"/>
+            <if-not-empty field="checkSequenceNum.portalPageId">
+                <set field="first.portalPageId" from-field="checkSequenceNum.portalPageId"/>
+                <set field="first.sequenceNum" from-field="getPortalPage.sequenceNum"
type="Long"/>
+                <call-service service-name="updatePortalPage" in-map-name="first"/>
+            </if-not-empty>
+        </if-not-empty>
         <call-simple-method method-name="checkOwnerShip"/>
         <remove-related value-field="portalPage" relation-name="PortalPageColumn"/>
         <remove-related value-field="portalPage" relation-name="PortalPagePortlet"/>
@@ -200,5 +221,67 @@
         </if-compare>
         <store-value value-field="portalPagePortlet"/>
     </simple-method>
-
+    <simple-method method-name="updatePortalPageSeq" short-description="Update the portal
page sequence numbers">
+        <call-simple-method method-name="checkOwnerShip"/>
+        <entity-one entity-name="PortalPage" value-field="getSequenceNum"/>       
       
+        <if-compare field="parameters.mode" value="UP" operator="equals">
+            <entity-condition entity-name="PortalPage" list="getDatas">
+                <condition-list combine="and">
+                    <condition-expr field-name="sequenceNum" operator="less" from-field="getSequenceNum.sequenceNum"/>
+                    <condition-expr field-name="ownerUserLoginId" operator="equals" from-field="userLogin.userLoginId"/>
                   
+                    <condition-list combine="or">
+                        <condition-expr field-name="parentPortalPageId" operator="equals"
from-field="parameters.parentPortalPageId"/>
+                        <condition-expr field-name="originalPortalPageId" operator="equals"
from-field="parameters.parentPortalPageId"/>
+                    </condition-list>
+                </condition-list>
+                <order-by field-name="-sequenceNum"/>
+            </entity-condition>
+        </if-compare>
+        <if-compare field="parameters.mode" value="DWN" operator="equals">     
+            <entity-condition entity-name="PortalPage" list="getDatas">
+                <condition-list combine="and">
+                    <condition-expr field-name="sequenceNum" operator="greater" from-field="getSequenceNum.sequenceNum"/>
+                    <condition-expr field-name="ownerUserLoginId" operator="equals" from-field="userLogin.userLoginId"/>
+                    <condition-list combine="or">
+                        <condition-expr field-name="parentPortalPageId" operator="equals"
from-field="parameters.parentPortalPageId"/>
+                        <condition-expr field-name="originalPortalPageId" operator="equals"
from-field="parameters.parentPortalPageId"/>
+                    </condition-list>
+                </condition-list>
+                <order-by field-name="sequenceNum"/>
+            </entity-condition>
+        </if-compare>
+        <if-compare field="parameters.mode" value="TOP" operator="equals">
+            <entity-condition entity-name="PortalPage" list="getDatas">
+                <condition-list combine="and">
+                    <condition-expr field-name="sequenceNum" operator="less" from-field="getSequenceNum.sequenceNum"/>
+                    <condition-expr field-name="ownerUserLoginId" operator="equals" from-field="userLogin.userLoginId"/>
+                    <condition-list combine="or">
+                        <condition-expr field-name="parentPortalPageId" operator="equals"
from-field="parameters.parentPortalPageId"/>
+                        <condition-expr field-name="originalPortalPageId" operator="equals"
from-field="parameters.parentPortalPageId"/>
+                    </condition-list>
+                </condition-list>
+                <order-by field-name="sequenceNum"/>
+            </entity-condition>
+        </if-compare>
+        <if-compare field="parameters.mode" value="BOT" operator="equals">
+            <entity-condition entity-name="PortalPage" list="getDatas">
+                <condition-list combine="and">
+                    <condition-expr field-name="sequenceNum" operator="greater" from-field="getSequenceNum.sequenceNum"/>
+                    <condition-expr field-name="ownerUserLoginId" operator="equals" from-field="userLogin.userLoginId"/>
+                    <condition-list combine="or">
+                        <condition-expr field-name="parentPortalPageId" operator="equals"
from-field="parameters.parentPortalPageId"/>
+                        <condition-expr field-name="originalPortalPageId" operator="equals"
from-field="parameters.parentPortalPageId"/>
+                    </condition-list>
+                </condition-list>
+                <order-by field-name="-sequenceNum"/>
+            </entity-condition>
+        </if-compare>
+        <first-from-list entry="getData" list="getDatas"/>
+        <set field="portalPage.sequenceNum" from-field="getData.sequenceNum" type="Long"/>
+        <store-value value-field="portalPage"/>
+        <set field="first.portalPageId" from-field="getData.portalPageId"/>
+        <set field="first.sequenceNum" from-field="getSequenceNum.sequenceNum" type="Long"/>
+        <call-service service-name="updatePortalPage" in-map-name="first"/>
+    </simple-method>
+    
 </simple-methods>

Modified: ofbiz/trunk/framework/common/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?rev=745438&r1=745437&r2=745438&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services.xml Wed Feb 18 08:55:20 2009
@@ -623,13 +623,20 @@
         location="org/ofbiz/common/PortalPageServices.xml" invoke="deletePortalPage">
         <description>Delete a Portal Page, related colums and used portlets</description>
         <auto-attributes include="pk" mode="IN" optional="false"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
     </service>
     <service name="updatePortalPagePortletSeq" engine="simple" default-entity-name="PortalPagePortlet"
auth="true"
         location="org/ofbiz/common/PortalPageServices.xml" invoke="updatePortalPagePortletSeq">
         <auto-attributes mode="IN" include="pk"/>
         <attribute name="mode" type="String" mode="IN"/><!-- possible values: TOP,
BOTTOM, UP, DOWN -->
     </service>
-
+    <service name="updatePortalPageSeq" engine="simple" default-entity-name="PortalPage"
auth="true"
+        location="org/ofbiz/common/PortalPageServices.xml" invoke="updatePortalPageSeq">
+        <auto-attributes mode="IN" include="pk"/>
+        <auto-attributes include="nonpk" mode="IN" optional="true"/>
+        <attribute name="mode" type="String" mode="IN"/><!-- possible values: TOP,
BOTTOM, UP, DOWN -->
+    </service>
+    
     <!-- PortalPageColumn services -->
     <service name="addPortalPageColumn" default-entity-name="PortalPageColumn" engine="simple"
auth="true"
         location="org/ofbiz/common/PortalPageServices.xml" invoke="addPortalPageColumn">

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=745438&r1=745437&r2=745438&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
Wed Feb 18 08:55:20 2009
@@ -69,7 +69,27 @@
         }
     }
     
+    // get sequenceNumMin and sequenceNumMax
+    sequenceNumCond = 
+            EntityCondition.makeCondition([
+                EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS,
parameters.userLogin.userLoginId),                           
+                EntityCondition.makeCondition([
+                    EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS,
parentPortalPageId),
+                    EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS,
parentPortalPageId)
+                ],EntityOperator.OR),
+            ],EntityOperator.AND);
+    sequenceNums = delegator.findList("PortalPage", sequenceNumCond, null, ["sequenceNum"],
null, false);
+    if(sequenceNums){
+       parameters.sequenceNumMin = sequenceNums.get(0).sequenceNum;
+       parameters.sequenceNumMax = sequenceNums.get(sequenceNums.size()-1).sequenceNum;
+    }
+    else{
+       parameters.sequenceNumMin = "null";
+       parameters.sequenceNumMax = "null";
+    }
+    
     context.portalPages = portalPages;
     context.userLoginSecurityGroupId = userLoginSecurityGroupId;
+    parameters.portalPagesSize = portalPages.get(portalPages.size()-1).sequenceNum;
 }
 

Modified: ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml?rev=745438&r1=745437&r2=745438&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml (original)
+++ ofbiz/trunk/framework/common/webcommon/WEB-INF/portal-controller.xml Wed Feb 18 08:55:20
2009
@@ -113,6 +113,12 @@
         <response name="success" type="request" value="ManagePortalPages"/>
         <response name="error" type="request" value="ManagePortalPages"/>
     </request-map>
+    <request-map uri="updatePortalPageSeq">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updatePortalPageSeq"/>
+        <response name="success" type="request" value="ManagePortalPages"/>
+        <response name="error" type="request" value="ManagePortalPages"/>
+    </request-map>
 
     <!-- View Mappings -->
     <view-map name="showPortalPage" type="screen" page="component://common/widget/PortalPageScreens.xml#showPortalPage"/>

Modified: ofbiz/trunk/framework/common/widget/PortalPageForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortalPageForms.xml?rev=745438&r1=745437&r2=745438&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/PortalPageForms.xml (original)
+++ ofbiz/trunk/framework/common/widget/PortalPageForms.xml Wed Feb 18 08:55:20 2009
@@ -18,17 +18,22 @@
 under the License.
 -->
 
-<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
+<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="../../widget/dtd/widget-form.xsd">
 
     <form name="ListPortalPages" type="list" list-name="portalPages" paginate-target="ManagePortalPages"
separate-columns="true"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table
hover-bar">
-        <row-actions>
-            <set field="portalPageName" from-field="portalPageName" default-value="???"/>
-        </row-actions>
         <field name="portalPageId" title="${uiLabelMap.CommonEdit}">
             <hyperlink description="${uiLabelMap.CommonEdit}" target="ManagePortalPages?portalPageId=${portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}"/>
         </field>
+        <field name="top" title=" " use-when="(ownerUserLoginId.equals(&quot;_NA_&quot;))||(sequenceNum
== ${parameters.sequenceNumMin})"><hyperlink target="" description=""/></field>
+        <field name="bot" title=" " use-when="(ownerUserLoginId.equals(&quot;_NA_&quot;))||(sequenceNum
&gt;= ${parameters.sequenceNumMax})"><hyperlink target="" description=""/></field>
+        <field name="up" title=" " use-when="(ownerUserLoginId.equals(&quot;_NA_&quot;))||(sequenceNum
== ${parameters.sequenceNumMin})"><hyperlink target="" description=""/></field>
+        <field name="dwn" title=" " use-when="(ownerUserLoginId.equals(&quot;_NA_&quot;))||(sequenceNum
&gt;= ${parameters.sequenceNumMax})"><hyperlink target="" description=""/></field>
      
+        <field name="top" title=" " use-when="(!ownerUserLoginId.equals(&quot;_NA_&quot;))&amp;&amp;(sequenceNum
&gt; ${parameters.sequenceNumMin})"><hyperlink target="updatePortalPageSeq?mode=TOP&amp;portalPageId=${portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}"
image-location="/images/arrow-end-up-green.png"/></field>
+        <field name="bot" title=" " use-when="(!ownerUserLoginId.equals(&quot;_NA_&quot;))&amp;&amp;(sequenceNum
&lt; ${parameters.sequenceNumMax})"><hyperlink target="updatePortalPageSeq?mode=BOT&amp;portalPageId=${portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}"
image-location="/images/arrow-end-down-green.png"/></field>
+        <field name="up" title=" " use-when="(!ownerUserLoginId.equals(&quot;_NA_&quot;))&amp;&amp;(sequenceNum
&gt; ${parameters.sequenceNumMin})"><hyperlink target="updatePortalPageSeq?mode=UP&amp;portalPageId=${portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}"
image-location="/images/arrow-single-up-green.png"/></field>
+        <field name="dwn" title=" " use-when="(!ownerUserLoginId.equals(&quot;_NA_&quot;))&amp;&amp;(sequenceNum
&lt; ${parameters.sequenceNumMax})"><hyperlink target="updatePortalPageSeq?mode=DWN&amp;portalPageId=${portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}"
image-location="/images/arrow-single-down-green.png"/></field>
         <field name="portalPageName" use-when="ownerUserLoginId.equals(&quot;_NA_&quot;)"
title="${uiLabelMap.CommonName}" sort-field="true"><display/></field>
         <field name="portalPageName" use-when="!ownerUserLoginId.equals(&quot;_NA_&quot;)"
title="${uiLabelMap.CommonName}" id-name="portalPageName" widget-style="tabletext" sort-field="true">
             <display>
@@ -56,15 +61,11 @@
         </field>
     </form>
     
-    <form name="NewPortalPage" type="single" target="createPortalPage?mainPortalPageId=${parameters.portalPageId}">
-        <actions>
-            <script location="component://common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy"/>
-        </actions>
+    <form name="NewPortalPage" type="single" target="createPortalPage">
         <field name="parentPortalPageId"><hidden value="${parameters.parentPortalPageId}"/></field>
+        <field name="sequenceNum"><hidden value="${parameters.portalPagesSize+1}"/></field>
         <field name="portalPageName" position="1"><text/></field>
         <field name="description" position="2"><text/></field>
         <field name="createButton"><submit button-type="button"/></field>
-    </form>
-    
-    
+    </form>       
 </forms>



Mime
View raw message