[OFBiz] SVN: r5906 - in trunk: applications/ecommerce/data applications/ecommerce/widget applications/order/src/org/ofbiz/order/order applications/product/config applications/product/entitydef applications/product/src/org/ofbiz/product/product applications/product/webapp/catalog/store applications/securityext applications/securityext/email/default applications/securityext/src/org/ofbiz/securityext/login applications/securityext/widget base/src/base/org/ofbiz/base/util

jonesde at svn.ofbiz.org jonesde at svn.ofbiz.org
Tue Oct 4 00:08:15 EDT 2005


Author: jonesde
Date: 2005-10-03 23:07:54 -0500 (Mon, 03 Oct 2005)
New Revision: 5906

Added:
   trunk/applications/ecommerce/widget/EmailProductScreens.xml
   trunk/applications/securityext/widget/
   trunk/applications/securityext/widget/EmailSecurityScreens.xml
Modified:
   trunk/applications/ecommerce/data/DemoProduct.xml
   trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
   trunk/applications/product/config/ProductUiLabels.properties
   trunk/applications/product/entitydef/entitymodel.xml
   trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
   trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml
   trunk/applications/securityext/email/default/passwordemail.ftl
   trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
   trunk/base/src/base/org/ofbiz/base/util/UtilMisc.java
Log:
A number of updates, finished moving all email notications to use the screen widget; fixes i18n issues, plus various small improvements

Modified: trunk/applications/ecommerce/data/DemoProduct.xml
===================================================================
--- trunk/applications/ecommerce/data/DemoProduct.xml	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/ecommerce/data/DemoProduct.xml	2005-10-04 04:07:54 UTC (rev 5906)
@@ -58,8 +58,9 @@
     <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_GC_PURCHASE" bodyScreenLocation="component://ecommerce/widget/EmailGiftCardScreens.xml#GiftCardPurchase" fromAddress="ofbiztest at yahoo.com" subject="A Gift From ${senderName}!"/>
     <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_GC_RELOAD" bodyScreenLocation="component://ecommerce/widget/EmailGiftCardScreens.xml#GiftCardReload" fromAddress="ofbiztest at yahoo.com" subject="Gift Card Reload Results"/>
 
-    <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_TELL_FRIEND" templatePath="/applications/ecommerce/templates/email/tellafriend.ftl" subject="${sendFrom} has sent you a link!" fromAddress="ofbiztest at yahoo.com"/>
-    <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_PWD_RETRIEVE" templatePath="/applications/securityext/email/default/passwordemail.ftl" subject="OFBiz Demo - Password Reminder (${userLoginId})" fromAddress="ofbiztest at yahoo.com"/>
+    <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_TELL_FRIEND" bodyScreenLocation="component://ecommerce/widget/EmailProductScreens.xml#TellFriend" subject="${sendFrom} has sent you a link!" fromAddress="ofbiztest at yahoo.com"/>
+
+    <ProductStoreEmailSetting productStoreId="9000" emailType="PRDS_PWD_RETRIEVE" bodyScreenLocation="component://securityext/widget/EmailSecurityScreens.xml#PasswordEmail" subject="OFBiz Demo - Password Reminder (${userLoginId})" fromAddress="ofbiztest at yahoo.com"/>
     
     <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"/>

Added: trunk/applications/ecommerce/widget/EmailProductScreens.xml
===================================================================
--- trunk/applications/ecommerce/widget/EmailProductScreens.xml	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/ecommerce/widget/EmailProductScreens.xml	2005-10-04 04:07:54 UTC (rev 5906)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005 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.
+ *
+ *  $Id: EmailGiftCardScreens.xml 5462 2005-08-05 18:35:48Z jonesde $
+-->
+
+<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-screen.xsd">
+    <screen name="TellFriend">
+        <section>
+            <actions>
+                <set field="baseEcommerceSecureUrl" value="${baseSecureUrl}/ecommerce/control/"/>
+                <property-map resource="EcommerceUiLabels" map-name="uiLabelMap" global="true"/>
+            </actions>
+            <widgets>
+                <platform-specific><html><html-template location="component://ecommerce/templates/email/tellafriend.ftl"/></html></platform-specific>
+            </widgets>
+        </section>
+    </screen>
+</screens>


