svn commit: r703759 - in /ofbiz/trunk: applications/party/script/org/ofbiz/party/communication/ applications/party/webapp/partymgr/communication/ specialpurpose/mypage/script/org/ofbiz/mypage/ specialpurpose/mypage/webapp/mypage/ specialpurpose/mypage/...

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

svn commit: r703759 - in /ofbiz/trunk: applications/party/script/org/ofbiz/party/communication/ applications/party/webapp/partymgr/communication/ specialpurpose/mypage/script/org/ofbiz/mypage/ specialpurpose/mypage/webapp/mypage/ specialpurpose/mypage/...

hansbak-2
Author: hansbak
Date: Sat Oct 11 19:31:57 2008
New Revision: 703759

URL: http://svn.apache.org/viewvc?rev=703759&view=rev
Log:
add attached files to email creation and allow for saving and not sending an email

Added:
    ofbiz/trunk/specialpurpose/mypage/webapp/mypage/addAttachFile.ftl   (with props)
    ofbiz/trunk/specialpurpose/mypage/webapp/mypage/attachFileList.ftl   (with props)
Modified:
    ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml
    ofbiz/trunk/specialpurpose/mypage/script/org/ofbiz/mypage/Events.xml
    ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml
    ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml
    ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml
    ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.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=703759&r1=703758&r2=703759&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 Sat Oct 11 19:31:57 2008
@@ -137,7 +137,6 @@
             to-field="oldStatusId">
             <call-simple-method method-name="setCommunicationEventStatus" />
         </if-compare-field>
-        <store-value value-name="event" />
         
         <!-- if the from- or to-party changed change also the roles -->
         <if-not-empty field="parameters.partyIdFrom">
@@ -161,6 +160,17 @@
                     in-map-name="newRoleFrom" />
             </if-compare>
         </if-not-empty>
+        <if-empty field="parameters.partyIdTo">
+            <if-not-empty field="parameters.contactMechIdTo">
+                <entity-and entity-name="PartyAndContactMech" list-name="partyContactMechs" filter-by-date="true">
+                    <field-map field-name="contactMechId" env-name="parameters.contactMechIdTo"/>
+                    <field-map field-name="contactMechTypeId" value="EMAIL_ADDRESS"/>
+                </entity-and>
+                <first-from-list entry-name="partyContactMech" list-name="partyContactMechs"/>                
+                <set field="parameters.partyIdTo" from-field="partyContactMech.partyId"/>
+                <set field="event.partyIdTo" from-field="partyContactMech.partyId"/>
+            </if-not-empty>
+        </if-empty>
         <if-not-empty field="parameters.partyIdTo">
             <if-compare operator="not-equals" value="parameters.partIdTo"
                 field="event.partyIdTo">
@@ -183,6 +193,7 @@
                     in-map-name="newRoleTo" />
             </if-compare>
         </if-not-empty>
+        <store-value value-name="event" />
     </simple-method>
 
     <simple-method method-name="deleteCommunicationEvent" short-description="Delete a CommunicationEvent">

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=703759&r1=703758&r2=703759&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml (original)
+++ ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml Sat Oct 11 19:31:57 2008
@@ -182,6 +182,7 @@
                 <sub-hyperlink description=" [${communicationEvent.partyIdTo}]" target="/partymgr/control/viewprofile?partyId=${communicationEvent.partyIdTo}" target-type="inter-app"/>
             </display-entity>
         </field>
+        <field name="statusId"><display-entity description="${description}" entity-name="StatusItem" key-field-name="statusId"/></field>
         <field name="datetimeStarted" title="${uiLabelMap.CommonSendDate}"><display type="date"/></field>
         <field name="subject"><display/></field>
         <field name="content" title="${uiLabelMap.CommonContent}"><display/></field>

Modified: ofbiz/trunk/specialpurpose/mypage/script/org/ofbiz/mypage/Events.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/script/org/ofbiz/mypage/Events.xml?rev=703759&r1=703758&r2=703759&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/script/org/ofbiz/mypage/Events.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/script/org/ofbiz/mypage/Events.xml Sat Oct 11 19:31:57 2008
@@ -179,4 +179,139 @@
         </if-not-empty>
     </simple-method>
     
