Author: nmalin
Date: Thu Jun 4 20:55:59 2015
New Revision: 1683642
URL: http://svn.apache.org/r1683642
Log:
Form widget hyperlink.id attribute isn't supported by MacroFormRenderer.java
(OFBIZ-6403) thanks christian carlow for this issue
Modified:
ofbiz/trunk/framework/widget/dtd/widget-common.xsd
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/renderer/macro/MacroFormRenderer.java
ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
Modified: ofbiz/trunk/framework/widget/dtd/widget-common.xsd
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-common.xsd?rev=1683642&r1=1683641&r2=1683642&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-common.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-common.xsd Thu Jun 4 20:55:59 2015
@@ -583,7 +583,13 @@ under the License.
<xs:element minOccurs="0" name="image" type="image" />
</xs:sequence>
<xs:attribute type="xs:string" name="text" />
- <xs:attribute type="xs:string" name="id" />
+ <xs:attribute type="xs:string" name="id" >
+ <xs:annotation>
+ <xs:documentation>
+ If you use id for link present in list form or multi
form, you can use ${itemIndex} to generate an unique id by line.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<xs:attribute type="xs:string" name="style" />
<xs:attribute type="xs:string" name="name" />
<xs:attribute type="xs:string" name="title" />
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=1683642&r1=1683641&r2=1683642&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
Thu Jun 4 20:55:59 2015
@@ -311,6 +311,7 @@ public final class MacroFormRenderer imp
this.request.setAttribute("alternate", encodedAlternate);
this.request.setAttribute("imageTitle", encodedImageTitle);
this.request.setAttribute("descriptionSize", hyperlinkField.getSize());
+ this.request.setAttribute("id", hyperlinkField.getId(context));
makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getUrlMode(),
hyperlinkField.getTarget(context), hyperlinkField.getParameterMap(context), hyperlinkField.getDescription(context),
hyperlinkField.getTargetWindow(context),
hyperlinkField.getConfirmation(context), modelFormField,
this.request, this.response, context);
this.appendTooltip(writer, context, modelFormField);
@@ -3073,6 +3074,7 @@ public final class MacroFormRenderer imp
String action = "";
String imgSrc = "";
String alt = "";
+ String id = "";
String imgTitle = "";
String hiddenFormName =
WidgetWorker.makeLinkHiddenFormName(context, modelFormField);
if (UtilValidate.isNotEmpty(modelFormField.getEvent()) &&
UtilValidate.isNotEmpty(modelFormField.getAction(context))) {
@@ -3099,6 +3101,9 @@ public final class MacroFormRenderer imp
if (UtilValidate.isEmpty(imgTitle)) {
imgTitle = modelFormField.getTitle(context);
}
+ if (UtilValidate.isNotEmpty(request.getAttribute("id"))) {
+ id = request.getAttribute("id").toString();
+ }
StringWriter sr = new StringWriter();
sr.append("<@makeHyperlinkString ");
sr.append("linkStyle=\"");
@@ -3123,6 +3128,8 @@ public final class MacroFormRenderer imp
sr.append(description);
sr.append("\" confirmation =\"");
sr.append(confirmation);
+ sr.append("\" id=\"");
+ sr.append(id);
sr.append("\" />");
executeMacro(writer, sr.toString());
}
Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1683642&r1=1683641&r2=1683642&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Thu Jun 4
20:55:59 2015
@@ -849,11 +849,12 @@ 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>
+<#macro makeHyperlinkString linkStyle hiddenFormName event action imgSrc title
alternate linkUrl targetWindow description confirmation id>
<a <#if linkStyle?has_content>class="${linkStyle}"</#if>
href="${linkUrl}"<#if targetWindow?has_content>
target="${targetWindow}"</#if>
<#if action?has_content && event?has_content> ${event}="${action}"</#if>
<#if confirmation?has_content> onclick="return
confirm('${confirmation?js_string}')"</#if>
+ <#if id?has_content> id="${id}"</#if>
<#if imgSrc?length == 0 && title?has_content> title="${title}"</#if>>
<#if imgSrc?has_content><img src="${imgSrc}" alt="${alternate}"
title="${title}"/></#if>${description}</a>
</#macro>