svn commit: r571237 - in /ofbiz/trunk/framework/widget: dtd/widget-form.xsd src/org/ofbiz/widget/form/ModelFormField.java src/org/ofbiz/widget/html/HtmlFormRenderer.java

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

svn commit: r571237 - in /ofbiz/trunk/framework/widget: dtd/widget-form.xsd src/org/ofbiz/widget/form/ModelFormField.java src/org/ofbiz/widget/html/HtmlFormRenderer.java

jaz-3
Author: jaz
Date: Thu Aug 30 09:41:09 2007
New Revision: 571237

URL: http://svn.apache.org/viewvc?rev=571237&view=rev
Log:
simple implementation of textfield readonly attribute (for html forms)

Modified:
    ofbiz/trunk/framework/widget/dtd/widget-form.xsd
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java

Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?rev=571237&r1=571236&r2=571237&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original)
+++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Thu Aug 30 09:41:09 2007
@@ -780,6 +780,15 @@
         <xs:attribute type="xs:positiveInteger" name="cols" default="60"/>
         <xs:attribute type="xs:positiveInteger" name="rows" default="3"/>
         <xs:attribute type="xs:string" name="default-value"/>
+        <xs:attribute name="read-only" default="false">
+            <xs:annotation><xs:documentation>Makes this textarea read-only (no edits allowed)</xs:documentation></xs:annotation>
+            <xs:simpleType>
+                <xs:restriction base="xs:token">
+                    <xs:enumeration value="true"/>
+                    <xs:enumeration value="false"/>
+                </xs:restriction>
+            </xs:simpleType>
+        </xs:attribute>
         <xs:attribute name="visual-editor-enable" default="false">
             <xs:annotation><xs:documentation>This will enable the html editor on this text area from www.unverse.net (more info there), only one textarea can be used on one page</xs:documentation></xs:annotation>
             <xs:simpleType>

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=571237&r1=571236&r2=571237&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 Thu Aug 30 09:41:09 2007
@@ -2250,6 +2250,7 @@
         protected int rows = 2;
         protected FlexibleStringExpander defaultValue;
         protected boolean visualEditorEnable = false;
+        protected boolean readOnly = false;
         protected FlexibleStringExpander visualEditorButtons;
 
         protected TextareaField() {
@@ -2270,6 +2271,7 @@
             
             visualEditorEnable = "true".equals(element.getAttribute("visual-editor-enable"));
             visualEditorButtons = new FlexibleStringExpander(element.getAttribute("visual-editor-buttons"));
+            readOnly = "true".equals(element.getAttribute("read-only"));
 
             String colsStr = element.getAttribute("cols");
             try {
@@ -2331,6 +2333,20 @@
          */
         public String getVisualEditorButtons(Map context) {
             return this.visualEditorButtons.expandString(context);
+        }
+
+        /**
+         * @return
+         */
+        public boolean isReadOnly() {
+            return readOnly;
+        }
+        
+        /**
+         * @param r
+         */
+        public void setReadOnly(boolean r) {
+            readOnly = r;
         }
 
         /**

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=571237&r1=571236&r2=571237&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Thu Aug 30 09:41:09 2007
@@ -309,6 +309,10 @@
             buffer.append("htmlEditArea");
             buffer.append('"');
         }
+
+        if (textareaField.isReadOnly()) {
+            buffer.append(" readonly");
+        }
 
         buffer.append('>');