--- loncom/interface/longroup.pm 2006/07/29 00:31:58 1.12 +++ loncom/interface/longroup.pm 2006/11/28 19:46:00 1.13 @@ -40,14 +40,17 @@ Input: 1. Optional course domain 2. Optional course number 3. Optional group name +4. Optional namespace Course domain and number will be taken from user's environment if not supplied. Optional group name will -be passed to lonnet::get_coursegroups() as a regexp to -use in the call to the dump function. +be passed to lonnet function as a regexp to +use in the call to the dump function. Optional namespace +will determine whether information is retrieved about current +groups (default) or deleted groups (namespace = deleted_groups). Output -Returns hash of groups in the course (subject to the +Returns hash of groups in a course (subject to the optional group name filter). In the hash, the keys are group names, and their corresponding values are scalars containing group information in XML. This @@ -60,7 +63,7 @@ None. ############################################### sub coursegroups { - my ($cdom,$cnum,$group) = @_; + my ($cdom,$cnum,$group,$namespace) = @_; if (!defined($cdom) || !defined($cnum)) { my $cid = $env{'request.course.id'}; @@ -69,12 +72,16 @@ sub coursegroups { $cdom = $env{'course.'.$cid.'.domain'}; $cnum = $env{'course.'.$cid.'.num'}; } - my %curr_groups = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group); - if (my $tmp = &Apache::lonnet::error(%curr_groups)) { - undef(%curr_groups); - &Apache::lonnet::logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'.$cdom); + if (!defined($namespace)) { + $namespace = 'coursegroups'; + } + my %groups = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group, + $namespace); + if (my $tmp = &Apache::lonnet::error(%groups)) { + undef(%groups); + &Apache::lonnet::logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'.$cdom.' - '.$namespace); } - return %curr_groups; + return %groups; } ###############################################