svn commit: r788048 - in /ofbiz/trunk: applications/commonext/data/ applications/commonext/script/org/ofbiz/ applications/commonext/widget/ framework/common/entitydef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/

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

svn commit: r788048 - in /ofbiz/trunk: applications/commonext/data/ applications/commonext/script/org/ofbiz/ applications/commonext/widget/ framework/common/entitydef/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/

hansbak-2
Author: hansbak
Date: Wed Jun 24 15:07:27 2009
New Revision: 788048

URL: http://svn.apache.org/viewvc?rev=788048&view=rev
Log:
added a portlet edit form to configure which system notes should be sent

Modified:
    ofbiz/trunk/applications/commonext/data/SystemInfoPortletData.xml
    ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml
    ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml
    ofbiz/trunk/framework/common/entitydef/entitymodel.xml
    ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageMethods.xml
    ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml
    ofbiz/trunk/framework/common/servicedef/services.xml

Modified: ofbiz/trunk/applications/commonext/data/SystemInfoPortletData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/data/SystemInfoPortletData.xml?rev=788048&r1=788047&r2=788048&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/data/SystemInfoPortletData.xml (original)
+++ ofbiz/trunk/applications/commonext/data/SystemInfoPortletData.xml Wed Jun 24 15:07:27 2009
@@ -24,7 +24,8 @@
     <PortalPortlet portalPortletId="SystemInfoNotes"
         portletName="System notes reporting an event"
         screenName="SystemInfoNotes"
-        screenLocation="component://commonext/widget/SystemInfoScreens.xml" description="List of system notes for this specific party"/>
+        screenLocation="component://commonext/widget/SystemInfoScreens.xml" description="List of system notes for this specific party"
+        editFormName="EditSysInfoPortletParams" editFormLocation="component://commonext/widget/SystemInfoForms.xml"/>
     <PortletPortletCategory portalPortletId="SystemInfoNotes" portletCategoryId="SYSTEMINFO"/>
     
     <PortalPortlet portalPortletId="SystemInfoStatus"

Modified: ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml?rev=788048&r1=788047&r2=788048&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml (original)
+++ ofbiz/trunk/applications/commonext/script/org/ofbiz/SystemInfoServices.xml Wed Jun 24 15:07:27 2009
@@ -34,38 +34,79 @@
             <if-not-empty field="roles">
                 <iterate entry="role" list="roles">
                     <if-compare field="role.statusId" value="COM_ROLE_CREATED" operator="equals">
-                        <make-value value-field="noteData" entity-name="NoteData"/>
-                        <set field="noteData.noteParty" from-field="role.partyId"/>
-                        <set field="noteData.noteName" value="SYSTEMNOTE"/>
-                        <now-timestamp field="noteData.noteDateTime"/>
-                        <sequenced-id sequence-name="NoteData" field="noteData.noteId"/>
-                        <set field="noteData.noteInfo" value="New incoming communication event: ${comm.subject} from ${comm.partyIdFrom}"/>
-                        <set field="noteData.moreInfoPortletId" value="MyCommunications"/>
-                        <create-value value-field="noteData"/>
-                    </if-compare>
+                        <set field="partyId" from-field="role.partyId"/>
+                        <call-simple-method method-name="getPortletAttributeMap"/>
+                        <log level="always" message="==========allNotificationsattrib: ${attributeMap.allNotifications}"></log>
+                        <if>
+                            <condition>
+                                <and>
+                                    <if-compare field="attributeMap.allNotifications" value="Y" operator="not-equals"/>
+                                    <or>
+                                        <and>
+                                            <if-compare field="attributeMap.incomingEmail" value="Y" operator="not-equals"/>
+                                            <if-compare field="comm.communicationEventTypeId" value="AUTO_EMAIL" operator="equals"/>
+                                        </and>
+                                        <and>
+                                            <if-compare field="attributeMap.email" value="Y" operator="not-equals"/>
+                                            <or>
+                                                <if-compare field="comm.communicationEventTypeId" value="AUTO_EMAIL_COMM" operator="equals"/>
+                                                <if-compare field="comm.communicationEventTypeId" value="EMAIL_COMMUNICATION" operator="equals"/>
+                                            </or>
+                                        </and>
+                                        <and>
+                                            <if-compare field="attributeMap.internalNotes" value="Y" operator="not-equals"/>
+                                            <if-compare field="comm.communicationEventTypeId" value="COMMENT_NOTE" operator="equals"/>
+                                        </and>
+                                    </or>
+                                </and>    
+                            </condition>
+                            <then>
+                                <make-value value-field="noteData" entity-name="NoteData"/>
+                                <set field="noteData.noteParty" from-field="role.partyId"/>
+                                <set field="noteData.noteName" value="SYSTEMNOTE"/>
+                                <now-timestamp field="noteData.noteDateTime"/>
+                                <sequenced-id sequence-name="NoteData" field="noteData.noteId"/>
+                                <set field="noteData.noteInfo" value="New incoming communication event: ${comm.subject} from ${comm.partyIdFrom}"/>
+                                <set field="noteData.moreInfoPortletId" value="MyCommunications"/>
+                                <create-value value-field="noteData"/>
+                            </then>
+                        </if>
+                    </if-compare>                        
                 </iterate>
             </if-not-empty>
         </if-compare>
         
         <!-- new task assignments for the logged on user -->
         <if-compare field="parameters.entityName" value="WorkEffortPartyAssignment" operator="equals">
