svn commit: r774654 - in /ofbiz/trunk/applications/marketing: entitydef/ script/org/ofbiz/marketing/contact/ servicedef/ webapp/marketing/WEB-INF/ webapp/marketing/contact/ widget/

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

svn commit: r774654 - in /ofbiz/trunk/applications/marketing: entitydef/ script/org/ofbiz/marketing/contact/ servicedef/ webapp/marketing/WEB-INF/ webapp/marketing/contact/ widget/

jaz-3
Author: jaz
Date: Thu May 14 06:32:21 2009
New Revision: 774654

URL: http://svn.apache.org/viewvc?rev=774654&view=rev
Log:
implemented request URL and configurable view (per contact list) to handle "linked" opt-out requests from within a communication event mailing

inside the comm event message content, include a link like:
<a href="http://localhost:8080/marketing/control/contactListOptOut?communicationEventId=${communicationEventId}">Opt-Out</a>



Modified:
    ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml
    ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml
    ofbiz/trunk/applications/marketing/servicedef/services.xml
    ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/controller.xml
    ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml
    ofbiz/trunk/applications/marketing/widget/ContactListScreens.xml

Modified: ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml?rev=774654&r1=774653&r2=774654&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/marketing/entitydef/entitymodel.xml Thu May 14 06:32:21 2009
@@ -158,11 +158,12 @@
       <field name="comments" type="comment"></field>
       <field name="isPublic" type="indicator"></field>
       <field name="singleUse" type="indicator"><description>Wether members of the list should be contacted only once.</description></field>
-      <field name="ownerPartyId" type="id"></field>
+      <field name="ownerPartyId" type="id"></field>      
       <field name="verifyEmailFrom" type="long-varchar"></field>
       <field name="verifyEmailScreen" type="long-varchar"></field>
       <field name="verifyEmailSubject" type="long-varchar"></field>
       <field name="verifyEmailWebSiteId" type="id"></field>
+      <field name="optOutScreen" type="long-varchar"></field>
       <field name="createdByUserLogin" type="id-vlong"></field>
       <field name="lastModifiedByUserLogin" type="id-vlong"></field>
       <prim-key field="contactListId"/>

Modified: ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml?rev=774654&r1=774653&r2=774654&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml (original)
+++ ofbiz/trunk/applications/marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml Thu May 14 06:32:21 2009
@@ -228,8 +228,7 @@
             </then>
         </else-if>
         </if>
-        
-        <log level="info" message="Wrote record : ${newEntity}"/>
+                
         <create-value value-field="newEntity"/>
     </simple-method>
 
@@ -296,6 +295,35 @@
         </if>
     </simple-method>
     
+    <!-- service to use in contact list communications to handle opt-out links based on the communication event sent -->
+    <simple-method method-name="optOutOfListFromCommEvent" short-description="Contact List Opt Out From Communication Event" login-required="false">
+        <entity-one value-field="commEvent" entity-name="CommunicationEvent"/>
+        <if>
+            <condition>
+                <and>                    
+                    <not><if-empty field="commEvent"/></not>
+                    <not><if-empty field="commEvent.contactListId"/></not>
+                    <not><if-empty field="commEvent.partyIdTo"/></not>
+                    <not><if-empty field="commEvent.contactMechIdTo"/></not>
+                </and>
+            </condition>
+            <then>
+                <now-timestamp field="nowTimestamp"/>
+                <entity-and list="contactListPartyList" entity-name="ContactListParty">
+                    <field-map field-name="contactListId" from-field="commEvent.contactListId"/>
+                    <field-map field-name="preferredContactMechId" from-field="commEvent.contactMechIdTo"/>
+                    <field-map field-name="partyId" from-field="commEvent.partyIdTo"/>                    
+                </entity-and>
+                <filter-list-by-date list="contactListPartyList"/>
+                <iterate entry="contactListParty" list="contactListPartyList">
+                    <set field="contactListParty.thruDate" from-field="nowTimestamp"/>
+                    <store-value value-field="contactListParty"/>
+                </iterate>                                
+            </then>
+        </if>
+        <field-to-result field="commEvent.contactListId" result-name="contactListId"/>        
+    </simple-method>
+    
     <simple-method method-name="updateContactListCommStatus" short-description="Update ContactList Communication Status">        
         <entity-one entity-name="ContactListCommStatus" value-field="lookedUpValue" auto-field-map="true"/>
         <if-empty field="lookedUpValue">

Modified: ofbiz/trunk/applications/marketing/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/servicedef/services.xml?rev=774654&r1=774653&r2=774654&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/marketing/servicedef/services.xml Thu May 14 06:32:21 2009
@@ -174,6 +174,12 @@
         <description>Send ContactListParty Verify Email</description>
         <auto-attributes entity-name="ContactListParty" include="pk" mode="IN" optional="false"/>
     </service>