+    <simple-method method-name="checkEnteredEmailExists" short-description="Check Enter Email Exists when click New Email">        
+        <entity-and entity-name="CommunicationEvent" list-name="comEventList">
+            <field-map field-name="statusId" value="COM_PENDING"/>
+            <field-map field-name="partyIdFrom" env-name="userLogin.partyId"/>
+        </entity-and>
+        <if-not-empty field="comEventList">
+            <iterate entry-name="comevent" list-name="comEventList">            
+                <set field="communicationEventId" from-field="comevent.communicationEventId" />  
+                <field-to-request field-name="communicationEventId" request-name="communicationEventId"/>
+            </iterate>
+            <else>
+                <set field="chkExists" value="true"/>
+            </else>
+        </if-not-empty>
+        <if-compare field="chkExists" value="true" operator="equals">
+            <set-service-fields service-name="createCommunicationEvent" map-name="parameters" to-map-name="createCommEvent"/>
+            <call-service service-name="createCommunicationEvent" in-map-name="createCommEvent">
+                <result-to-request result-name="communicationEventId" request-name="communicationEventId"/>
+            </call-service>
+        </if-compare>                        
+    </simple-method>
+    
+    <simple-method method-name="createCommunicationContent" short-description="Upload Content and Create Communication Content Association">
+        <!-- Call layout to get field -->
+        <call-class-method class-name="org.ofbiz.content.layout.LayoutWorker"
+            method-name="uploadImageAndParameters"
+            ret-field-name="formInput">
+            <field field-name="request" type="javax.servlet.http.HttpServletRequest"/>
+            <string value="uploadedFile"/>
+        </call-class-method>
+        <set field="parameters.imageFileName" from-field="formInput.imageFileName"/>
+        
+        <!-- Call bsh get file type -->
+        <call-bsh><![CDATA[
+            String fileName = parameters.get("imageFileName");
+            String mimeTypeId = fileName.substring(fileName.indexOf(".")+1,fileName.length());
+            parameters.put("mimeType",mimeTypeId);
+            ]]>
+        </call-bsh>
+        
+        <!-- Get mime type from FileExtention -->
+        <set field="fileMap.fileExtensionId" value="${parameters.mimeType}"/>
+        <find-by-primary-key map-name="fileMap" value-name="mimeType" entity-name="FileExtension"/>        
+        
+        <!-- Create Data Resource -->
+        <set-service-fields service-name="createContentFromUploadedFile" map-name="formInput.formInput" to-map-name="data"/>
+        <set field="data.dataResourceTypeId" value="LOCAL_FILE"/>
+        <set field="data.dataTemplateTypeId" value="NONE"/>
+        <set field="data.dataCategoryId" from-field="formInput.formInput.dataCategoryId"/>
+        
+        <set field="data.statusId" from-field="formInput.formInput.statusId"/>
+        <set field="data.dataResourceName" from-field="formInput.imageFileName"/>
+        <set field="data.mimeTypeId" from-field="mimeType.mimeTypeId"/>
+        <set field="data.uploadedFile" from-field="formInput.imageData"/>
+        <set field="data._uploadedFile_fileName" from-field="formInput.imageFileName"/>
+        <set field="data._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
+        <call-service service-name="createDataResource" in-map-name="data">
+            <result-to-field result-name="dataResourceId" field-name="dataResourceId" map-name="parameters"/>
+        </call-service>        
+        <log level="always" message=" DataResource : ${parameters.dataResourceId}"></log>
+        
+        <!-- Create attach upload to data resource -->
+        <set-service-fields service-name="attachUploadToDataResource" map-name="formInput.formInput" to-map-name="attachMap"/>
+        <set field="attachMap.uploadedFile" from-field="formInput.imageData"/>
+        <set field="attachMap._uploadedFile_fileName" from-field="formInput.imageFileName"/>
+        <set field="attachMap._uploadedFile_contentType" from-field="formInput.formInput.mimeTypeId"/>
+        <set field="attachMap.dataResourceId" from-field="parameters.dataResourceId"/>
+        <set field="attachMap.mimeTypeId" from-field="mimeType.mimeTypeId"/>
+        <call-service service-name="attachUploadToDataResource" in-map-name="attachMap"/>
+        
+        <!-- Create content from dataResource -->
+        <set-service-fields service-name="createContentFromDataResource" map-name="formInput.formInput" to-map-name="contentMap"/>
+        <set field="contentMap.roleTypeId" from-field="formInput.formInput.roleTypeId"/>
+        <set field="contentMap.partyId" from-field="formInput.formInput.partyId"/>
+        <set field="contentMap.contentTypeId" from-field="formInput.formInput.contentTypeId"/>
+        <set field="contentMap.dataResourceId" from-field="parameters.dataResourceId"/>
+        <call-service service-name="createContentFromDataResource" in-map-name="contentMap">
+            <result-to-field result-name="contentId" field-name="contentId" map-name="parameters"/>
+        </call-service>
+        <log level="always" message=" Content : ${parameters.contentId}"></log>
+        
+        <!-- Create party content -->
+        <set-service-fields service-name="createPartyContent" map-name="formInput.formInput" to-map-name="partycontent"/>
+        <set field="partycontent.contentId" from-field="parameters.contentId"/>
+        <set field="partycontent.partyContentTypeId" from-field="formInput.formInput.partyContentTypeId"/>
+        <set field="partycontent.partyId" from-field="formInput.formInput.partyId"/>
+        <call-service service-name="createPartyContent" in-map-name="partycontent"/>
+        
+        <!-- Create communication event and content association -->
+        <set-service-fields service-name="createCommEventContentAssoc" map-name="formInput.formInput" to-map-name="contentAssoc"/>
+        <set field="contentAssoc.contentId" from-field="parameters.contentId"/>
+        <set field="contentAssoc.communicationEventId" from-field="formInput.formInput.communicationEventId"/>
+        <call-service service-name="createCommEventContentAssoc" in-map-name="contentAssoc">
+            <result-to-field result-name="fromDate" field-name="fromDate"/>
+        </call-service>
+        
+        <!-- Return to request -->
+        <set field="communicationEventTypeId" from-field="formInput.formInput.communicationEventTypeId"/>
+        <set field="communicationEventId" from-field="formInput.formInput.communicationEventId"/>        
+        <field-to-request field-name="communicationEventId" request-name="communicationEventId"/>
+        <field-to-request field-name="communicationEventTypeId" request-name="communicationEventTypeId"/>        
+        
+    </simple-method>
+    
+    <simple-method method-name="addContentToCommEvent" short-description="Add content to email communication">        
+        <!-- Call layout to get field -->
+        <call-class-method class-name="org.ofbiz.content.layout.LayoutWorker"
+            method-name="uploadImageAndParameters"
+            ret-field-name="formInput">
+            <field field-name="request" type="javax.servlet.http.HttpServletRequest"/>
+            <string value="partyId"/>
+        </call-class-method>
+        
+        <!-- Create party content -->
+        <set-service-fields service-name="createPartyContent" map-name="formInput.formInput" to-map-name="partycontent"/>
+        <set field="partycontent.contentId" from-field="formInput.formInput.contentId"/>
+        <set field="partycontent.partyContentTypeId" from-field="formInput.formInput.partyContentTypeId"/>
+        <set field="partycontent.partyId" from-field="formInput.formInput.partyId"/>        
+        <call-service service-name="createPartyContent" in-map-name="partycontent"/>
+        
+        <!-- Create communication event and content association -->
+        <set-service-fields service-name="createCommEventContentAssoc" map-name="formInput.formInput" to-map-name="contentAssoc"/>
+        <set field="contentAssoc.contentId" from-field="formInput.formInput.contentId"/>
+        <set field="contentAssoc.communicationEventId" from-field="formInput.formInput.communicationEventId"/>
+        <call-service service-name="createCommEventContentAssoc" in-map-name="contentAssoc">
+            <result-to-field result-name="fromDate" field-name="fromDate"/>
+        </call-service>
+        
+        <!-- Return to request -->
+        <set field="communicationEventTypeId" from-field="formInput.formInput.communicationEventTypeId"/>
+        <set field="communicationEventId" from-field="formInput.formInput.communicationEventId"/>
+        <field-to-request field-name="communicationEventTypeId" request-name="communicationEventTypeId"/>
+        <field-to-request field-name="communicationEventId" request-name="communicationEventId"/>
+    </simple-method>
+    
 </simple-methods>

