svn commit: r823849 - in /ofbiz/trunk: applications/party/data/ applications/party/script/org/ofbiz/party/communication/ applications/party/servicedef/ specialpurpose/ecommerce/data/ specialpurpose/ecommerce/templates/email/ specialpurpose/ecommerce/we...

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

svn commit: r823849 - in /ofbiz/trunk: applications/party/data/ applications/party/script/org/ofbiz/party/communication/ applications/party/servicedef/ specialpurpose/ecommerce/data/ specialpurpose/ecommerce/templates/email/ specialpurpose/ecommerce/we...

ashish-18
Author: ashish
Date: Sat Oct 10 13:07:50 2009
New Revision: 823849

URL: http://svn.apache.org/viewvc?rev=823849&view=rev
Log:
Applied patch from jira issue OFBIZ-3024 - Implement contact us functionality for unregistered user.
Thanks Awdesh for the contribution.

Added:
    ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactUsEmail.ftl   (with props)
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/AnonContactus.ftl   (with props)
Modified:
    ofbiz/trunk/applications/party/data/PartyTypeData.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/communication/CommunicationEventServices.xml
    ofbiz/trunk/applications/party/servicedef/services.xml
    ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/header.ftl
    ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml
    ofbiz/trunk/specialpurpose/ecommerce/widget/EmailContactListScreens.xml

Modified: ofbiz/trunk/applications/party/data/PartyTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/data/PartyTypeData.xml?rev=823849&r1=823848&r2=823849&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/data/PartyTypeData.xml (original)
+++ ofbiz/trunk/applications/party/data/PartyTypeData.xml Sat Oct 10 13:07:50 2009
@@ -148,6 +148,7 @@
     <Enumeration description="Update Personal Info Confirmation" enumCode="UPDAT_CONFIRM" enumId="UPD_PRSNL_INF_CNFRM" sequenceId="02" enumTypeId="PARTY_EMAIL"/>
     <Enumeration description="Party Email Address Verification" enumCode="EMAIL_VERIFY" enumId="PRDS_EMAIL_VERIFY" sequenceId="03" enumTypeId="PARTY_EMAIL"/>
     <Enumeration description="Party Invitation" enumCode="INVITE_EMAIL" enumId="PRDS_PARTYINV_EMAIL" sequenceId="04" enumTypeId="PARTY_EMAIL"/>
+    <Enumeration description="Contact-Us Notification" enumCode="CONT_EMAIL" enumId="CONT_NOTI_EMAIL" sequenceId="05" enumTypeId="PARTY_EMAIL"/>
 
     <!-- the groups which are the main roles on he party listing -->
     <RoleType description="Main Role" hasTable="N" parentTypeId="" roleTypeId="MAIN_ROLE"/>

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=823849&r1=823848&r2=823849&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 10 13:07:50 2009
@@ -598,4 +598,45 @@
             </if-empty>
         </if-compare-field>
     </simple-method>
