Hi Andy, Please could you have a look at the related Jira issue https://issues.apache.org/jira/browse/OFBIZ-1224 ?
Thanks Jacques > 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("statusId").equals("COM_ENTERED")"> > <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&&!communicationEvent.getString("statusId").equals("COM_ENTERED")"> > + <display-entity entity-name="CommunicationEventType" > description="${description}" key-field-name="communicationEventTypeId"/> > + </field> > + > + <!-- parent communications --> > + <field name="parentCommEventId" use-when="communicationEvent!=null&&communicationEvent.getString("parentCommEventId")!=null"> > + <hyperlink description="${communicationEvent.parentCommEventId}" target="EditCommunicationEvent?communicationEventId=${communicationEvent.parentCommEventId}&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&&communicationEvent.getString("fromString")!=null"> > + <display/> > + </field> > + <field name="toString" use-when="communicationEvent!=null&&communicationEvent.getString("toString")!=null"> > + <display/> > + </field> > + <field name="toString" map-name="parameters" > use-when="communicationEvent==null&&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("statusId").equals("COM_ENTERED")"> > <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&&!communicationEvent.getString("statusId").equals("COM_ENTERED")"> > + <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("communicationEventTypeId")!=null)&&(parameters.get("communicationEventTypeId" ).equals("EMAIL_COMMUNICATION"))"> > + use-when="(parameters.get("communicationEventTypeId")!=null)&&(parameters.get("communicationEventTypeId" ).equals("EMAIL_COMMUNICATION")||parameters.get("communicationEventTypeId").equals("AUTO_EMAIL_COMM")) "> > <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("communicationEventTypeId")==null)||!(parameters.get("communicationEventTypeId").equal s("EMAIL_COMMUNICATION"))"> > + use-when="(parameters.get("communicationEventTypeId")==null)||!(parameters.get("communicationEventTypeId").equal s("EMAIL_COMMUNICATION")||parameters.get("communicationEventTypeId").equals("AUTO_EMAIL_COMM"))"> > <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("communicationEventTypeId")!=null)&&(parameters.get("communicationEventTypeId" ).equals("EMAIL_COMMUNICATION"))"> > @@ -102,28 +147,44 @@ > <field name="contactMechIdTo" > title="${uiLabelMap.PartyToContactMech}" > use-when="(parameters.get("communicationEventTypeId")==null)||!(parameters.get("communicationEventTypeId").equal s("EMAIL_COMMUNICATION"))"> > <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("statusId").equals("COM_ENTERED")"> > <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&&!communicationEvent.getString("statusId").equals("COM_ENTERED")"> > + <display-entity entity-name="RoleType" > description="${description}" key-field-name="roleTypeId"/> > + </field> > + > + <field name="roleTypeIdTo" use-when="communicationEvent==null||communicationEvent.getString("statusId").equals("COM_ENTERED")"> > <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&&!communicationEvent.getString("statusId").equals("COM_ENTERED")"> > + <display-entity entity-name="RoleType" > description="${description}" key-field-name="roleTypeId"/> > + </field> > + > + <!-- contact list --> > + <field name="contactListId" use-when="communicationEvent==null||communicationEvent.getString("statusId").equals("COM_ENTERED")"> > <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&&communicationEvent.getString("contactListId")!=null&&!communicationEve nt.getString("statusId").equals("COM_ENTERED")"><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("statusId").equals("COM_ENTERED")"><text size="60"/></field> > + <field name="subject" use-when="communicationEvent!=null&&!communicationEvent.getString("statusId").equals("COM_ENTERED")"><di splay/></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("statusId").equals("COM_ENTERED")"> > + <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&&!communicationEvent.getString("statusId").equals("COM_ENTERED")"><di splay/></field> > + > + <field name="content" title="${uiLabelMap.CommonContent}" use-when="communicationEvent==null||communicationEvent.getString("statusId").equals("COM_ENTERED")"><textarea cols="60" rows="10"/></field> > + <field name="content" title="${uiLabelMap.CommonContent}" use-when="communicationEvent!=null&&!communicationEvent.getString("statusId").equals("COM_ENTERED")"><te xtarea 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&&communicationEvent.getString("messageId")!=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("contentMimeTypeId")!=null)&&(communicationEvent.getString("contentMi meTypeId").indexOf("text/html")) != -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}&partyIdFrom=${partyId}" text="${uiLabelMap.PartyNewCommunication}"/> > - <link style="smallSubmit" target="EditCommunicationEvent?partyId=${partyId}&partyIdTo=${partyId}" text="${uiLabelMap.PartyReply}"/> > + <link style="smallSubmit" target="EditCommunicationEvent?partyId=${partyId}&parentCommEventId=${communicationEventId}" text="${uiLabelMap.PartyReply}"/> > + <!--<link style="smallSubmit" target="EditCommunicationEvent?communicationEventTypeId=${communicationEvent.communicationEventTypeId}&contactMechIdTo=${communi cationEvent.contactMechIdFrom}&contactMechIdFrom=${communicationEvent.contactMechIdTo}&partyId=${partyId}&partyIdTo=${pa rtyId}&partyIdFrom=${userLogin.partyId}&parentCommEventId=${communicationEventId}&toString=${communicationEvent.fromStri ng}" 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> >