Modified: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml?rev=703759&r1=703758&r2=703759&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/webapp/mypage/WEB-INF/controller.xml Sat Oct 11 19:31:57 2008
@@ -220,6 +220,49 @@
     <request-map uri="listInvoices">
         <security https="true" auth="true"/>
         <response name="success" type="view" value="ListInvoices"/>
+    </request-map>    
+    
+    <!-- EMAIL COMMUNICATIONS -->
+    <request-map uri="NewCommunicationEvents">
+        <security https="true" auth="true"/>        
+        <response name="success" type="view" value="EditCommunicationEvent"/>
+    </request-map>
+    
+    <request-map uri="NewCommunicationEvent">
+        <security https="true" auth="true"/>
+        <event type="simple" path="org/ofbiz/mypage/Events.xml" invoke="checkEnteredEmailExists"/>
+        <response name="success" type="view" value="EditCommunicationEvent"/>
+    </request-map>
+    
+    <request-map uri="addAttachmentEmail">
+        <security https="true" auth="true"/>        
+        <response name="success" type="view" value="addAttachmentEmail"/>
+    </request-map>
+    
+    <request-map uri="addContentToCommEvent">
+        <security https="true" auth="true"/>        
+        <event type="simple" path="org/ofbiz/mypage/Events.xml" invoke="addContentToCommEvent"/>
+        <response name="success" type="request" value="NewCommunicationEvents"/>
+        <response name="error" type="view" value="EditCommunicationEvent"/>
+    </request-map>
+    
+    <request-map uri="uploadAttachFiletoEmail">
+        <security https="true" auth="true"/>        
+        <event type="simple" path="org/ofbiz/mypage/Events.xml" invoke="createCommunicationContent"/>
+        <response name="success" type="request" value="NewCommunicationEvents"/>
+        <response name="error" type="view" value="EditCommunicationEvent"/>
+    </request-map>
+    
+    <request-map uri="removeAttachFile">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="removeCommEventContentAssoc"/>        
+        <response name="success" type="request" value="NewCommunicationEvents"/>
+        <response name="error" type="view" value="EditCommunicationEvent"/>
+    </request-map>
+    
+    <request-map uri="EditCommunicationEvent">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="EditCommunicationEvent"/>
     </request-map>
     
     <view-map name="main" type="screen" page="component://mypage/widget/CommonScreens.xml#main"/>
