@@ -319,23 +329,31 @@ END
if (!$functionality) {
$functionality = &mt('None available');
}
- my $link = $actionlinks{$action};
+ my $link;
if ($action eq 'modify' || $action eq 'delete' ||
$action eq 'reenable') {
- $link .= $group;
+ $link = ''.$lt{$action}.'';
} else {
- $link .= $group.'/smppg?ref=grouplist';
- if (exists($env{'form.refpage'})) {
- $link .= '&refpage='.$env{'form.refpage'};
+ $link =
+ &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap,
+ $view_permission);
+ if ($link) {
+ $link = ''.$lt{$action}.'';
}
}
- $link .= '">'.$lt{$action}.'';
if ($action eq 'view') {
if ($manage_permission) {
- $link .= ' '.$actionlinks{'modify'}.
- $group.'">'.$lt{'modify'}.''.
- ' '.$actionlinks{'delete'}.
- $group.'">'.$lt{'delete'}.'';
+ $link .= ' '.$lt{'modify'}.''.$lt{'delete'}.'';
}
}
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').
@@ -383,19 +401,60 @@ END
} else {
my @coursegroups = split(/:/,$env{'request.course.groups'});
if (@coursegroups > 0) {
+ my $numlinks = 0;
$r->print('
');
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.'
'
+ .&mt('You do not currently have access to any '.$gpterm.'s'
+ .' in this '.lc($crstype).'.')
+ .'
'
+ );
+ }
} else {
- $r->print(&mt('You are not currently a member of any active '.$gpterm.'s in this '.lc($crstype).'.'));
+ $r->print(
+ '
'
+ .&mt('You are not currently a member of any active '.$gpterm.'s'
+ .' in this '.lc($crstype).'.')
+ .'
'
+ );
}
}
return;
@@ -537,7 +596,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';
}
@@ -785,7 +844,7 @@ sub group_administration {
}
var maxposs = '.sprintf("%.2f",$maxposs).';
if (newquota > maxposs) {
- alert("The group portfolio 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.';
@@ -804,7 +863,7 @@ sub group_administration {
}
}
if (warn_zero == 1) {
- 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.");
+ alert("You have indicated that the group portfolio should be enabled, but you have set the repository quota to 0 MB.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature.");
return;
}
}
@@ -870,7 +929,7 @@ function changeSort(caller) {
faq=>9,bug=>'Instructor Interface',});
if ($action eq 'modify' || $action eq 'delete') {
&Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"/adm/coursegroups?refpage=cusr&action=$action",
+ ({href=>"/adm/coursegroups?refpage=cusr&action=$action",
text=>"Groups",
faq=>9,bug=>'Instructor Interface',});
}
@@ -1086,7 +1145,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,
@@ -1119,31 +1178,36 @@ 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 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;
@@ -1156,7 +1220,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;
@@ -1198,38 +1262,45 @@ sub delete_group {
.&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("Although the group was deleted, an error occurred when removing"
- ." the group's folder from the 'Course Groups' folder: [_1]",$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 -[_1]',$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);
@@ -1243,7 +1314,7 @@ sub reenable_folder {
$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('An error occurred when saving updated parent folder to group:'
@@ -1258,14 +1329,19 @@ sub reenable_folder {
}
sub modify_folders {
- my ($cdom,$cnum,$groupname) = @_;
+ my ($cdom,$cnum,$groupname,$crstype) = @_;
my ($outcome,$groupmap,$groupmapres,$map,$id,$src);
my $navmap = Apache::lonnavmaps::navmap->new();
if (!defined($navmap)) {
- $outcome = '
'.
- &mt('Error reading course contents.').' '.
- &mt('You need to re-initialize the course.').
- '
';
+ $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_'.
@@ -1303,7 +1379,7 @@ 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('An error occurred when saving updated parent folder to group:')
@@ -1320,13 +1396,18 @@ 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 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;
@@ -1339,7 +1420,7 @@ 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');
@@ -1413,20 +1494,24 @@ $context) eq 'ok') {
.&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("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Course Groups' folder: [_1]",$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;
}
@@ -1440,7 +1525,7 @@ sub header {
{'add_entries' => $loaditems,});
my $output = <<"END";
$start_page
-