svn commit: r571303 - in /ofbiz/trunk/applications/party: webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh webapp/partymgr/communication/CommForms.xml widget/partymgr/CommunicationScreens.xml

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

svn commit: r571303 - in /ofbiz/trunk/applications/party: webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh webapp/partymgr/communication/CommForms.xml widget/partymgr/CommunicationScreens.xml

jaz-3
Author: jaz
Date: Thu Aug 30 13:42:08 2007
New Revision: 571303

URL: http://svn.apache.org/viewvc?rev=571303&view=rev
Log:
first pass of communication event UI cleanup

Added:
    ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh   (with props)
Modified:
    ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
    ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml

Added: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh?rev=571303&view=auto
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh (added)
+++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh Thu Aug 30 13:42:08 2007
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.ofbiz.base.util.*;
+
+delegator = request.getAttribute("delegator");
+userLogin = request.getAttribute("userLogin");
+parentCommEventId = parameters.get("parentCommEventId");
+
+if (parentCommEventId != null) {
+    parentEvent = delegator.findByPrimaryKey("CommunicationEvent", UtilMisc.toMap("communicationEventId", parentCommEventId));
+    if (parentEvent != null) {
+        orgEventId = parentEvent.get("origCommEventId");
+        if (orgEventId == null) orgEventId = parentCommEventId;
+
+        parameters.put("communicationEventTypeId", parentEvent.get("communicationEventTypeId"));
+        parameters.put("parentCommEventId", parentCommEventId);
+        parameters.put("origCommEventId", orgEventId);
+
+        parameters.put("contactMechIdTo", parentEvent.get("contactMechIdFrom"));
+        parameters.put("contactMechIdFrom", parentEvent.get("contactMechIdTo"));
+
+        parameters.put("partyIdFrom", userLogin.get("partyId"));
+        parameters.put("partyIdTo", parentEvent.get("partyIdFrom"));        
+        parameters.put("toString", parentEvent.get("fromString"));
+        parameters.put("statusId", "COM_IN_PROGRESS");
+        
+        parameters.put("subject", "RE: " + parentEvent.get("subject"));
+        parameters.put("content", "\n\n\n--------------- In reply to:\n\n" + parentEvent.get("content"));
+    }
+}
\ No newline at end of file

Propchange: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=571303&r1=571302&r2=571303&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml Thu Aug 30 13:42:08 2007
@@ -46,19 +46,33 @@
             <entity-one entity-name="StatusItem" value-name="currentStatus" auto-field-map="false">
                 <field-map field-name="statusId" env-name="communicationEvent.statusId"/>
             </entity-one>
+            <script location="component://party/webapp/partymgr/WEB-INF/actions/communication/prepCommEventReply.bsh"/>
         </actions>
+        
         <alt-target target="createCommunicationEvent" use-when="communicationEvent==null"/>
         <field name="partyId" map-name="parameters"><hidden/></field>
+                
         <field name="communicationEventId" use-when="communicationEvent!=null"><display/></field>
-        <field name="communicationEventTypeId">
+        <field name="communicationEventTypeId" use-when="communicationEvent==null||communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
             <drop-down>
                 <entity-options entity-name="CommunicationEventType" description="${description}">
                     <entity-order-by field-name="description"/>
                 </entity-options>
             </drop-down>
         </field>
-        <field name="partyIdFrom" title="${uiLabelMap.PartyPartyFrom}"><lookup target-form-name="LookupPartyName" default-value="${userLogin.partyId}"/></field>
-        <field name="partyIdTo" title="${uiLabelMap.PartyPartyTo}"><lookup target-form-name="LookupPartyName" default-value="${userLogin.partyId}"/></field>
+        <field name="communicationEventTypeId" use-when="communicationEvent!=null&amp;&amp;!communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
+            <display-entity entity-name="CommunicationEventType" description="${description}" key-field-name="communicationEventTypeId"/>
+        </field>
+
+        <!-- parent communications -->
+        <field name="parentCommEventId" use-when="communicationEvent!=null&amp;&amp;communicationEvent.getString(&quot;parentCommEventId&quot;)!=null">
+            <hyperlink description="${communicationEvent.parentCommEventId}" target="EditCommunicationEvent?communicationEventId=${communicationEvent.parentCommEventId}&amp;partyId=${partyId}" target-type="intra-app"/>
+        </field>
+        <field name="parentCommEventId" map-name="parameters" use-when="communicationEvent==null" >
+            <hidden/>
+        </field>
+        
+        <!-- status -->
         <field name="statusId" use-when="communicationEvent==null" title="${uiLabelMap.CommonStatus}" >
             <drop-down>
                 <entity-options description="${description}" entity-name="StatusItem" key-field-name="statusId">
