Author: nmalin
Date: Fri Jan 15 13:17:39 2016
New Revision: 1724796

URL: http://svn.apache.org/viewvc?rev=1724796&view=rev
Log:
Correct on layered-modal link : 
* the uuid string to set as unique layered-modal call method name, error 
introduce with issue OFBIZ-6707 and raise on the issue OFBIZ-6786 by Wai.
* parameters missing when you call the link from a form because their passed in 
the url and not with the jquery data set, related to OFBIZ-6803

Modified:
    
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
    
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroMenuRenderer.java
    ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl
    ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl
    ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
    ofbiz/trunk/framework/widget/templates/htmlMenuMacroLibrary.ftl
    ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl
    ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1724796&r1=1724795&r2=1724796&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
 (original)
+++ 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
 Fri Jan 15 13:17:39 2016
@@ -3085,7 +3085,7 @@ public final class MacroFormRenderer imp
             }
         } else {
             if ("layered-modal".equals(realLinkType)) {
-                String uniqueItemName = 
"Modal_".concat(UUID.randomUUID().toString());
+                String uniqueItemName = 
"Modal_".concat(UUID.randomUUID().toString().replace("-", "_"));
                 String width = (String) this.request.getAttribute("width");
                 if (UtilValidate.isEmpty(width)) {
                     width = 
String.valueOf(UtilProperties.getPropertyValue("widget", 
"widget.link.default.layered-modal.width", "800"));
@@ -3111,7 +3111,7 @@ public final class MacroFormRenderer imp
             String targetWindow) throws IOException {
         if (description != null || 
UtilValidate.isNotEmpty(request.getAttribute("image"))) {
             StringBuilder linkUrl = new StringBuilder();
-            WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, 
parameterMap, null, false, false, true, request, response, context);
+            WidgetWorker.buildHyperlinkUrl(linkUrl, target, targetType, 
UtilValidate.isEmpty(request.getAttribute("uniqueItemName"))?parameterMap:null, 
null, false, false, true, request, response, context);
             String event = "";
             String action = "";
             String imgSrc = "";
@@ -3154,6 +3154,21 @@ public final class MacroFormRenderer imp
                 width = request.getAttribute("width").toString();
                 height = request.getAttribute("height").toString();
             }
+            StringBuilder targetParameters = new StringBuilder();
+            if (UtilValidate.isNotEmpty(parameterMap) ) {
+                targetParameters.append("{");
+                for (Map.Entry<String, String> parameter : 
parameterMap.entrySet()) {
+                    if (targetParameters.length() > 1) {
+                        targetParameters.append(",");
+                    }
+                    targetParameters.append("'");
+                    targetParameters.append(parameter.getKey());
+                    targetParameters.append("':'");
+                    targetParameters.append(parameter.getValue());
+                    targetParameters.append("'");
+                }
+                targetParameters.append("}");
+            }
             StringWriter sr = new StringWriter();
             sr.append("<@makeHyperlinkString ");
             sr.append("linkStyle=\"");
@@ -3170,6 +3185,8 @@ public final class MacroFormRenderer imp
             sr.append(imgTitle);
             sr.append("\" alternate=\"");
             sr.append(alt);
+            sr.append("\" targetParameters=\"");
+            sr.append(targetParameters.toString());
             sr.append("\" linkUrl=\"");
             sr.append(linkUrl.toString());
             sr.append("\" targetWindow=\"");

Modified: 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroMenuRenderer.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroMenuRenderer.java?rev=1724796&r1=1724795&r2=1724796&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroMenuRenderer.java
 (original)
+++ 
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroMenuRenderer.java
 Fri Jan 15 13:17:39 2016
@@ -251,7 +251,7 @@ public class MacroMenuRenderer implement
         if (UtilValidate.isNotEmpty(target)) {
             if (!"hidden-form".equals(linkType)) {
                 StringBuilder sb = new StringBuilder();
-                WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), 
link.getParameterMap(context), link.getPrefix(context), link.getFullPath(), 
link.getSecure(), link.getEncode(), request, response, context);
+                WidgetWorker.buildHyperlinkUrl(sb, target, link.getUrlMode(), 
"layered-modal".equals(linkType)?null:link.getParameterMap(context), 
link.getPrefix(context), link.getFullPath(), link.getSecure(), 
link.getEncode(), request, response, context);
                 linkUrl = sb.toString();
             }
         }

Modified: ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl?rev=1724796&r1=1724795&r2=1724796&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/csvFormMacroLibrary.ftl Fri Jan 15 
13:17:39 2016
@@ -121,4 +121,4 @@ under the License.
 <#macro renderAsterisks requiredField requiredStyle></#macro>
 <#macro makeHiddenFormLinkForm actionUrl name parameters targetWindow></#macro>
 <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc 
description confirmation><@renderField description /></#macro>
-<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
alternate linkUrl targetWindow description confirmation uniqueItemName="" 
height="" width="" id=""><@renderField description />,<#rt/></#macro>
\ No newline at end of file
+<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
targetParameters alternate linkUrl targetWindow description confirmation 
uniqueItemName="" height="" width="" id=""><@renderField description 
/>,<#rt/></#macro>
\ No newline at end of file

Modified: ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl?rev=1724796&r1=1724795&r2=1724796&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/foFormMacroLibrary.ftl Fri Jan 15 
13:17:39 2016
@@ -145,7 +145,7 @@ under the License.
 <#macro formatBoundaryComment boundaryType widgetType widgetName></#macro>
 <#macro makeHiddenFormLinkForm actionUrl name parameters targetWindow></#macro>
 <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc 
