Index: openacs-4/packages/categories/tcl/category-trees-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/tcl/category-trees-procs.tcl,v diff -u -r1.22 -r1.23 --- openacs-4/packages/categories/tcl/category-trees-procs.tcl 6 Oct 2007 13:51:43 -0000 1.22 +++ openacs-4/packages/categories/tcl/category-trees-procs.tcl 7 Oct 2007 22:36:56 -0000 1.23 @@ -26,6 +26,21 @@ return [array get tree] } + ad_proc -public get_categories { + {-tree_id:required} + } { + returns the main categories of a given tree + } { + set locale [ad_conn locale] + set result [list] + set categories [db_list get_categories ""] + foreach category_id $categories { + lappend result $category_id + } + return $result + + } + ad_proc -public map { -tree_id:required -object_id:required @@ -216,7 +231,38 @@ return $result } + ad_proc -public get_trees { object_id } { + Get the category trees mapped to an object. + @param object_id object to get the mapped category trees. + @return tcl list of tree_ids + @author Peter Kreuzinger (peter.kreuzinger@wu-wien.ac.at) + } { + set result [list] + + db_foreach get_trees "" { + lappend result $tree_id + } + + return $result + } + + ad_proc -public get_id_by_object_title { + {-title} + } { + Gets the id of a category_tree given an object title (object_type=category). + This is highly useful as the category_tree object title will not change if you change the + name (label) of the category_tree, so you can access the category_tree even if the label has changed. + Why would you want this? E.g. if you have the category widget and want to get only one specific tree + displayed and not all of them. + + @param title object title of the category to retrieve + @return the category_tree_id or empty string it no category was found + @author Malte Sussdorff (malte.sussdorff@cognovis.de) + } { + return [db_string get_tree_id {} -default ""] + } + ad_proc -public get_mapped_trees_from_object_list { object_id_list {locale ""}} { Get the category trees mapped to a list of objects.