Author: hansbak
Date: Wed Apr 22 10:00:34 2009
New Revision: 767440

URL: http://svn.apache.org/viewvc?rev=767440&view=rev
Log:
fix problem in reply and forward email, sort emails in list, fix html coding 
problems

Modified:
    
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/trunk/applications/party/servicedef/services.xml
    ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
    ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml
    ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml

Modified: 
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml?rev=767440&r1=767439&r2=767440&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
 (original)
+++ 
ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
 Wed Apr 22 10:00:34 2009
@@ -33,7 +33,51 @@
     </simple-method>
 
     <simple-method method-name="createCommunicationEvent" 
short-description="Create a CommunicationEvent with or w/o permission check">
+        <!-- create basic info for communication event -->
+        <make-value value-field="newEntity" entity-name="CommunicationEvent"/>
+        <set-nonpk-fields map="parameters" value-field="newEntity"/>
+        
+        <if-empty field="parameters.communicationEventId">
+            <sequenced-id sequence-name="CommunicationEvent" 
field="newEntity.communicationEventId"/>
+            <else>
+                <set field="newEntity.communicationEventId" 
from-field="parameters.communicationEventId"/>
+            </else>
+        </if-empty>
+        <field-to-result field="newEntity.communicationEventId" 
result-name="communicationEventId"/>
+        
+        <!-- check for reply or forward -->
         <if-not-empty field="parameters.parentCommEventId">
+            <entity-one entity-name="CommunicationEvent" 
value-field="parentCommEvent">
+                <field-map field-name="communicationEventId" 
from-field="parameters.parentCommEventId"/>
+            </entity-one>
+            <entity-one entity-name="PartyNameView" 
value-field="partyNameView">
+                <field-map field-name="partyId" 
from-field="parentCommEvent.partyIdFrom"/>
+            </entity-one>
+            
+            <if-compare-field field="parentCommEvent.partyIdFrom" 
operator="equals" to-field="parameters.partyIdTo">
+                <!-- concider this as a reply -->
+                <set field="newEntity.partyIdTo" 
from-field="parentCommEvent.partyIdFrom"/>
+            </if-compare-field>
+
+            <set field="newEntity.content" value="${groovy:
+                def localContent = parentCommEvent.content;
+                if (!localContent || localContent.indexOf(&quot;\n&quot;,0) == 
-1) return(&quot;&quot;);
+
+                resultLine = &quot;\n\n\n&quot; 
+                    + 
(partyNameView.firstName!=null?partyNameView.firstName:&quot;&quot;) 
+                    + &quot; &quot; 
+                    + 
(partyNameView.middleName!=null?partyNameView.middleName+&quot; 
&quot;:&quot;&quot;) 
+                    + &quot; &quot; 
+                    + 
(partyNameView.lastName!=null?partyNameView.lastName:&quot; &quot;) 
+                    + &quot; wrote:&quot;;
+                resultLine += &quot;\n 
-------------------------------------------------------------------- &quot;;
+                resultLine += &quot;\n&gt; &quot; + localContent.substring(0, 
localContent.indexOf(&quot;\n&quot;,0));
+                startChar = localContent.indexOf(&quot;\n&quot;,0);
+                while(startChar != -1 &amp;&amp; (startChar = 
localContent.indexOf(&quot;\n&quot;,startChar) + 1) != 0)
+                    resultLine += &quot;\n&gt; &quot; + 
localContent.substring(startChar, 
localContent.indexOf(&quot;\n&quot;,startChar)==-1 ? localContent.length() : 
localContent.indexOf(&quot;\n&quot;,startChar));
+                return(resultLine);
+                }"/>
+
             <entity-and list="roles" entity-name="CommunicationEventRole">
                 <field-map field-name="communicationEventId" 
from-field="parameters.parentCommEventId"/>
                 <field-map field-name="partyId" 
from-field="parameters.partyIdFrom"/>
@@ -52,17 +96,6 @@
             <set value="COM_ENTERED" field="parameters.statusId"/>
         </if-empty>
 
-        <make-value value-field="newEntity" entity-name="CommunicationEvent"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-
-        <if-empty field="parameters.communicationEventId">
-            <sequenced-id sequence-name="CommunicationEvent" 
field="newEntity.communicationEventId"/>
-            <else>
-                <set field="newEntity.communicationEventId" 
from-field="parameters.communicationEventId"/>
-            </else>
-        </if-empty>
-        <field-to-result field="newEntity.communicationEventId" 
result-name="communicationEventId"/>
-
         <if-empty field="newEntity.partyIdFrom">
             <set field="newEntity.partyIdFrom" from-field="userLogin.partyId"/>
         </if-empty>

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=767440&r1=767439&r2=767440&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Wed Apr 22 10:00:34 
2009
@@ -682,11 +682,13 @@
         <description>Create a Communication Event with permission 