Property changes on: trunk/applications/ecommerce/widget/EmailProductScreens.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:keywords
   + "Id Rev Author"
Name: svn:eol-style
   + native

Modified: trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
===================================================================
--- trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java	2005-10-04 04:07:54 UTC (rev 5906)
@@ -2006,7 +2006,7 @@
             sendResp = dispatcher.runSync("sendMailFromScreen", sendMap);
         } catch (Exception e) {
             Debug.logError(e, module);
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderServiceExceptionSeeLogs",locale));
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderServiceExceptionSeeLogs",locale));
         }
 
         // check for errors

Modified: trunk/applications/product/config/ProductUiLabels.properties
===================================================================
--- trunk/applications/product/config/ProductUiLabels.properties	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/product/config/ProductUiLabels.properties	2005-10-04 04:07:54 UTC (rev 5906)
@@ -239,6 +239,7 @@
 ProductAssocs=Assocs
 ProductAtp=ATP
 ProductAtpQohSerial=ATP/QOH or Serial#
+ProductAttachmentScreenLocation=Attachment Screen Location (XSL-FO)
 ProductAttributes=Attributes
 ProductAutoCreateKeywords=AutoCreateKeywords
 ProductAutoCreateKeywordsForAllProducts=Auto Create Keywords for All Products

Modified: trunk/applications/product/entitydef/entitymodel.xml
===================================================================
--- trunk/applications/product/entitydef/entitymodel.xml	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/product/entitydef/entitymodel.xml	2005-10-04 04:07:54 UTC (rev 5906)
@@ -2932,7 +2932,6 @@
             title="Product Store Email Settings Entity">
       <field name="productStoreId" type="id-ne"></field>
       <field name="emailType" type="id-ne"></field>
-      <field name="templatePath" type="long-varchar"><!-- deprecated by screenLocation, but still used for some non-order notice emails --></field>
       <field name="bodyScreenLocation" type="long-varchar"><!-- if empty defaults to a screen based on the emailType --></field>
       <field name="xslfoAttachScreenLocation" type="long-varchar"><!-- if specified is used to generate XSL:FO that is transformed to a PDF via Apache FOP and attached to the email --></field>
       <field name="fromAddress" type="email"></field>