-            <entity-one entity-name="WorkEffort" value-field="workEffort">
-                <field-map field-name="workEffortId" from-field="parameters.entityNameId"/>
-            </entity-one>
-            <make-value value-field="noteData" entity-name="NoteData"/>
-            <set field="noteData.noteParty" from-field="partyId"/>
-            <set field="noteData.noteName" value="SYSTEMNOTE"/>
-            <now-timestamp field="noteData.noteDateTime"/>
-            <set field="noteData.noteInfo" value="New task assignment '${workEffort.workEffortName}' [${workEffort.workEffortId}]"/>
-            <sequenced-id sequence-name="NoteData" field="noteData.noteId"/>
-            <set field="noteData.moreInfoPortletId" value="mytasks"/>
-            <create-value value-field="noteData"/>
+            <call-simple-method method-name="getPortletAttributeMap"/>
+            <if-compare field="attributeMap.taskAssignment" value="Y" operator="not-equals">
+                <entity-one entity-name="WorkEffort" value-field="workEffort">
+                    <field-map field-name="workEffortId" from-field="parameters.entityNameId"/>
+                </entity-one>
+                <make-value value-field="noteData" entity-name="NoteData"/>
+                <set field="noteData.noteParty" from-field="partyId"/>
+                <set field="noteData.noteName" value="SYSTEMNOTE"/>
+                <now-timestamp field="noteData.noteDateTime"/>
+                <set field="noteData.noteInfo" value="New task assignment '${workEffort.workEffortName}' [${workEffort.workEffortId}]"/>
+                <sequenced-id sequence-name="NoteData" field="noteData.noteId"/>
+                <set field="noteData.moreInfoPortletId" value="mytasks"/>
+                <create-value value-field="noteData"/>
+            </if-compare>
         </if-compare>
         
-        <if-empty field="noteData">
-            <log level="error" message="No logic to create system note for entity name: ${parameters.entityName} "/>
-        </if-empty>
-    
+    </simple-method>
+
+    <simple-method method-name="getPortletAttributeMap" short-description="get the attributes of the SystemInfoNotes portlet for a userlogin">
+        <!-- get the portlet settings: works only if portlet is used only one time and the user only has a single userLogin -->
+        <entity-and entity-name="UserLogin" list="ulList">
+            <field-map field-name="partyId" from-field="partyId"/>
+        </entity-and>
+        <first-from-list entry="userLogin" list="ulList"/>
+        <set field="paMap.ownerUserLoginId" from-field="userLogin.userLoginId"/>
+        <set field="paMap.portalPortletId" value="SystemInfoNotes"/>
+        <call-service service-name="getPortletAttributes" in-map-name="paMap">
+            <result-to-field result-name="attributeMap" field="attributeMap"/>
+        </call-service>
     </simple-method>
 
     <simple-method method-name="deleteAllSystemNotes" short-description="delete all system notes from a particular user">

Modified: ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml?rev=788048&r1=788047&r2=788048&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml (original)
+++ ofbiz/trunk/applications/commonext/widget/SystemInfoForms.xml Wed Jun 24 15:07:27 2009
@@ -26,6 +26,16 @@
         <field name="noteDateTime" title="Date info created"><display type="date-time"/></field>
         <field name="noteInfo" title="System Info Note"><hyperlink target="/myportal/control/showPortletDecorator?portalPortletId=${moreInfoPortletId}" target-type="inter-app" description="${noteInfo}"></hyperlink></field>
     </form>
+    
+    <form name="EditSysInfoPortletParams" extends="CommonPortletEdit" extends-resource="component://common/widget/PortletEditForms.xml">
+        <field name="dummy" title="BLOCK the following notifications:"><display/></field>
+        <field name="allNotifications" entry-name="attributeMap.allNotifications"><check/></field>
+        <field name="email" entry-name="attributeMap.email"><check/></field>
+        <field name="internalNotes" entry-name="attributeMap.internalNotes"><check/></field>
+        <field name="telephoneForwards" entry-name="attributeMap.telephoneForwards"><check/></field>
+        <field name="taskAssignment" entry-name="attributeMap.taskAssignment"><check/></field>
+        <field name="updateButton"><submit/></field>
+    </form>
 
     <form name="SystemInfoStatus" type="list" list-name="systemInfoStatus"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">

