Hello,

On 10/1/19 11:26 AM, Jacques Le Roux wrote:
Hi Nicolas,

Bear with me, here is for now a rough answer with a suggestion.

Apart that UrlRegexpTransform is related with product and categories in ecomseo, I clearly remember why it was put in: SEO.

Recently Paul (Foxworthy) wrote in user ML (please read it!)[1]:

   <<The word "control" in the middle of all our APIs is a technical implementation detail, and it's just noise for all our users all of the time.>>

I totally agree with that and globally what Paul  says in[1].

I suggest that UrlRegexpTransform (with maybe some changes) could be used it everywhere. Now there are maybe few features in OfbizUrlTransform that are not in UrlRegexpTransform. That needs to be checked. If we can merge OfbizUrlTransform in UrlRegexpTransform then the later could be used everywhere. I believe it's doing more, not less.
I will check that but, sure it's would be a good idea to have only one class to manage <@ofbizUrl>

For its comment, here is my initial related commit: http://svn.apache.org/viewvc?view=revision&revision=1655803

[1] https://markmail.org/message/gzsdbqn3dyfpfetc
Long ago Paul already suggested similar and added the "Canonical link element" notion  in OFBIZ-5312: https://s.apache.org/93dl5

BTW Nicolas, is the feature sending a link to change the password by email not longer working because of Deepak's change? I ask because I tried and with the same data than before it's now failing locally

To test, you can check with this patch

Index: applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java
===================================================================
--- applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java (revision 1867618) +++ applications/securityext/src/main/java/org/apache/ofbiz/securityext/login/LoginEvents.java (working copy)
@@ -50,6 +50,7 @@
 import org.apache.ofbiz.service.ModelService;
 import org.apache.ofbiz.service.ServiceUtil;
 import org.apache.ofbiz.webapp.control.LoginWorker;