@@ -236,4 +279,6 @@
     <view-map name="EditRequest" type="screen" page="component://mypage/widget/MyPageScreens.xml#EditRequest"/>
     <view-map name="ListInvoices" type="screen" page="component://mypage/widget/MyPageScreens.xml#ListInvoices"/>
     <view-map name="custPreferences" type="screen" page="component://mypage/widget/CommonScreens.xml#custPreferences"/>
+    <view-map name="EditCommunicationEvent" type="screen" page="component://mypage/widget/MyPageScreens.xml#EditCommunicationEvent"/>
+    <view-map name="addAttachmentEmail" type="screen" page="component://mypage/widget/MyPageScreens.xml#addAttachmentEmail"/>
 </site-conf>

Added: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/addAttachFile.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/webapp/mypage/addAttachFile.ftl?rev=703759&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/webapp/mypage/addAttachFile.ftl (added)
+++ ofbiz/trunk/specialpurpose/mypage/webapp/mypage/addAttachFile.ftl Sat Oct 11 19:31:57 2008
@@ -0,0 +1,38 @@
+  <div id="partyContent" class="screenlet">
+    <div class="screenlet-title-bar">
+      <h3>Attach File</h3>
+    </div>
+    <div class="screenlet-body">
+          ${screens.render("component://mypage/widget/MyPageScreens.xml#AttachFiletList")}
+      <hr/>
+      <div class="label">${uiLabelMap.Content}</div>
+      <form id="content2comevent" method="post" enctype="multipart/form-data" action="<@ofbizUrl>addContentToCommEvent</@ofbizUrl>" name="content2comevent">
+        <input type="hidden" name="partyId" value="${partyId}" id="contentPartyId"/>      
+ <input type="hidden" name="communicationEventId" value="${communicationEventId}"/>  
+ <input type="hidden" name="partyContentTypeId" value="USERDEF"/>
+ <input type="hidden" name="communicationEventTypeId" value="${communicationEventTypeId}"/>
+ <input type="text" size="25" name="contentId"/>
+ <a href="javascript:call_fieldlookup2(document.content2comevent.contentId,'LookupContent');">
+ <img width="15" height="14" border="0" alt="Lookup" src="/images/fieldlookup.gif"/>
+ </a>
+        &nbsp;&nbsp;<input type="submit" value="${uiLabelMap.CommonAdd}"/><br><br>
+      </form>
+            
+      <div class="label">${uiLabelMap.Attach}</div>
+      <form id="uploadPartyContent" method="post" enctype="multipart/form-data" action="<@ofbizUrl>uploadAttachFiletoEmail</@ofbizUrl>">
+        <input type="hidden" name="dataCategoryId" value="PERSONAL"/>
+        <input type="hidden" name="contentTypeId" value="DOCUMENT"/>
+        <input type="hidden" name="statusId" value="CTNT_PUBLISHED"/>
+        <input type="hidden" name="partyId" value="${partyId}" id="contentPartyId"/>
+        <input type="hidden" name="partyContentTypeId" value="USERDEF"/>
+        <input type="hidden" name="roleTypeId" value="CONTENT"/>
+        <input type="hidden" name="communicationEventId" value="${communicationEventId}"/>  
+        <input type="hidden" name="communicationEventTypeId" value="${communicationEventTypeId}"/>        
+              
+        <input type="file" name="uploadedFile" size="25" id="uploadedFile"/>
+        <input type="submit" value="${uiLabelMap.CommonUpload}"/><br><br>
+        <input type="button" value="Back" onClick="javascript:history.go(-1);">
+      </form>
+      <div id='progress_bar'><div></div></div>
+    </div>
+  </div>