Modified: ofbiz/trunk/framework/common/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/entitydef/entitymodel.xml?rev=788048&r1=788047&r2=788048&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/framework/common/entitydef/entitymodel.xml Wed Jun 24 15:07:27 2009
@@ -698,7 +698,7 @@
             <key-map field-name="columnSeqId"/>
         </relation>
     </entity>
-    <view-entity entity-name="PortalPagePortletView" package-name="org.ofbiz.common.portal" title="View entity to have all Portal and Portlet information">
+    <view-entity entity-name="PortalPagePortletView" package-name="org.ofbiz.common.portal" title="View entity to have all Portlet information with portalPageId ">
         <member-entity entity-alias="PPGPTLT" entity-name="PortalPagePortlet"/>
         <member-entity entity-alias="PTLT" entity-name="PortalPortlet"/>
         <alias-all entity-alias="PPGPTLT"/>
@@ -722,4 +722,14 @@
             <key-map field-name="portalPortletId"/>
         </relation>
     </entity>
+
+    <view-entity entity-name="PortalPageAndPortlet" package-name="org.ofbiz.common.portal" title="View entity to have all Portal and Portlet information">
+        <member-entity entity-alias="PP" entity-name="PortalPage"/>
+        <member-entity entity-alias="PPP" entity-name="PortalPagePortlet"/>
+        <alias-all entity-alias="PP"/>
+        <alias-all entity-alias="PPP"/>
+        <view-link entity-alias="PP" rel-entity-alias="PPP">
+            <key-map field-name="portalPageId"/>
+        </view-link>
+    </view-entity>
 </entitymodel>

