Index: openacs-4/packages/contacts/tcl/contact-extend-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/contacts/tcl/contact-extend-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/contacts/tcl/contact-extend-procs.tcl 15 Nov 2005 15:56:46 -0000 1.4
+++ openacs-4/packages/contacts/tcl/contact-extend-procs.tcl 1 Apr 2006 07:07:16 -0000 1.5
@@ -82,4 +82,105 @@
Returns a list of the form { var_name pretty_name subquery description aggregated_p } of the extend_id
} {
return [db_list_of_lists get_options { }]
-}
\ No newline at end of file
+}
+
+
+
+
+
+
+
+
+
+
+
+namespace eval template::widget {}
+
+ad_proc -public template::widget::select_with_optgroup { element_reference tag_attributes } {
+
+ upvar $element_reference element
+
+ if { [info exists element(html)] } {
+ array set attributes $element(html)
+ }
+
+ array set attributes $tag_attributes
+ set options_list $element(options)
+ set widget_name $element(name)
+ set element_mode $element(mode)
+
+ # edit...
+ # Create an array for easier testing of selected values
+ template::util::list_to_lookup $element(values) values
+
+ if { ![string equal $element(mode) "edit"] } {
+ # this is the same as the menu display.
+ # we may want to customize it to use the optgroup
+ # as some sort of heading for certain options
+ set selected_list [list]
+
+ foreach option $options_list {
+
+ set label [lindex $option 0]
+ set value [lindex $option 1]
+
+ if { [info exists values($value)] } {
+ lappend selected_list $label
+ append output ""
+ }
+ }
+
+ append output [join $selected_list ", "]
+ } else {
+
+
+ append output ""
+ }
+
+ return $output
+}
+