svn commit: r1744571 - /ofbiz/trunk/applications/party/template/party/profileblocks/Contact.ftl

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

svn commit: r1744571 - /ofbiz/trunk/applications/party/template/party/profileblocks/Contact.ftl

jleroux@apache.org
Author: jleroux
Date: Thu May 19 13:37:34 2016
New Revision: 1744571

URL: http://svn.apache.org/viewvc?rev=1744571&view=rev
Log:
A patch from Florian Montalbano for "Sending mail button from viewProfile doesn't work" https://issues.apache.org/jira/browse/OFBIZ-7075

The button 'send mail' from the profile overview page is not working.

How to reproduce :
1) Go to the party component
2) Search for an party with a registered mail address
3) Go to the profile page : i.e. : https://localhost:8443/partymgr/control/viewprofile?partyId=admin
4) Click on the "send mail" button
5) Nothing happens

Problem :
When checking the target of the button "send mail", we can see that a "@" symbol appears.  The target corresponds to the form name just above (the one containing the email address). Thus, the form name contains the symbol too.
This symbol seems to be forbidden in javascript naming (a warning is risen by the browser console) and this prevents the execution of the javascript.
When manually deleting this symbol in both the name of the form and the target of the button, the javascript works fine.

Root of the problem :
In the "Contact.ftl" template, which creates this form, we can see that the name of the form and the target are created from the 'contactMech.infoString' (the email address in this case). A parsing of the string is done to remove the "@" symbol and the "." . The dot is deleted but not the at symbol. The problem comes from the encoding of the symbol. The parsing looks for a html coding "@" but in the source code of the page, the symbol is in UCS "@" .

Modified:
    ofbiz/trunk/applications/party/template/party/profileblocks/Contact.ftl

Modified: ofbiz/trunk/applications/party/template/party/profileblocks/Contact.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/template/party/profileblocks/Contact.ftl?rev=1744571&r1=1744570&r2=1744571&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/template/party/profileblocks/Contact.ftl (original)
+++ ofbiz/trunk/applications/party/template/party/profileblocks/Contact.ftl Thu May 19 13:37:34 2016
@@ -84,7 +84,7 @@ under the License.
                 <#elseif "EMAIL_ADDRESS" = contactMech.contactMechTypeId>
                   <div>
                     ${contactMech.infoString!}
-                    <form method="post" action="<@ofbizUrl>NewDraftCommunicationEvent</@ofbizUrl>" onsubmit="javascript:submitFormDisableSubmits(this)" name="createEmail${contactMech.infoString?replace("&#64;","")?replace(".","")}">
+                    <form method="post" action="<@ofbizUrl>NewDraftCommunicationEvent</@ofbizUrl>" onsubmit="javascript:submitFormDisableSubmits(this)" name="createEmail${contactMech.infoString?replace("&#64;","")?replace("&#x40;","")?replace(".","")}">
                       <#if userLogin.partyId?has_content>
                       <input name="partyIdFrom" value="${userLogin.partyId}" type="hidden"/>
                       </#if>
@@ -93,7 +93,7 @@ under the License.
                       <input name="my" value="My" type="hidden"/>
                       <input name="statusId" value="COM_PENDING" type="hidden"/>
                       <input name="communicationEventTypeId" value="EMAIL_COMMUNICATION" type="hidden"/>
-                    </form><a class="buttontext" href="javascript:document.createEmail${contactMech.infoString?replace("&#64;","")?replace(".","")}.submit()">${uiLabelMap.CommonSendEmail}</a>
+                    </form><a class="buttontext" href="javascript:document.createEmail${contactMech.infoString?replace("&#64;","")?replace("&#x40;","")?replace(".","")}.submit()">${uiLabelMap.CommonSendEmail}</a>
                   </div>
                 <#elseif "WEB_ADDRESS" = contactMech.contactMechTypeId>
                   <div>