Re: svn commit: r920770 - in /ofbiz/trunk/framework/widget: dtd/widget-form.xsd src/org/ofbiz/widget/form/MacroFormRenderer.java src/org/ofbiz/widget/form/ModelFormField.java templates/htmlFormMacroLibrary.ftl

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

Re: svn commit: r920770 - in /ofbiz/trunk/framework/widget: dtd/widget-form.xsd src/org/ofbiz/widget/form/MacroFormRenderer.java src/org/ofbiz/widget/form/ModelFormField.java templates/htmlFormMacroLibrary.ftl

Jacopo Cappellato-4
Hi Erwan,

please remember to add the "description" and  "alternate" arguments to all the other *FormMacroLibrary.ftl templates.

Kind regards,

Jacopo

On Mar 9, 2010, at 11:18 AM, [hidden email] wrote:

> Author: erwan
> Date: Tue Mar  9 10:18:54 2010
> New Revision: 920770
>
> URL: http://svn.apache.org/viewvc?rev=920770&view=rev
> Log:
> Adding description and alternate text on a field type="image"
>
> Modified:
>    ofbiz/trunk/framework/widget/dtd/widget-form.xsd
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
>    ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
>
> Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=920770&r1=920769&r2=920770&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original)
> +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Tue Mar  9 10:18:54 2010
> @@ -875,6 +875,8 @@ under the License.
>         <xs:attribute type="xs:positiveInteger" name="height"/>
>         <xs:attribute type="xs:string" name="value"/>
>         <xs:attribute type="xs:string" name="default-value"/>
> +        <xs:attribute type="xs:string" name="description"/>
> +        <xs:attribute type="xs:string" name="alternate"/>
>     </xs:attributeGroup>
>     <xs:element name="lookup" substitutionGroup="AllFields">
>         <xs:complexType>
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=920770&r1=920769&r2=920770&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Tue Mar  9 10:18:54 2010
> @@ -2396,6 +2396,12 @@ public class MacroFormRenderer implement
>         String value = modelFormField.getEntry(context, imageField.getValue(context));
>         String width = "";
>         String height = "";
> +        String description = imageField.getDescription();
> +        String alternate = imageField.getAlternate();
> +
> +        if(UtilValidate.isEmpty(description)){
> +            description = imageField.getModelFormField().getTitle(context);
> +        }
>         if (UtilValidate.isNotEmpty(value)) {
>             StringBuilder buffer = new StringBuilder();
>             ContentUrlTag.appendContentPrefix(request, buffer);
> @@ -2420,6 +2426,10 @@ public class MacroFormRenderer implement
>         sr.append("<@renderImageField ");
>         sr.append(" value=\"");
>         sr.append(value);
> +        sr.append("\" description=\"");
> +        sr.append(description);
> +        sr.append("\" alternate=\"");
> +        sr.append(alternate);
>         sr.append("\" border=\"");
>         sr.append(border);
>         sr.append("\" width=\"");
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=920770&r1=920769&r2=920770&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Tue Mar  9 10:18:54 2010
> @@ -3620,6 +3620,8 @@ public class ModelFormField {
>         protected FlexibleStringExpander defaultValue;
>         protected FlexibleStringExpander value;
>         protected SubHyperlink subHyperlink;
> +        protected String description;
> +        protected String alternate;
>
>         protected ImageField() {
>             super();
> @@ -3636,6 +3638,8 @@ public class ModelFormField {
>         public ImageField(Element element, ModelFormField modelFormField) {
>             super(element, modelFormField);
>             this.setValue(element.getAttribute("value"));
> +            this.setDescription(element.getAttribute("description"));
> +            this.setAlternate(element.getAttribute("alternate"));
>
>             String borderStr = element.getAttribute("border");
>             try {
> @@ -3726,6 +3730,22 @@ public class ModelFormField {
>             this.value = FlexibleStringExpander.getInstance(string);
>         }
>
> +        public String getDescription() {
> +                return this.description;
> +        }
> +
> +        public void setDescription(String string) {
> +            this.description = string;
> +        }
> +
> +        public String getAlternate() {
> +            return this.alternate;
> +        }
> +
> +        public void setAlternate(String string) {
> +            this.alternate = string;
> +        }
> +
>     }
>
>     public static class ContainerField extends FieldInfo {
>
> Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=920770&r1=920769&r2=920770&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
> +++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Tue Mar  9 10:18:54 2010
> @@ -484,7 +484,7 @@ ${item.description}</div>
>
> <#macro renderFileField className alert name value size maxlength autocomplete><input type="file" <@renderClass className alert /><#if name?has_content> name="${name}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if autocomplete?has_content> autocomplete="off"</#if>/><#rt/></#macro>
> <#macro renderPasswordField className alert name value size maxlength id autocomplete><input type="password" <@renderClass className alert /><#if name?has_content> name="${name}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if id?has_content> id="${id}"</#if><#if autocomplete?has_content> autocomplete="off"</#if>/></#macro>
> -<#macro renderImageField value border width height event action><img<#if value?has_content> src="${value}"</#if><#if border?has_content> border="${border}"</#if><#if width?has_content> width="${width}"</#if><#if height?has_content> height="${height}"</#if><#if event?has_content> ${rp.event?html}="${action}" </#if>/></#macro>
> +<#macro renderImageField value description alternate border width height event action><img<#if value?has_content> src="${value}"</#if><#if description?has_content> title="${description}"</#if><#if alternate?has_content> alt="${alternate}"</#if><#if border?has_content> border="${border}"</#if><#if width?has_content> width="${width}"</#if><#if height?has_content> height="${height}"</#if><#if event?has_content> ${rp.event?html}="${action}" </#if>/></#macro>
>
> <#macro renderBanner style leftStyle rightStyle leftText text rightText>
> <table width="100%">  <tr><#rt/>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r920770 - in /ofbiz/trunk/framework/widget: dtd/widget-form.xsd src/org/ofbiz/widget/form/MacroFormRenderer.java src/org/ofbiz/widget/form/ModelFormField.java templates/htmlFormMacroLibrary.ftl

Scott Gray-2
Also please html encode the strings within the MacroFormRenderer.

Thanks
Scott

HotWax Media
http://www.hotwaxmedia.com

On 9/03/2010, at 4:25 AM, Jacopo Cappellato wrote:

> Hi Erwan,
>
> please remember to add the "description" and  "alternate" arguments to all the other *FormMacroLibrary.ftl templates.
>
> Kind regards,
>
> Jacopo
>
> On Mar 9, 2010, at 11:18 AM, [hidden email] wrote:
>
>> Author: erwan
>> Date: Tue Mar  9 10:18:54 2010
>> New Revision: 920770
>>
>> URL: http://svn.apache.org/viewvc?rev=920770&view=rev
>> Log:
>> Adding description and alternate text on a field type="image"
>>
>> Modified:
>>   ofbiz/trunk/framework/widget/dtd/widget-form.xsd
>>   ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
>>   ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
>>   ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
>>
>> Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=920770&r1=920769&r2=920770&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original)
>> +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Tue Mar  9 10:18:54 2010
>> @@ -875,6 +875,8 @@ under the License.
>>        <xs:attribute type="xs:positiveInteger" name="height"/>
>>        <xs:attribute type="xs:string" name="value"/>
>>        <xs:attribute type="xs:string" name="default-value"/>
>> +        <xs:attribute type="xs:string" name="description"/>
>> +        <xs:attribute type="xs:string" name="alternate"/>
>>    </xs:attributeGroup>
>>    <xs:element name="lookup" substitutionGroup="AllFields">
>>        <xs:complexType>
>>
>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=920770&r1=920769&r2=920770&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original)
>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Tue Mar  9 10:18:54 2010
>> @@ -2396,6 +2396,12 @@ public class MacroFormRenderer implement
>>        String value = modelFormField.getEntry(context, imageField.getValue(context));
>>        String width = "";
>>        String height = "";
>> +        String description = imageField.getDescription();
>> +        String alternate = imageField.getAlternate();
>> +
>> +        if(UtilValidate.isEmpty(description)){
>> +            description = imageField.getModelFormField().getTitle(context);
>> +        }
>>        if (UtilValidate.isNotEmpty(value)) {
>>            StringBuilder buffer = new StringBuilder();
>>            ContentUrlTag.appendContentPrefix(request, buffer);
>> @@ -2420,6 +2426,10 @@ public class MacroFormRenderer implement
>>        sr.append("<@renderImageField ");
>>        sr.append(" value=\"");
>>        sr.append(value);
>> +        sr.append("\" description=\"");
>> +        sr.append(description);
>> +        sr.append("\" alternate=\"");
>> +        sr.append(alternate);
>>        sr.append("\" border=\"");
>>        sr.append(border);
>>        sr.append("\" width=\"");
>>
>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=920770&r1=920769&r2=920770&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Tue Mar  9 10:18:54 2010
>> @@ -3620,6 +3620,8 @@ public class ModelFormField {
>>        protected FlexibleStringExpander defaultValue;
>>        protected FlexibleStringExpander value;
>>        protected SubHyperlink subHyperlink;
>> +        protected String description;
>> +        protected String alternate;
>>
>>        protected ImageField() {
>>            super();
>> @@ -3636,6 +3638,8 @@ public class ModelFormField {
>>        public ImageField(Element element, ModelFormField modelFormField) {
>>            super(element, modelFormField);
>>            this.setValue(element.getAttribute("value"));
>> +            this.setDescription(element.getAttribute("description"));
>> +            this.setAlternate(element.getAttribute("alternate"));
>>
>>            String borderStr = element.getAttribute("border");
>>            try {
>> @@ -3726,6 +3730,22 @@ public class ModelFormField {
>>            this.value = FlexibleStringExpander.getInstance(string);
>>        }
>>
>> +        public String getDescription() {
>> +                return this.description;
>> +        }
>> +
>> +        public void setDescription(String string) {
>> +            this.description = string;
>> +        }
>> +
>> +        public String getAlternate() {
>> +            return this.alternate;
>> +        }
>> +
>> +        public void setAlternate(String string) {
>> +            this.alternate = string;
>> +        }
>> +
>>    }
>>
>>    public static class ContainerField extends FieldInfo {
>>
>> Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=920770&r1=920769&r2=920770&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
>> +++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Tue Mar  9 10:18:54 2010
>> @@ -484,7 +484,7 @@ ${item.description}</div>
>>
>> <#macro renderFileField className alert name value size maxlength autocomplete><input type="file" <@renderClass className alert /><#if name?has_content> name="${name}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if autocomplete?has_content> autocomplete="off"</#if>/><#rt/></#macro>
>> <#macro renderPasswordField className alert name value size maxlength id autocomplete><input type="password" <@renderClass className alert /><#if name?has_content> name="${name}"</#if><#if value?has_content> value="${value}"</#if><#if size?has_content> size="${size}"</#if><#if maxlength?has_content> maxlength="${maxlength}"</#if><#if id?has_content> id="${id}"</#if><#if autocomplete?has_content> autocomplete="off"</#if>/></#macro>
>> -<#macro renderImageField value border width height event action><img<#if value?has_content> src="${value}"</#if><#if border?has_content> border="${border}"</#if><#if width?has_content> width="${width}"</#if><#if height?has_content> height="${height}"</#if><#if event?has_content> ${rp.event?html}="${action}" </#if>/></#macro>
>> +<#macro renderImageField value description alternate border width height event action><img<#if value?has_content> src="${value}"</#if><#if description?has_content> title="${description}"</#if><#if alternate?has_content> alt="${alternate}"</#if><#if border?has_content> border="${border}"</#if><#if width?has_content> width="${width}"</#if><#if height?has_content> height="${height}"</#if><#if event?has_content> ${rp.event?html}="${action}" </#if>/></#macro>
>>
>> <#macro renderBanner style leftStyle rightStyle leftText text rightText>
>> <table width="100%">  <tr><#rt/>
>>
>>
>


smime.p7s (3K) Download Attachment