Re: svn commit: r1364942 - in /ofbiz/trunk: applications/product/src/org/ofbiz/product/product/ProductEvents.java specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl

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

Re: svn commit: r1364942 - in /ofbiz/trunk: applications/product/src/org/ofbiz/product/product/ProductEvents.java specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl

Scott Gray-2
Hi Hans,

Why not just always get the webSiteId from WebSiteWorker instead of passing it through the form in a hidden parameter?

Thanks
Scott

On 24/07/2012, at 9:00 PM, [hidden email] wrote:

> Author: hansbak
> Date: Tue Jul 24 09:00:06 2012
> New Revision: 1364942
>
> URL: http://svn.apache.org/viewvc?rev=1364942&view=rev
> Log:
> make the websiteId available in the tellafriend.ftl
>
> Modified:
>    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
>    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl
>
> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1364942&r1=1364941&r2=1364942&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
> +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Tue Jul 24 09:00:06 2012
> @@ -57,6 +57,7 @@ import org.ofbiz.product.store.ProductSt
> import org.ofbiz.security.Security;
> import org.ofbiz.service.GenericServiceException;
> import org.ofbiz.service.LocalDispatcher;
> +import org.ofbiz.webapp.website.WebSiteWorker;
>
> /**
>  * Product Information Related Events
> @@ -1018,6 +1019,10 @@ public class ProductEvents {
>         }
>
>         Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
> +        String websiteId = (String) paramMap.get("websiteId");
> +        if (UtilValidate.isEmpty(websiteId)) {
> +            websiteId = WebSiteWorker.getWebSiteId(request);
> +        }
>         paramMap.put("locale", UtilHttp.getLocale(request));
>         paramMap.put("userLogin", session.getAttribute("userLogin"));
>
> @@ -1030,6 +1035,7 @@ public class ProductEvents {
>         context.put("sendCc", productStoreEmail.get("ccAddress"));
>         context.put("sendBcc", productStoreEmail.get("bccAddress"));
>         context.put("subject", productStoreEmail.getString("subject"));
> +        context.put("webSiteId", websiteId);
>
>         try {
>             dispatcher.runAsync("sendMailFromScreen", context);
>
> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl?rev=1364942&r1=1364941&r2=1364942&view=diff
> ==============================================================================
> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl (original)
> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl Tue Jul 24 09:00:06 2012
> @@ -28,6 +28,7 @@ under the License.
>         <#else>
>             <#assign cancel = "Y">
>         </#if>
> +        <input type="hidden" name="webSiteId" value="${context.webSiteId?if_exists}">
>       <#if !cancel?exists>
>         <table>
>           <tr>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1364942 - in /ofbiz/trunk: applications/product/src/org/ofbiz/product/product/ProductEvents.java specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl

hans_bakker
Hi Scott,

isn't that what is happening here? I do not think the context is
available in the ftl? We need  it in the ftl to be able to provide a
link to the current site in the email which is sent.....Or do I not
understand your suggestion?

please elaborate...

Regards,
Hans

On 07/24/2012 04:28 PM, Scott Gray wrote:

> Hi Hans,
>
> Why not just always get the webSiteId from WebSiteWorker instead of passing it through the form in a hidden parameter?
>
> Thanks
> Scott
>
> On 24/07/2012, at 9:00 PM, [hidden email] wrote:
>
>> Author: hansbak
>> Date: Tue Jul 24 09:00:06 2012
>> New Revision: 1364942
>>
>> URL: http://svn.apache.org/viewvc?rev=1364942&view=rev
>> Log:
>> make the websiteId available in the tellafriend.ftl
>>
>> Modified:
>>     ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
>>     ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl
>>
>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1364942&r1=1364941&r2=1364942&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Tue Jul 24 09:00:06 2012
>> @@ -57,6 +57,7 @@ import org.ofbiz.product.store.ProductSt
>> import org.ofbiz.security.Security;
>> import org.ofbiz.service.GenericServiceException;
>> import org.ofbiz.service.LocalDispatcher;
>> +import org.ofbiz.webapp.website.WebSiteWorker;
>>
>> /**
>>   * Product Information Related Events
>> @@ -1018,6 +1019,10 @@ public class ProductEvents {
>>          }
>>
>>          Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
>> +        String websiteId = (String) paramMap.get("websiteId");
>> +        if (UtilValidate.isEmpty(websiteId)) {
>> +            websiteId = WebSiteWorker.getWebSiteId(request);
>> +        }
>>          paramMap.put("locale", UtilHttp.getLocale(request));
>>          paramMap.put("userLogin", session.getAttribute("userLogin"));
>>
>> @@ -1030,6 +1035,7 @@ public class ProductEvents {
>>          context.put("sendCc", productStoreEmail.get("ccAddress"));
>>          context.put("sendBcc", productStoreEmail.get("bccAddress"));
>>          context.put("subject", productStoreEmail.getString("subject"));
>> +        context.put("webSiteId", websiteId);
>>
>>          try {
>>              dispatcher.runAsync("sendMailFromScreen", context);
>>
>> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl?rev=1364942&r1=1364941&r2=1364942&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl (original)
>> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl Tue Jul 24 09:00:06 2012
>> @@ -28,6 +28,7 @@ under the License.
>>          <#else>
>>              <#assign cancel = "Y">
>>          </#if>
>> +        <input type="hidden" name="webSiteId" value="${context.webSiteId?if_exists}">
>>        <#if !cancel?exists>
>>          <table>
>>            <tr>
>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1364942 - in /ofbiz/trunk: applications/product/src/org/ofbiz/product/product/ProductEvents.java specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl

Scott Gray-2
I was talking about this change here:

>> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl?rev=1364942&r1=1364941&r2=1364942&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl (original)
>> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl Tue Jul 24 09:00:06 2012
>> @@ -28,6 +28,7 @@ under the License.
>>         <#else>
>>             <#assign cancel = "Y">
>>         </#if>
>> +        <input type="hidden" name="webSiteId" value="${context.webSiteId?if_exists}">
>>       <#if !cancel?exists>
>>         <table>
>>           <tr>

I haven't opened up the actual files, only looked at the diff, but it seems to me that having the webSiteId submitted with the form is unnecessary.  Anyway it's really a minor thing.

Regards
Scott

On 24/07/2012, at 9:48 PM, Hans Bakker wrote:

> Hi Scott,
>
> isn't that what is happening here? I do not think the context is available in the ftl? We need  it in the ftl to be able to provide a link to the current site in the email which is sent.....Or do I not understand your suggestion?
>
> please elaborate...
>
> Regards,
> Hans
>
> On 07/24/2012 04:28 PM, Scott Gray wrote:
>> Hi Hans,
>>
>> Why not just always get the webSiteId from WebSiteWorker instead of passing it through the form in a hidden parameter?
>>
>> Thanks
>> Scott
>>
>> On 24/07/2012, at 9:00 PM, [hidden email] wrote:
>>
>>> Author: hansbak
>>> Date: Tue Jul 24 09:00:06 2012
>>> New Revision: 1364942
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1364942&view=rev
>>> Log:
>>> make the websiteId available in the tellafriend.ftl
>>>
>>> Modified:
>>>    ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
>>>    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java?rev=1364942&r1=1364941&r2=1364942&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductEvents.java Tue Jul 24 09:00:06 2012
>>> @@ -57,6 +57,7 @@ import org.ofbiz.product.store.ProductSt
>>> import org.ofbiz.security.Security;
>>> import org.ofbiz.service.GenericServiceException;
>>> import org.ofbiz.service.LocalDispatcher;
>>> +import org.ofbiz.webapp.website.WebSiteWorker;
>>>
>>> /**
>>>  * Product Information Related Events
>>> @@ -1018,6 +1019,10 @@ public class ProductEvents {
>>>         }
>>>
>>>         Map<String, Object> paramMap = UtilHttp.getParameterMap(request);
>>> +        String websiteId = (String) paramMap.get("websiteId");
>>> +        if (UtilValidate.isEmpty(websiteId)) {
>>> +            websiteId = WebSiteWorker.getWebSiteId(request);
>>> +        }
>>>         paramMap.put("locale", UtilHttp.getLocale(request));
>>>         paramMap.put("userLogin", session.getAttribute("userLogin"));
>>>
>>> @@ -1030,6 +1035,7 @@ public class ProductEvents {
>>>         context.put("sendCc", productStoreEmail.get("ccAddress"));
>>>         context.put("sendBcc", productStoreEmail.get("bccAddress"));
>>>         context.put("subject", productStoreEmail.getString("subject"));
>>> +        context.put("webSiteId", websiteId);
>>>
>>>         try {
>>>             dispatcher.runAsync("sendMailFromScreen", context);
>>>
>>> Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl?rev=1364942&r1=1364941&r2=1364942&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl (original)
>>> +++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/catalog/tellafriend.ftl Tue Jul 24 09:00:06 2012
>>> @@ -28,6 +28,7 @@ under the License.
>>>         <#else>
>>>             <#assign cancel = "Y">
>>>         </#if>
>>> +        <input type="hidden" name="webSiteId" value="${context.webSiteId?if_exists}">
>>>       <#if !cancel?exists>
>>>         <table>
>>>           <tr>
>>>
>>>
>