+    <service name="optOutOfListFromCommEvent" engine="simple"
+            location="component://marketing/script/org/ofbiz/marketing/contact/ContactListServices.xml" invoke="optOutOfListFromCommEvent" auth="false">
+        <description>Uses the communication event infromation to locate the contact list party information and removes the contact from the list</description>
+        <attribute name="communicationEventId" type="String" mode="IN" optional="false"/>
+        <attribute name="contactListId" type="String" mode="OUT" optional="true"/>
+    </service>
 
     <!--  ContactList Comm Status Services -->
     <service name="updateContactListCommStatus" engine="simple" default-entity-name="ContactListCommStatus"

Modified: ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/controller.xml?rev=774654&r1=774653&r2=774654&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/marketing/webapp/marketing/WEB-INF/controller.xml Thu May 14 06:32:21 2009
@@ -320,6 +320,10 @@
         <response name="success" type="view" value="ListContactListParties"/>
         <response name="error" type="view" value="ListContactListParties"/>
     </request-map>
+    <request-map uri="contactListOptOut" track-serverhit="false" track-visit="false">
+        <security https="true" auth="false"/>        
+        <response name="success" type="view" value="ContactListOptOut"/>
+    </request-map>  
 
     <request-map uri="ListContactListCommEvents"><security https="true" auth="true"/><response name="success" type="view" value="ListContactListCommEvents"/></request-map>
     <request-map uri="EditContactListCommEvent"><security https="true" auth="true"/><response name="success" type="view" value="EditContactListCommEvent"/></request-map>
@@ -345,7 +349,7 @@
         <event type="service" invoke="deleteCommunicationEvent"/>
         <response name="success" type="view" value="ListContactListCommEvents"/>
         <response name="error" type="view" value="ListContactListCommEvents"/>
-    </request-map>
+    </request-map>    
 
     <!-- Lookup request mappings -->
     <request-map uri="LookupSegmentGroup"><security https="true" auth="true"/><response name="success" type="view" value="LookupSegmentGroup"/></request-map>
@@ -407,6 +411,7 @@
     <view-map name="ListContactListParty" type="screen" page="component://marketing/widget/ContactListScreens.xml#ListContactListParties"/>
     <view-map name="EditContactListParty" type="screen" page="component://marketing/widget/ContactListScreens.xml#EditContactListParty"/>
     <view-map name="FindContactListParties" type="screen" page="component://marketing/widget/ContactListScreens.xml#FindContactListParties"/>
+    <view-map name="ContactListOptOut" type="screen" page="component://marketing/widget/ContactListScreens.xml#OptOutResponse"/>
 
     <view-map name="ListContactListCommEvents" type="screen" page="component://marketing/widget/ContactListScreens.xml#ListContactListCommEvents"/>
     <view-map name="EditContactListCommEvent" type="screen" page="component://marketing/widget/ContactListScreens.xml#EditContactListCommEvent"/>

Modified: ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml?rev=774654&r1=774653&r2=774654&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml (original)
+++ ofbiz/trunk/applications/marketing/webapp/marketing/contact/ContactListForms.xml Thu May 14 06:32:21 2009
@@ -74,7 +74,8 @@
                 </entity-options>
             </drop-down>
         </field>
-
+        <field name="optOutScreen"><text size="60"/></field>
+        
         <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="buttontext"><submit button-type="text-link"/></field>
         <!-- <field name="DONE_PAGE"><hidden value="${donePage}"/></field> -->
         <!-- <field name="cancelLink" title="${uiLabelMap.CommonEmptyHeader}" widget-style="buttontext"><hyperlink target="${donePage}" also-hidden="false" description="${uiLabelMap.CommonCancelDone}" target-type="inter-app"/></field> -->

Modified: ofbiz/trunk/applications/marketing/widget/ContactListScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/ContactListScreens.xml?rev=774654&r1=774653&r2=774654&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/widget/ContactListScreens.xml (original)
+++ ofbiz/trunk/applications/marketing/widget/ContactListScreens.xml Thu May 14 06:32:21 2009
@@ -502,4 +502,47 @@
             </widgets>
         </section>
     </screen>
+    
+    <screen name="DefaultOptOutScreen">
+        <section>            
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container style="screenlet">
+                            <container style="screenlet-title-bar">
+                                <container style="h3">
+                                    <label text="Opt-Out Results"/>
+                                </container>
+                            </container>
+                            <container style="screenlet-body">
+                                <section>
+                                    <widgets>
+                                        <container>
+                                            <label text="You have been successfully removed from the ${contactList.contactListName} mailing list!"/>                                            
+                                        </container>                                        
+                                    </widgets>
+                                </section>
+                            </container>
+                        </container>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    
+    <screen name="OptOutResponse">
+        <section>
+            <actions>
+                <service service-name="optOutOfListFromCommEvent" result-map="optOutResult"/>                
+                <entity-one value-field="contactList" entity-name="ContactList">
+                    <field-map from-field="optOutResult.contactListId" field-name="contactListId"/>                    
+                </entity-one>
+                <set field="contactListId" from-field="contactList.contactListId"/>
+                <set field="screenName" from-field="contactList.optOutScreen" default-value="component://marketing/widget/ContactListScreens.xml#DefaultOptOutScreen"/>
+            </actions>
+            <widgets>
+                <include-screen name="${screenName}" share-scope="true"/>                
+            </widgets>
+        </section>
+    </screen>
 </screens>