@@ -75,23 +89,54 @@
                 </entity-options>
             </drop-down>
         </field>
-        <field name="contactMechTypeId">  <!-- does not have use-when restrictions so we can enter what the contactMechTypeId is -->
+
+        <!-- auto email fields -->
+        <field name="fromString" use-when="communicationEvent!=null&amp;&amp;communicationEvent.getString(&quot;fromString&quot;)!=null">
+            <display/>
+        </field>
+        <field name="toString" use-when="communicationEvent!=null&amp;&amp;communicationEvent.getString(&quot;toString&quot;)!=null">
+            <display/>
+        </field>
+        <field name="toString" map-name="parameters" use-when="communicationEvent==null&amp;&amp;toString!=null">
+            <text size="60"/>
+        </field>
+        
+        <!-- party ID fields -->
+        <field name="partyIdFrom" title="${uiLabelMap.PartyPartyFrom}" use-when="communicationEvent==null">
+            <lookup target-form-name="LookupPartyName" default-value="${userLogin.partyId}"/>
+        </field>
+        <field name="partyIdFrom" title="${uiLabelMap.PartyPartyFrom}" use-when="communicationEvent!=null">
+            <lookup target-form-name="LookupPartyName"/>
+        </field>
+        <field name="partyIdTo" title="${uiLabelMap.PartyPartyTo}">
+            <lookup target-form-name="LookupPartyName"/>
+        </field>
+
+        <!-- contact mech type -->
+        <field name="contactMechTypeId" use-when="communicationEvent==null||communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
             <drop-down>
                 <entity-options description="${description}" entity-name="ContactMechType" key-field-name="contactMechTypeId">
                     <entity-order-by field-name="description"/>
                 </entity-options>
             </drop-down>
         </field>
+        <field name="contactMechTypeId" use-when="communicationEvent!=null&amp;&amp;!communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
+            <display-entity entity-name="ContactMechType" description="${description}" key-field-name="contactMechTypeId"/>
+        </field>
+
         <!-- this is an example of how to display different types of contact mech to the user -->
         <field name="contactMechIdFrom" title="${uiLabelMap.PartyFromEmailAddress}"
-            use-when="(parameters.get(&quot;communicationEventTypeId&quot;)!=null)&amp;&amp;(parameters.get(&quot;communicationEventTypeId&quot;).equals(&quot;EMAIL_COMMUNICATION&quot;))">
+            use-when="(parameters.get(&quot;communicationEventTypeId&quot;)!=null)&amp;&amp;(parameters.get(&quot;communicationEventTypeId&quot;).equals(&quot;EMAIL_COMMUNICATION&quot;)||parameters.get(&quot;communicationEventTypeId&quot;).equals(&quot;AUTO_EMAIL_COMM&quot;))">
             <drop-down allow-empty="false" current="selected">
-             <list-options key-name="contactMechId" list-name="userEmailAddresses" description="${infoString}"/>
+                <entity-options entity-name="PartyAndContactMech" description="${infoString}" key-field-name="contactMechId">
+                    <entity-constraint name="partyId" operator="equals" value="${partyIdFrom}"/>
+                </entity-options>                    
             </drop-down>            
         </field>
         <field name="contactMechIdFrom" title="${uiLabelMap.PartyFromContactMech}"