+import org.apache.ofbiz.webapp.website.WebSiteWorker;

 /**
  * LoginEvents - Events for UserLogin and Security handling.
@@ -286,6 +287,7 @@
             Map<String, Object> serviceContext = new HashMap<>();
             serviceContext.put("bodyScreenUri", bodyScreenLocation);
             serviceContext.put("bodyParameters", bodyParameters);
+            serviceContext.put("webSiteId", WebSiteWorker.getWebSiteId(request));
             if (productStoreEmail != null) {
                 serviceContext.put("subject", productStoreEmail.getString("subject"));                  serviceContext.put("sendFrom", productStoreEmail.get("fromAddress"));
Index: applications/securityext/template/email/PasswordEmail.ftl
===================================================================
--- applications/securityext/template/email/PasswordEmail.ftl (revision 1867618)
+++ applications/securityext/template/email/PasswordEmail.ftl (working copy)
@@ -26,7 +26,7 @@

   <br />
   <div>
-      <form method="post" action="${baseEcommerceSecureUrl}/partymgr/control/passwordChange?USERNAME=${userLogin.userLoginId!}&TOKEN=${token!}&forgotPwdFlag=true&tenantId=${tenantId!}" name="loginform" id="loginform" target="_blank"> +      <form method="post" action="<@ofbizUrl fullPath="true" secure="true" webSiteId="${webSiteId!}">passwordChange</@ofbizUrl>?USERNAME=${userLogin.userLoginId!}&TOKEN=${token!}&forgotPwdFlag=true&tenantId=${tenantId!}" name="loginform" id="loginform" target="_blank">          <input type="submit" name="submit" value="${uiLabelMap.ResetPassword}" />
       </form>
       ${uiLabelMap.SecurityExtLinkOnce}.
Index: applications/securityext/widget/EmailSecurityScreens.xml
===================================================================
--- applications/securityext/widget/EmailSecurityScreens.xml (revision 1867618)
+++ applications/securityext/widget/EmailSecurityScreens.xml (working copy)
@@ -26,7 +26,6 @@
             <actions>
                 <property-map resource="EmailPasswordUiLabels" map-name="uiLabelMap" global="true"/>                  <property-map resource="SecurityUiLabels" map-name="uiLabelMap" global="true"/> -                <set field="baseEcommerceSecureUrl" value="${baseSecureUrl}"/>
             </actions>
             <widgets>
<platform-specific><html><html-template location="component://securityext/template/email/PasswordEmail.ftl"/></html></platform-specific> Index: framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java
===================================================================
--- framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java (revision 1867618) +++ framework/common/src/main/java/org/apache/ofbiz/common/email/EmailServices.java (working copy)
@@ -494,6 +494,7 @@

         MapStack<String> screenContext = MapStack.create();
         screenContext.put("locale", locale);
+        screenContext.put("webSiteId", webSiteId);

         ScreenStringRenderer screenStringRenderer = null;
         try {

Nicolas


Sorry for the somewhat convoluted email, obviously more work ahead if we want to get this way...

Jacques


Le 30/09/2019 à 19:00, Nicolas Malin a écrit :
Thanks Deepak,

Jacques, I saw you worked on this big issue OFBIZ-5312 ? Do you have any idea on impact that I raised ?

Nicolas

On 9/30/19 2:26 PM, Deepak Dixit wrote:
Hi Nicolas,

In this commit I only removed the dependency from product component,
I think the original works done under OFBIZ-5312,
I was also not sure why ofbizUrl points to the UrlRegexpTransform class,
this is part fo SEO url work.

Kind Regards,
Deepak Dixit


On Mon, Sep 30, 2019 at 4:36 PM Nicolas Malin <[email protected]>
wrote:

Hello,

I have a pb with this commit or the mechanism linked to it.

For issue STORE-4361 [1], tried to improve the 'forgotPassword' email
template with use website and <@ofbizUrl> to be sure that the email link to reset the password is related to sur websiet and component where the
ask has been done.

The problem that currently it's
org.apache.ofbiz.product.category.ftl.UrlRegexpTransform class that been use and not org.apache.ofbiz.webapp.ftl.OfbizUrlTransform. So if I force
all ofbizUrl to this last class, my improvement work because the
UrlRegexpTransform doesn't support website url build.

I didn't understand why we have the same properties on different
freemarkerTransforms properties, that in my mid generate many
understanding error. Can we thinking how solve this situation? do we
really maintain different value for the same property ?

Any help would be welcome I I'm looking forward to close this long
forget Password task :)

Regards,

Nicolas

[1] https://issues.apache.org/jira/browse/OFBIZ-4361

On 7/6/18 1:46 PM, [email protected] wrote:
Author: deepak
Date: Fri Jul  6 11:46:52 2018
New Revision: 1835235

URL: http://svn.apache.org/viewvc?rev=1835235&view=rev
Log:
Fixed: Framework webapp freemarkerTransform.properties has dependency on
proudct component
(OFBIZ-10463)

Modified:

ofbiz/ofbiz-framework/trunk/applications/product/config/freemarkerTransforms.properties ofbiz/ofbiz-framework/trunk/framework/webapp/config/freemarkerTransforms.properties
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/config/freemarkerTransforms.properties
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/config/freemarkerTransforms.properties?rev=1835235&r1=1835234&r2=1835235&view=diff ==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/config/freemarkerTransforms.properties
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/config/freemarkerTransforms.properties
Fri Jul  6 11:46:52 2018
@@ -25,4 +25,5 @@

#ofbizCatalogUrl=org.apache.ofbiz.product.category.ftl.CatalogUrlDirective ofbizCatalogAltUrl=org.apache.ofbiz.product.category.ftl.CatalogAltUrlSeoTransform ofbizCatalogUrl=org.apache.ofbiz.product.category.ftl.CatalogUrlSeoTransform
+ofbizUrl=org.apache.ofbiz.product.category.ftl.UrlRegexpTransform


Modified:
ofbiz/ofbiz-framework/trunk/framework/webapp/config/freemarkerTransforms.properties
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webapp/config/freemarkerTransforms.properties?rev=1835235&r1=1835234&r2=1835235&view=diff ==============================================================================
---
ofbiz/ofbiz-framework/trunk/framework/webapp/config/freemarkerTransforms.properties
(original)
+++
ofbiz/ofbiz-framework/trunk/framework/webapp/config/freemarkerTransforms.properties
Fri Jul  6 11:46:52 2018
@@ -21,8 +21,7 @@

   # entries are in the form: key=transform name, property=transform
class name
-#ofbizUrl=org.apache.ofbiz.webapp.ftl.OfbizUrlTransform
-ofbizUrl=org.apache.ofbiz.product.category.ftl.UrlRegexpTransform
+ofbizUrl=org.apache.ofbiz.webapp.ftl.OfbizUrlTransform
ofbizContentUrl=org.apache.ofbiz.webapp.ftl.OfbizContentTransform
ofbizCurrency=org.apache.ofbiz.webapp.ftl.OfbizCurrencyTransform
ofbizAmount=org.apache.ofbiz.webapp.ftl.OfbizAmountTransform





Reply via email to