Index: openacs-4/packages/acs-templating/tcl/deprecated-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/deprecated-procs.tcl,v diff -u -N -r1.8.2.3 -r1.8.2.4 --- openacs-4/packages/acs-templating/tcl/deprecated-procs.tcl 1 Feb 2021 10:54:23 -0000 1.8.2.3 +++ openacs-4/packages/acs-templating/tcl/deprecated-procs.tcl 28 Dec 2021 16:15:50 -0000 1.8.2.4 @@ -442,8 +442,35 @@ return $name } +ad_proc -deprecated template::util::set_to_list { set args } { + Turns an ns_set into a key-value list, excluding any number of + specified keys. Useful for turning the contents on an ns_set into + a form that may be cached or manipulated as a native Tcl data structure. + DEPRECATED: this proc can be replaced with trivial ns_set and + plain tcl idioms + @see ns_set + + @param set A reference to an ns_set. + @param args Any number of key names to exclude from the list. + + @return A list in the form { key value key value key value ... } +} { + + set result [list] + + for { set i 0 } { $i < [ns_set size $set] } { incr i } { + + set key [ns_set key $set $i] + if { $key in $args } { continue } + + lappend result $key [ns_set value $set $i] + } + + return $result +} + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-templating/tcl/tag-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/tag-init.tcl,v diff -u -N -r1.49.2.11 -r1.49.2.12 --- openacs-4/packages/acs-templating/tcl/tag-init.tcl 28 Dec 2021 14:29:29 -0000 1.49.2.11 +++ openacs-4/packages/acs-templating/tcl/tag-init.tcl 28 Dec 2021 16:15:50 -0000 1.49.2.12 @@ -510,7 +510,8 @@ set id [template::get_attribute formwidget $params id] # get any additional HTML attributes specified by the designer - set tag_attributes [template::util::set_to_list $params id] + set tag_attributes [ns_set array $params] + dict unset tag_attributes id template::adp_append_string \ "\[template::element render \${form:id} [list $id] { $tag_attributes } \]" @@ -524,7 +525,8 @@ set id [template::get_attribute formhelp $params id] # get any additional HTML attributes specified by the designer - set tag_attributes [template::util::set_to_list $params id] + set tag_attributes [ns_set array $params] + dict unset tag_attributes id template::adp_append_string \ "\[template::element render_help \${form:id} [list $id] { $tag_attributes } \]" @@ -569,7 +571,8 @@ set id [template::get_attribute formgroup $params id] # get any additional HTML attributes specified by the designer - set tag_attributes [template::util::set_to_list $params id] + set tag_attributes [ns_set array $params] + dict unset tag_attributes id # generate a list of options and option labels as a data source @@ -599,7 +602,9 @@ set row [template::get_attribute formgroup-widget $params row] # get any additional HTML attributes specified by the designer - set tag_attributes [template::util::set_to_list $params id row] + set tag_attributes [ns_set array $params] + dict unset tag_attributes id + dict unset tag_attributes row # generate a list of options and option labels as a data source @@ -639,8 +644,10 @@ } # get any additional HTML attributes specified by the designer - set tag_attributes [template::util::set_to_list $params \ - id style method title cols headers] + set tag_attributes [ns_set array $params] + foreach key {id style method title cols headers} { + dict unset tag_attributes $key + } template::adp_append_string \ [subst -nocommands {[template::form render $id { $tag_attributes } ]}] Index: openacs-4/packages/acs-templating/tcl/util-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/util-procs.tcl,v diff -u -N -r1.43.2.9 -r1.43.2.10 --- openacs-4/packages/acs-templating/tcl/util-procs.tcl 28 Dec 2021 10:57:01 -0000 1.43.2.9 +++ openacs-4/packages/acs-templating/tcl/util-procs.tcl 28 Dec 2021 16:15:50 -0000 1.43.2.10 @@ -217,30 +217,6 @@ set inlist [array get values] } -ad_proc -public template::util::set_to_list { set args } { - Turns an ns_set into a key-value list, excluding any number of - specified keys. Useful for turning the contents on an ns_set into - a form that may be cached or manipulated as a native Tcl data structure. - - @param set A reference to an ns_set. - @param args Any number of key names to exclude from the list. - - @return A list in the form { key value key value key value ... } -} { - - set result [list] - - for { set i 0 } { $i < [ns_set size $set] } { incr i } { - - set key [ns_set key $set $i] - if { $key in $args } { continue } - - lappend result $key [ns_set value $set $i] - } - - return $result -} - ad_proc -public template::util::set_to_vars { set args } { Declare local variables for set values