-            use-when="(parameters.get(&quot;communicationEventTypeId&quot;)==null)||!(parameters.get(&quot;communicationEventTypeId&quot;).equals(&quot;EMAIL_COMMUNICATION&quot;))">
+            use-when="(parameters.get(&quot;communicationEventTypeId&quot;)==null)||!(parameters.get(&quot;communicationEventTypeId&quot;).equals(&quot;EMAIL_COMMUNICATION&quot;)||parameters.get(&quot;communicationEventTypeId&quot;).equals(&quot;AUTO_EMAIL_COMM&quot;))">
             <lookup target-form-name="LookupPreferredContactMech" target-parameter="partyIdFrom"/></field>
+        
         <!-- TODO: somehow show the address or email here, rather than just a contactMechId -->
         <field name="contactMechIdTo" title="${uiLabelMap.PartyToEmailAddress}"
             use-when="(parameters.get(&quot;communicationEventTypeId&quot;)!=null)&amp;&amp;(parameters.get(&quot;communicationEventTypeId&quot;).equals(&quot;EMAIL_COMMUNICATION&quot;))">
@@ -102,28 +147,44 @@
         <field name="contactMechIdTo" title="${uiLabelMap.PartyToContactMech}"
             use-when="(parameters.get(&quot;communicationEventTypeId&quot;)==null)||!(parameters.get(&quot;communicationEventTypeId&quot;).equals(&quot;EMAIL_COMMUNICATION&quot;))">
             <lookup target-form-name="LookupPreferredContactMech" target-parameter="partyIdTo"/></field>
-        <field name="roleTypeIdFrom" use-when="commEventRoleTypeIdFrom!=null">
+
+        <!-- role type info -->
+        <field name="roleTypeIdFrom" use-when="communicationEvent==null||communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
             <drop-down no-current-selected-key="_NA_">
                 <entity-options description="${description}" entity-name="RoleType" key-field-name="roleTypeId">
                     <entity-order-by field-name="description"/>
                 </entity-options>
             </drop-down>
         </field>
-        <field name="roleTypeIdTo" use-when="commEventRoleTypeIdTo!=null">
+        <field name="roleTypeIdFrom" use-when="communicationEvent!=null&amp;&amp;!communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
+            <display-entity entity-name="RoleType" description="${description}" key-field-name="roleTypeId"/>
+        </field>
+
+        <field name="roleTypeIdTo" use-when="communicationEvent==null||communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
             <drop-down no-current-selected-key="_NA_">
                 <entity-options description="${description}" entity-name="RoleType" key-field-name="roleTypeId">
                     <entity-order-by field-name="description"/>
                 </entity-options>
             </drop-down>
         </field>
-        <field name="contactListId">
+        <field name="roleTypeIdTo" use-when="communicationEvent!=null&amp;&amp;!communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
+            <display-entity entity-name="RoleType" description="${description}" key-field-name="roleTypeId"/>
+        </field>
+
+        <!-- contact list -->
+        <field name="contactListId" use-when="communicationEvent==null||communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
             <lookup size="20" target-form-name="LookupContactList">
                 <sub-hyperlink target="/marketing/control/EditContactList?contactListId=${communicationEvent.contactListId}" target-type="inter-app" link-style="smallSubmit"/>
             </lookup>
         </field>
+        <field name="contactListId" use-when="communicationEvent!=null&amp;&amp;communicationEvent.getString(&quot;contactListId&quot;)!=null&amp;&amp;!communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)"><display/></field>
+
         <field name="datetimeStarted" title="${uiLabelMap.CommonStartDate}"><date-time/></field>
         <field name="datetimeEnded" title="${uiLabelMap.CommonFinishDate}"><date-time/></field>
-        <field name="subject"><text size="60"/></field>
+
+        <field name="subject" use-when="communicationEvent==null||communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)"><text size="60"/></field>
+        <field name="subject" use-when="communicationEvent!=null&amp;&amp;!communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)"><display/></field>
+
         <field name="reasonEnumId">
             <drop-down no-current-selected-key="" allow-empty="true">
                 <entity-options entity-name="Enumeration" description="${description}" key-field-name="enumId">
@@ -132,15 +193,20 @@
                 </entity-options>
             </drop-down>
         </field>                              
