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 -N -r1.32 -r1.33 --- openacs-4/packages/acs-templating/tcl/widget-procs.tcl 1 Dec 2003 15:26:01 -0000 1.32 +++ openacs-4/packages/acs-templating/tcl/widget-procs.tcl 7 Feb 2004 11:47:34 -0000 1.33 @@ -43,7 +43,7 @@ @see template::widget::submit @see template::widget::text @see template::widget::textarea - + @see template::widget::block @see template::element::create } - @@ -613,3 +613,64 @@ return $output } +ad_proc -public template::widget::block { element_reference tag_attributes } { + widget for blocks of radio-buttoned questions +} { + upvar $element_reference element + + if { [info exists element(html)] } { + array set attributes $element(html) + } + + if { [info exists element(value)] } { + set value $element(value) + } else { + set value {} + } + + array set attributes $tag_attributes + + set output "" + set options $element(options) + set count 0 + foreach option $options { + if {$count == 0} { + # answer descriptions in a list: {{desc1 no_of_answers} {desc2 no_of_answers} ...} + append output "" + foreach answer_desc $option { + set answer_description [lindex $answer_desc 0] + set no_of_answers [lindex $answer_desc 1] + append output "$answer_description" + } + append output "" + } elseif {$count == 1} { + append output "[lindex $option 0]" + foreach answer_set [lindex $option 1] { + append output "required?" + foreach answer $answer_set { + append output "$answer" + } + } + append output "" + } else { + append output "[lindex $option 0]" + foreach question [lindex $option 1] { + set name [lindex $question 0] + set required_p [lindex $question 1] + append output "[ad_decode $required_p "t" "*" " "]" + foreach choice [lindex $question 2] { + if {[lsearch -exact $value $choice]==-1} { + append output "" + } else { + append output "" + } + } + } + append output "" + } + incr count + } + return "$output
" + +} +