[LON-CAPA-cvs] cvs: loncom /interface grouproster.pm loncoursegroups.pm longroup.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Mon, 17 Jul 2006 15:07:27 -0000
This is a MIME encoded message
--raeburn1153148847
Content-Type: text/plain
raeburn Mon Jul 17 11:07:27 2006 EDT
Modified files:
/loncom/interface grouproster.pm longroup.pm loncoursegroups.pm
Log:
Counts for active, future and previous now stored in a hash in longroup. Breadcrumbs includes link to all groups if route to roster page was via the 'Groups' link in inline menu. Title of a group bulletin board can now be returned from longroup.pm for a specified board. Priv checking for vcg and mdg for roles which include section specifier. Group privs allow editing of group board posts by poster, and detailed view of course roster information.
--raeburn1153148847
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20060717110727.txt"
Index: loncom/interface/grouproster.pm
diff -u loncom/interface/grouproster.pm:1.2 loncom/interface/grouproster.pm:1.3
--- loncom/interface/grouproster.pm:1.2 Fri Jul 7 20:59:22 2006
+++ loncom/interface/grouproster.pm Mon Jul 17 11:07:26 2006
@@ -52,7 +52,7 @@
return HTTP_NOT_ACCEPTABLE;
}
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['group']);
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['group','ref']);
my $gpterm = &Apache::loncommon::group_term();
my $ucgpterm = $gpterm;
@@ -91,7 +91,7 @@
'/'.$group);
my $view_details = &Apache::lonnet::allowed('vmd',$env{'request.course.id'}.'/'.$group);
- my $viewgrps = &Apache::lonnet::allowed('vcg',$env{'request.course.id'});
+ my $viewgrps = &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
my $editgrps = &Apache::lonnet::allowed('mdg',$env{'request.course.id'});
if ((!$can_view) && (!$view_details) && (!$viewgrps) && (!$editgrps)) {
@@ -118,6 +118,14 @@
sub roster_header {
my ($cdom,$cnum,$group,$description,$gpterm,$ucgpterm) = @_;
+ my $refarg;
+ if (exists($env{'form.ref'})) {
+ $refarg = 'ref='.$env{'form.ref'};
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"/adm/coursegroups",
+ text=>"Groups",
+ title=>"View course groups"});
+ }
my $jscript = qq|
function changeSort(caller) {
document.grouproster.sortby.value = caller;
@@ -128,10 +136,10 @@
'<script type="text/javascript">'.
$jscript.'</script>');
&Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"/adm/$cdom/$cnum/$group/smppg",
+ ({href=>"/adm/$cdom/$cnum/$group/smppg?$refarg",
text=>"$ucgpterm: $description",
title=>"Go to group's home page"},
- {href=>"/adm/grouproster?group=$group",
+ {href=>'/adm/grouproster?group='.$group.'&'.$refarg,
text=>"Membership roster",
title=>"Display group membership"},);
$output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('[_1] membership status - [_2]',$gpterm,$description));
@@ -144,7 +152,7 @@
my $fixedprivs = &Apache::longroup::get_fixed_privs();
- my ($memberinfo,$hastools,$addtools,$numitems) =
+ my ($memberinfo,$numitems,$hastools,$addtools) =
&Apache::longroup::group_memberlist($cdom,$cnum,$group,$fixedprivs,
$available);
my (%tooltype,$toolprivs);
@@ -196,8 +204,12 @@
'<input type="submit" name="statusbutton" value="'.
$lt{'updi'}.'"><input type="hidden" name="sortby" value="'.
$env{'form.sortby'}.'"/>'.
- '<input type="hidden" name="group" value="'.$group.
- '"/></form><br /><br />');
+ '<input type="hidden" name="group" value="'.$group.'"/>');
+ if (exists($env{'form.ref'})) {
+ $r->print('<input type="hidden" name="ref" value="'.$env{'form.ref'}.
+ '" />');
+ }
+ $r->print('</form><br /><br />');
}
if (ref($numitems) eq 'HASH') {
@@ -214,6 +226,10 @@
<input type="hidden" name="group" value="'.$group.'" />
<input type="hidden" name="sortby" value="'.$env{'form.sortby'}.'" />
');
+ if (exists($env{'form.ref'})) {
+ $r->print('<input type="hidden" name="ref" value="'.$env{'form.ref'}.
+ '" />');
+ }
my %Sortby = ();
my $usercount = 0;
foreach my $user (sort(keys(%{$memberinfo}))) {
Index: loncom/interface/longroup.pm
diff -u loncom/interface/longroup.pm:1.9 loncom/interface/longroup.pm:1.10
--- loncom/interface/longroup.pm:1.9 Fri Jul 7 20:52:45 2006
+++ loncom/interface/longroup.pm Mon Jul 17 11:07:26 2006
@@ -439,8 +439,8 @@
discussion => {
cgb => 'Create boards',
pgd => 'Post',
- pag => 'Anon. posts',
- rgi => 'Get identities',
+ egp => 'Edit own posts',
+ dgp => 'Hide/Delete any post',
vgb => 'View boards',
},
chat => {
@@ -454,7 +454,8 @@
agf => 'Control Access',
},
roster => {
- vgm => 'View',
+ vgm => 'Basic Display',
+ vmd => 'Detailed Display',
},
homepage => {
vgh => 'View page',
@@ -519,7 +520,7 @@
$current{$user}{'status'} = 'active';
$member_nums{'active'} ++;
}
- if (@userprivs > 0) {
+ if ((@userprivs > 0) && (ref($fixedprivs) eq 'HASH')) {
foreach my $tool (sort(keys(%{$fixedprivs}))) {
foreach my $priv (keys(%{$$fixedprivs{$tool}})) {
if (grep/^$priv$/,@userprivs) {
@@ -530,7 +531,7 @@
}
$hastools = 1;
}
- if (@{$available} > 0) {
+ if ((ref($available) eq 'ARRAY') && (@{$available} > 0)) {
if (@{$current{$user}{currtools}} > 0) {
if ("@{$available}" ne "@{$current{$user}{currtools}}") {
foreach my $tool (@{$available}) {
@@ -565,7 +566,7 @@
}
}
}
- return (\%current,$hastools,$addtools,\%member_nums);
+ return (\%current,\%member_nums,$hastools,$addtools);
}
###############################################
@@ -621,7 +622,7 @@
###############################################
sub get_group_bbinfo {
- my ($cdom,$cnum,$group) = @_;
+ my ($cdom,$cnum,$group,$boardurl) = @_;
my $navmap = Apache::lonnavmaps::navmap->new();
my @groupboards;
my %boardshash;
@@ -632,12 +633,23 @@
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(),
- };
+ if ($url =~ m|^(/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard)|) {
+ if ($boardurl) {
+ if ($boardurl =~ /^\Q$1\E/) {
+ push(@groupboards,$res->symb());
+ $boardshash{$res->symb()} = {
+ title => $res->title(),
+ url => $res->src(),
+ };
+ last;
+ }
+ } else {
+ push(@groupboards,$res->symb());
+ $boardshash{$res->symb()} = {
+ title => $res->title(),
+ url => $res->src(),
+ };
+ }
}
}
}
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.51 loncom/interface/loncoursegroups.pm:1.52
--- loncom/interface/loncoursegroups.pm:1.51 Fri Jul 7 21:16:30 2006
+++ loncom/interface/loncoursegroups.pm Mon Jul 17 11:07:26 2006
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursegroups.pm,v 1.51 2006/07/08 01:16:30 raeburn Exp $
+# $Id: loncoursegroups.pm,v 1.52 2006/07/17 15:07:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -63,9 +63,9 @@
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $view_permission =
- &Apache::lonnet::allowed('vcg',$env{'request.course.id'});
+ &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
my $manage_permission =
- &Apache::lonnet::allowed('mdg',$env{'request.course.id'});
+ &Apache::lonnet::allowed('mdg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
&Apache::lonhtmlcommon::clear_breadcrumbs();
my $gpterm = &Apache::loncommon::group_term();
@@ -329,8 +329,7 @@
$curr_groups{$group});
my $description = &unescape(
$group_info{description});
- my ($uname,$udom) = split(/:/,$group_info{creator});
- $r->print('<font size="+1"><a href="/adm/'.$udom.'/'.$uname.'/'.$group.'/smppg?ref=grouplist">'.$group,'</a><font><br /><small>'.$description.'</small><br /><br />');
+ $r->print('<font size="+1"><a href="/adm/'.$cdom.'/'.$cnum.'/'.$group.'/smppg?ref=grouplist">'.$group,'</a><font><br /><small>'.$description.'</small><br /><br />');
}
}
} else {
@@ -556,7 +555,7 @@
$num_reenable ++;
next;
} elsif (($start > $now)) {
- $num_activate = 1;
+ $num_activate ++;
next;
} else {
$num_expire ++;
@@ -2076,20 +2075,20 @@
'curf' => 'Current Functionality',
'chpr' => 'Change Privileges'
);
- my ($current,$hastools,$addtools,$num_reenable,$num_activate,$num_expire) =
+ my ($current,$num_items,$hastools,$addtools) =
&Apache::longroup::group_memberlist($cdom,$cnum,$groupname,$fixedprivs,
$available);
if (keys(%{$current}) > 0) {
$r->print('
<table>
<tr>');
- if ($num_expire) {
+ if ($num_items->{'active'}) {
&check_uncheck_buttons($r,$formname,'expire',$lt{'expi'});
}
- if ($num_reenable) {
+ if ($num_items->{'previous'}) {
&check_uncheck_buttons($r,$formname,'reenable',$lt{'reen'});
}
- if ($num_activate) {
+ if ($num_items->{'future'}) {
&check_uncheck_buttons($r,$formname,'activate',$lt{'acti'});
}
&check_uncheck_buttons($r,$formname,'deletion',$lt{'dele'});
@@ -3261,7 +3260,7 @@
if ($action eq 'create') {
# check if group_allfolders.sequence exists.
if (!$topmap) {
- my $grpstitle = &mt('[_1] [_2]',$crstype,$ucgpterm);
+ my $grpstitle = &mt('[_1] [_2]s',$crstype,$ucgpterm);
my $topmap_url = '/'.$env{'course.'.$env{'request.course.id'}.'.url'};
$topmap_url =~ s|/+|/|g;
if ($topmap_url =~ m|^/uploaded|) {
--raeburn1153148847--