Modified: ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageMethods.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageMethods.xml?rev=788048&r1=788047&r2=788048&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageMethods.xml (original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageMethods.xml Wed Jun 24 15:07:27 2009
@@ -41,32 +41,44 @@
     <simple-method method-name="setPortalPortletAttributes" short-description="Sets a PortalPortlet attributes">
         <if-not-empty field="parameters">
             <iterate-map map="parameters" key="attributeKey" value="attributeValue">
-                <if-not-empty field="attributeKey">
-                    <if>
-                        <condition>
-                            <and>
-                                <if-compare field="attributeKey"  operator="not-equals" value="portalPageId"/>
-                                <if-compare field="attributeKey"  operator="not-equals" value="portalPortletId"/>
-                                <if-compare field="attributeKey"  operator="not-equals" value="portletSeqId"/>
-                            </and>
-                        </condition>
-                        <then>
-                            <clear-field field="attributeEntityMap"/>
-                            <set-service-fields service-name="createPortletAttribute" to-map="attributeEntityMap" map="parameters"/>
-                            <set field="attributeEntityMap.attrName"  from-field="attributeKey"/>
-                            <set field="attributeEntityMap.attrValue" from-field="attributeValue"/>
-
-                            <entity-one entity-name="PortletAttribute" value-field="attributeItem">
-                                <field-map field-name="attrName" from-field="attributeEntityMap.attrName"/>
-                            </entity-one>
-                            <if-not-empty field="attributeItem">
-                                <remove-value value-field="attributeItem"/>
-                            </if-not-empty>
-
-                            <call-service in-map-name="attributeEntityMap" service-name="createPortletAttribute"/>
-                        </then>
-                    </if>
-                </if-not-empty>
+                <if>
+                    <condition>
+                        <and>
+                            <if-compare field="attributeKey"  operator="not-equals" value="portalPageId"/>
+                            <if-compare field="attributeKey"  operator="not-equals" value="portalPortletId"/>
+                            <if-compare field="attributeKey"  operator="not-equals" value="portletSeqId"/>
+                        </and>
+                    </condition>
+                    <then>
+                        <log level="always" message="===2==processing: ${attributeKey}"></log>
+                        <clear-field field="attributeEntityMap"/>
+                        <set-service-fields service-name="createPortletAttribute" map="parameters" to-map="attributeEntityMap"/>
+                        <set field="attributeEntityMap.attrName"  from-field="attributeKey"/>
+                        <set field="attributeEntityMap.attrValue" from-field="attributeValue"/>
+                        
+                        <entity-one entity-name="PortletAttribute" value-field="attributeItem">
+                            <field-map field-name="attrName" from-field="attributeEntityMap.attrName"/>
+                        </entity-one>
+                        <if-not-empty field="attributeItem">
+                            <remove-value value-field="attributeItem"/>
+                        </if-not-empty>
+                        <call-service service-name="createPortletAttribute" in-map-name="attributeEntityMap"/>
+                        <!-- remove all attributes which were not provided -->
+                        <entity-condition entity-name="PortletAttribute" list="attributeList">
+                            <condition-list combine="and">
+                                <condition-expr field-name="portalPageId" operator="equals" from-field="parameters.portalPageId"/>                
+                                <condition-expr field-name="portalPortletId" operator="equals" from-field="parameters.portalPortletId"/>                
+                                <condition-expr field-name="portletSeqId" operator="equals" from-field="parameters.portletSeqId" ignore-if-null="true"/>                
+                            </condition-list>
+                        </entity-condition>
+                        <!-- remove all not supplied attributes -->
+                        <iterate entry="attribute" list="attributeList">
+                            <if-empty field="parameters.${attribute.attrName}">
+                                <remove-value value-field="attribute"/>
+                            </if-empty>
+                        </iterate>                        
+                    </then>
+                </if>
             </iterate-map>
         </if-not-empty>
     </simple-method>

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=788048&r1=788047&r2=788048&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml (original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/PortalPageServices.xml Wed Jun 24 15:07:27 2009
@@ -92,16 +92,35 @@
         </if-not-empty>
     </simple-method>
 
-    <simple-method method-name="getPortletAttributes" short-description="Get all attributes of a Portlet" login-required="true">
-        <entity-and entity-name="PortletAttribute" list="attributeList">
-            <field-map field-name="portalPageId" from-field="parameters.portalPageId"/>
-            <field-map field-name="portalPortletId" from-field="parameters.portalPortletId"/>
-            <field-map field-name="portletSeqId" from-field="parameters.portletSeqId"/>
-        </entity-and>
-        <iterate list="attributeList" entry="attributeRecord">
-            <set field="attributeMap.${attributeRecord.attrName}" from-field="attributeRecord.attrValue"/>
-        </iterate>
-        <field-to-result field="attributeMap" result-name="attributeMap"/>
+    <simple-method method-name="getPortletAttributes" short-description="Get all attributes of a Portlet either by providing userLogin or portalPageid with portalPortletId" login-required="true">
+        <if-empty field="parameters.ownerUserLoginId">
+            <if-empty field="parameters.portalPageId">
+                <log level="error" message="Service getPortletAttributes did not receive either ownerUserLoginId OR portalPageId"></log>
+                <return response-code="error"/>
+            </if-empty>
+        </if-empty>
+        <!-- if userLogin provided get the portalPageId with the required portlet -->
+        <if-not-empty field="parameters.ownerUserLoginId">
+            <entity-and entity-name="PortalPageAndPortlet" list="ppList">
+                <field-map field-name="ownerUserLoginId" from-field="parameters.ownerUserLoginId"/>
+                <field-map field-name="portalPortletId"  from-field="parameters.portalPortletId"/>
+            </entity-and>
+            <first-from-list entry="portalPage" list="ppList"/>
+            <set field="parameters.portalPageId" from-field="portalPage.portalPageId"/>
+        </if-not-empty>
+        <entity-condition entity-name="PortletAttribute" list="attributeList">
+            <condition-list combine="and">
+                <condition-expr field-name="portalPageId" operator="equals" from-field="parameters.portalPageId"/>                
+                <condition-expr field-name="portalPortletId" operator="equals" from-field="parameters.portalPortletId"/>                
+                <condition-expr field-name="portletSeqId" operator="equals" from-field="parameters.portletSeqId" ignore-if-empty="true"/>                
+            </condition-list>
+        </entity-condition>
+        <if-not-empty field="attributeList">
+            <iterate list="attributeList" entry="attributeRecord">
+                <set field="attributeMap.${attributeRecord.attrName}" from-field="attributeRecord.attrValue"/>
+            </iterate>
+            <field-to-result field="attributeMap" result-name="attributeMap"/>
+        </if-not-empty>
     </simple-method>
 
     <simple-method method-name="createPortalPage" short-description="Create a new Portal Page">

Modified: ofbiz/trunk/framework/common/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?rev=788048&r1=788047&r2=788048&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services.xml Wed Jun 24 15:07:27 2009
@@ -637,9 +637,10 @@
     <service name="getPortletAttributes" engine="simple" auth="true"
         location="component://common/script/org/ofbiz/common/PortalPageServices.xml" invoke="getPortletAttributes">
         <description>Get all attributes of a Portlet</description>
-        <attribute name="portalPageId" type="String" mode="IN" optional="false"/>
+        <attribute name="portalPageId" type="String" mode="IN" optional="true"/>
+        <attribute name="ownerUserLoginId" type="String" mode="IN" optional="true"/>
         <attribute name="portalPortletId" type="String" mode="IN" optional="false"/>
-        <attribute name="portletSeqId" type="String" mode="IN" optional="false"/>
+        <attribute name="portletSeqId" type="String" mode="IN" optional="true"/>
         <attribute name="attributeMap" type="Map" mode="OUT" optional="true"/>
     </service>
 </services>