You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/12/15 10:50:40 UTC

svn commit: r1422212 - in /ofbiz/branches/release12.04: ./ framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java

Author: jleroux
Date: Sat Dec 15 09:50:39 2012
New Revision: 1422212

URL: http://svn.apache.org/viewvc?rev=1422212&view=rev
Log:
"Applied fix from trunk for revision: 1422207  " 
------------------------------------------------------------------------
r1422207 | jleroux | 2012-12-15 10:15:37 +0100 (sam., 15 déc. 2012) | 32 lines

A patch from Naofumi Fukue for "javascript error in hidden form" https://issues.apache.org/jira/browse/OFBIZ-5098

HtmlMenuRenderer generates like bellow form tags. It generates double target="_BLANK" , then cause javascript error.

<li><form method="post" action="/ar/control/invoice.pdf" target="_BLANK" name="InvoiceSubTabBar_pdf_LF_8"><input name="invoiceId" value="8010" type="hidden"/></form><a target="_BLANK" href="javascript:document.InvoiceSubTabBar_pdf_LF_8.submit()">PDF</a></li>

document.InvoiceSubTabBar_pdf_LF_8 is undefined @ javascript:document.InvoiceSubTabBar_pdf_LF_8.submit()

jleroux: to reproduce 

For example, edit applications/accounting/webapp/accounting/WEB-INF/controller.xml like this.

<request-map uri="invoice.pdf">
<security https="true" auth="true"/>
<event name="test" type="java" path="org.ofbiz.webapp.event.TestEvent" invoke="test"/> <= add this
<response name="success" type="view" value="InvoicePDF"/>
</request-map>

And in invoice screen, click 'PDF' button. Exist or not exist above line, generated html is different.

As is 
~event: PDF rendered
<li><a target="_BLANK" href="/ar/control/invoice.pdf?invoiceId=8010">PDF</a></li>
event:  PDF not rendered
<li><form method="post" action="/ar/control/invoice.pdf" target="_BLANK" name="InvoiceSubTabBar_pdf_LF_8"><input name="invoiceId" value="8010" type="hidden"/></form><a target="_BLANK" href="javascript:document.InvoiceSubTabBar_pdf_LF_8.submit()">PDF</a></li>

patched
~event: PDF rendered
<li><a target="_BLANK" href="/ar/control/invoice.pdf?invoiceId=8010">PDF</a></li>
event: PDF rendered
<li><form method="post" action="/ar/control/invoice.pdf" target="_BLANK" name="InvoiceSubTabBar_pdf_LF_8"><input name="invoiceId" value="8010" type="hidden"/></form><a href="javascript:document.InvoiceSubTabBar_pdf_LF_8.submit()">PDF</a></li>

------------------------------------------------------------------------


Modified:
    ofbiz/branches/release12.04/   (props changed)
    ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java

Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1422207

Modified: ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=1422212&r1=1422211&r2=1422212&view=diff
==============================================================================
--- ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original)
+++ ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Sat Dec 15 09:50:39 2012
@@ -455,10 +455,12 @@ public class HtmlMenuRenderer extends Ht
                 writer.append(name);
                 writer.append("\"");
             }
-            if (UtilValidate.isNotEmpty(targetWindow)) {
-                writer.append(" target=\"");
-                writer.append(targetWindow);
-                writer.append("\"");
+            if (!"hidden-form".equals(linkType)) {
+                if (UtilValidate.isNotEmpty(targetWindow)) {
+                    writer.append(" target=\"");
+                    writer.append(targetWindow);
+                    writer.append("\"");
+                }
             }
 
             writer.append(" href=\"");