description><@renderField description /></#macro>
-<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
alternate linkUrl targetWindow description confirmation uniqueItemName="" 
height="" width="" id=""><@makeBlock linkStyle description /></#macro>
+<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
targetParameters alternate linkUrl targetWindow description confirmation 
uniqueItemName="" height="" width="" id=""></#macro>
 <#macro renderTooltip tooltip tooltipStyle></#macro>
 <#macro renderAsterisks requiredField requiredStyle></#macro>
 </#escape>

Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1724796&r1=1724795&r2=1724796&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Fri Jan 15 
13:17:39 2016
@@ -869,7 +869,7 @@ Parameter: tabindex, String, optional -
     <#if confirmation?has_content> onclick="return 
confirm('${confirmation?js_string}')"</#if>>
       <#if imgSrc?has_content><img src="${imgSrc}" 
alt=""/></#if>${description}</a>
 </#macro>
-<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
alternate linkUrl targetWindow description confirmation uniqueItemName="" 
height="" width="" id="">
+<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
targetParameters alternate linkUrl targetWindow description confirmation 
uniqueItemName="" height="" width="" id="">
     <#if uniqueItemName?has_content>
         <div id="${uniqueItemName}"></div>
         <a href="javascript:void(0);" id="${uniqueItemName}_link" 
@@ -877,10 +877,14 @@ Parameter: tabindex, String, optional -
         <#if description?has_content>${description}</#if></a>
         <script type="text/javascript">
             function ${uniqueItemName}_data () {
-                var data =  {
-                    <#--list parameterList as parameter>
-                        "${parameter.name}": "${parameter.value}",
-                    </#list-->
+                var data = {
+                <#if targetParameters?has_content>
+                    <#assign parameterMap = targetParameters?eval>
+                    <#assign parameterKeys = parameterMap?keys>
+                    <#list parameterKeys as key>
+                    "${key}": "${parameterMap[key]}",
+                    </#list>
+                </#if>
                     "presentation": "layer"
                 };
                 return data;

Modified: ofbiz/trunk/framework/widget/templates/htmlMenuMacroLibrary.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlMenuMacroLibrary.ftl?rev=1724796&r1=1724795&r2=1724796&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/htmlMenuMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/htmlMenuMacroLibrary.ftl Fri Jan 15 
13:17:39 2016
@@ -62,9 +62,9 @@ under the License.
 <script type="text/javascript">
     function ${uniqueItemName}_data() {
         var data =  {
-                   <#--list parameterList as parameter>
-                        "${parameter.name}": "${parameter.value}",
-                    </#list-->
+                   <#list parameterList as parameter>
+                    "${parameter.name}": "${parameter.value}",
+                    </#list>
                     "presentation": "layer"
                 };
                 return data;
@@ -93,7 +93,7 @@ under the License.
 <#if (linkType?has_content && "hidden-form" == linkType) || 
linkUrl?has_content>
 <a<#if id?has_content> id="${id}"</#if><#if style?has_content> 
class="${style}"</#if><#if name?has_content> name="${name}"</#if><#if 
targetWindow?has_content> target="${targetWindow}"</#if> href="<#if 
"hidden-form"==linkType>javascript:document.${uniqueItemName}.submit()<#else>${linkUrl}</#if>"><#rt/>
 </#if>
-<#if imgStr?has_content>${imgStr}</#if><#if 
text?has_content>${text}</#if><#rt/>
+<#if imgStr?has_content>${imgStr}</#if> <#if 
text?has_content>${text}</#if><#rt/>
 <#if (linkType?has_content && "hidden-form" == linkType) || 
linkUrl?has_content></a><#rt/></#if>
   </#if>
 </#macro>

Modified: ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl?rev=1724796&r1=1724795&r2=1724796&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl Fri Jan 15 
13:17:39 2016
@@ -121,4 +121,4 @@ under the License.
 <#macro renderAsterisks requiredField requiredStyle>*</#macro>
 <#macro makeHiddenFormLinkForm actionUrl name parameters targetWindow></#macro>
 <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc 
description confirmation><@renderField description /></#macro>
-<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
alternate linkUrl targetWindow description confirmation uniqueItemName="" 
height="" width="" id=""><@renderField description /></#macro>
\ No newline at end of file
+<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
targetParameters alternate linkUrl targetWindow description confirmation 
uniqueItemName="" height="" width="" id=""><@renderField description /></#macro>
\ No newline at end of file

Modified: ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl?rev=1724796&r1=1724795&r2=1724796&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl Fri Jan 15 
13:17:39 2016
@@ -112,6 +112,6 @@ under the License.
 <#macro formatBoundaryComment boundaryType widgetType widgetName></#macro>
 <#macro makeHiddenFormLinkForm actionUrl name parameters targetWindow></#macro>
 <#macro makeHiddenFormLinkAnchor linkStyle hiddenFormName event action imgSrc 
description confirmation><@renderField description /></#macro>
-<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
alternate linkUrl targetWindow description confirmation uniqueItemName="" 
height="" width="" id=""><@renderField description /></#macro>
+<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title 
targetParameters alternate linkUrl targetWindow description confirmation 
uniqueItemName="" height="" width="" id=""><@renderField description /></#macro>
 <#macro renderTooltip tooltip tooltipStyle></#macro>
 <#macro renderAsterisks requiredField requiredStyle></#macro>


Reply via email to