Propchange: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/addAttachFile.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/addAttachFile.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/addAttachFile.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/attachFileList.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/webapp/mypage/attachFileList.ftl?rev=703759&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/webapp/mypage/attachFileList.ftl (added)
+++ ofbiz/trunk/specialpurpose/mypage/webapp/mypage/attachFileList.ftl Sat Oct 11 19:31:57 2008
@@ -0,0 +1,29 @@
+  <div id="partyContentList">  
+  
+      <#if commEventContent?has_content>
+        <table class="basic-table" cellspacing="0">
+          <#list commEventContent as commContent>
+           <#list partyContent as pContent>
+   <#assign partyId = pContent.partyId/>
+   <#if commContent.contentId == pContent.contentId>
+   <#assign content = pContent.getRelatedOne("Content")>  
+   <#assign fromDate = commContent.fromDate>
+   <#assign ptype = pContent.partyContentTypeId>  
+   </#if>
+   </#list>
+            <tr>
+              <td width="30%"><#if (content.contentName?has_content)>
+                    <a href="<@ofbizUrl>img/${content.contentName}?imgId=${content.dataResourceId}</@ofbizUrl>" target="blank"> ${content.contentName?if_exists}</a>
+                </#if></td>
+              <td class="button-col" width="20%">                              
+                <a href="<@ofbizUrl>removeAttachFile/EditCommunicationEvent?communicationEventTypeId=EMAIL_COMMUNICATION&communicationEventId=${commContent.communicationEventId}&contentId=${commContent.contentId}&fromDate=${fromDate}</@ofbizUrl>">${uiLabelMap.CommonRemove}</a>
+              </td>
+              <td  width="20%">${commContent.fromDate?if_exists}</td>      
+              <td  width="30%">&nbsp;</td>                        
+            </tr>
+          </#list>
+        </table>
+      <#else>
+        ${uiLabelMap.PartyNoContent}
+      </#if>
+  </div>
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/attachFileList.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/attachFileList.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/mypage/webapp/mypage/attachFileList.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml?rev=703759&r1=703758&r2=703759&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/widget/CommonScreens.xml Sat Oct 11 19:31:57 2008
@@ -114,6 +114,9 @@
         <section>
             <actions>
                 <set field="headerItem" value="${parameters.donePage}"/>
+                <entity-one entity-name="CommunicationEvent" value-name="commEvent">
+                    <field-map field-name="communicationEventId" env-name="parameters.communicationEventId"/>
+                </entity-one>
                 <script location="component://mypage/webapp/mypage/WEB-INF/actions/GetMyCommunicationEventRole.groovy"/>
             </actions>
             <widgets>

Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml?rev=703759&r1=703758&r2=703759&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageForms.xml Sat Oct 11 19:31:57 2008
@@ -212,4 +212,76 @@
         <field name="amountToApply" widget-area-style="align-text"><display type="currency" currency="${currencyUomId}"/></field>
     </form>
 
