You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-cvs@tcl.apache.org by mx...@apache.org on 2012/11/13 23:48:42 UTC

svn commit: r1409006 - in /tcl/rivet/branches/2.1: ./ ChangeLog doc/ doc/xml/form.xml rivet/packages/form/form2.tcl

Author: mxmanghi
Date: Tue Nov 13 22:48:41 2012
New Revision: 1409006

URL: http://svn.apache.org/viewvc?rev=1409006&view=rev
Log:
committing the last merge from trunk and preparing to create
the new 2.1.0rc tarball

Modified:
    tcl/rivet/branches/2.1/   (props changed)
    tcl/rivet/branches/2.1/ChangeLog
    tcl/rivet/branches/2.1/doc/   (props changed)
    tcl/rivet/branches/2.1/doc/xml/form.xml
    tcl/rivet/branches/2.1/rivet/packages/form/form2.tcl

Propchange: tcl/rivet/branches/2.1/
------------------------------------------------------------------------------
  Merged /tcl/rivet/trunk:r1403537-1409005

Modified: tcl/rivet/branches/2.1/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.1/ChangeLog?rev=1409006&r1=1409005&r2=1409006&view=diff
==============================================================================
--- tcl/rivet/branches/2.1/ChangeLog (original)
+++ tcl/rivet/branches/2.1/ChangeLog Tue Nov 13 22:48:41 2012
@@ -1,3 +1,18 @@
+2012-11-13 Massimo Manghi <mx...@apache.org>
+    * doc/xml/form.xml: subcommand 'checkboxes' documented
+
+2012-11-09 Harald Oehlmann <oe...@apache.org>
+    * rivet/packages/form/form2.tcl: Checkboxes with no value and an arbitrary
+    default value are initialy checked.
+    *** POTENTIAL INCOMPATIBILITY ***
+    The default value is not taken as checkbox value any more.
+    This was IMHO a security hole.
+    (reported on rivet-dev by Jeff Lawson)
+
+2012-11-05 Harald Oehlmann <oe...@apache.org>
+    * rivet/packages/form/form2.tcl: Bug fixed: method textarea did not honor default values.
+    (reported on rivet-dev by Jeff Lawson)
+
 2012-10-29 Massimo Manghi <mx...@apache.org>
     * rivet/packages/session/[session-create-mysql.sql|session-create-sqlite.sql]: index
     riv_sess_cache_ix had a incomplete unique key definition that missed the 'package_' column (fixes bug #54063)

Propchange: tcl/rivet/branches/2.1/doc/
------------------------------------------------------------------------------
  Merged /tcl/rivet/trunk/doc:r1403537-1409005

Modified: tcl/rivet/branches/2.1/doc/xml/form.xml
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.1/doc/xml/form.xml?rev=1409006&r1=1409005&r2=1409006&view=diff
==============================================================================
--- tcl/rivet/branches/2.1/doc/xml/form.xml (original)
+++ tcl/rivet/branches/2.1/doc/xml/form.xml Tue Nov 13 22:48:41 2012
@@ -379,7 +379,55 @@ myform end</programlisting>
 								type input field with the name, label and value attributes set 
 								according to the parameters passed to the subcommand.
 							</para>
-								<refsect3>
+							<para>
+								Example:
+							</para>
+							<programlisting>form myform -defaults response -method get -name formname -action &lt;form_url&gt;
+myform start
+myform checkbox options -value opt1 -label "Option 1"
+myform checkbox options -value opt2 -label "Option 2"
+myform checkbox options -value opt3 -label "Option 3"
+myform checkbox options -value opt4 -label "Option 4"
+myform submit save_tps -value "Send Options"
+myform end
+myform destroy</programlisting>
+							<para>
+								Provided opt2 was in response array (in the list valued 'options' variable) that 
+								initialized the form, the output would look like this
+							</para>
+							<programlisting>&lt;form  action=&quot;&lt;form_url&gt;&quot; method=&quot;get&quot; name=&quot;formname&quot;&gt;
+&lt;input type=&quot;checkbox&quot; name=&quot;options&quot;  id=&quot;autogen_1&quot; label=&quot;Option 1&quot; value=&quot;sopt1&quot; /&gt;&lt;label for=&quot;autogen_1&quot;&gt;Option 1&lt;/label&gt;
+&lt;input type=&quot;checkbox&quot; name=&quot;options&quot;  id=&quot;autogen_2&quot; label=&quot;Option 2&quot; value=&quot;sopt2&quot; /&gt;&lt;label for=&quot;autogen_2&quot;&gt;Option 2&lt;/label&gt;
+&lt;input type=&quot;checkbox&quot; name=&quot;options&quot;  id=&quot;autogen_3&quot; label=&quot;Option 3&quot; value=&quot;sopt3&quot; /&gt;&lt;label for=&quot;autogen_3&quot;&gt;Option 3&lt;/label&gt;
+&lt;input type=&quot;checkbox&quot; name=&quot;options&quot;  id=&quot;autogen_4&quot; label=&quot;Option 4&quot; value=&quot;sopt4&quot; /&gt;&lt;label for=&quot;autogen_4&quot;&gt;Option 4&lt;/label&gt;
+&lt;input type=&quot;submit&quot; name=&quot;submit&quot;  value=&quot;Send&quot; /&gt;
+&lt;/form&gt;</programlisting>
+						</listitem>				
+					</varlistentry>
+				</variablelist>
+			</refsect2>
+
+			<!-- CHECKBOXES -->
+			
+			<refsect2>
+				<variablelist>
+					<varlistentry>
+						<listitem>
+							<cmdsynopsis>
+								<arg choice="plain">checkboxes</arg>
+								<arg>name</arg>
+								<arg>-labels <replaceable>labels_list</replaceable></arg>
+								<arg>-values <replaceable>values_list</replaceable></arg>
+								<arg>args</arg>
+							</cmdsynopsis>
+							<para>
+								The <arg choice="plain">checkboxes</arg> is an extended form
+								of the <arg choice="plain">checkbox</arg> subcommand. 
+								<arg choice="plain">checkboxes</arg>
+								prints as many checkboxes as the number of elements in the 
+								<arg><replaceable>labels_list</replaceable></arg> argument								 
+							</para>
+							<refsect3>
 								<title>Options</title>
 								<variablelist>
 									<varlistentry>
@@ -405,29 +453,31 @@ myform end</programlisting>
 	 										</para>
 										</listitem>								
 									</varlistentry>
-								</variablelist>				
+								</variablelist>		
 							</refsect3>
 							<para>
 								Example:
 							</para>
-							<programlisting>myform checkbox options -value opt1   -label "Option 1"
-myform checkbox options -value opt2   -label "Option 2"
-myform checkbox options -value opt3   -label "Option 3"
-myform checkbox options -value opt4   -label "Option 4"</programlisting>
+							<programlisting>form myform -defaults response -method post -action &lt;form_url&gt;
+myform start
+myform checkboxes options -values {opt1 opt2 opt3 opt4} -labels {"Option 1" "Option 2" "Option 3" "Option 4"}
+myform submit save_tps -value "Send Options"
+myform end
+myform destroy</programlisting>
 							<para>
-								Provided opt2 was in response array (in the list valued 'options' variable) that 
-								initialized the form, the output would look like this
+								will print the following HTML code
 							</para>
-							<programlisting>&lt;input type="checkbox" name="options" label="Option 1" value="opt1" /&gt;Option 1
-&lt;input type="checkbox" name="options" label="Option 2" value="opt2" 
-       	 checked="checked" /&gt;Option 2
-&lt;input type="checkbox" name="options" label="Option 3" value="opt3" /&gt;Option 3
-&lt;input type="checkbox" name="options" label="Option 4" value="opt4" /&gt;Option 4</programlisting>
+							<programlisting>&lt;form  action=&quot;&lt;form_url&gt;&quot; method=&quot;post&quot;&gt;
+&lt;input type=&quot;checkbox&quot; name=&quot;options&quot;  id=&quot;autogen_1&quot; label=&quot;Option 1&quot; value=&quot;opt1&quot; /&gt;&lt;label for=&quot;autogen_1&quot;&gt;Option 1&lt;/label&gt;
+&lt;input type=&quot;checkbox&quot; name=&quot;options&quot;  id=&quot;autogen_2&quot; label=&quot;Option 2&quot; value=&quot;opt2&quot; /&gt;&lt;label for=&quot;autogen_2&quot;&gt;Option 2&lt;/label&gt;
+&lt;input type=&quot;checkbox&quot; name=&quot;options&quot;  id=&quot;autogen_3&quot; label=&quot;Option 3&quot; value=&quot;opt3&quot; /&gt;&lt;label for=&quot;autogen_3&quot;&gt;Option 3&lt;/label&gt;
+&lt;input type=&quot;checkbox&quot; name=&quot;options&quot;  id=&quot;autogen_4&quot; label=&quot;Option 4&quot; value=&quot;opt4&quot; /&gt;&lt;label for=&quot;autogen_4&quot;&gt;Option 4&lt;/label&gt;
+&lt;input type=&quot;submit&quot; name=&quot;save_tps&quot;  value=&quot;Send Options&quot; /&gt;
+&lt;/form&gt;</programlisting>
 						</listitem>				
 					</varlistentry>
 				</variablelist>
-			</refsect2>
-
+			</refsect2>				
 			<refsect2>
 				<variablelist>
 					<varlistentry>
@@ -546,22 +596,6 @@ myform checkbox options -value opt4   -l
 					<varlistentry>
 						<listitem>
 							<cmdsynopsis>
-								<arg choice="plain">checkbox</arg>
-								<arg>name</arg>
-								<arg>args</arg>
-							</cmdsynopsis>
-							<para>
-								Emits a checkbox input field
-							</para>
-						</listitem>
-					</varlistentry>
-				</variablelist>
-			</refsect2>
-			<refsect2>
-				<variablelist>
-					<varlistentry>
-						<listitem>
-							<cmdsynopsis>
 								<arg choice="plain">radio</arg>
 								<arg>name</arg>
 								<arg>args</arg>

Modified: tcl/rivet/branches/2.1/rivet/packages/form/form2.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/branches/2.1/rivet/packages/form/form2.tcl?rev=1409006&r1=1409005&r2=1409006&view=diff
==============================================================================
--- tcl/rivet/branches/2.1/rivet/packages/form/form2.tcl (original)
+++ tcl/rivet/branches/2.1/rivet/packages/form/form2.tcl Tue Nov 13 22:48:41 2012
@@ -276,11 +276,16 @@ package provide form 2.0
                     append label ">" $data(label) "</label>"
                 }
 
-                # ...and if there is a default value for this field
+                # if there is a default value for this field
                 # and it matches the value we have for it, make
                 # the field show up as selected (checked)
-                if {[info exists data(value)]
-                        && [default_value_exists $name $data(value)]
+                # Alternatively, select a checkbox, if it has no value but a
+                # default value with arbitrary value.
+                if {    [info exists data(value)]
+                            && [default_value_exists $name $data(value)]
+                        || ![info exists data(value)]
+                            && $type eq "checkbox"
+                            && [info exists DefaultValues($name)]
                 } {
                     set data(checked) "checked"
                 }
@@ -576,7 +581,9 @@ package provide form 2.0
         if {[info exists data(value)]} {
             set value $data(value)
             unset data(value)
-        }
+        } elseif {[default_exists $name]} {
+			set value [default_value_get $name]
+		}
         html "<textarea name=\"$name\" [argstring data]>$value</textarea>"
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: site-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: site-cvs-help@tcl.apache.org