+    
+    <simple-method method-name="sendContactUsInfoEmailToCompany" short-description="Create communication event and send mail to company" login-required="false">
+        <entity-one entity-name="UserLogin" value-field="systemUserLogin" auto-field-map="false">
+            <field-map field-name="userLoginId" value="system"/>
+        </entity-one>
+        
+        <set-service-fields service-name="createCommunicationEventWithoutPermission" map="parameters" to-map="contactUsMap"/>
+        <set field="contactUsMap.userLogin" from-field="systemUserLogin"/>
+        <call-service service-name="createCommunicationEventWithoutPermission" in-map-name="contactUsMap"/>
+        
+        <!-- Get party email address -->
+        <set field="getPartyEmailMap.partyId" from-field="parameters.partyIdTo"/>
+        <set field="getPartyEmailMap.userLogin" from-field="systemUserLogin"/>
+        <call-service service-name="getPartyEmail" in-map-name="getPartyEmailMap">
+            <result-to-field result-name="emailAddress"/>
+        </call-service>
+        
+        <entity-one entity-name="ProductStoreEmailSetting" value-field="productStoreEmailSetting"/>
+        <set field="bodyParameters.partyId" from-field="parameters.partyIdTo"/>
+        <set field="bodyParameters.email" from-field="parameters.emailAddress"/>
+        <set field="bodyParameters.firstName" from-field="parameters.firstName"/>
+        <set field="bodyParameters.lastName" from-field="parameters.lastName"/>
+        <set field="bodyParameters.postalCode" from-field="parameters.postalCode"/>
+        <set field="bodyParameters.countryCode" from-field="parameters.countryCode"/>
+        <set field="bodyParameters.message" from-field="parameters.content"/>
+        <if-not-empty field="productStoreEmailSetting.bodyScreenLocation">
+            <set field="emailParams.bodyParameters" from-field="bodyParameters"/>
+            <set field="emailParams.userLogin" from-field="systemUserLogin"/>
+            <if-not-empty field="emailAddress">
+                <set field="emailParams.sendTo" from-field="emailAddress"/>
+            <else>
+                <set field="emailParams.sendTo" from-field="productStoreEmailSetting.fromAddress"/>
+            </else>
+            </if-not-empty>
+            <set field="emailParams.subject" from-field="productStoreEmailSetting.subject"/>
+            <set field="emailParams.sendFrom" from-field="parameters.emailAddress"/>
+            <set field="emailParams.contentType" from-field="productStoreEmailSetting.contentType"/>
+            <set field="emailParams.bodyScreenUri" from-field="productStoreEmailSetting.bodyScreenLocation"/>
+            <call-service service-name="sendMailFromScreen" in-map-name="emailParams"/>
+        </if-not-empty>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/party/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/servicedef/services.xml?rev=823849&r1=823848&r2=823849&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/party/servicedef/services.xml Sat Oct 10 13:07:50 2009
@@ -1292,5 +1292,16 @@
         <attribute name="description" type="String" mode="OUT" optional="true"/>
     </service>
 
-
+    <service name="sendContactUsInfoEmailToCompany" engine="simple"
+            location="component://party/script/org/ofbiz/party/communication/CommunicationEventServices.xml" invoke="sendContactUsInfoEmailToCompany" auth="false">
+        <description>Create communication event and send mail to company</description>
+        <implements service="createCommunicationEventWithoutPermission"/>
+        <attribute name="emailAddress" type="String" mode="IN" optional="true"/>
+        <attribute name="firstName" type="String" mode="IN" optional="true"/>
+        <attribute name="lastName" type="String" mode="IN" optional="true"/>
+        <attribute name="postalCode" type="String" mode="IN" optional="true"/>
+        <attribute name="countryCode" type="String" mode="IN" optional="true"/>
+        <attribute name="emailType" type="String" mode="IN" optional="true"/>
+        <attribute name="productStoreId" type="String" mode="IN" optional="true"/>
+    </service>
 </services>

Modified: ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml?rev=823849&r1=823848&r2=823849&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/data/DemoProduct.xml Sat Oct 10 13:07:50 2009
@@ -121,6 +121,8 @@
     <ProductStoreEmailSetting productStoreId="9000" emailType="UPD_PRSNL_INF_CNFRM" bodyScreenLocation="component://party/widget/partymgr/EmailPartyScreens.xml#ChangePersonalInfoNotification" subject="Personal Information Updated" bccAddress="[hidden email]" fromAddress="[hidden email]"/>
     <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_EMAIL_VERIFY" bodyScreenLocation="component://party/widget/partymgr/EmailPartyScreens.xml#VerifyEmailAddressNotification" subject="Email Address Verification" bccAddress="[hidden email]" fromAddress="[hidden email]"/>
 
+    <ProductStoreEmailSetting productStoreId="9000" emailType="CONT_NOTI_EMAIL" bodyScreenLocation="component://ecommerce/widget/EmailContactListScreens.xml#ContactUsEmailNotification" subject="Contact-us Information Notification" fromAddress="[hidden email]" />
+
     <ProductStoreFacility productStoreId="9000" facilityId="WebStoreWarehouse" fromDate="2001-05-13 12:00:00.0"/>
     <ProductStoreRole partyId="admin" roleTypeId="SALES_REP" productStoreId="9000" fromDate="2001-05-13 12:00:00.0"/>
     <ProductStoreKeywordOvrd productStoreId="9000" keyword="gizmo" fromDate="2001-05-13 12:00:00.0" target="100" targetTypeEnumId="KOTT_PRODCAT"/>