-        <field name="contentMimeTypeId">
-            <drop-down no-current-selected-key="_NA_" allow-empty="false">
+        <field name="contentMimeTypeId" use-when="communicationEvent==null||communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)">
+            <drop-down no-current-selected-key="text/plain" allow-empty="false">
                 <entity-options description="${mimeTypeId}" entity-name="MimeType" key-field-name="mimeTypeId">
                     <entity-order-by field-name="mimeTypeId"/>
                 </entity-options>
             </drop-down>
         </field>
-        <field name="content" title="${uiLabelMap.CommonContent}"><textarea cols="60" rows="10"/></field>
+        <field name="contentMimeTypeId" use-when="communicationEvent!=null&amp;&amp;!communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)"><display/></field>
+
+        <field name="content" title="${uiLabelMap.CommonContent}" use-when="communicationEvent==null||communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)"><textarea cols="60" rows="10"/></field>
+        <field name="content" title="${uiLabelMap.CommonContent}" use-when="communicationEvent!=null&amp;&amp;!communicationEvent.getString(&quot;statusId&quot;).equals(&quot;COM_ENTERED&quot;)"><textarea cols="60" rows="10" read-only="true"/></field>
+
         <field name="note" title="${uiLabelMap.CommonNote}"><textarea cols="60" rows="3"/></field>
+        <field name="messageId" use-when="communicationEvent!=null&amp;&amp;communicationEvent.getString(&quot;messageId&quot;)!=null"><display/></field>
         <field name="submitButton" title="${uiLabelMap.CommonSave}"><submit button-type="button"/></field>
     </form>
 
@@ -171,7 +237,7 @@
         <field name="subject"><display/></field>
         <field map-name="subjectMap" name="eventNote" title="${uiLabelMap.CommonNote}"><display/></field>
         <field name="contentMimeTypeId"><display/></field>
-        <field name="content" title="${uiLabelMap.CommonContent}"><textarea cols="60" rows="10"/></field>
+        <field name="content" title="${uiLabelMap.CommonContent}"><textarea cols="60" rows="10" read-only="true"/></field>
         <field name="content" title="${uiLabelMap.CommonContent}" use-when="(communicationEvent.getString(&quot;contentMimeTypeId&quot;)!=null)&amp;&amp;(communicationEvent.getString(&quot;contentMimeTypeId&quot;).indexOf(&quot;text/html&quot;)) != -1">
             <display also-hidden="false"/>  <!-- if not set, it is also hidden, which could cause it to re-dislay -->
         </field>
@@ -180,6 +246,8 @@
     <form name="findCommEvents" type="single" target="ListLookupCommEvents"
         paginate="true">
         <field name="communicationEventId" use-when="communicationEvent != null"><text-find/></field>
+        <field name="parentCommEventId"><text-find/></field>
+        <field name="origCommEventId"><text-find/></field>
         <field name="partyIdFrom" title="${uiLabelMap.CommonPartyID} ${uiLabelMap.CommonFrom}"><lookup target-form-name="LookupPartyName"/></field>
         <field name="partyIdTo" title="${uiLabelMap.CommonPartyID} ${uiLabelMap.CommonTo}"><lookup target-form-name="LookupPartyName"/></field>
  <field name="communicationEventTypeId">
@@ -268,6 +336,17 @@
                         <condition-expr field-name="partyIdTo" operator="equals" value="${partyId}"/>
                     </condition-list>
                     <condition-expr env-name="" field-name="statusId" operator="equals" value="COM_PENDING"/>
+                </condition-list>
+            </entity-condition>
+        </actions>
+    </form>
+
+    <form name="ListChildCommEvents" type="list" extends="ListCommEvents">
+        <actions>
+            <entity-condition entity-name="CommunicationEvent">
+                <condition-list combine="or">
+                    <condition-expr field-name="parentCommEventId" operator="equals" value="${communicationEventId}"/>
+                    <condition-expr field-name="origCommEventId" operator="equals" value="${communicationEventId}"/>
                 </condition-list>
             </entity-condition>
         </actions>

