version 1.4, 2006/06/22 14:19:18
|
version 1.7, 2006/06/30 18:27:19
|
Line 70 sub coursegroups {
|
Line 70 sub coursegroups {
|
$cnum = $env{'course.'.$cid.'.num'}; |
$cnum = $env{'course.'.$cid.'.num'}; |
} |
} |
my %curr_groups = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group); |
my %curr_groups = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group); |
my ($tmp) = keys(%curr_groups); |
if (my $tmp = &Apache::lonnet::error(%curr_groups)) { |
if ($tmp=~/^(con_lost|no_such_host|error: [^2] )/) { |
undef(%curr_groups); |
undef(%curr_groups); |
|
&Apache::lonnet::logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'.$cdom); |
&Apache::lonnet::logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'.$cdom); |
} elsif ($tmp=~/^error: 2 /) { |
|
undef(%curr_groups); |
|
} |
} |
return %curr_groups; |
return %curr_groups; |
} |
} |
Line 95 Hash containing group information as key
|
Line 92 Hash containing group information as key
|
hash of hashes for (b) |
hash of hashes for (b) |
|
|
Keys (in two categories): |
Keys (in two categories): |
(a) groupname, creator, creation, modified, startdate,enddate. |
(a) groupname, creator, creation, modified, startdate, enddate, quota. |
Corresponding values are name of the group, creator of the group |
Corresponding values are name of the group, creator of the group |
(username:domain), UNIX time for date group was created, and |
(username:domain), UNIX time for date group was created, and |
settings were last modified, and default start and end access |
settings were last modified, file quota, and default start and end |
times for group members. |
access times for group members. |
|
|
(b) functions returned in hash of hashes. |
(b) functions returned in hash of hashes. |
Outer hash key is functions. |
Outer hash key is functions. |
Line 272 sub group_changes {
|
Line 269 sub group_changes {
|
if (@changegroups > 0) { |
if (@changegroups > 0) { |
my %currpriv; |
my %currpriv; |
my %roleshash = &Apache::lonnet::dump('roles',$udom,$uname,$cid); |
my %roleshash = &Apache::lonnet::dump('roles',$udom,$uname,$cid); |
my ($tmp) = keys(%roleshash); |
if (my $tmp = &Apache::lonnet::error(%roleshash)) { |
if ($tmp=~/^error:/) { |
|
&Apache::lonnet::logthis('Error retrieving roles: '.$tmp. |
&Apache::lonnet::logthis('Error retrieving roles: '.$tmp. |
' for '.$uname.':'.$udom); |
' for '.$uname.':'.$udom); |
} else { |
} else { |
Line 418 sub group_changes {
|
Line 414 sub group_changes {
|
} |
} |
|
|
############################################### |
############################################### |
|
|
|
sub sum_quotas { |
|
my ($courseid) = @_; |
|
my $totalquotas = 0; |
|
my ($cdom,$cnum); |
|
if (!defined($courseid)) { |
|
if (defined($env{'request.course.id'})) { |
|
$courseid = $env{'request.course.id'}; |
|
$cdom = $env{'course.'.$courseid.'.domain'}; |
|
$cnum = $env{'course.'.$courseid.'.num'}; |
|
} else { |
|
return ''; |
|
} |
|
} else { |
|
($cdom,$cnum) = split(/_/,$courseid); |
|
} |
|
if ($cdom && $cnum) { |
|
my %curr_groups = &coursegroups($cdom,$cnum); |
|
if (%curr_groups) { |
|
foreach my $group (keys(%curr_groups)) { |
|
my %settings=&get_group_settings($curr_groups{$group}); |
|
my $quota = $settings{'quota'}; |
|
if ($quota eq '') { |
|
$quota = 0; |
|
} |
|
$totalquotas += $quota; |
|
} |
|
} else { |
|
return 0; |
|
} |
|
} else { |
|
return ''; |
|
} |
|
return $totalquotas; |
|
} |
|
|
|
############################################### |
|
|
|
sub get_bbfolder_url { |
|
my ($cdom,$cnum,$group) = @_; |
|
my %curr_groups = &coursegroups($cdom,$cnum,$group); |
|
my $grpbbmap; |
|
if (%curr_groups) { |
|
my %group_info = &get_group_settings($curr_groups{$group}); |
|
my $creation = $group_info{'creation'}; |
|
my $bbfolder = $creation + 1; |
|
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; |
|
$grpbbmap = $crspath.'default_'.$bbfolder.'.sequence'; |
|
} |
|
return $grpbbmap; |
|
} |
|
|
|
############################################### |
|
|
|
sub get_group_bbinfo { |
|
my ($cdom,$cnum,$group) = @_; |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
my @groupboards; |
|
my %boardshash; |
|
my $grpbbmap = &get_bbfolder_url($cdom,$cnum,$group); |
|
if ($grpbbmap) { |
|
my $bbfolderres = $navmap->getResourceByUrl($grpbbmap); |
|
if ($bbfolderres) { |
|
my @boards = $navmap->retrieveResources($bbfolderres,undef,0,0); |
|
foreach my $res (@boards) { |
|
my $url = $res->src(); |
|
if ($url =~ m|^/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard|) { |
|
push(@groupboards,$res->symb()); |
|
$boardshash{$res->symb()} = { |
|
title => $res->title(), |
|
url => $res->src(), |
|
}; |
|
} |
|
} |
|
} |
|
} |
|
undef($navmap); |
|
return (\@groupboards,\%boardshash); |
|
} |
|
|
|
############################################### |
|
|
1; |
1; |
|
|