[OFBiz] SVN: r6488 - in trunk/applications/party: config webapp/partymgr/WEB-INF/actions/communication webapp/partymgr/communication widget/partymgr
sichen@svn.ofbiz.org
sichen at svn.ofbiz.org
Tue Jan 10 13:54:38 CST 2006
Author: sichen
Date: 2006-01-10 13:54:28 -0600 (Tue, 10 Jan 2006)
New Revision: 6488
Added:
trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.bsh
Modified:
trunk/applications/party/config/PartyUiLabels.properties
trunk/applications/party/webapp/partymgr/communication/CommForms.xml
trunk/applications/party/widget/partymgr/CommunicationScreens.xml
Log:
Enhancements to the comm events screens for emails: now actually shows the email addresses instead of just a contactMechId and allows user a drop down of emails to choose for the from and to emails
Modified: trunk/applications/party/config/PartyUiLabels.properties
===================================================================
--- trunk/applications/party/config/PartyUiLabels.properties 2006-01-10 16:58:44 UTC (rev 6487)
+++ trunk/applications/party/config/PartyUiLabels.properties 2006-01-10 19:54:28 UTC (rev 6488)
@@ -213,7 +213,9 @@
PartyFirstNameMissing=Firstname is Missing
PartyFollowSession=Follow Session
PartyFromContactMech=From Contact Mech
+PartyFromEmailAddress=From Email Address
PartyToContactMech=To Contact Mech
+PartyToEmailAddress=To Email Address
PartyGender=Gender
PartyGotoList=Goto List
PartyGroupName=Group Name
Added: trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.bsh
===================================================================
--- trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.bsh 2006-01-10 16:58:44 UTC (rev 6487)
+++ trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.bsh 2006-01-10 19:54:28 UTC (rev 6488)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2006 The Open For Business Project - www.ofbiz.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
+ * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ *@author Si Chen (sichen at opensourcestrategies.com)
+ *
+ */
+
+
+/**
+ * This script finds and places in the context of the form current (un-expired) contact mechs for the logged in user and the
+ * party for whom the communication event is intended. It currently just does searches for email but should be
+ * expanded to work off other communication event types.
+ */
+
+import org.ofbiz.base.util.*;
+import org.ofbiz.entity.util.EntityUtil;
+
+delegator = request.getAttribute("delegator");
+userLogin = request.getAttribute("userLogin");
+
+if (parameters.get("communicationEventTypeId") != null) {
+ if (parameters.get("communicationEventTypeId").equals("EMAIL_COMMUNICATION")) {
+ userEmailAddresses = delegator.findByAnd("PartyContactWithPurpose", UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId", userLogin.getString("partyId")));
+ userEmailAddresses = EntityUtil.filterByDate(userEmailAddresses, UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true);
+ context.put("userEmailAddresses", userEmailAddresses);
+
+ targetEmailAddresses = delegator.findByAnd("PartyContactWithPurpose", UtilMisc.toMap("contactMechTypeId", "EMAIL_ADDRESS", "partyId", parameters.get("partyId")));
+ targetEmailAddresses = EntityUtil.filterByDate(targetEmailAddresses, UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true);
+ context.put("targetEmailAddresses", targetEmailAddresses);
+ }
+}
+
Property changes on: trunk/applications/party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.bsh
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ "Date Rev Author URL Id"
Name: svn:eol-style
+ native
Modified: trunk/applications/party/webapp/partymgr/communication/CommForms.xml
===================================================================
--- trunk/applications/party/webapp/partymgr/communication/CommForms.xml 2006-01-10 16:58:44 UTC (rev 6487)
+++ trunk/applications/party/webapp/partymgr/communication/CommForms.xml 2006-01-10 19:54:28 UTC (rev 6488)
@@ -88,9 +88,25 @@
</entity-options>
</drop-down>
</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"))">
+ <drop-down allow-empty="false" current="selected">
+ <list-options key-name="contactMechId" list-name="userEmailAddresses" description="${infoString}"/>
+ </drop-down>
+ </field>
+ <field name="contactMechIdFrom" title="${uiLabelMap.PartyFromContactMech}"
+ use-when="(parameters.get("communicationEventTypeId")==null)||!(parameters.get("communicationEventTypeId").equals("EMAIL_COMMUNICATION"))"><text/></field>
<!-- TODO: somehow show the address or email here, rather than just a contactMechId -->
- <field name="contactMechIdFrom" title="${uiLabelMap.PartyFromContactMech}"><text/></field>
- <field name="contactMechIdTo" title="${uiLabelMap.PartyToContactMech}"><text/></field>
+ <field name="contactMechIdTo" title="${uiLabelMap.PartyToEmailAddress}"
+ use-when="(parameters.get("communicationEventTypeId")!=null)&&(parameters.get("communicationEventTypeId").equals("EMAIL_COMMUNICATION"))">
+ <drop-down allow-empty="false" current="selected" no-current-selected-key="${parameters.contactMechIdTo}">
+ <list-options key-name="contactMechId" list-name="targetEmailAddresses" description="${infoString}"/>
+ </drop-down>
+ </field>
+ <field name="contactMechIdTo" title="${uiLabelMap.PartyToContactMech}"
+ use-when="(parameters.get("communicationEventTypeId")==null)||!(parameters.get("communicationEventTypeId").equals("EMAIL_COMMUNICATION"))"><text/></field>
<field name="roleTypeIdFrom" use-when="commEventRoleTypeIdFrom!=null">
<drop-down no-current-selected-key="_NA_">
@@ -125,8 +141,22 @@
<field name="partyIdTo" title="Party To"><display-entity description="${firstName} ${lastName} [${partyId}]" entity-name="Person" key-field-name="partyId"/></field>
<field name="statusId"><display-entity description="${description}" entity-name="StatusItem" key-field-name="statusId"/></field>
<field name="contactMechTypeId"><display-entity description="${description}" entity-name="ContactMechType" key-field-name="contactMechTypeId"/></field>
- <field name="contactMechIdFrom" title="${uiLabelMap.PartyFromContactMech}"><display/></field>
- <field name="contactMechIdTo" title="${uiLabelMap.PartyToContactMech}"><display/></field>
+
+ <!-- This will display email addresses when it is an email. This could be more elaborate to show the actual string, or it could
+ be done probably with a Java helper method to cut down on repetitive code -->
+ <field name="contactMechIdFrom" title="${uiLabelMap.PartyFromEmailAddress}"
+ use-when="((communicationEvent.getString("contactMechTypeId")!=null)&&(communicationEvent.getString("contactMechTypeId").equals("EMAIL_ADDRESS")))">
+ <display-entity entity-name="ContactMech" key-field-name="contactMechId" description="${infoString}"/>
+ </field>
+ <field name="contactMechIdFrom" title="${uiLabelMap.PartyFromContactMech}"
+ use-when="((communicationEvent.getString("contactMechTypeId")==null)||!(communicationEvent.getString("contactMechTypeId").equals("EMAIL_ADDRESS")))"><display/></field>
+ <field name="contactMechIdTo" title="${uiLabelMap.PartyToEmailAddress}"
+ use-when="((communicationEvent.getString("contactMechTypeId")!=null)&&(communicationEvent.getString("contactMechTypeId").equals("EMAIL_ADDRESS")))">
+ <display-entity entity-name="ContactMech" key-field-name="contactMechId" description="${infoString}"/>
+ </field>
+ <field name="contactMechIdTo" title="${uiLabelMap.PartyToContactMech}"
+ use-when="((communicationEvent.getString("contactMechTypeId")==null)||!(communicationEvent.getString("contactMechTypeId").equals("EMAIL_ADDRESS")))"><display/></field>
+
<field name="roleTypeIdFrom"><display-entity description="${description}" entity-name="RoleType" key-field-name="roleTypeId"/></field>
<field name="roleTypeIdTo"><display-entity description="${description}" entity-name="RoleType" key-field-name="roleTypeId"/></field>
<field name="datetimeStarted" title="${uiLabelMap.CommonStartDate}"><display/></field>
Modified: trunk/applications/party/widget/partymgr/CommunicationScreens.xml
===================================================================
--- trunk/applications/party/widget/partymgr/CommunicationScreens.xml 2006-01-10 16:58:44 UTC (rev 6487)
+++ trunk/applications/party/widget/partymgr/CommunicationScreens.xml 2006-01-10 19:54:28 UTC (rev 6488)
@@ -337,6 +337,7 @@
<entity-one entity-name="Party" use-cache="true" value-name="party"/>
<entity-one entity-name="Person" use-cache="true" value-name="lookupPerson"/>
<entity-one entity-name="CommunicationEvent" value-name="communicationEvent"/>
+ <script location="component://party/webapp/partymgr/WEB-INF/actions/communication/findCommEventContactMechs.bsh"/>
</actions>
<widgets>
<decorator-screen name="CommonCommunicationEventDecorator">
More information about the Svn
mailing list