Modified: trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
===================================================================
--- trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java	2005-10-04 04:07:54 UTC (rev 5906)
@@ -36,6 +36,8 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
+import javolution.util.FastMap;
+
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilHttp;
@@ -1258,8 +1260,11 @@
     }
 
     public static String tellAFriend(HttpServletRequest request, HttpServletResponse response) {
+        HttpSession session = request.getSession();
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
+        String emailType = "PRDS_TELL_FRIEND";
+        String defaultScreenLocation = "component://ecommerce/widget/EmailProductScreens.xml#TellFriend";
 
         GenericValue productStore = ProductStoreWorker.getProductStore(request);
         if (productStore == null) {
@@ -1270,7 +1275,6 @@
         String productStoreId = productStore.getString("productStoreId");
         
         GenericValue productStoreEmail = null;
-        String emailType = "PRDS_TELL_FRIEND";
         try {
             productStoreEmail = delegator.findByPrimaryKey("ProductStoreEmailSetting",
                     UtilMisc.toMap("productStoreId", productStoreId, "emailType", emailType));
@@ -1286,23 +1290,27 @@
             return "error";
         }
 
+        String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation");
+        if (UtilValidate.isEmpty(bodyScreenLocation)) {
+            bodyScreenLocation = defaultScreenLocation;
+        }
+        
         Map paramMap = UtilHttp.getParameterMap(request);
-        String subjectString = productStoreEmail.getString("subject");
-        subjectString = FlexibleStringExpander.expandString(subjectString, paramMap);
+        paramMap.put("locale", UtilHttp.getLocale(request));
+        paramMap.put("userLogin", session.getAttribute("userLogin"));
 
-        String ofbizHome = System.getProperty("ofbiz.home");
-        Map context = new HashMap();
-        context.put("templateName", ofbizHome + productStoreEmail.get("templatePath"));
-        context.put("templateData", paramMap);
+        Map context = FastMap.newInstance();
+        context.put("bodyScreenUri", bodyScreenLocation);
+        context.put("bodyParameters", paramMap);
         context.put("sendTo", paramMap.get("sendTo"));
         context.put("contentType", productStoreEmail.get("contentType"));
         context.put("sendFrom", productStoreEmail.get("fromAddress"));
         context.put("sendCc", productStoreEmail.get("ccAddress"));
         context.put("sendBcc", productStoreEmail.get("bccAddress"));
-        context.put("subject", subjectString);
+        context.put("subject", productStoreEmail.getString("subject"));
 
         try {
-            dispatcher.runAsync("sendGenericNotificationEmail", context);
+            dispatcher.runAsync("sendMailFromScreen", context);
         } catch (GenericServiceException e) {
             String errMsg = "Problem sending mail: " + e.toString();
             Debug.logError(e, errMsg, module);

Modified: trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml
===================================================================
--- trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/product/webapp/catalog/store/ProductStoreForms.xml	2005-10-04 04:07:54 UTC (rev 5906)
@@ -237,8 +237,8 @@
                 </entity-options>
             </drop-down>
         </field>
-        <field name="bodyScreenLocation" title="${uiLabelMap.ProductBodyScreenLocation}" tooltip="Used for Order Notice Emails"></field>
-        <field name="templatePath" title="${uiLabelMap.ProductTemplatePath}" tooltip="Used for non-Order Emails"></field>
+        <field name="bodyScreenLocation" title="${uiLabelMap.ProductBodyScreenLocation}"></field>
+        <field name="xslfoAttachScreenLocation" title="${uiLabelMap.ProductAttachmentScreenLocation}"></field>
         <field name="subject" title="${uiLabelMap.ProductSubject}"></field>
         <field name="fromAddress" title="${uiLabelMap.CommonFromAddress}"></field>
         <field name="submitButton" title="${uiLabelMap.CommonAdd}" widget-style="smallSubmit"><submit button-type="button"/></field>
@@ -251,9 +251,8 @@
         <field name="emailType" title="${uiLabelMap.CommonEmailType}" widget-style="tabletext">
             <display-entity entity-name="Enumeration" key-field-name="enumId" description="${description}" cache="true" also-hidden="true"/>
         </field>
-        <field name="bodyScreenLocation" title="${uiLabelMap.ProductBodyScreenLocation}" tooltip="Used for Order Notice Emails"></field>
-        <field name="xslfoAttachScreenLocation" title="XSL-FO Attachment Screen Location"></field>
-        <field name="templatePath" title="${uiLabelMap.ProductTemplatePath}" tooltip="Used for non-Order Emails"></field>
+        <field name="bodyScreenLocation" title="${uiLabelMap.ProductBodyScreenLocation}"></field>
+        <field name="xslfoAttachScreenLocation" title="${uiLabelMap.ProductAttachmentScreenLocation}"></field>
         <field name="subject" title="${uiLabelMap.ProductSubject}"></field>
         <field name="fromAddress" title="${uiLabelMap.CommonFromAddress}"></field>
         <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field>

Modified: trunk/applications/securityext/email/default/passwordemail.ftl
===================================================================
--- trunk/applications/securityext/email/default/passwordemail.ftl	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/securityext/email/default/passwordemail.ftl	2005-10-04 04:07:54 UTC (rev 5906)
@@ -1,5 +1,5 @@
 <#--
- *  Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
+ *  Copyright (c) 2003-2005 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"), 
@@ -20,6 +20,7 @@
  *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  *@author     Andy Zeneski (jaz at ofbiz.org)
+ *@author     David E. Jones (jonesde at ofbiz.org)
  *@version    $Rev$
  *@since      2.2
 -->

Modified: trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java
===================================================================
--- trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/securityext/src/org/ofbiz/securityext/login/LoginEvents.java	2005-10-04 04:07:54 UTC (rev 5906)
@@ -33,6 +33,8 @@
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
+import javolution.util.FastMap;
+
 import org.ofbiz.base.component.ComponentConfig;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilFormatOut;
@@ -225,7 +227,7 @@
             if (userLogin != null && hasBasePermission(userLogin, request)) {
                 doBasicLogin(userLogin, request);
             } else {
-                errMsg = UtilProperties.getMessage(resource,"loginevents.unable_to_login_this_application", UtilHttp.getLocale(request));
+                errMsg = UtilProperties.getMessage(resource, "loginevents.unable_to_login_this_application", UtilHttp.getLocale(request));
                 request.setAttribute("_ERROR_MESSAGE_", errMsg );
                 return "error";
             }
@@ -235,7 +237,7 @@
             }
         } else {
             Map messageMap = UtilMisc.toMap("errorMessage", (String) result.get(ModelService.ERROR_MESSAGE));
-            errMsg = UtilProperties.getMessage(resource,"loginevents.following_error_occurred_during_login", messageMap, UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.following_error_occurred_during_login", messageMap, UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
@@ -352,7 +354,7 @@
 
         if (!UtilValidate.isNotEmpty(userLoginId)) {
             // the password was incomplete
-            errMsg = UtilProperties.getMessage(resource,"loginevents.username_was_empty_reenter", UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.username_was_empty_reenter", UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
@@ -366,7 +368,7 @@
         }
         if (supposedUserLogin == null) {
             // the Username was not found
-            errMsg = UtilProperties.getMessage(resource,"loginevents.username_not_found_reenter", UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.username_not_found_reenter", UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
@@ -375,13 +377,13 @@
 
         if (!UtilValidate.isNotEmpty(passwordHint)) {
             // the Username was not found
-            errMsg = UtilProperties.getMessage(resource,"loginevents.no_password_hint_specified_try_password_emailed", UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.no_password_hint_specified_try_password_emailed", UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
 
         Map messageMap = UtilMisc.toMap("passwordHint", passwordHint);
-        errMsg = UtilProperties.getMessage(resource,"loginevents.password_hint_is", messageMap, UtilHttp.getLocale(request));
+        errMsg = UtilProperties.getMessage(resource, "loginevents.password_hint_is", messageMap, UtilHttp.getLocale(request));
         request.setAttribute("_ERROR_MESSAGE_", errMsg);
         return "success";
     }
@@ -394,12 +396,15 @@
      * @return String specifying the exit status of this event
      */
     public static String emailPassword(HttpServletRequest request, HttpServletResponse response) {
+        String defaultScreenLocation = "component://securityext/widget/EmailSecurityScreens.xml#PasswordEmail";
+        
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         String productStoreId = ProductStoreWorker.getProductStoreId(request);
+        
         String errMsg = null;
 
-        Map subjectData = new HashMap();
+        Map subjectData = FastMap.newInstance();
         subjectData.put("productStoreId", productStoreId);
 
         boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security.properties", "password.encrypt"));
@@ -413,7 +418,7 @@
 
         if (!UtilValidate.isNotEmpty(userLoginId)) {
             // the password was incomplete
-            errMsg = UtilProperties.getMessage(resource,"loginevents.username_was_empty_reenter", UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.username_was_empty_reenter", UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
@@ -425,7 +430,7 @@
             supposedUserLogin = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", userLoginId));
             if (supposedUserLogin == null) {
                 // the Username was not found
-                errMsg = UtilProperties.getMessage(resource,"loginevents.username_not_found_reenter", UtilHttp.getLocale(request));
+                errMsg = UtilProperties.getMessage(resource, "loginevents.username_not_found_reenter", UtilHttp.getLocale(request));
                 request.setAttribute("_ERROR_MESSAGE_", errMsg);
                 return "error";
             }
@@ -443,14 +448,14 @@
         } catch (GenericEntityException e) {
             Debug.logWarning(e, "", module);
             Map messageMap = UtilMisc.toMap("errorMessage", e.toString());
-            errMsg = UtilProperties.getMessage(resource,"loginevents.error_accessing_password", messageMap, UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.error_accessing_password", messageMap, UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
         if (supposedUserLogin == null) {
             // the Username was not found
             Map messageMap = UtilMisc.toMap("userLoginId", userLoginId);
-            errMsg = UtilProperties.getMessage(resource,"loginevents.user_with_the_username_not_found", messageMap, UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.user_with_the_username_not_found", messageMap, UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
@@ -474,7 +479,7 @@
 
         if (!UtilValidate.isNotEmpty(emails.toString())) {
             // the Username was not found
-            errMsg = UtilProperties.getMessage(resource,"loginevents.no_primary_email_address_set_contact_customer_service", UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.no_primary_email_address_set_contact_customer_service", UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
@@ -488,27 +493,27 @@
         }
 
         if (productStoreEmail == null) {
-            errMsg = UtilProperties.getMessage(resource,"loginevents.problems_with_configuration_contact_customer_service", UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.problems_with_configuration_contact_customer_service", UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
 
-        // need OFBIZ_HOME for processing
-        String ofbizHome = System.getProperty("ofbiz.home");
-
+        String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation");
+        if (UtilValidate.isEmpty(bodyScreenLocation)) {
+            bodyScreenLocation = defaultScreenLocation;
+        }
+        
         // set the needed variables in new context
-        Map templateData = new HashMap();
-        templateData.put("useEncryption", new Boolean(useEncryption));
-        templateData.put("password", UtilFormatOut.checkNull(passwordToSend));
+        Map bodyParameters = FastMap.newInstance();
+        bodyParameters.put("useEncryption", new Boolean(useEncryption));
+        bodyParameters.put("password", UtilFormatOut.checkNull(passwordToSend));
+        bodyParameters.put("locale", UtilHttp.getLocale(request));
+        bodyParameters.put("userLogin", supposedUserLogin);
 
-        // prepare the parsed subject
-        String subjectString = productStoreEmail.getString("subject");
-        subjectString = FlexibleStringExpander.expandString(subjectString, subjectData);
-
-        Map serviceContext = new HashMap();
-        serviceContext.put("templateName", ofbizHome + productStoreEmail.get("templatePath"));
-        serviceContext.put("templateData", templateData);
-        serviceContext.put("subject", subjectString);
+        Map serviceContext = FastMap.newInstance();
+        serviceContext.put("bodyScreenUri", bodyScreenLocation);
+        serviceContext.put("bodyParameters", bodyParameters);
+        serviceContext.put("subject", productStoreEmail.getString("subject"));
         serviceContext.put("sendFrom", productStoreEmail.get("fromAddress"));
         serviceContext.put("sendCc", productStoreEmail.get("ccAddress"));
         serviceContext.put("sendBcc", productStoreEmail.get("bccAddress"));
@@ -516,17 +521,17 @@
         serviceContext.put("sendTo", emails.toString());
 
         try {
-            Map result = dispatcher.runSync("sendGenericNotificationEmail", serviceContext);
+            Map result = dispatcher.runSync("sendMailFromScreen", serviceContext);
 
             if (ModelService.RESPOND_ERROR.equals((String) result.get(ModelService.RESPONSE_MESSAGE))) {
                 Map messageMap = UtilMisc.toMap("errorMessage", result.get(ModelService.ERROR_MESSAGE));
-                errMsg = UtilProperties.getMessage(resource,"loginevents.error_unable_email_password_contact_customer_service_errorwas", messageMap, UtilHttp.getLocale(request));
+                errMsg = UtilProperties.getMessage(resource, "loginevents.error_unable_email_password_contact_customer_service_errorwas", messageMap, UtilHttp.getLocale(request));
                 request.setAttribute("_ERROR_MESSAGE_", errMsg);
                 return "error";
             }
         } catch (GenericServiceException e) {
             Debug.logWarning(e, "", module);
-            errMsg = UtilProperties.getMessage(resource,"loginevents.error_unable_email_password_contact_customer_service", UtilHttp.getLocale(request));
+            errMsg = UtilProperties.getMessage(resource, "loginevents.error_unable_email_password_contact_customer_service", UtilHttp.getLocale(request));
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
@@ -538,18 +543,18 @@
             } catch (GenericEntityException e) {
                 Debug.logWarning(e, "", module);
                 Map messageMap = UtilMisc.toMap("errorMessage", e.toString());
-                errMsg = UtilProperties.getMessage(resource,"loginevents.error_saving_new_password_email_not_correct_password", messageMap, UtilHttp.getLocale(request));
+                errMsg = UtilProperties.getMessage(resource, "loginevents.error_saving_new_password_email_not_correct_password", messageMap, UtilHttp.getLocale(request));
                 request.setAttribute("_ERROR_MESSAGE_", errMsg);
                 return "error";
             }
         }
 
         if (useEncryption) {
-            errMsg = UtilProperties.getMessage(resource,"loginevents.new_password_createdandsent_check_email", UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
+            errMsg = UtilProperties.getMessage(resource, "loginevents.new_password_createdandsent_check_email", UtilHttp.getLocale(request));
+            request.setAttribute("_EVENT_MESSAGE_", errMsg);
         } else {
-            errMsg = UtilProperties.getMessage(resource,"loginevents.new_password_sent_check_email", UtilHttp.getLocale(request));
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
+            errMsg = UtilProperties.getMessage(resource, "loginevents.new_password_sent_check_email", UtilHttp.getLocale(request));
+            request.setAttribute("_EVENT_MESSAGE_", errMsg);
         }
         return "success";
     }

Added: trunk/applications/securityext/widget/EmailSecurityScreens.xml
===================================================================
--- trunk/applications/securityext/widget/EmailSecurityScreens.xml	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/applications/securityext/widget/EmailSecurityScreens.xml	2005-10-04 04:07:54 UTC (rev 5906)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *  Copyright (c) 2005 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.
+ *
+ *  $Id: EmailGiftCardScreens.xml 5462 2005-08-05 18:35:48Z jonesde $
+-->
+
+<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+        xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-screen.xsd">
+
+    <screen name="PasswordEmail">
+        <section>
+            <actions>
+            </actions>
+            <widgets>
+                <platform-specific><html><html-template location="component://securityext/email/default/passwordemail.ftl"/></html></platform-specific>
+            </widgets>
+        </section>
+    </screen>
+</screens>


Property changes on: trunk/applications/securityext/widget/EmailSecurityScreens.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:keywords
   + "Id Rev Author"
Name: svn:eol-style
   + native

Modified: trunk/base/src/base/org/ofbiz/base/util/UtilMisc.java
===================================================================
--- trunk/base/src/base/org/ofbiz/base/util/UtilMisc.java	2005-10-04 02:48:02 UTC (rev 5905)
+++ trunk/base/src/base/org/ofbiz/base/util/UtilMisc.java	2005-10-04 04:07:54 UTC (rev 5906)
@@ -386,9 +386,8 @@
         }
         if (localeObject != null && localeObject instanceof Locale) {
             return (Locale) localeObject;
-        } else {
-            return Locale.getDefault();
         }
+        return Locale.getDefault();
     }
 
     public static List availableLocaleList = null;



More information about the Svn mailing list