+    <form name="ListDraftEmails" type="list" extends="ListCommEvents" extends-resource="component://party/webapp/partymgr/communication/CommForms.xml"
+         use-row-submit="true">
+        <actions>
+            <entity-condition entity-name="CommunicationEvent" list-name="commEvents">
+                <condition-list combine="and">
+                    <condition-expr env-name="" field-name="statusId" operator="equals" value="COM_READ"/>
+                    <condition-list combine="or">
+                        <condition-expr field-name="partyIdFrom" operator="equals" value="${partyId}"/>                        
+                    </condition-list>
+                </condition-list>
+                <order-by field-name="-lastUpdatedStamp"/>
+            </entity-condition>
+        </actions>        
+        <field name="subject">
+            <hyperlink description="${subject}" target="EditCommunicationEvent?communicationEventId=${communicationEventId}&amp;communicationEventTypeId=EMAIL_COMMUNICATION"/>
+        </field>
+        <field name="removeLink" title="${uiLabelMap.CommonDelete}" widget-style="smallSubmit">
+            <hyperlink also-hidden="false" description="${uiLabelMap.CommonDelete}" target="deletePartyCommunicationEvent?partyId=${partyId}&amp;communicationEventId=${communicationEventId}"/>
+        </field>
+    </form>
+
+    <form name="MyPageNewEmail" type="single" target="createCommunicationEvent" default-map-name="communicationEvent">
+        <actions>
+            <set field="nowDate" value="${bsh:org.ofbiz.base.util.UtilDateTime.nowDateString(&quot;yyyy-MM-dd HH:mm:ss.S&quot;)}" type="String"/>            
+            <entity-condition entity-name="PartyContactWithPurpose" list-name="emailAddresses">
+                <condition-list combine="and">
+                    <condition-expr field-name="partyId" value="${userLogin.partyId}"/>
+                    <condition-expr field-name="contactFromDate" operator="less-equals" env-name="nowDate"/>
+                    <condition-list combine="or">
+                        <condition-expr field-name="contactThruDate" env-name="null"/>
+                        <condition-expr field-name="contactThruDate" operator="greater-equals" env-name="nowDate"/>
+                    </condition-list>
+                    <condition-expr field-name="purposeFromDate" operator="less-equals" env-name="nowDate"/>
+                    <condition-list combine="or">
+                        <condition-expr field-name="purposeThruDate" operator="greater-equals" env-name="nowDate"/>
+                        <condition-expr field-name="purposeThruDate" env-name="null"/>
+                    </condition-list>
+                    <condition-expr field-name="contactMechPurposeTypeId" operator="equals" value="PRIMARY_EMAIL"/>
+                    <condition-expr field-name="contactMechTypeId" operator="equals" value="EMAIL_ADDRESS"/>
+                </condition-list>
+                <order-by field-name="infoString"/>
+            </entity-condition>
+        </actions>
+        <alt-target use-when="communicationEventId!=null" target="updateCommunicationEvent"/>
+        <field name="donePage"><hidden/></field>        
+        <field name="communicationEventId"  use-when="communicationEventId!=null"><hidden/></field>
+        <field name="communicationEventTypeId"><hidden value="AUTO_EMAIL_COMM"/></field>
+        <field name="statusId"><hidden value="COM_IN_PROGRESS"/></field>
+        <field name="parentCommEventId"><hidden value="${parameters.parentCommEventId}"/></field>
+        <field name="partyIdFrom"><hidden value="${userLogin.partyId}"/></field>
+        <field name="emailAddress" parameter-name="contactMechIdFrom">
+            <drop-down>
+                <list-options list-name="emailAddresses" description="${infoString}" key-name="contactMechId"/>
+            </drop-down>
+        </field>
+        <field name="contactMechIdTo" title="${uiLabelMap.PartyEmailTo}">
+            <lookup target-form-name="LookupPartyEmail"/>
+        </field>
+        <field name="datetimeStarted" title="${uiLabelMap.CommonSendDate}"><date-time/></field>
+        <field name="subject"><text size="60"/></field>
+        <field name="fileAttach"><display/></field><field name="fileAttach">
+            <hyperlink target="addAttachmentEmail?communicationEventTypeId=${parameters.communicationEventTypeId}&amp;partyId=${userLogin.partyId}&amp;communicationEventId=${parameters.communicationEventId}" description="Attach File"/>
+        </field>        
+        <field name="contentMimeTypeId"><hidden value="text/plain"/></field>
+        <field name="content" title="${uiLabelMap.CommonContent}"><textarea cols="80" rows="20"/></field>
+        <field name="save" title="&amp;nbsp;">
+            <hyperlink also-hidden="true" target-type="plain" description="Save" target="javascript:(document.MyPageNewEmail.statusId.value='COM_READ'),(document.MyPageNewEmail.submit())"/>          
+        </field>
+        <field name="send" title="&amp;nbsp;">
+            <hyperlink also-hidden="true" target-type="plain" description="Send" target="javascript:(document.MyPageNewEmail.submit())"/>
+        </field>
+    </form>
 </forms>