Modified: ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml?rev=571303&r1=571302&r2=571303&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml (original)
+++ ofbiz/trunk/applications/party/widget/partymgr/CommunicationScreens.xml Thu Aug 30 13:42:08 2007
@@ -250,13 +250,14 @@
                 <set field="titleProperty" value="PageTitleEditCommunication"/>
                 <set field="tabButtonItem" value="PartyCommEvents"/>
                 <set field="subTabButtonItem" value="CommunicationEvent"/>
+                <set field="entityName" value="CommunicationEvent"/>
 
                 <set field="communicationEventId" from-field="parameters.communicationEventId"/>
                 <set field="parentCommEventId" from-field="parameters.parentCommEventId"/>
 
                 <set field="partyId" from-field="parameters.partyId"/>
                 <set field="partyIdFrom" from-field="parameters.partyIdFrom" default-value="${userLogin.partyId}"/>
-                <set field="partyIdTo" from-field="parameters.partyIdTo" default-value="${userLogin.partyId}"/>
+                <set field="partyIdTo" from-field="parameters.partyIdTo"/>
                 <set field="contactMechIdFrom" from-field="parameters.contactMechIdFrom"/>
                 <set field="contactMechIdTo" from-field="parameters.contactMechIdTo"/>
                 <set field="contactMechTypeId" from-field="parameters.contactMechTypeId"/>
@@ -282,25 +283,34 @@
                                         <label style="head1" text="${uiLabelMap.PartyNewCommunication}"/>
                                     </fail-widgets>
                                 </section>
-                                <!--
                                 <section>
                                     <widgets>
                                         <container>
                                             <link style="smallSubmit" target="EditCommunicationEvent?partyId=${partyId}&amp;partyIdFrom=${partyId}" text="${uiLabelMap.PartyNewCommunication}"/>
-                                            <link style="smallSubmit" target="EditCommunicationEvent?partyId=${partyId}&amp;partyIdTo=${partyId}" text="${uiLabelMap.PartyReply}"/>
+                                            <link style="smallSubmit" target="EditCommunicationEvent?partyId=${partyId}&amp;parentCommEventId=${communicationEventId}" text="${uiLabelMap.PartyReply}"/>
+                                            <!--<link style="smallSubmit" target="EditCommunicationEvent?communicationEventTypeId=${communicationEvent.communicationEventTypeId}&amp;contactMechIdTo=${communicationEvent.contactMechIdFrom}&amp;contactMechIdFrom=${communicationEvent.contactMechIdTo}&amp;partyId=${partyId}&amp;partyIdTo=${partyId}&amp;partyIdFrom=${userLogin.partyId}&amp;parentCommEventId=${communicationEventId}&amp;toString=${communicationEvent.fromString}" text="${uiLabelMap.PartyReply}"/>-->
                                         </container>
                                     </widgets>
                                 </section>
-                                -->
                                 <section>
                                     <condition>
                                         <if-compare field-name="okayToUpdate" operator="equals" value="true" type="Boolean"/>
                                     </condition>
                                     <widgets>
-                                        <include-form location="component://party/webapp/partymgr/communication/CommForms.xml" name="EditCommEvent"/>
+                                        <container style="widget-container">
+                                            <include-form location="component://party/webapp/partymgr/communication/CommForms.xml" name="EditCommEvent"/>
+                                        </container>
+                                        <container style="widget-container">
+                                            <include-form location="component://party/webapp/partymgr/communication/CommForms.xml" name="ListChildCommEvents"/>
+                                        </container>
                                     </widgets>
                                     <fail-widgets>
-                                        <include-form location="component://party/webapp/partymgr/communication/CommForms.xml" name="ViewCommEvent"/>
+                                        <container style="widget-container">
+                                            <include-form location="component://party/webapp/partymgr/communication/CommForms.xml" name="ViewCommEvent"/>
+                                        </container>
+                                        <container style="widget-container">
+                                            <include-form location="component://party/webapp/partymgr/communication/CommForms.xml" name="ListChildCommEvents"/>
+                                        </container>
                                     </fail-widgets>
                                 </section>
                             </widgets>