Added: ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactUsEmail.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactUsEmail.ftl?rev=823849&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactUsEmail.ftl (added)
+++ ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactUsEmail.ftl Sat Oct 10 13:07:50 2009
@@ -0,0 +1,28 @@
+<#--
+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.
+-->
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head></head>
+  <body>
+    <p>The information filled by the person on contact us page is as follows:</p>
+    <p>${uiLabelMap.CommonName}: ${parameters.firstName?if_exists} ${parameters.lastName?if_exists}</p>
+    <p>${uiLabelMap.CommonEmail}: ${parameters.email?if_exists}</p>
+    <p>${uiLabelMap.CommonMessage}: ${parameters.message?if_exists}</p>
+  </body>
+</html>
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactUsEmail.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactUsEmail.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/ecommerce/templates/email/ContactUsEmail.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=823849&r1=823848&r2=823849&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Sat Oct 10 13:07:50 2009
@@ -1279,12 +1279,22 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="contactus"/>
     </request-map>
+    <request-map uri="AnonContactus">
+        <security https="true" auth="false"/>
+        <response name="success" type="view" value="AnonContactus"/>
+    </request-map>
     <request-map uri="contactsubmit">
         <security https="true" auth="true"/>
         <event type="service" invoke="createCommunicationEventWithoutPermission"/>
         <response name="success" type="view" value="contactus"/>
         <response name="error" type="view" value="contactus"/>
     </request-map>
+    <request-map uri="submitAnonContact">
+        <security https="true" auth="false"/>
+        <event type="service" invoke="sendContactUsInfoEmailToCompany"/>
+        <response name="success" type="view" value="AnonContactus"/>
+        <response name="error" type="view" value="AnonContactus"/>
+    </request-map>
 
     <request-map uri="signUpForContactList">
         <security https="false" auth="false"/>
@@ -1956,6 +1966,7 @@
     <view-map name="digitalproductedit" type="screen" page="component://ecommerce/widget/CustomerScreens.xml#digitalproductedit"/>
 
     <view-map name="contactus" type="screen" page="component://ecommerce/widget/CustomerScreens.xml#contactus"/>