check</description>
         <permission-service 
service-name="partyCommunicationEventPermissionCheck" main-action="CREATE"/>
         <implements service="createCommunicationEventInterface"/>
+        <override name="content" allow-html="any"/>
     </service>
     <service name="createCommunicationEventWithoutPermission" engine="simple"
             
location="component://party/script/org/ofbiz/party/communication/CommunicationEventServices.xml"
 invoke="createCommunicationEventWithoutPermission" auth="true">
         <description>Create a Communication Event without permission 
check</description>
         <implements service="createCommunicationEventInterface"/>
+        <override name="content" allow-html="any"/>
     </service>
 
     <service name="updateCommunicationEvent" engine="simple"

Modified: 
ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml?rev=767440&r1=767439&r2=767440&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml 
(original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml 
Wed Apr 22 10:00:34 2009
@@ -161,7 +161,7 @@
         <field name="datetimeStarted" 
title="${uiLabelMap.CommonSendDate}"><date-time/></field>
         <field name="subject"><text size="60" 
default-value="${parameters.subject}"/></field>
         <field name="contentMimeTypeId"><hidden value="text/plain"/></field>
-        <field name="content" title="${uiLabelMap.CommonContent}"><textarea 
cols="60" rows="10" default-value="${parameters.content}"/></field>
+        <field name="content" title="${uiLabelMap.CommonContent}" 
encode-output="false"><textarea cols="72" rows="15" 
default-value="${parameters.content}"/></field>
         <field name="send" title="&amp;nbsp;" position="1" 
use-when="communicationEvent!=null">
             <hyperlink also-hidden="true" target-type="plain" 
description="${uiLabelMap.CommonSend}" 
target="javascript:(document.EditEmail.submit())"/>
         </field>

Modified: 
ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml?rev=767440&r1=767439&r2=767440&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml 
(original)
+++ ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml Wed 
Apr 22 10:00:34 2009
@@ -835,7 +835,7 @@
                         <condition-expr field-name="communicationEventTypeId"
                             operator="equals" value="COMMENT_NOTE" 
ignore="${internalNotesOnly}"/>
                     </condition-list>
-                    <order-by field-name="-datetimeStarted"/>
+                    <order-by field-name="-entryDate"/>
                 </entity-condition>
                 <entity-condition entity-name="CommunicationEventAndRole" 
list="commEventsUnknown">
                     <condition-list combine="and">
@@ -846,7 +846,7 @@
                         <condition-expr field-name="partyId" operator="equals"
                             value="${partyId}"/>
                     </condition-list>
-                    <order-by field-name="-datetimeStarted"/>
+                    <order-by field-name="-entryDate"/>
                 </entity-condition>
                 <entity-condition entity-name="CommunicationEventAndRole" 
list="commEventDraft">
                     <condition-list combine="and">
@@ -855,7 +855,7 @@
                         <condition-expr field-name="partyId" operator="equals"
                             value="${partyId}"/>
                     </condition-list>
-                    <order-by field-name="-datetimeStarted"/>
+                    <order-by field-name="-entryDate"/>
                 </entity-condition>
                 <entity-one entity-name="PartyNameView" 
value-field="partyName">
                     <field-map field-name="partyId" from-field="partyId"/>

Modified: ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml?rev=767440&r1=767439&r2=767440&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/PartyMenus.xml Wed Apr 22 
10:00:34 2009
@@ -389,6 +389,7 @@
                 <parameter param-name="parentCommEventId" 
from-field="parameters.communicationEventId"/>
                 <parameter param-name="my" value="My"/>
                 <parameter param-name="statusId" value="COM_PENDING"/>
+                <parameter param-name="partyIdTo" 
from-field="communicationEvent.partyIdFrom"/>
             </link>
         </menu-item>
         <menu-item name="forward" title="${uiLabelMap.PartyForward}">
@@ -401,7 +402,7 @@
                 </and>
             </condition>
             <link target="NewDraftCommunicationEvent">
-                <parameter param-name="communicationEventTypeId" 
value="communicationEvent.communicationEventTypeId"/>
+                <parameter param-name="communicationEventTypeId" 
from-field="communicationEvent.communicationEventTypeId"/>
                 <parameter param-name="originalCommEventId" 
from-field="parameters.communicationEventId"/>
                 <parameter param-name="my" value="My"/>
                 <parameter param-name="statusId" value="COM_PENDING"/>


Reply via email to