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 <form_url>
+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><form action="<form_url>" method="get" name="formname">
+<input type="checkbox" name="options" id="autogen_1" label="Option 1" value="sopt1" /><label for="autogen_1">Option 1</label>
+<input type="checkbox" name="options" id="autogen_2" label="Option 2" value="sopt2" /><label for="autogen_2">Option 2</label>
+<input type="checkbox" name="options" id="autogen_3" label="Option 3" value="sopt3" /><label for="autogen_3">Option 3</label>
+<input type="checkbox" name="options" id="autogen_4" label="Option 4" value="sopt4" /><label for="autogen_4">Option 4</label>
+<input type="submit" name="submit" value="Send" />
+</form></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 <form_url>
+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><input type="checkbox" name="options" label="Option 1" value="opt1" />Option 1
-<input type="checkbox" name="options" label="Option 2" value="opt2"
- checked="checked" />Option 2
-<input type="checkbox" name="options" label="Option 3" value="opt3" />Option 3
-<input type="checkbox" name="options" label="Option 4" value="opt4" />Option 4</programlisting>
+ <programlisting><form action="<form_url>" method="post">
+<input type="checkbox" name="options" id="autogen_1" label="Option 1" value="opt1" /><label for="autogen_1">Option 1</label>
+<input type="checkbox" name="options" id="autogen_2" label="Option 2" value="opt2" /><label for="autogen_2">Option 2</label>
+<input type="checkbox" name="options" id="autogen_3" label="Option 3" value="opt3" /><label for="autogen_3">Option 3</label>
+<input type="checkbox" name="options" id="autogen_4" label="Option 4" value="opt4" /><label for="autogen_4">Option 4</label>
+<input type="submit" name="save_tps" value="Send Options" />
+</form></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