Index: openacs-4/contrib/packages/bcms/tcl/bcms-widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/bcms/tcl/bcms-widget-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/bcms/tcl/bcms-widget-procs.tcl 14 May 2003 15:34:59 -0000 1.1 +++ openacs-4/contrib/packages/bcms/tcl/bcms-widget-procs.tcl 4 Aug 2003 11:19:46 -0000 1.2 @@ -15,6 +15,8 @@ -display_columns:required {-prefix " "} } { + @depracated use patched bcms::widget::extract_values + creates a list for use of ad_form's option_list. Gets a list of ns_sets. -value_column is the column that will be used the html value @@ -107,3 +109,51 @@ return $option_list } + + +ad_proc -public bcms::widget::extract_values { + -list_of_ns_sets:required + -keys_to_extract:required +} { + Gets the values of list_of_ns_sets and creates a list of list + {{value1 value2 ... valueX} {value1 value2 ... valueX}} + + @param -list_of_ns_sets a list of ns_sets normally created from db_list_of_ns_sets + @param -keys_to_extract a list of keys, the value of the key present in the list + will be returned on the results + +} { + + set result_list [list] + + foreach set $list_of_ns_sets { + set inner_list [list] + foreach key $keys_to_extract { + lappend inner_list [ns_set get $set $key] + } + lappend result_list $inner_list + } + + return $result_list + +} + + +ad_proc -public bcms::widget::item_context { + -item_id:required + {-append_list {}} +} { + creates a list based the folder it resides that can be used as context or trail. + + @param item_id id of which item to get a context + + @returns a list in {{url label} {url label}} format +} { + + set root_url [ad_conn package_url] + set root_id [bcms::folder::get_bcms_root_folder] + + return [bcms::widget::extract_values -list_of_ns_sets \ + [bcms::item::get_item_path -item_id $item_id -root_id $root_id -prepend_path "$root_url" -return_list] \ + -keys_to_extract {path title}] +}