svn commit: r921287 - in /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form: MacroFormRenderer.java ModelFormField.java

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

svn commit: r921287 - in /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form: MacroFormRenderer.java ModelFormField.java

erwan
Author: erwan
Date: Wed Mar 10 10:24:33 2010
New Revision: 921287

URL: http://svn.apache.org/viewvc?rev=921287&view=rev
Log:
html string encoding for alternate and description tags on image field

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

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=921287&r1=921286&r2=921287&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 Wed Mar 10 10:24:33 2010
@@ -2396,8 +2396,8 @@ public class MacroFormRenderer implement
         String value = modelFormField.getEntry(context, imageField.getValue(context));
         String width = "";
         String height = "";
-        String description = imageField.getDescription();
-        String alternate = imageField.getAlternate();
+        String description = imageField.getDescription(context);
+        String alternate = imageField.getAlternate(context);
 
         if(UtilValidate.isEmpty(description)){
             description = imageField.getModelFormField().getTitle(context);
@@ -2427,11 +2427,11 @@ public class MacroFormRenderer implement
         sr.append(" value=\"");
         sr.append(value);
         sr.append("\" description=\"");
-        sr.append(description);
+        sr.append(encode(description, modelFormField, context));
         sr.append("\" alternate=\"");
         sr.append(alternate);
         sr.append("\" border=\"");
-        sr.append(border);
+        sr.append(encode(alternate, modelFormField, context));
         sr.append("\" width=\"");
         sr.append(width);
         sr.append("\" height=\"");

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=921287&r1=921286&r2=921287&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 Wed Mar 10 10:24:33 2010
@@ -3620,8 +3620,8 @@ public class ModelFormField {
         protected FlexibleStringExpander defaultValue;
         protected FlexibleStringExpander value;
         protected SubHyperlink subHyperlink;
-        protected String description;
-        protected String alternate;
+        protected FlexibleStringExpander description;
+        protected FlexibleStringExpander alternate;
 
         protected ImageField() {
             super();
@@ -3730,20 +3730,28 @@ public class ModelFormField {
             this.value = FlexibleStringExpander.getInstance(string);
         }
 
-        public String getDescription() {
-                return this.description;
+        public String getDescription(Map<String, Object> context) {
+            if (this.description != null && !this.description.isEmpty()) {
+                return this.description.expandString(context);
+            } else {
+                return "";
+            }
         }
 
-        public void setDescription(String string) {
-            this.description = string;
+        public void setDescription(String description) {
+            this.description = FlexibleStringExpander.getInstance(description);
         }
 
-        public String getAlternate() {
-            return this.alternate;
+        public String getAlternate(Map<String, Object> context) {
+            if (this.alternate != null && !this.alternate.isEmpty()) {
+                return this.alternate.expandString(context);
+            } else {
+                return "";
+            }
         }
 
-        public void setAlternate(String string) {
-            this.alternate = string;
+        public void setAlternate(String alternate) {
+            this.alternate = FlexibleStringExpander.getInstance(alternate);
         }
 
     }