\ No newline at end of file

Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml?rev=703759&r1=703758&r2=703759&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageMenus.xml Sat Oct 11 19:31:57 2008
@@ -124,7 +124,7 @@
                 <if-has-permission permission="PARTYMGR_CME-EMAIL_CREATE"/>
             </condition>      
             <link
-                target="EditCommunicationEvent?communicationEventTypeId=EMAIL_COMMUNICATION&amp;donePage=${parameters.donePage}" />
+                target="NewCommunicationEvent?communicationEventTypeId=EMAIL_COMMUNICATION&amp;donePage=${parameters.donePage}&amp;partyIdFrom=${userLogin.partyId}&amp;statusId=COM_PENDING"/>
         </menu-item>
         <menu-item name="newNote" title="${uiLabelMap.PartyNewInternalNote}">
             <condition>
@@ -186,6 +186,12 @@
             </condition>
             <link target="setCommunicationEventRoleStatus?communicationEventId=${parameters.communicationEventId}&amp;partyId=${userLogin.partyId}&amp;roleTypeId=${communicationEventRole.roleTypeId}&amp;statusId=COM_ROLE_COMPLETED"/>
         </menu-item>
+        <menu-item name="send" title="${uiLabelMap.CommonSend}">
+            <condition>
+                <if-compare field-name="commEvent.statusId" operator="equals" value="COM_READ"/>
+            </condition>
+            <link target="updateCommunicationEvent/main?communicationEventId=${parameters.communicationEventId}&amp;statusId=COM_IN_PROGRESS"/>
+        </menu-item>
         <menu-item name="delete" title="${uiLabelMap.CommonDelete}">
             <condition>
                 <not><if-empty field-name="communicationEventRole"/></not>

Modified: ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml?rev=703759&r1=703758&r2=703759&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml Sat Oct 11 19:31:57 2008
@@ -194,8 +194,10 @@
  <entity-condition entity-name="CommunicationEventAndRole"
  list-name="commEvents">
  <condition-list combine="and">
- <condition-expr field-name="statusId" operator="not-equals"
- value="COM_UNKNOWN_PARTY" />
+                        <condition-expr field-name="statusId" operator="not-equals"
+                            value="COM_UNKNOWN_PARTY" />
+                        <condition-expr field-name="roleStatusId" operator="not-equals"
+                            value="COM_ROLE_CREATED" />
  <condition-expr field-name="partyId" operator="equals"
  value="${partyId}" />
                         <condition-expr field-name="roleStatusId"
@@ -210,13 +212,19 @@
                             value="COM_UNKNOWN_PARTY" />
                         <condition-expr field-name="roleStatusId" operator="not-equals"
                             value="COM_ROLE_COMPLETED" />
-                        <condition-expr field-name="roleStatusId" operator="not-equals"
-                            value="COM_ROLE_COMPLETED" />
                         <condition-expr field-name="partyId" operator="equals"
                             value="${partyId}" />
                     </condition-list>
                     <order-by field-name="-datetimeStarted" />
-                </entity-condition>
+ </entity-condition>
+    <entity-condition entity-name="CommunicationEventAndRole" list-name="commEventDraft">
+        <condition-list combine="and">
+            <condition-expr field-name="statusId" operator="equals"
+                value="COM_READ"/>
+            <condition-expr field-name="partyId" operator="equals"
+                value="${partyId}"/>            
+        </condition-list>
+    </entity-condition>
                 <entity-one entity-name="PartyNameView" value-name="partyName">
                     <field-map field-name="partyId" env-name="partyId"/>
                 </entity-one>
@@ -243,6 +251,19 @@
                     <label style="h2" text="${uiLabelMap.EmailsFromKnownOrigin}"></label>
                     <include-form name="ListPartyCommEvents"
                         location="component://mypage/widget/MyPageForms.xml" />
+                    <section>
+                        <condition>
+                            <not>
+                                <if-empty field-name="commEventDraft" />
+                            </not>
+                        </condition>
+                        <widgets>
+                            <label style="h2" text="${uiLabelMap.DraftEmails}"></label>
+                            <include-form
+                                location="component://mypage/widget/MyPageForms.xml"
+                                name="ListDraftEmails" />
+                        </widgets>
+                    </section>
                 </screenlet>
             </widgets>
         </section>
@@ -511,4 +532,119 @@
             </widgets>
         </section>
     </screen>
