Index: openacs-4/packages/acs-templating/tcl/widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/widget-procs.tcl,v diff -u -r1.14.2.2 -r1.14.2.3 --- openacs-4/packages/acs-templating/tcl/widget-procs.tcl 26 Feb 2003 21:34:28 -0000 1.14.2.2 +++ openacs-4/packages/acs-templating/tcl/widget-procs.tcl 5 Mar 2003 14:57:37 -0000 1.14.2.3 @@ -71,31 +71,58 @@ if { [info exists element(html)] } { array set attributes $element(html) } - array set attributes $tag_attributes + + if { [info exists element(value)] } { + set value $element(value) + } else { + set value {} + } - set output "" + return $output +} +ad_proc -public template::widget::textarea_internal { + name + attribute_reference + {value {}} + {mode edit} +} { + upvar $attribute_reference attributes + + if { ![string equal $mode "edit"] } { + set output {} + if { ![empty_string_p value] } { + append output "[ad_quotehtml $value]" + } + } else { + set output "" + } + return $output } + + ad_proc -public template::widget::inform { element_reference tag_attributes } { A static information widget that does not submit any data } { @@ -124,22 +151,43 @@ set attributes(id) "$element(form_id):elements:$element(name):$element(value)" } - set output "" + # This is ugly, but it works: Only export the value when we're on a selected option + append output "\[ad_decode \$checked \"checked\" \"\" \"\"\]" + } + default { + if { [info exists element(value)] } { + append output [ad_quotehtml $element(value)] + append output "" + } + } + } + } else { + set output "" } - append output " />" - return $output } @@ -209,42 +257,65 @@ return [input button element $tag_attributes] } -ad_proc -public template::widget::menu { widget_name options_list values_list \ - attribute_reference } { +ad_proc -public template::widget::menu { + widget_name + options_list + values_list + attribute_reference + {mode edit} +} { upvar $attribute_reference attributes - - set output "\n" + + foreach option $options_list { + + set label [lindex $option 0] + set value [lindex $option 1] + + append output " \n" + } + + append output "" } - append output "" - return $output } @@ -259,7 +330,7 @@ array set attributes $tag_attributes return [template::widget::menu \ - $element(name) $element(options) $element(values) attributes] + $element(name) $element(options) $element(values) attributes $element(mode)] } ad_proc -public template::widget::multiselect { element_reference tag_attributes } { @@ -285,7 +356,7 @@ } return [template::widget::menu \ - $element(name) $element(options) $element(values) attributes] + $element(name) $element(options) $element(values) attributes $element(mode)] } ad_proc -public template::data::transform::search { element_ref } { @@ -360,38 +431,6 @@ return [list $value] } - - -ad_proc -public template::widget::textarea { element_reference tag_attributes } { - - upvar $element_reference element - - if { [info exists element(html)] } { - array set attributes $element(html) - } - - array set attributes $tag_attributes - - set output "" - return $output -} - ad_proc -public template::widget::comment { element_reference tag_attributes } { upvar $element_reference element @@ -408,29 +447,18 @@ append output "$element(history)" } - if { [info exists element(header)] } { - append output "

$element(header)

" - } + if { [string equal $element(mode) "edit"] } { + if { [info exists element(header)] } { + append output "

$element(header)

" + } + + append output [textarea $element_reference $tag_attributes] - append output "" - + return $output }