--- loncom/interface/loncoursegroups.pm 2006/05/25 22:39:59 1.22 +++ loncom/interface/loncoursegroups.pm 2006/07/07 17:11:04 1.41 @@ -1,3 +1,6 @@ +# The LearningOnline Network with CAPA +# +# $Id: loncoursegroups.pm,v 1.41 2006/07/07 17:11:04 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,7 +34,10 @@ use Apache::lonhtmlcommon; use Apache::lonlocal; use Apache::lonnavmaps; use Apache::longroup; +use Apache::portfolio; use Apache::Constants qw(:common :http); +use lib '/home/httpd/lib/perl/'; +use LONCAPA; sub handler { my ($r) = @_; @@ -64,13 +70,18 @@ sub handler { &Apache::lonnet::allowed('mdg',$env{'request.course.id'}); &Apache::lonhtmlcommon::clear_breadcrumbs(); + my $gpterm = &Apache::loncommon::group_term(); + my $ucgpterm = $gpterm; + $ucgpterm =~ s/^(\w)/uc($1)/e; + my $crstype = &Apache::loncommon::course_type(); + my %functions = ( email => 'E-mail', discussion => 'Discussion boards', chat => 'Chat', files => 'File repository', roster => 'Membership roster', - homepage => 'Group home page', + homepage => $ucgpterm.' home page', ); my %idx = (); @@ -78,6 +89,7 @@ sub handler { $idx{fullname} = &Apache::loncoursedata::CL_FULLNAME(); $idx{udom} = &Apache::loncoursedata::CL_SDOM(); $idx{uname} = &Apache::loncoursedata::CL_SNAME(); + $idx{section} = &Apache::loncoursedata::CL_SECTION(); my $rowColor1 = "#dddddd"; my $rowColor2 = "#eeeeee"; @@ -93,43 +105,44 @@ sub handler { if ($view_permission || $manage_permission) { &group_administration($r,$action,$state,$cdom,$cnum,$function, $tabcol,\%functions,\%idx,$view_permission, - $manage_permission,$rowColor1,$rowColor2); + $manage_permission,$rowColor1,$rowColor2, + $gpterm,$ucgpterm,$crstype); } else { - $r->print(&mt('You do not have group administration '. - 'privileges in this course')); + $r->print(&mt('You do not have [_1] administration '. + 'privileges in this [_2]',$gpterm,lc($crstype))); } } else { - &print_main_menu($r,$cdom,$cnum,$function,$tabcol,\%functions,\%idx, - $view_permission,$manage_permission,$action,$state, - $rowColor1,$rowColor2); + &print_main_menu($r,$cdom,$cnum,\%functions,\%idx,$view_permission, + $manage_permission,$action,$state,$gpterm,$ucgpterm, + $crstype); } return OK; } sub print_main_menu { - my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission, - $manage_permission,$action,$state,$rowColor1,$rowColor2) = @_; + my ($r,$cdom,$cnum,$functions,$idx,$view_permission,$manage_permission, + $action,$state,$gpterm,$ucgpterm,$crstype) = @_; + my $pagename = "$crstype $ucgpterm".'s'; my $jscript = qq| function changeSort(caller) { document.$state.sortby.value = caller; document.$state.submit(); }\n|; - $r->print(&header('Course Groups',$jscript,$action,$state, - undef,$function)); + $r->print(&header($pagename,$jscript,$action,$state)); &Apache::lonhtmlcommon::add_breadcrumb ({href=>"/adm/coursegroups", - text=>"Course Groups",}); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Groups')); - &display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx, - $view_permission,$manage_permission,$action,$state, - $rowColor1,$rowColor2); + text=>"$pagename"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs($pagename)); + &display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission, + $manage_permission,$action,$state,$gpterm,$ucgpterm, + $crstype); $r->print(&footer()); return; } sub display_groups { - my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission, - $manage_permission,$action,$state,$rowColor1,$rowColor2) = @_; + my ($r,$cdom,$cnum,$functions,$idx,$view_permission, + $manage_permission,$action,$state,$gpterm,$ucgpterm,$crstype) = @_; my %curr_groups = (); my %grp_info = (); my %actionlinks = ( @@ -144,7 +157,7 @@ sub display_groups { view => 'View', delete => 'Delete', act => 'Action', - gname => 'Group Name', + gname => "$ucgpterm Name", desc => 'Description', crea => 'Creator', crtd => 'Created', @@ -154,13 +167,13 @@ sub display_groups { memb => 'Members', file => 'Files', dibd => 'Discussion Boards', - dius => 'Disk Use', - nogr => 'No groups exist.', - crng => 'Create a new group', + dius => 'Disk Use (%)', + nogr => 'No '.$gpterm.'s exist.', + crng => 'Create a new '.$gpterm, alth => 'Although your current role has privileges'. - ' to view any existing groups in this course,'. - ' you do not have privileges to create new'. - ' groups.', + ' to view any existing '.$gpterm.'s in this'. + lc($crstype).', you do not have privileges'. + 'to create new '.$gpterm.'s.', ); if ($view_permission) { if (!defined($action)) { @@ -168,29 +181,28 @@ sub display_groups { } my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum); if (%curr_groups) { + if ($manage_permission) { + $r->print(''.$lt{'crng'}.''); + } $r->print(''); - $r->print(&Apache::lonhtmlcommon::start_pick_box()); + $r->print(&Apache::loncommon::start_data_table(). + &Apache::loncommon::start_data_table_header_row()); + $r->print(<<"END"); -
'.&mt("For full access to all of [_1]'s privileges, users will need to log out and log back in.",$groupname).'