+    <screen name="EditCommunicationEvent">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleEditCommunication" />
+                <set field="tabButtonItem" value="CommunicationEvent" />
+                <entity-one entity-name="CommunicationEvent" value-name="communicationEvent" />
+                <script location="component://party/webapp/partymgr/WEB-INF/actions/communication/PrepCommEventReply.groovy"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonCommunicationEventDecorator"
+                    location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <section><!-- Email -->
+                            <condition>
+                                <or><!-- have for e-mails a special form -->
+                                    <if-compare field-name="parameters.communicationEventTypeId"
+                                        operator="equals" value="EMAIL_COMMUNICATION" />
+                                    <if-compare field-name="parameters.communicationEventTypeId"
+                                        operator="equals" value="AUTO_EMAIL_COMM" />
+                                </or>
+                            </condition>
+                            <widgets>
+                                <screenlet id="EditCommunicationEventPanel" title="${uiLabelMap.PartyEditCommunicationEvent}" collapsible="true">
+                                    <include-form location="component://mypage/widget/MyPageForms.xml" name="MyPageNewEmail"/>
+                                </screenlet>
+                            </widgets>
+                        </section>
+                        <section>
+                            <condition><!-- internal note -->
+                                <if-compare field-name="parameters.communicationEventTypeId"
+                                    operator="equals" value="COMMENT_NOTE" />
+                            </condition>
+                            <widgets>
+                                <screenlet id="EditCommunicationEventPanel" title="${uiLabelMap.PartyEditCommunicationEvent}" collapsible="true">
+                                    <include-form location="component://party/webapp/partymgr/communication/CommForms.xml" name="NewInternalNote"/>
+                                </screenlet>
+                            </widgets>
+                        </section>
+                        <section>
+                            <condition><!-- others -->
+                                <and>
+                                    <if-compare field-name="parameters.communicationEventTypeId"
+                                        operator="not-equals" value="COMMENT_NOTE" />
+                                    <if-compare field-name="parameters.communicationEventTypeId"
+                                        operator="not-equals" value="EMAIL_COMMUNICATION" />
+                                    <if-compare field-name="parameters.communicationEventTypeId"
+                                        operator="not-equals" value="AUTO_EMAIL_COMM" />
+                                </and>
+                            </condition>
+                            <widgets>
+                                <screenlet id="EditCommunicationEventPanel"
+                                    title="${uiLabelMap.PartyEditCommunicationEvent}" collapsible="true">
+                                    <include-form
+                                        location="component://party/webapp/partymgr/communication/CommForms.xml"
+                                        name="EditCommEvent" />
+                                </screenlet>
+                                <screenlet title="${uiLabelMap.PartyChildCommunicationEvents}"
+                                    navigation-form-name="ListChildCommEvents">
+                                    <include-form
+                                        location="component://party/webapp/partymgr/communication/CommForms.xml"
+                                        name="ListChildCommEvents" />
+                                </screenlet>
+                            </widgets>
+                        </section>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
+    <screen name="addAttachmentEmail">
+        <section>
+            <actions>
+                <entity-condition entity-name="MimeType" list-name="mimeTypes">
+                    <order-by field-name="description"/>
+                    <order-by field-name="mimeTypeId"/>
+                </entity-condition>
+                <set field="communicationEventId" from-field="parameters.communicationEventId"/>
+                <set field="communicationEventTypeId" from-field="parameters.communicationEventTypeId"/>
+                <set field="partyId" from-field="parameters.partyId"/>                    
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonCommunicationEventDecorator"
+                    location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <platform-specific>
+                            <html>
+                                <html-template location="component://mypage/webapp/mypage/addAttachFile.ftl"/>
+                            </html>
+                        </platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>                  
+        </section>
+    </screen>    
+    <screen name="AttachFiletList">
+        <section>
+            <actions>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="ContentUiLabels" map-name="uiLabelMap" global="true"/>
+                <entity-and entity-name="CommEventContentAssoc" list-name="commEventContent">
+                    <field-map field-name="communicationEventId" env-name="parameters.communicationEventId"/>
+                </entity-and>
+                <entity-and entity-name="PartyContent" list-name="partyContent">
+                    <field-map field-name="partyId" env-name="parameters.partyId"/>
+                </entity-and>
+            </actions>
+            <widgets>
+                <platform-specific>
+                    <html>
+                        <html-template location="component://mypage/webapp/mypage/attachFileList.ftl"/>
+                    </html>
+                </platform-specific>
+            </widgets>
+        </section>
+    </screen>
 </screens>