svn commit: r742251 - in /ofbiz/trunk: framework/common/config/ framework/common/script/org/ofbiz/common/ framework/common/widget/ specialpurpose/myportal/data/

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

svn commit: r742251 - in /ofbiz/trunk: framework/common/config/ framework/common/script/org/ofbiz/common/ framework/common/widget/ specialpurpose/myportal/data/

hansbak-2
Author: hansbak
Date: Mon Feb  9 04:30:53 2009
New Revision: 742251

URL: http://svn.apache.org/viewvc?rev=742251&view=rev
Log:
some fault fixing and added check on ownership to portalPage services.

Modified:
    ofbiz/trunk/framework/common/config/CommonUiLabels.xml
    ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml
    ofbiz/trunk/framework/common/widget/PortalPageForms.xml
    ofbiz/trunk/framework/common/widget/PortalPageScreens.xml
    ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml

Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=742251&r1=742250&r2=742251&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Mon Feb  9 04:30:53 2009
@@ -4708,6 +4708,12 @@
         <value xml:lang="zh">人员</value>
         <value xml:lang="zh_CN">人</value>
     </property>
+    <property key="PortalPageNotFound">
+        <value xml:lang="en">This page (${parameters.portalPageId}) could not be found!</value>
+    </property>
+    <property key="PortalPageNotOwned">
+        <value xml:lang="en">The page '${portalPage.portalPageName}' [${portalPage.portalPageId}] is not owned by you, so cannot be changed!</value>
+    </property>
     <property key="CommonPostedBy">
         <value xml:lang="ar">مرسلة من</value>
         <value xml:lang="de">Übermittelt von</value>

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=742251&r1=742250&r2=742251&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml (original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml Mon Feb  9 04:30:53 2009
@@ -22,31 +22,22 @@
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd">
 
     <simple-method method-name="movePortletToPortalPage" short-description="Moves a PortalPortlet from the actual portalPage to a different one">
-        <entity-one entity-name="PortalPagePortlet" value-field="oldEntity" auto-field-map="true"/>      
-        <entity-one entity-name="PortalPage" value-field="getOwnerUserLoginId" auto-field-map="true">
-            <field-map field-name="portalPageId" from-field="parameters.newPortalPageId"/>
-        </entity-one>    
-        <check-errors/>
-        <if-compare field="getOwnerUserLoginId.ownerUserLoginId" value="_NA_" operator="equals">
-            <set field="parameters.portalPageId" from-field="parameters.newPortalPageId"/>
-            <call-simple-method method-name="copyIfRequiredSystemPage" xml-resource="component://common/script/org/ofbiz/common/PortalPageMethods.xml"/>
-            <set field="parameters.newPortalPageId" from-field="portalPageId"/>
-        </if-compare>
-
+        <call-simple-method method-name="checkOwnerShip"/>
+        <entity-one entity-name="PortalPagePortlet" value-field="oldEntity"/>
+        <set field="parameters.portalPageId" from-field="parameters.newPortalPageId"/>
+        <call-simple-method method-name="copyIfRequiredSystemPage" xml-resource="component://common/script/org/ofbiz/common/PortalPageMethods.xml"/>
+        <set field="parameters.newPortalPageId" from-field="portalPageId"/>
         <make-value value-field="newEntity" entity-name="PortalPagePortlet"/>
         <set field="newEntity.portalPortletId" from-field="parameters.portalPortletId"/>
         <set field="newEntity.portalPageId" from-field="parameters.newPortalPageId"/>
         <set field="newEntity.columnNum" value="1"/>
         <make-next-seq-id value-field="newEntity" seq-field-name="portletSeqId"/>
-
         <create-value value-field="newEntity"/>
-        <check-errors/>
-
         <remove-value value-field="oldEntity"/>
-        <check-errors/>
     </simple-method>
 
     <simple-method method-name="addPortalPageColumn" short-description="Add a new Column to a PortalPage">
+        <call-simple-method method-name="checkOwnerShip"/>
         <make-value entity-name="PortalPageColumn" value-field="newEntity"/>
         <set-pk-fields map="parameters" value-field="newEntity"/>
         <if-empty field="parameters.columnSeqId">
@@ -54,28 +45,28 @@
         </if-empty>
         <field-to-result field="newEntity.columnSeqId" result-name="columnSeqId"/>
         <set-nonpk-fields map="parameters" value-field="newEntity"/>
-        <create-value value-field="newEntity"/>  
+        <create-value value-field="newEntity"/>
     </simple-method>
-
+    
     <simple-method method-name="deletePortalPageColumn" short-description="Delete a Column from a PortalPage">
+        <call-simple-method method-name="checkOwnerShip"/>
         <entity-one entity-name="PortalPageColumn" value-field="column" auto-field-map="true" use-cache="true"/>
-
         <if-not-empty field="column">
             <entity-and entity-name="PortalPagePortlet" list="portalPortletList">
                 <field-map field-name="portalPageId" from-field="column.portalPageId"/>
                 <field-map field-name="columnSeqId"  from-field="column.columnSeqId"/>
             </entity-and>
-
             <iterate list="portalPortletList" entry="portalPortlet">
                 <set-service-fields service-name="deletePortalPagePortlet" to-map="deletePortalPagePortletInMap" map="portalPortlet"/>
                 <call-service service-name="deletePortalPagePortlet" in-map-name="deletePortalPagePortletInMap"/>
             </iterate>
-          
             <remove-value value-field="column"/>
         </if-not-empty>
+        <check-errors/>
     </simple-method>
-
+    
     <simple-method method-name="createPortalPagePortlet" short-description="Add a registered PortalPortlet to a PortalPage">
+        <call-simple-method method-name="checkOwnerShip"/>
         <make-value entity-name="PortalPagePortlet" value-field="newEntity"/>
         <set-pk-fields map="parameters" value-field="newEntity"/>
         <make-next-seq-id value-field="newEntity" seq-field-name="portletSeqId"/>
@@ -85,19 +76,18 @@
         <make-value entity-name="PortalPageColumn" value-field="newEntity1"/>
         <set-pk-fields map="parameters" value-field="newEntity1"/>
         <make-next-seq-id value-field="newEntity1" seq-field-name="columnSeqId"/>
-        <create-value value-field="newEntity1"/>  
+        <create-value value-field="newEntity1"/>
     </simple-method>
-
+    
     <simple-method method-name="deletePortalPagePortlet" short-description="Delete a PortalPortlet from a PortalPageColumn">
+        <call-simple-method method-name="checkOwnerShip"/>
         <entity-one entity-name="PortalPagePortlet" value-field="portlet" auto-field-map="true" use-cache="true"/>
-
         <if-not-empty field="portlet">
             <make-value value-field="newEntity" entity-name="PortletAttribute"/>
             <set field="newEntity.portalPageId" from-field="portlet.portalPageId"/>
             <set field="newEntity.portalPortletId" from-field="portlet.portalPortletId"/>
             <set field="newEntity.portletSeqId" from-field="portlet.portletSeqId"/>
             <remove-by-and entity-name="PortletAttribute" map="newEntity"/>
-            
             <remove-value value-field="portlet"/>
         </if-not-empty>
     </simple-method>
@@ -123,23 +113,34 @@
         <set-nonpk-fields map="parameters" value-field="newPortalPage"/>
         <set field="newPortalPage.ownerUserLoginId" from-field="parameters.userLogin.userLoginId"/>
         <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"/>
     </simple-method>
     
     <simple-method method-name="deletePortalPage" short-description="Delete a Portal Page">
-        <entity-one entity-name="PortalPage" value-field="portalPage"/>
-        <if-not-empty field="portalPage">
-            <if-compare field="portalPage.ownerUserLoginId" value="_NA_" operator="not-equals">
-                <remove-related value-field="portalPage" relation-name="PortalPageColumn"/>
-                <remove-related value-field="portalPage" relation-name="PortalPagePortlet"/>
-                <remove-value value-field="portalPage"/>
+        <call-simple-method method-name="checkOwnerShip"/>
+        <remove-related value-field="portalPage" relation-name="PortalPageColumn"/>
+        <remove-related value-field="portalPage" relation-name="PortalPagePortlet"/>
+        <remove-value value-field="portalPage"/>
+    </simple-method>
+
+    <simple-method method-name="checkOwnerShip" short-description="Check the ownership of a Portal Page">
+        <if-not-empty field="parameters.portalPageId">
+            <entity-one entity-name="PortalPage" value-field="portalPage"/>
+            <if-empty field="portalPage">
+                <add-error>
+                    <fail-property resource="CommonUiLabels" property="PortalPageNotFound"/>
+                </add-error>
+            </if-empty>
+            <check-errors/>
+            <if-compare field="portalPage.ownerUserLoginId" operator="not-equals" value="${parameters.userLogin.userLoginId}">
+                <add-error>
+                    <fail-property resource="CommonUiLabels" property="PortalPageNotOwned"/>
+                </add-error>
             </if-compare>
+            <check-errors/>
         </if-not-empty>
-
     </simple-method>
 
 </simple-methods>

Modified: ofbiz/trunk/framework/common/widget/PortalPageForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortalPageForms.xml?rev=742251&r1=742250&r2=742251&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/PortalPageForms.xml (original)
+++ ofbiz/trunk/framework/common/widget/PortalPageForms.xml Mon Feb  9 04:30:53 2009
@@ -23,10 +23,6 @@
 
     <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">
-        <actions>
-            <script location="component://common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy"/>
-        </actions>
-        
         <field name="portalPageId" title="${uiLabelMap.CommonEdit}">
             <hyperlink description="${uiLabelMap.CommonEdit}" target="ManagePortalPages?portalPageId=${portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}"/>
         </field>
@@ -41,7 +37,7 @@
         </field>
         <field name="description" use-when="ownerUserLoginId.equals(&quot;_NA_&quot;)" title="${uiLabelMap.CommonDescription}" widget-style="tabletext" sort-field="true"><display/></field>
         <field name="description" use-when="!ownerUserLoginId.equals(&quot;_NA_&quot;)" title="${uiLabelMap.CommonDescription}" id-name="portalDescription" widget-style="tabletext" sort-field="true">
-                <display>
+            <display>
                 <in-place-editor url="updatePortalPage" cancel-control="button" saving-text="Updating..." text-between-controls=" ">
                     <simple-editor/>
                     <field-map field-name="portalPageId" from-field="portalPageId"/>
@@ -50,10 +46,10 @@
         </field>
         <field name="originalPortalPageId"><display-entity entity-name="PortalPage" description="${portalPageName} [${portalPageId}]" key-field-name="portalPageId"/></field>
         <field name="deleteLink" use-when="!ownerUserLoginId.equals(&quot;_NA_&quot;)" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext" >
-            <hyperlink target="deletePortalPage?portalPageId=${portalPageId}&amp;parentPortalPageId=${parameters.portalPageId}" description="${uiLabelMap.CommonDelete}"/>
+            <hyperlink target="deletePortalPage?portalPageId=${portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}" description="${uiLabelMap.CommonDelete}"/>
         </field>
         <field name="deleteLink" use-when="!ownerUserLoginId.equals(&quot;_NA_&quot;)&amp;&amp;originalPortalPageId!=null" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext" >
-            <hyperlink target="deletePortalPage?portalPageId=${parameters.portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}" description="${uiLabelMap.CommonRevertPortalPage}"/>
+            <hyperlink target="deletePortalPage?portalPageId=${portalPageId}&amp;parentPortalPageId=${parameters.parentPortalPageId}" description="${uiLabelMap.CommonRevertPortalPage}"/>
         </field>
     </form>
     

Modified: ofbiz/trunk/framework/common/widget/PortalPageScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/widget/PortalPageScreens.xml?rev=742251&r1=742250&r2=742251&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/widget/PortalPageScreens.xml (original)
+++ ofbiz/trunk/framework/common/widget/PortalPageScreens.xml Mon Feb  9 04:30:53 2009
@@ -41,6 +41,7 @@
         <section>
             <actions>
                 <entity-one entity-name="PortalPage" value-field="portalPage"/>
+                <script location="component://common/webcommon/WEB-INF/actions/includes/ListPortalPages.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">

Modified: ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml?rev=742251&r1=742250&r2=742251&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml Mon Feb  9 04:30:53 2009
@@ -33,14 +33,14 @@
     <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 communications" description="The OFBiz My Portal Company 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" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
     <PortalPage portalPageId="MYPORTAL_EMPL-NOEML2" sequenceNum="03" portalPageName="Other Communications" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
-    <PortalPage portalPageId="MYPORTAL_EMPL-NOEML3" sequenceNum="04" portalPageName="Company communications" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
+    <PortalPage portalPageId="MYPORTAL_EMPLOYEE3" 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" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>
     <PortalPage portalPageId="MYPORTAL_EMPL-NOEML5" sequenceNum="06" portalPageName="My Tasks" ownerUserLoginId="_NA_" parentPortalPageId="MYPORTAL_EMPL-NOEML"/>