+    <view-map name="AnonContactus" type="screen" page="component://ecommerce/widget/CustomerScreens.xml#AnonContactus"/>
     <view-map name="messagelist" type="screen" page="component://ecommerce/widget/CustomerScreens.xml#messagelist"/>
     <view-map name="messagedetail" type="screen" page="component://ecommerce/widget/CustomerScreens.xml#messagedetail"/>
     <view-map name="messagecreate" type="screen" page="component://ecommerce/widget/CustomerScreens.xml#messagecreate"/>

Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/AnonContactus.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/AnonContactus.ftl?rev=823849&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/AnonContactus.ftl (added)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/AnonContactus.ftl Sat Oct 10 13:07:50 2009
@@ -0,0 +1,60 @@
+<#--
+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.
+-->
+
+<h3>${uiLabelMap.CommonContactUs}</h3>
+<form id="contactForm" method="post" action="<@ofbizUrl>submitAnonContact</@ofbizUrl>">
+  <fieldset>
+    <input type="hidden" name="partyIdFrom" value="${(userLogin.partyId)?if_exists}" />
+    <input type="hidden" name="partyIdTo" value="${productStore.payToPartyId?if_exists}"/>
+    <input type="hidden" name="contactMechTypeId" value="WEB_ADDRESS" />
+    <input type="hidden" name="communicationEventTypeId" value="WEB_SITE_COMMUNICATI" />
+    <input type="hidden" name="productStoreId" value="${productStore.productStoreId}" />
+    <input type="hidden" name="emailType" value="CONT_NOTI_EMAIL" />
+    <input type="hidden" name="note" value="${Static["org.ofbiz.base.util.UtilHttp"].getFullRequestUrl(request).toString()}" />
+    <div>
+      <label for="comment">${uiLabelMap.CommonComment}:</label>
+      <textarea name="content" id="comment" class="required" cols="50" rows="5"></textarea>
+    </div>
+    <div>
+      <label for="emailAddress">${uiLabelMap.FormFieldTitle_emailAddress} *</label>
+      <input type="text" name="emailAddress" id="emailAddress" class="required" />
+    </div>
+    <div>
+      <label for="firstName">${uiLabelMap.FormFieldTitle_firstName}</label>
+      <input type="text" name="firstName" id="firstName" class="required" />
+    </div>
+    <div>
+      <label for="lastName">${uiLabelMap.FormFieldTitle_lastName}</label>
+      <input type="text" name="lastName" id="lastName" class="required" />
+    </div>
+    <div>
+      <label for="postalCode">${uiLabelMap.CommonZipPostalCode}</label>
+      <input name="postalCode" id="postalCode" type="text" />
+    </div>
+    <div>
+      <label>${uiLabelMap.CommonCountry}</label>
+      <select name="countryCode" id="countryCodeGeoId" class="required">
+        ${screens.render("component://common/widget/CommonScreens.xml#countries")}
+      </select>
+    </div>
+  </fieldset>
+  <div>
+    <input type="submit" value="${uiLabelMap.CommonSubmit}" />
+  </div>
+</form>
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/AnonContactus.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/AnonContactus.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/AnonContactus.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/header.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/header.ftl?rev=823849&r1=823848&r2=823849&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/header.ftl (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/includes/header.ftl Sat Oct 10 13:07:50 2009
@@ -56,7 +56,12 @@
         <li id="header-bar-login"><a href="<@ofbizUrl>${checkLoginUrl}</@ofbizUrl>">${uiLabelMap.CommonLogin}</a></li>
         <li id="header-bar-register"><a href="<@ofbizUrl>newcustomer</@ofbizUrl>">${uiLabelMap.EcommerceRegister}</a></li>
       </#if>
-      <li id="header-bar-contactus"><a href="<@ofbizUrl>contactus</@ofbizUrl>">${uiLabelMap.CommonContactUs}</a></li>
+      <li id="header-bar-contactus">
+        <#if userLogin?has_content && userLogin.userLoginId != "anonymous">
+          <a href="<@ofbizUrl>contactus</@ofbizUrl>">${uiLabelMap.CommonContactUs}</a></li>
+        <#else>
+          <a href="<@ofbizUrl>AnonContactus</@ofbizUrl>">${uiLabelMap.CommonContactUs}</a></li>
+        </#if>
       <li id="header-bar-main"><a href="<@ofbizUrl>main</@ofbizUrl>">${uiLabelMap.CommonMain}</a></li>
     </ul>
     <ul id="right-links">

Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml?rev=823849&r1=823848&r2=823849&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml Sat Oct 10 13:07:50 2009
@@ -607,4 +607,25 @@
         </section>
     </screen>
 
+    <screen name="AnonContactus">
+        <section>
+            <actions>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="rightbarScreenName" value="rightbar"/>
+                <set field="MainColumnStyle" value="rightonly"/>
+
+                <set field="titleProperty" value="PageTitleLogin"/>
+                <set field="pageHeader" value="${uiLabelMap.CommonContactUs}"/>
+                <set field="headerItem" value="contactus"/>
+                <set field="submitRequest" value="contactsubmit"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/customer/AnonContactus.ftl"/></html></platform-specific>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 </screens>

Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/EmailContactListScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/EmailContactListScreens.xml?rev=823849&r1=823848&r2=823849&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/widget/EmailContactListScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/widget/EmailContactListScreens.xml Sat Oct 10 13:07:50 2009
@@ -50,4 +50,15 @@
         </section>
     </screen>
 
+    <screen name="ContactUsEmailNotification">
+        <section>
+            <actions>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="EcommerceUiLabels" map-name="uiLabelMap" global="true"/>
+            </actions>
+            <widgets>
+                <platform-specific><html><html-template location="component://ecommerce/templates/email/ContactUsEmail.ftl"/></html></platform-specific>
+            </widgets>
+        </section>
+    </screen>
 </screens>