--- loncom/interface/loncoursegroups.pm 2006/11/28 19:46:00 1.65
+++ loncom/interface/loncoursegroups.pm 2014/02/27 11:16:06 1.124
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursegroups.pm,v 1.65 2006/11/28 19:46:00 raeburn Exp $
+# $Id: loncoursegroups.pm,v 1.124 2014/02/27 11:16:06 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,6 +31,7 @@ use strict;
use Apache::lonnet;
use Apache::loncommon();
use Apache::lonhtmlcommon();
+use Apache::lonhtmlgateway;
use Apache::lonlocal;
use Apache::lonnavmaps();
use Apache::longroup();
@@ -54,7 +55,7 @@ sub handler {
if (! ($env{'request.course.fn'})) {
# Not in a course
$env{'user.error.msg'}=
- "/adm/coursegroups:mdg:0:0:Cannot edit or view course groups";
+ "/adm/coursegroups:mdg:0:0:Cannot edit or view course/community groups";
return HTTP_NOT_ACCEPTABLE;
}
@@ -75,11 +76,11 @@ sub handler {
my $crstype = &Apache::loncommon::course_type();
my %functions = (
- email => 'E-mail',
- discussion => 'Discussion boards',
- chat => 'Chat',
- files => 'File repository',
- roster => 'Membership roster',
+ email => 'Send Messages',
+ discussion => 'Discussion Boards',
+ chat => 'Chat Room',
+ files => 'Group Portfolio',
+ roster => 'Membership Roster',
homepage => $ucgpterm.' home page',
);
@@ -111,8 +112,10 @@ sub handler {
$crstype);
}
} else {
- $r->print(&mt('You do not have [_1] administration '.
- 'privileges in this [_2]',$gpterm,lc($crstype)));
+ $r->print('
'
+ .&mt('You do not have '.$gpterm.' administration '
+ .'privileges in this '.lc($crstype).'.')
+ .'
');
}
} else {
&print_main_menu($r,$cdom,$cnum,\%functions,\%idx,$view_permission,
@@ -133,22 +136,26 @@ function changeSort(caller) {
function openGroupRoster(group,status) {
var url = '/adm/grouproster?';
url += 'group='+group+'&status='+status+'&ref=popup';
- var title = 'Group Membership';
+ var title = 'Group_Membership';
var options = 'scrollbars=1,resizable=1,menubar=0';
options += ',width=700,height=600';
rosterbrowser = open(url,title,options,'1');
rosterbrowser.focus();
}\n|;
- $r->print(&header('Groups',$jscript,$action,$state));
- if ($env{'form.refpage'} eq 'enrl') {
+ $r->print(&header('My Space',$jscript,$action,$state));
+ if ($env{'form.refpage'} eq 'cusr') {
&Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"/adm/dropadd",
- text=>"Enrollment Manager"});
+ ({href=>"/adm/createuser",
+ text=>"User Management"});
}
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"/adm/coursegroups",
text=>"Groups"});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Groups'));
+ my $helpitem;
+ if ($manage_permission) {
+ $helpitem = 'Creating_Groups';
+ }
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Groups',$helpitem));
&display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission,
$manage_permission,$action,$state,$gpterm,$ucgpterm,
$crstype);
@@ -164,7 +171,7 @@ sub display_groups {
my %actionlinks = (
modify => ' ' ''.$lt{'redg'}.'';
+ }
+ }
}
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum,undef,
$status);
+
if (%curr_groups) {
+ my $navmap=Apache::lonnavmaps::navmap->new();
+ if (!defined($navmap)) {
+ $r->print('
'.
+ &mt('An error occurred retrieving information about resources in the course.').' '.
+ &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this page.','','').
+ '
');
+ return;
+ }
if ($manage_permission) {
- if (!exists($env{'form.refpage'})) {
- $r->print(' '.$lt{'crng'}.'');
+ if ($action ne 'reenable') {
+ $r->print(' '.$lt{'crng'}.'');
+ }
+ if ($reenable_link) {
+ $r->print($reenable_link);
}
}
$r->print('
');
@@ -237,13 +265,13 @@ END
my $members_result = &group_members($cdom,$cnum,$group,
\%grp_info);
my $port_path = '/userfiles/groups/'.$group.'/portfolio';
- my $port_dir = &Apache::loncommon::propath($cdom,$cnum).$port_path;
my $totaldirs = 0;
my $totalfiles = 0;
- &group_files($group,$port_dir,\$totalfiles,\$totaldirs);
+ &group_files($group,$port_path,\$totalfiles,\$totaldirs);
$grp_info{$group}{'totalfiles'} = $totalfiles;
$grp_info{$group}{'totaldirs'} = $totaldirs;
- my $diskuse = &Apache::lonnet::diskusage($cdom,$cnum,$port_dir);
+ my $getpropath = 1;
+ my $diskuse = &Apache::lonnet::diskusage($cdom,$cnum,$port_path, $getpropath);
if ($grp_info{$group}{'quota'} > 0) {
my $pct_use = 0.1 * $diskuse/$grp_info{$group}{'quota'};
$grp_info{$group}{'diskuse'} = sprintf("%.0f",$pct_use);
@@ -305,15 +333,16 @@ END
$action eq 'reenable') {
$link .= $group;
} else {
- $link .= $group.'/smppg?ref=grouplist';
+ $link .=
+ &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap);
+ $link .= (($link=~/\?/)?'&':'?').'ref=grouplist';
if (exists($env{'form.refpage'})) {
$link .= '&refpage='.$env{'form.refpage'};
}
}
$link .= '">'.$lt{$action}.'';
if ($action eq 'view') {
- if (($manage_permission) &&
- ($env{'form.refpage'} ne 'enrl')) {
+ if ($manage_permission) {
$link .= ' '.$actionlinks{'modify'}.
$group.'">'.$lt{'modify'}.''.
' '.$actionlinks{'delete'}.
@@ -330,7 +359,10 @@ END
'
');
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
if (%curr_groups) {
+ my $navmap=Apache::lonnavmaps::navmap->new();
+ if (!defined($navmap)) {
+ $r->print('
'.
+ &mt('An error occurred retrieving information about resources in the course.').' '.
+ &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this page.','','').
+ '
');
+ return;
+ }
foreach my $group (@coursegroups) {
my %group_info = &Apache::longroup::get_group_settings(
$curr_groups{$group});
my $description = &unescape(
$group_info{description});
- $r->print(''.$group,' '.$description.'
');
}
}
} else {
- $r->print(&mt('You are not currently a member of any '.
- 'active [_1]s in this [_2]',$gpterm,
- lc($crstype)));
+ $r->print(
+ '
'
+ .&mt('You are not currently a member of any active '.$gpterm.'s'
+ .' in this '.lc($crstype).'.')
+ .'
'
+ );
}
}
return;
@@ -388,7 +436,6 @@ sub group_administration {
my @types = ();
my @roles = ();
my @sections = ();
- my @buildsections = ();
my %users = ();
my %userdata = ();
my @members = ();
@@ -517,7 +564,7 @@ sub group_administration {
if (ref($stored{'autorole'}) eq 'ARRAY') {
foreach my $role (@{$stored{'autorole'}}) {
- unless ($role eq 'cc') {
+ unless (($role eq 'cc') || ($role eq 'co')) {
$elements{'modify'}{'change_settings'}{'sec_'.$role} =
'selectbox';
}
@@ -548,16 +595,11 @@ sub group_administration {
}
if (defined($env{'form.sectionpick'})) {
@sections=&Apache::loncommon::get_env_multiple('form.sectionpick');
- if (grep/^all$/,@sections) {
- @buildsections = sort {$a cmp $b} keys(%sectioncount);
- } else {
- @buildsections = @sections;
- }
}
}
if (($state eq 'pick_members') || ($state eq 'pick_privs') || ($state eq 'change_privs')) {
- &build_members_list($cdom,$cnum,\@types,\@roles,\@buildsections,\%users,
+ &build_members_list($cdom,$cnum,\@types,\@roles,\@sections,\%users,
\%userdata);
}
if ($state eq 'pick_members') {
@@ -770,7 +812,7 @@ sub group_administration {
}
var maxposs = '.sprintf("%.2f",$maxposs).';
if (newquota > maxposs) {
- alert("The file repository quota you entered for this group ("+newquota+" Mb) exceeds the maximum possible ("+maxposs+" Mb). Please enter a smaller number.");
+ alert("The group portfolio quota you entered for this group ("+newquota+" MB) exceeds the maximum possible ("+maxposs+" MB). Please enter a smaller number.");
return;
}
var re_quota = '.$float_check.';
@@ -789,7 +831,7 @@ sub group_administration {
}
}
if (warn_zero == 1) {
- alert("You have indicated that the file repository should be enabled, but you have set the respository quota to 0 Mb.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature.");
+ alert("You have indicated that the group portfolio should be enabled, but you have set the respository quota to 0 MB.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature.");
return;
}
}
@@ -848,14 +890,14 @@ function changeSort(caller) {
$r->print(&header("Groups Manager",
$jscript,$action,$state,$page,$loaditems));
- if ($env{'form.refpage'} eq 'enrl') {
+ if ($env{'form.refpage'} eq 'cusr') {
&Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"/adm/dropadd",
- text=>"Enrollment Manager",
+ ({href=>"/adm/createuser",
+ text=>"User Management",
faq=>9,bug=>'Instructor Interface',});
if ($action eq 'modify' || $action eq 'delete') {
&Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"/adm/coursegroups?refpage=enrl&action=$action",
+ ({href=>"/adm/coursegroups?refpage=cusr&action=$action",
text=>"Groups",
faq=>9,bug=>'Instructor Interface',});
}
@@ -900,11 +942,11 @@ function changeSort(caller) {
result => 'Re-enabled'
);
my %navbuttons = &Apache::lonlocal::texthash(
- gtns => 'Go to next step',
- gtps => 'Go to previous step',
+ gtns => 'Next',#'Go to next step',
+ gtps => 'Back',#'Go to previous step',
crgr => 'Create '.$gpterm,
- mose => 'Modify settings',
- gtpp => 'Go to previous page',
+ mose => 'Save',#'Modify settings',
+ gtpp => 'Back',#'Go to previous page',
adme => 'Add members',
);
if ((($action eq 'create') || ($action eq 'modify') || ($action eq 'delete') || ($action eq 'reenable')) &&
@@ -1071,7 +1113,7 @@ sub display_control {
&add_members_form($r,$cdom,$cnum,$action,$state,$page,$startdate,
$enddate,$groupname,$description,$granularity,
$quota,$sectioncount,$tools,$functions,$stored,
- $states,$navbuttons,$gpterm,$ucgpterm);
+ $states,$navbuttons,$gpterm,$ucgpterm,$crstype);
} elsif ($state eq 'pick_members') {
&choose_members_form($r,$cdom,$cnum,$action,$state,$page,
$groupname,$description,$granularity,$quota,
@@ -1104,35 +1146,40 @@ sub display_control {
my %stored = &retrieve_settings($cdom,$cnum,$groupname,$action);
if ($state eq 'verify') {
&verify_delete($r,$groupname,$state,$action,$page,$states,
- \%stored);
+ \%stored,$crstype);
} elsif ($state eq 'result') {
- &delete_group($r,$cdom,$cnum,$groupname);
+ &delete_group($r,$cdom,$cnum,$groupname,$crstype);
}
} elsif ($action eq 'reenable') {
my %stored = &retrieve_settings($cdom,$cnum,$groupname,$action);
if ($state eq 'verify') {
&verify_reenable($r,$groupname,$state,$action,$page,$states,
- \%stored);
+ \%stored,$crstype);
} elsif ($state eq 'result') {
- &reenable_group($r,$cdom,$cnum,$groupname);
+ &reenable_group($r,$cdom,$cnum,$groupname,$crstype);
}
}
}
sub verify_delete {
- my ($r,$groupname,$formname,$action,$page,$states,$stored) = @_;
+ my ($r,$groupname,$formname,$action,$page,$states,$stored,$crstype) = @_;
$r->print(&Apache::lonhtmlcommon::echo_form_input([]));
- $r->print(&mt("You have requested deletion of the following group: ").''.
- $stored->{'description'}.''.
+ $r->print(&mt('You have requested deletion of the group [_1].'
+ ,''.$stored->{'description'}.'').
'
'.&mt('When a group is deleted the following occurs:').'
'.
'
'.&mt('All group membership is terminated.').'
'.
- '
'.&mt('The group ceases to be available either for viewing or for modification of group settings and membership.').'
'.
- '
'.&mt('The group folder is removed from the folder containing it - normally this is the "Course Groups" folder which contains folders for all groups in the course.').'
'.
- '
'.&mt('Although a deleted group is no longer accessible, the group name used for the group will be reserved, and will not be available for assignment to a new group in the same course in the future.'));
+ '
'.&mt('The group ceases to be available either for viewing or for modification of group settings and membership.').'
');
+ if ($crstype eq 'Community') {
+ $r->print( '
'.&mt("The group folder is removed from the folder containing it - normally this is the 'Community Groups' folder which contains folders for all groups in the community.").'
'.
+ ''.&mt("Although a deleted group is no longer accessible, the group name used for the group will be reserved, and will not be available for assignment to a new group in the same community in the future."));
+ } else {
+ $r->print( '
'.&mt("The group folder is removed from the folder containing it - normally this is the 'Course Groups' folder which contains folders for all groups in the course.").'
'.
+ ''.&mt("Although a deleted group is no longer accessible, the group name used for the group will be reserved, and will not be available for assignment to a new group in the same course in the future."));
+ }
my $prevtext = &mt('Go back');
my $nexttext = &mt('Delete group');
my $prev;
- if ($env{'form.refpage'} eq 'enrl') {
+ if ($env{'form.refpage'} eq 'cusr') {
$prev = 'view';
}
&display_navbuttons($r,$formname,$prev,$prevtext,
@@ -1141,7 +1188,7 @@ sub verify_delete {
}
sub delete_group {
- my ($r,$cdom,$cnum,$groupname) = @_;
+ my ($r,$cdom,$cnum,$groupname,$crstype) = @_;
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum,
$groupname);
my $now = time;
@@ -1151,6 +1198,7 @@ sub delete_group {
my @deleted;
my @undeleted;
my %usersettings;
+ my $context = 'deletegroup';
foreach my $key (sort(keys(%membership))) {
if ($key =~ /^\Q$groupname\E:([^:]+:[^:]+)$/) {
my $user = $1;
@@ -1160,7 +1208,8 @@ sub delete_group {
$usersettings{$groupname.':'.$user} = $now.':-1:'.$userprivs;
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,
$groupname,$user,
- $now,'-1',$userprivs)
+ $now,'-1',$userprivs,
+ '',$context)
eq 'ok') {
$num_ok ++;
push(@deleted,$user);
@@ -1177,47 +1226,68 @@ sub delete_group {
\%usersettings);
}
if ($num_fail > 0) {
- $r->print(&mt('Group deletion failed because deletion of [_1] out of [_2] members failed.',$num_fail,$num_users));
-
+ $r->print('
'
+ .&mt('Group deletion failed because deletion of [_1] out of [_2] members failed.'
+ ,$num_fail,$num_users)
+ .'
');
} else {
my ($result,$message) =
&Apache::lonnet::toggle_coursegroup_status($cdom,$cnum,
$groupname,'delete');
if ($result eq 'ok') {
- my $outcome = &modify_folders($cdom,$cnum,$groupname);
+ my $outcome = &modify_folders($cdom,$cnum,$groupname,$crstype);
if ($outcome eq '') {
- $r->print(&mt('Group successfully deleted.'));
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Group successfully deleted.'));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
} else {
- $r->print(&mt("Although the group was deleted, an error ([_1]) occurred when removing the group's folder from the 'Course Groups' folder.",$outcome));
+ $r->print('
');
+ if ($crstype eq 'Community') {
+ $r->print(&mt("Although the group was deleted, an error occurred when removing the group's folder from the 'Community Groups' folder: [_1]",$outcome));
+ } else {
+ $r->print(&mt("Although the group was deleted, an error occurred when removing the group's folder from the 'Course Groups' folder: [_1]",$outcome));
+ }
+ $r->print('
');
}
} else {
- $r->print(&mt('Group deletion failed.'));
+ my $msg = &Apache::lonhtmlcommon::confirm_success(&mt('Group deletion failed.'),1);
+ $msg = &Apache::loncommon::confirmwrapper($msg);
+ $r->print($msg);
}
}
return;
}
sub reenable_folder {
- my ($cdom,$cnum,$groupname,$description) = @_;
+ my ($cdom,$cnum,$groupname,$description,$crstype) = @_;
my $outcome;
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/';
my $allgrpsmap = $crspath.'group_allfolders.sequence';
- my $foldertitle = &mt('Course Folder -').$description;
+ my $foldertitle;
+ if ($crstype eq 'Community') {
+ $foldertitle = &mt("Community Folder -[_1]",$description);
+ } else {
+ $foldertitle = &mt("Course Folder -[_1]",$description);
+ }
my $mapurl = $crspath.'group_folder_'.
$groupname.'.sequence';
my ($errtext,$fatal)=&LONCAPA::map::mapread($allgrpsmap);
if ($fatal) {
- $outcome=&mt('Error reading contents of parent folder to group').
- " ($allgrpsmap): $errtext".' ';
+ $outcome='
'
+ .&mt('An error occurred when reading contents of parent folder to group:')
+ ." ($allgrpsmap): $errtext"
+ .'
';
} else {
my $idx=&LONCAPA::map::getresidx($mapurl);
$LONCAPA::map::resources[$idx] = $foldertitle.':'.$mapurl.
':false:normal:res';
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$idx;
- my ($outtext,$errtext) = &LONCAPA::map::storemap($allgrpsmap,1);
+ my ($outtext,$errtext) = &LONCAPA::map::storemap($allgrpsmap,1,1);
if ($errtext) {
- $outcome = &mt('Error storing updated parent folder to group').
- "- $allgrpsmap - $errtext".' ';
+ $outcome='
'
+ .&mt('An error occurred when saving updated parent folder to group:'
+ ," $allgrpsmap - $errtext")
+ .'
';
} else {
my ($furl,$ferr) =
&Apache::lonuserstate::readmap($cdom.'/'.$cnum);
@@ -1227,13 +1297,24 @@ sub reenable_folder {
}
sub modify_folders {
- my ($cdom,$cnum,$groupname) = @_;
- my $outcome;
+ my ($cdom,$cnum,$groupname,$crstype) = @_;
+ my ($outcome,$groupmap,$groupmapres,$map,$id,$src);
my $navmap = Apache::lonnavmaps::navmap->new();
- my $groupmap = '/uploaded/'.$cdom.'/'.$cnum.'/'.'group_folder_'.
+ if (!defined($navmap)) {
+ $outcome = '
';
+ if ($crstype eq 'Community') {
+ $outcome .= &mt("Error reading community contents.").' '.
+ &mt("You need to re-initialize the community.");
+ } else {
+ $outcome .= &mt("Error reading course contents.").' '.
+ &mt("You need to re-initialize the course.");
+ }
+ $outcome .= '
';
+ return $outcome;
+ }
+ $groupmap = '/uploaded/'.$cdom.'/'.$cnum.'/'.'group_folder_'.
$groupname.'.sequence';
- my $groupmapres = $navmap->getResourceByUrl($groupmap);
- my ($map,$id,$src);
+ $groupmapres = $navmap->getResourceByUrl($groupmap);
if ($groupmapres) {
($map,$id,$src)=&Apache::lonnet::decode_symb($groupmapres->symb());
}
@@ -1242,8 +1323,10 @@ sub modify_folders {
$map = '/'.$map;
my ($errtext,$fatal) = &LONCAPA::map::mapread($map);
if ($fatal) {
- $outcome=&mt('Error reading contents of parent folder to group').
- " ($map): $errtext".' ';
+ $outcome='
'
+ .&mt('An error occurred when reading contents of parent folder to group:')
+ ." ($map): $errtext"
+ .'
';
} else {
my $idx = 0;
my $grpidx;
@@ -1264,9 +1347,12 @@ sub modify_folders {
$LONCAPA::map::order[$i] = $LONCAPA::map::order[$i+1];
}
$#LONCAPA::map::order--;
- my ($outtext,$errtext) = &LONCAPA::map::storemap($map,1);
+ my ($outtext,$errtext) = &LONCAPA::map::storemap($map,1,1);
if ($errtext) {
- $outcome = &mt('Error storing updated parent folder to group'). "- $map - $errtext".' ';
+ $outcome='
'
+ .&mt('An error occurred when saving updated parent folder to group:')
+ ." $map - $errtext"
+ .'
';
} else {
my ($furl,$ferr) =
&Apache::lonuserstate::readmap($cdom.'/'.$cnum);
@@ -1278,17 +1364,22 @@ sub modify_folders {
}
sub verify_reenable {
- my ($r,$groupname,$formname,$action,$page,$states,$stored) = @_;
+ my ($r,$groupname,$formname,$action,$page,$states,$stored,$crstype) = @_;
$r->print(&Apache::lonhtmlcommon::echo_form_input([]));
- $r->print(&mt("You have requested enabling the following previously deleted group: ").''.
- $stored->{'description'}.''.
+ $r->print(&mt('You have requested enabling the previously deleted group [_1].'
+ ,''.$stored->{'description'}.'').
'
'.&mt('When a deleted group is re-enabled the following occurs:').'
'.
- '
'.&mt('Group settings and membership at the time the group was deleted are reinstated.').'
'.
- '
'.&mt('A group folder is added to the "Course Groups" folder which contains folders for all groups in the course.').'
');
+ '
'.&mt('Group settings and membership at the time the group was deleted are reinstated.').'
');
+ if ($crstype eq 'Community') {
+ $r->print(&mt("A group folder is added to the 'Community Groups' folder which contains folders for all groups in the community."));
+ } else {
+ $r->print(&mt("A group folder is added to the 'Course Groups' folder which contains folders for all groups in the course."));
+ }
+ $r->print('
');
my $prevtext = &mt('Go back');
my $nexttext = &mt('Reenable group');
my $prev;
- if ($env{'form.refpage'} eq 'enrl') {
+ if ($env{'form.refpage'} eq 'cusr') {
$prev = 'view';
}
&display_navbuttons($r,$formname,$prev,$prevtext,
@@ -1297,10 +1388,14 @@ sub verify_reenable {
}
sub reenable_group {
- my ($r,$cdom,$cnum,$groupname,) = @_;
+ my ($r,$cdom,$cnum,$groupname,$crstype) = @_;
my %groups =
&Apache::longroup::coursegroups($cdom,$cnum,$groupname,
'deleted_groups');
+ if (keys(%groups) == 0) {
+ $r->print(&mt('The group [_1] was not re-enabled, because it is not a deleted group.[_2]Perhaps it has already been re-enabled?',''.$groupname.''),' ');
+ return;
+ }
my %groupinfo =
&Apache::longroup::get_group_settings($groups{$groupname});
my $defstart = $groupinfo{'startdate'};
@@ -1316,6 +1411,7 @@ sub reenable_group {
my $num_users = 0;
my $num_ok = 0;
my $num_fail = 0;
+ my $context = 'reenablegroup';
my (%usersettings,@enabled,@unenabled);
my ($result,$message) =
&Apache::lonnet::toggle_coursegroup_status($cdom,$cnum,$groupname,
@@ -1335,7 +1431,8 @@ sub reenable_group {
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,
$groupname,$user,
$defend,$defstart,
- $userprivs) eq 'ok') {
+ $userprivs,'',
+$context) eq 'ok') {
$num_ok ++;
push(@enabled,$user);
} else {
@@ -1351,23 +1448,40 @@ sub reenable_group {
&Apache::lonnet::modify_coursegroup_membership($cdom,$cnum,
\%usersettings);
if ($roster_result eq 'ok') {
- $r->print(&mt('Membership reinstated for [_1] users, each with start and end dates for group access set to defaults: [_2] and [_3]',$num_ok,$showstart,$showend).' ');
+ $r->print('
'
+ .&mt('Membership reinstated for [quant,_1,user], each with start and end dates for group access set to defaults: [_2] and [_3]',$num_ok,$showstart,$showend)
+ .'
');
}
} else {
- $r->print(&mt('A problem occurred when trying to reinstate [_1] of the [_2] members of the pre-existing group.',$num_fail,$num_users).' ');
+ $r->print('
'
+ .&mt('A problem occurred when trying to reinstate [_1] of the [_2] members of the pre-existing group.',$num_fail,$num_users)
+ .'
');
}
} else {
- $r->print(&mt('There were no group members to reinstate, as none were removed when the group was deleted.').' ');
+ $r->print('
'
+ .&mt('There were no group members to reinstate, as none were removed when the group was deleted.')
+ .'
');
}
- my $outcome = &reenable_folder($cdom,$cnum,$groupname,$description);
+ my $outcome = &reenable_folder($cdom,$cnum,$groupname,$description,$crstype);
if ($outcome eq '') {
- $r->print(&mt('Group successfully re-enabled.'));
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Group successfully re-enabled.'));
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
} else {
- $r->print(&mt("Although the group was re-enabled, an error ([_1]) occurred when adding the group's folder to the 'Course Groups' folder.",$outcome));
+ $r->print('
');
+ if ($crstype eq 'Community') {
+ $r->print(&mt("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Community Groups' folder: [_1]",$outcome));
+ } else {
+ $r->print(&mt("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Course Groups' folder: [_1]",$outcome));
+ }
+ $r->print('
');
}
} else {
- $r->print(&mt('Re-enabling group failed'));
+ my $message = &Apache::lonhtmlcommon::confirm_success(&mt('Re-enabling group failed.'),1);
+ $message = &Apache::loncommon::confirmwrapper($message);
+ $r->print($message);
}
+ return;
}
sub header {
@@ -1379,7 +1493,7 @@ sub header {
{'add_entries' => $loaditems,});
my $output = <<"END";
$start_page
-