Index: openacs-4/packages/acs-subsite/tcl/group-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/group-procs.tcl,v diff -u -r1.25.2.6 -r1.25.2.7 --- openacs-4/packages/acs-subsite/tcl/group-procs.tcl 9 Sep 2005 16:57:03 -0000 1.25.2.6 +++ openacs-4/packages/acs-subsite/tcl/group-procs.tcl 15 Sep 2005 08:04:33 -0000 1.25.2.7 @@ -188,6 +188,7 @@ " return $object_type + util_memoize_flush "group::get_title_not_cached -group_id $group_id" } ad_proc -public group::get { @@ -236,6 +237,23 @@ @error } { + return [util_memoize [list group::get_id_not_cached -group_name $group_name]] +} + +ad_proc -private group::get_id_not_cached { + {-group_name:required} +} { + Retrieve the group_id to a given group-name. + + @author Christian Langmann (C_Langmann@gmx.de) + @creation-date 2005-06-09 + + @param group_name the name of the group to look for + + @return the id of the group + + @error +} { return [db_string get_group_id {} -default ""] } @@ -371,6 +389,7 @@ set title = :pretty_name where object_id = :group_id } + util_memoize_flush "group::get_title_not_cached -group_id $group_id" } } @@ -610,3 +629,34 @@ flush_members_cache -group_id $group_id } + +ad_proc -public group::title { + {-group_name ""} + {-group_id ""} +} { + Get the title of a group, cached + Use either the group_id or the group_name + + @param group_id The group_id of the group + @param group_name The name of the group. Note this is not the I18N title we want to retrieve with this procedure +} { + if {![empty_string_p $group_name]} { + set group_id [group::get_id -group_name $group_name] + } + + if {![empty_string_p $group_id]} { + return [util_memoize [list group::title_not_cached -group_id $group_id]] + } else { + return "" + } +} + +ad_proc -private group::title_not_cached { + {-group_id ""} +} { + Get the title of a group, not cached + + @param group_id The group_id of the group +} { + return [group::get_element -group_id $group_id -element "title"] +}