');
&mapping_options($r,$action,$formname,$page,$tabcol,$sectioncount,
$states,$stored,$navbuttons,4,5,$rowColor1,
- $rowColor2);
+ $rowColor2,$gpterm,$ucgpterm,$crstype);
$nexttext = $$navbuttons{'mose'};
}
$prevtext = $$navbuttons{'gtpp'};
@@ -1109,18 +1225,25 @@ sub general_settings_form {
}
sub groupsettings_options {
- my ($r,$tabcol,$functions,$action,$formname,$stored,$image) = @_;
+ my ($r,$tabcol,$functions,$action,$formname,$stored,$image,$gpterm,
+ $ucgpterm,$crstype) = @_;
my %lt = &Apache::lonlocal::texthash(
- 'gdat' => 'Group open and close dates',
- 'sten' => 'Set a start date/time and end date/time for the group',
- 'gfun' => 'Group functionality',
- 'gnde' => 'Group name, description and available functionality',
+ 'gdat' => "$ucgpterm open and close dates",
+ 'sten' => "Set a start date/time and end date/time for the $gpterm",
+ 'gfun' => "$ucgpterm functionality",
+ 'gnde' => "$ucgpterm name, description and available functionality",
'desc' => 'Description',
'func' => 'Functionality',
- 'gnam' => 'Group Name',
- 'doyo' => 'Do you want to assign different functionality '.
- 'to different group members?',
+ 'gnam' => "$ucgpterm Name",
+ 'doyo' => "Do you want to assign different functionality ".
+ "to different $gpterm members?",
);
+ my $crsquota = $env{'course.'.$env{'request.course.id'}.'.internal.coursequota'};
+ if ($crsquota eq '') {
+ $crsquota = 20;
+ }
+ my $freespace = $crsquota - &Apache::longroup::sum_quotas();
+ my $maxposs = $$stored{'quota'} + $freespace;
&topic_bar($r,$tabcol,$image,$lt{'gnde'});
$r->print('
@@ -1181,8 +1304,8 @@ END
-
Granularity:
-
'.$lt{'doyo'}.' ');
+
'.&mt('Granularity:').'
+
'.$lt{'doyo'}.' ');
if ($action eq 'modify') {
$r->print(' ('.&mt('Currently set to "[_1]"',
$$stored{'granularity'}).')');
@@ -1190,6 +1313,30 @@ END
$r->print('
+
+
'.&mt('Disk quota: ').'
');
+ if ($action eq 'create') {
+ $r->print(&mt('If you enable the file repository for the [_1], allocate a disk quota.',$gpterm));
+ } else {
+ $r->print(&mt('Quota allocated to file repository:'));
+ }
+ $r->print(' Mb');
+ if ($action eq 'create') {
+ $r->print(' '.
+ &mt('A total of [_1] Mb is shared between all [_2]s in the '.
+ '[_3], and [_4] Mb are currently unallocated.',$crsquota,
+ $gpterm,lc($crstype),$freespace));
+ } else {
+ $r->print(' ('.&mt('The quota is currently [_1] Mb',
+ $$stored{'quota'}).').');
+
+ $r->print(' '.&mt('The quota can be increased to [_1] Mb, '.
+ 'by adding all unallocated space for [_2]s in the [_3].',
+ $maxposs,$gpterm,lc($crstype)));
+ }
+ $r->print('
+
+
@@ -1198,19 +1345,21 @@ END
}
sub membership_options {
- my ($r,$action,$state,$tabcol,$sectioncount,$image) = @_;
+ my ($r,$action,$state,$tabcol,$sectioncount,$image,$gpterm,$ucgpterm) = @_;
+ my $crstype = &Apache::loncommon::course_type();
my %lt = &Apache::lonlocal::texthash(
'pipa' => 'Pick parameters to generate membership list',
- 'gmem' => 'Group membership options',
+ 'gmem' => "$ucgpterm membership options",
'picr' => 'Pick the criteria to use to build a list of '.
- 'course users from which you will select ',
- 'meof' => 'members of the new group.',
- 'admg' => 'additional members of the group.',
- 'ifno' => 'If you do not wish to add members when you first '.
- 'create the group, do not make any selections',
+ lc($crstype).' users from which you will select ',
+ 'meof' => "members of the new $gpterm.",
+ 'admg' => "additional members of the $gpterm.",
+ 'ifno' => "If you do not wish to add members when you first ".
+ "create the $gpterm, do not make any selections.",
+ 'asub' => "A subsequent step will also allow you to specify automatic adding/dropping of $gpterm members triggered by specified role and section changes.",
'acty' => 'Access types',
- 'coro' => 'Course roles',
- 'cose' => 'Course sections',
+ 'coro' => $crstype.' roles',
+ 'cose' => $crstype.' sections',
);
my %status_types = (
active => &mt('Currently has access'),
@@ -1229,7 +1378,7 @@ sub membership_options {
'.$lt{'gmem'}.' '.$lt{'picr'});
if ($action eq 'create') {
- $r->print($lt{'meof'}.' '.$lt{'ifno'});
+ $r->print($lt{'meof'}.' '.$lt{'ifno'}.' '.$lt{'asub'});
} else {
$r->print($lt{'admg'});
}
@@ -1291,9 +1440,9 @@ sub sections_selection {
}
sub access_date_settings {
- my ($r,$tabcol,$action,$formname,$stored,$image) = @_;
+ my ($r,$tabcol,$action,$formname,$stored,$image,$gpterm,$ucgpterm) = @_;
my %lt = &Apache::lonlocal::texthash(
- 'sten' => 'Default start and end dates for group access',
+ 'sten' => "Default start and end dates for $gpterm access",
);
my $starttime = time;
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
@@ -1323,16 +1472,17 @@ sub access_date_settings {
sub choose_members_form {
my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$groupname,$description,
- $granularity,$startdate,$enddate,$tools,$fixedprivs,$toolprivs,
+ $granularity,$quota,$startdate,$enddate,$tools,$fixedprivs,$toolprivs,
$functions,$users,$userdata,$idx,$stored,$states,$navbuttons,
- $rowColor1,$rowColor2) = @_;
+ $rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype) = @_;
my @regexps = ('user_','userpriv_','sec_');
my %origmembers;
$r->print(&Apache::lonhtmlcommon::echo_form_input(
['origin','action','state','page','member','specificity','branch',
'defpriv','autorole','autoadd','autodrop','sortby','togglefunc'],
\@regexps));
- my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum);
+ my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum,$gpterm,
+ $ucgpterm,$crstype);
$r->print('
@@ -1353,8 +1503,8 @@ sub choose_members_form {
if ($action eq 'create') {
&print_current_settings($r,$action,$tabcol,$rowColor1,$rowColor2,
$functions,$startdate,$enddate,$groupname,
- $description,$granularity,\@available,
- \@unavailable);
+ $description,$granularity,$quota,\@available,
+ \@unavailable,$gpterm,$ucgpterm);
$specimg = 4;
$memimg = 5;
} else {
@@ -1376,11 +1526,11 @@ sub choose_members_form {
}
&privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action,
$specimg,$tools,$stored,$toolprivs,
- $fixedprivs,\@available,$formname);
+ $fixedprivs,\@available,$formname,$gpterm,$ucgpterm);
my $newusers = &pick_new_members($r,$action,$formname,$tabcol,$rowColor1,
$rowColor2,\@available,$idx,$stored,
$memimg,$users,$userdata,$granularity,
- \%origmembers);
+ \%origmembers,$gpterm,$ucgpterm);
if ($newusers || $action eq 'create') {
&display_navbuttons($r,$formname,$$states{$action}[$page-1],
$$navbuttons{'gtps'},$$states{$action}[$page+1],
@@ -1433,17 +1583,19 @@ sub check_tools {
sub print_current_settings {
my ($r,$action,$tabcol,$rowColor1,$rowColor2,$functions,$startdate,$enddate,
- $groupname,$description,$granularity,$available,$unavailable) =@_;
+ $groupname,$description,$granularity,$quota,$available,$unavailable,
+ $gpterm,$ucgpterm) = @_;
my %lt = &Apache::lonlocal::texthash(
- grna => 'Group Name',
+ grna => "$ucgpterm Name",
desc => 'Description',
- grfn => 'Group Functions',
+ grfn => "$ucgpterm Functions",
gran => 'Granularity',
+ quot => 'File quota',
dfac => 'Default access dates',
- ygrs => 'Your group selections',
- tfwa => 'The following settings will apply to the group:',
- difn => 'Different functionality for different users:',
+ ygrs => "Your $gpterm selections",
+ tfwa => "The following settings will apply to the $gpterm:",
+ difn => 'Different functionality for different members:',
stda => 'Start date',
enda => 'End date:',
);
@@ -1474,6 +1626,7 @@ sub print_current_settings {
'.$lt{'desc'}.'
'.$lt{'grfn'}.'
'.$lt{'gran'}.'
+
'.$lt{'quot'}.'
'.$lt{'dfac'}.'
@@ -1520,7 +1673,8 @@ sub print_current_settings {
$r->print(<<"END");
$lt{'difn'}
- $granularity
+ $granularity
+
$quota Mb
$lt{'stda'} $showstart $lt{'enda'} $showend
@@ -1536,16 +1690,17 @@ END
sub pick_new_members {
my ($r,$action,$formname,$tabcol,$rowColor1,$rowColor2,$available,$idx,
- $stored,$img,$users,$userdata,$granularity,$origmembers) = @_;
+ $stored,$img,$users,$userdata,$granularity,$origmembers,$gpterm,
+ $ucgpterm) = @_;
my %lt = &Apache::lonlocal::texthash(
- 'gpme' => 'Group membership',
+ 'gpme' => "$ucgpterm membership",
'addm' => 'Add members',
'setf' => 'Set functionality',
'func' => 'Functionality',
'nome' => 'No members to add at this time.',
- 'nnew' => 'There are no users to add as new members, as all users'.
- ' matching the specified type(s), role(s), and/or '.
- 'section(s) are already affiliated with this group.',
+ 'nnew' => "There are no users to add as new members, as all users".
+ " matching the specified type(s), role(s), and/or ".
+ "section(s) are already affiliated with this $gpterm.",
'yoma' => 'You may need to use the '."'".'modify existing, past or '.
'future members'."'".' page if you need to re-enable '.
'or activate access for previous or future members.',
@@ -1702,7 +1857,7 @@ sub pick_new_members {
sub privilege_specificity {
my ($r,$tabcol,$rowColor1,$rowColor2,$action,$img,$tools,$stored,
- $toolprivs,$fixedprivs,$available,$formname) = @_;
+ $toolprivs,$fixedprivs,$available,$formname,$gpterm,$ucgpterm) = @_;
my %lt = &Apache::lonlocal::texthash (
'uprv' => 'User privileges',
'frty' => 'For each type of functionality you have chosen to include, '.
@@ -1717,19 +1872,19 @@ sub privilege_specificity {
'privileges which apply to members with access to that '.
'functionality, and may also include additional privileges '.
'which can be set for specific members.',
- 'cutg' => 'Currently the group is configured ',
- 'sdif' => 'so different group members can receive different privileges.',
- 'sall' => 'so all group members will receive the same privileges.',
- 'algm' => 'All group members will receive the same privileges.',
- 'smgp' => 'Some group members will receive different privileges from '.
- 'others.',
- 'thwi' => 'These will be the privileges all group members receive, '.
- 'if you selected the first option above.',
- 'thes' => 'These will be the privileges given to members assigned '.
- 'in the future, including via automatic group assignment '.
- 'for specific sections/roles ',
- 'asyo' => 'As you have chosen not to include any functionality in the '.
- 'group, no default user privileges settings need to be set.',
+ 'cutg' => "Currently the $gpterm is configured ",
+ 'sdif' => "so different $gpterm members can receive different privileges.",
+ 'sall' => "so all $gpterm members will receive the same privileges.",
+ 'algm' => "All $gpterm members will receive the same privileges.",
+ 'smgp' => "Some $gpterm members will receive different privileges from ".
+ "others.",
+ 'thwi' => "These will be the privileges all $gpterm members receive, ".
+ "if you selected the first option above.",
+ 'thes' => "These will be the privileges given to members assigned ".
+ "in the future, including via automatic $gpterm assignment ".
+ "for specific sections/roles ",
+ 'asyo' => "As you have chosen not to include any functionality in the ".
+ "$gpterm, no default user privileges settings need to be set.",
'plin' => 'Please indicate which optional privileges members '.
'will receive by default.',
'oppr' => 'Optional privileges',
@@ -1994,11 +2149,11 @@ sub display_defprivs {
sub change_members_form {
my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$groupname,$description,
$startdate,$enddate,$tools,$fixedprivs,$functions,$users,$userdata,
- $granularity,$specificity,$idx,$states,$navbuttons,$rowColor1,
- $rowColor2) = @_;
+ $granularity,$quota,$specificity,$idx,$states,$navbuttons,$rowColor1,
+ $rowColor2,$gpterm,$ucgpterm) = @_;
my %lt = &Apache::lonlocal::texthash(
- grse => 'Group settings',
- mogm => 'Modify group membership',
+ grse => "$ucgpterm settings",
+ mogm => "Modify $gpterm membership",
);
my @regexps = ('user_','userpriv_');
$r->print(&Apache::lonhtmlcommon::echo_form_input(
@@ -2023,7 +2178,8 @@ sub change_members_form {
');
&print_current_settings($r,$action,$tabcol,$rowColor1,$rowColor2,
$functions,$startdate,$enddate,$groupname,
- $description,$granularity,\@available,\@unavailable);
+ $description,$granularity,$quota,\@available,
+ \@unavailable,$gpterm,$ucgpterm);
$r->print('
');
&topic_bar($r,$tabcol,2,$lt{'mogm'});
@@ -2068,7 +2224,7 @@ sub current_membership {
my $addtools = 0;
my $num_reenable = 0;
my $num_activate = 0;
- my $num_expire - 0;
+ my $num_expire = 0;
foreach my $key (sort(keys(%membership))) {
if ($key =~ /^\Q$groupname\E:([^:]+):([^:]+)$/) {
my $uname = $1;
@@ -2077,11 +2233,14 @@ sub current_membership {
my($end,$start,@userprivs) = split(/:/,$membership{$key});
unless ($start == -1) {
$allnames{$udom}{$uname} = 1;
- %{$current{$user}} = ();
- $current{$user}{uname} = $uname;
- $current{$user}{udom} = $udom;
- $current{$user}{start} =
- &Apache::lonlocal::locallocaltime($start);
+ $current{$user} = {
+ uname => $uname,
+ udom => $udom,
+ start => &Apache::lonlocal::locallocaltime($start),
+ currtools => [],
+ newtools => [],
+ };
+
if ($end == 0) {
$current{$user}{end} = 'No end date';
} else {
@@ -2099,8 +2258,6 @@ sub current_membership {
$current{$user}{changestate} = 'expire';
$num_expire ++;
}
- @{$current{$user}{currtools}} = ();
- @{$current{$user}{newtools}} = ();
if (@userprivs > 0) {
foreach my $tool (sort(keys(%{$fixedprivs}))) {
foreach my $priv (keys(%{$$fixedprivs{$tool}})) {
@@ -2364,13 +2521,13 @@ sub change_privs_form {
my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$startdate,$enddate,
$tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools,
$memchg,$idx,$states,$stored,$sectioncount,$navbuttons,$rowColor1,
- $rowColor2) = @_;
+ $rowColor2,$gpterm,$ucgpterm) = @_;
my @regexps = ('userpriv_');
my $nexttext;
my %lt = &Apache::lonlocal::texthash(
'tode' => 'To be deleted',
'toex' => 'To be expired',
- 'nome' => 'No members to be deleted or expired from the group.',
+ 'nome' => "No members to be deleted or expired from the $gpterm.",
);
$r->print(&Apache::lonhtmlcommon::echo_form_input(
['origin','action','state','page','sortby'],\@regexps));
@@ -2409,12 +2566,13 @@ sub change_privs_form {
'
');
}
- &topic_bar($r,$tabcol,4,&mt('Group member privileges'));
+ &topic_bar($r,$tabcol,4,&mt('[_1] member privileges',$ucgpterm));
my $numchgs = &member_privileges_form($r,$tabcol,$action,$formname,$tools,
$toolprivs,$fixedprivs,$userdata,
$usertools,$idx,$memchg,$states,
- $stored,$rowColor1,$rowColor2);
+ $stored,$rowColor1,$rowColor2,
+ $gpterm);
$r->print('
');
my $prevtext = $$navbuttons{'gtps'};
if ($numchgs || $exp_or_del) {
@@ -2429,8 +2587,8 @@ sub change_privs_form {
sub add_members_form {
my ($r,$tabcol,$action,$formname,$page,$startdate,$enddate,$groupname,
- $description,$granularity,$sectioncount,$tools,$functions,$stored,
- $states,$navbuttons,$rowColor1,$rowColor2) = @_;
+ $description,$granularity,$quota,$sectioncount,$tools,$functions,
+ $stored,$states,$navbuttons,$rowColor1,$rowColor2,$gpterm,$ucgpterm)=@_;
$r->print('
');
- &membership_options($r,$action,$formname,$tabcol,$sectioncount,1);
+ &membership_options($r,$action,$formname,$tabcol,$sectioncount,1,$gpterm,
+ $ucgpterm);
my $nexttext = $$navbuttons{'gtns'};
my $prevtext = $$navbuttons{'gtpp'};
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,
@@ -2463,7 +2623,8 @@ sub add_members_form {
sub choose_privs_form {
my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$startdate,$enddate,
$tools,$functions,$toolprivs,$fixedprivs,$userdata,$usertools,$idx,
- $states,$stored,$sectioncount,$navbuttons,$rowColor1,$rowColor2) = @_;
+ $states,$stored,$sectioncount,$navbuttons,$rowColor1,$rowColor2,
+ $gpterm,$ucgpterm,$crstype) = @_;
my @regexps = ('userpriv_');
my $nexttext;
@@ -2481,11 +2642,11 @@ sub choose_privs_form {
}
$r->print('
');
- &topic_bar($r,$tabcol,6,&mt('Group member privileges'));
+ &topic_bar($r,$tabcol,6,&mt('[_1] member privileges',$ucgpterm));
&member_privileges_form($r,$tabcol,$action,$formname,$tools,$toolprivs,
$fixedprivs,$userdata,$usertools,$idx,undef,
- $states,$stored,$rowColor1,$rowColor2);
+ $states,$stored,$rowColor1,$rowColor2,$gpterm);
$r->print('
');
if ($action eq 'create') {
@@ -2494,7 +2655,7 @@ sub choose_privs_form {
my $img2 = 8;
&mapping_options($r,$action,$formname,$page,$tabcol,$sectioncount,
$states,$stored,$navbuttons,$img1,$img2,
- $rowColor1,$rowColor2);
+ $rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype);
}
}
my $prevtext = $$navbuttons{'gtps'};
@@ -2564,7 +2725,8 @@ function uncheckAllTools(formname) {
sub member_privileges_form {
my ($r,$tabcol,$action,$formname,$tools,$toolprivs,$fixedprivs,$userdata,
- $usertools,$idx,$memchg,$states,$stored,$rowColor1,$rowColor2) = @_;
+ $usertools,$idx,$memchg,$states,$stored,$rowColor1,$rowColor2,
+ $gpterm) = @_;
my %lt = &Apache::lonlocal::texthash(
'addp' => 'Additional privileges',
'fixp' => 'Fixed privileges',
@@ -2573,15 +2735,15 @@ sub member_privileges_form {
'forf' => 'For the functionality you have chosen to include '.
'there are no optional privileges to set besides '.
'the standard privileges.',
- 'algr' => 'All group members will receive the same privileges.',
- 'asno' => 'As no group members are being added, '.
- 'there are no specific user privileges to set.',
- 'asng' => 'As no group tools will be made available to users, '.
- 'there are no specific user privileges to set.',
- 'nogm' => 'No group member privileges to display or set, '.
- 'as you have not indicated that you will be activating,'.
- ' re-enabling, changing privileges, or adding/removing '.
- 'functionality for any current members ',
+ 'algr' => "All $gpterm members will receive the same privileges.",
+ 'asno' => "As no $gpterm members are being added, ".
+ "there are no specific user privileges to set.",
+ 'asng' => "As no $gpterm tools will be made available to users, ".
+ "there are no specific user privileges to set.",
+ 'nogm' => "No $gpterm member privileges to display or set, ".
+ "as you have not indicated that you will be activating,".
+ " re-enabling, changing privileges, or adding/removing ".
+ "functionality for any current members ",
'full' => 'Fullname',
'user' => 'Username',
'doma' => 'Domain',
@@ -2740,12 +2902,14 @@ sub process_request {
my ($r,$cdom,$cnum,$tabcol,$action,$state,$page,$groupname,$description,
$specificity,$userdata,$startdate,$enddate,$tools,$functions,$toolprivs,
$usertools,$idx,$types,$roles,$sections,$states,$navbuttons,$memchg,
- $sectioncount,$stored,$rowColor1,$rowColor2) = @_;
+ $sectioncount,$stored,$rowColor1,$rowColor2,$gpterm,$ucgpterm,
+ $crstype) = @_;
$r->print(&Apache::lonhtmlcommon::echo_form_input(
['origin','action','state','page','sortby']));
- my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum);
+ my $earlyout = &validate_groupname($groupname,$action,$cdom,$cnum,$gpterm,
+ $ucgpterm,$crstype);
if ($earlyout) {
$r->print('
@@ -2791,13 +2955,15 @@ sub process_request {
$description,$startdate,$enddate,
$specificity,$functions,$tools,
$sectioncount,$roles,$types,$sections,
- \@defprivs,$stored);
+ \@defprivs,$stored,$gpterm,$ucgpterm,
+ $crstype);
}
if (($action eq 'create' && $outcome eq 'ok') || (($action eq 'modify') &&
(($state eq 'memresult') || ($state eq 'addresult')))) {
&process_membership($r,$cdom,$cnum,$action,$state,$groupname,$tools,
$enddate,$startdate,$userdata,$idx,$toolprivs,
- $usertools,$specificity,\@defprivs,$memchg);
+ $usertools,$specificity,\@defprivs,$memchg,$gpterm,
+ $ucgpterm);
}
return;
}
@@ -2805,7 +2971,7 @@ sub process_request {
sub write_group_data {
my ($r,$cdom,$cnum,$action,$state,$groupname,$description,$startdate,
$enddate,$specificity,$functions,$tools,$sectioncount,$roles,$types,
- $sections,$defprivs,$stored) = @_;
+ $sections,$defprivs,$stored,$gpterm,$ucgpterm,$crstype) = @_;
my $now = time;
my $creation = $now;
my $creator = $env{'user.name'}.':'.$env{'user.domain'};
@@ -2813,10 +2979,10 @@ sub write_group_data {
$creation = $$stored{'creation'};
$creator = $$stored{'creator'};
}
- my $esc_description = &Apache::lonnet::escape($description);
+ my $esc_description = &escape($description);
my @single_attributes = ('description','functions','startdate','enddate',
'creation','modified','creator','granularity',
- 'specificity','autoadd','autodrop');
+ 'specificity','autoadd','autodrop','quota');
my @mult_attributes = ('roles','types','sectionpick','defpriv');
my %groupinfo = (
@@ -2830,6 +2996,7 @@ sub write_group_data {
specificity => $specificity,
autoadd => $env{'form.autoadd'},
autodrop => $env{'form.autodrop'},
+ quota => $env{'form.quota'},
);
foreach my $func (keys(%{$functions})) {
my $status;
@@ -2878,27 +3045,30 @@ sub write_group_data {
if ($result eq 'ok') {
if ($action eq 'create') {
my $put_result = &create_homepage($cdom,$cnum,$groupname,
- \%groupinfo,$tools);
- $r->print('Group '.$groupname.' was created. ');
+ \%groupinfo,$tools,$gpterm,
+ $ucgpterm);
+ $r->print(&mt('[_1] [_2] was created. ',$ucgpterm,$groupname));
} else {
- $r->print('Group '.$groupname.' was updated. ');
+ $r->print(&mt('[_1] [_2] was updated. ',$ucgpterm,$groupname));
}
} else {
my %actiontype = (
'create' => 'creating',
'modify' => 'modifying',
);
- &Apache::lonnet::logthis('Failed to store group '.$groupname.
- 'in course: '.$cnum.' in domain: '.$cdom);
- $r->print(&mt('An error occurred when [_1] the new group. '.
- 'Please try again.',$actiontype{$action}));
+ &Apache::lonnet::logthis("Failed to store $gpterm $groupname ".
+ 'in '.lc($crstype).': '.$cnum.
+ ' in domain: '.$cdom);
+ $r->print(&mt('An error occurred when [_1] the new [_2]. '.
+ 'Please try again.',$actiontype{$action},$gpterm));
}
return $result;
}
sub process_membership {
my ($r,$cdom,$cnum,$action,$state,$groupname,$tools,$enddate,$startdate,
- $userdata,$idx,$toolprivs,$usertools,$specificity,$defprivs,$memchg)=@_;
+ $userdata,$idx,$toolprivs,$usertools,$specificity,$defprivs,$memchg,
+ $gpterm,$ucgpterm)=@_;
my %usersettings = ();
my %added= ();
my %failed = ();
@@ -2906,6 +3076,8 @@ sub process_membership {
my $num_fail = 0;
my %group_privs = ();
my %curr_privs = ();
+ my %curr_start = ();
+ my %curr_end = ();
my %tooltype = ();
foreach my $tool (@{$tools}) {
@@ -2924,7 +3096,7 @@ sub process_membership {
}
} else {
if (@{$defprivs} > 0) {
- foreach my $priv (@{$defprivs}) {
+ if (grep/^\Q$priv\E$/,@{$defprivs}) {
foreach my $user (sort(keys(%{$usertools}))) {
if ($$usertools{$user}{$tool}) {
$group_privs{$user} .= $priv.':';
@@ -2962,21 +3134,21 @@ sub process_membership {
$groupname);
foreach my $key (sort(keys(%membership))) {
if ($key =~ /^\Q$groupname\E:([^:]+:[^:]+)$/) {
- (undef,undef,$curr_privs{$1})=split(/:/,$membership{$key},3);
+ ($curr_end{$1},$curr_start{$1},$curr_privs{$1}) =
+ split(/:/,$membership{$key},3);
}
}
if (@expire + @deletion > 0) {
foreach my $user (@expire) {
- my ($currend,$currstart,$grp_privs) =
- split(/:/,$membership{$groupname.':'.$user},3);
- if ($currstart > $now) {
- $currstart = $now;
+ my $savestart = $curr_start{$user};
+ if ($savestart > $now) {
+ $savestart = $now;
}
- $usersettings{$groupname.':'.$user} = $now.':'.$currstart.':'.
- $grp_privs;
+ $usersettings{$groupname.':'.$user} = $now.':'.$savestart.':'.
+ $curr_privs{$user};
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname,
- $user,$now,$currstart,
- $grp_privs) eq 'ok') {
+ $user,$now,$savestart,
+ $curr_privs{$user}) eq 'ok') {
push(@{$added{'expired'}},$user);
$num_ok ++;
} else {
@@ -3011,15 +3183,24 @@ sub process_membership {
push(@unchanged,$user);
next;
}
+ if (exists($curr_start{$user})) {
+ $start = $curr_start{$user};
+ }
+ if (exists($curr_end{$user})) {
+ $end = $curr_end{$user};
+ }
$type = 'modified';
if (@activate > 0) {
if (grep/^$user$/,@activate) {
$start = $now;
+ $end = $enddate;
$type = 'activated';
}
}
if (@reenable > 0) {
if (grep/^$user$/,@reenable) {
+ $start = $startdate;
+ $end = $enddate;
$type = 'reenabled';
}
}
@@ -3084,30 +3265,32 @@ sub process_membership {
$r->print(' ');
}
if ($roster_result eq 'ok') {
- $r->print(' '.&mt('Group membership list updated.'));
+ $r->print(' '.&mt('[_1] membership list updated.',$ucgpterm));
+ $r->print('
'.&mt("For full access to all of [_1]'s privileges, users will need to log out and log back in.",$groupname).'
');
} else {
- $r->print(' '.&mt('An error occurred while updating the group membership list -').$roster_result.' ');
+ $r->print(' '.&mt('An error occurred while updating the [_1] membership list -',$gpterm).$roster_result.' ');
}
return;
}
sub mapping_options {
my ($r,$action,$formname,$page,$tabcol,$sectioncount,$states,$stored,
- $navbuttons,$img1,$img2,$rowColor1,$rowColor2) = @_;
+ $navbuttons,$img1,$img2,$rowColor1,$rowColor2,$gpterm,$ucgpterm,
+ $crstype) = @_;
my %lt = &Apache::lonlocal::texthash(
- 'auto' => 'Settings for automatic group enrollment',
- 'gmma' => 'Group membership mapping to specific sections/roles',
- 'endi' => 'Enable/disable automatic group enrollment for '.
- 'users in specified roles and sections',
- 'adds' => 'If automatic group enrollment is enabled, when a user is assigned a course-wide or section-specific role, he/she will automatically be added as a member of the group, with start and end access dates defined by the default dates set for the group, unless he/she is already a group member, with access dates that permit either current or future group access.',
- 'drops' => "If automatic group disenrollment is enabled, when a user's role is expired, access to the group will be terminated unless the user continues to have other course-wide or section-specific active or future roles which receive automatic membership in the group.",
- 'pirs' => 'Pick roles and sections for automatic group enrollment',
+ 'auto' => "Settings for automatic $gpterm enrollment",
+ 'gmma' => "$ucgpterm membership mapping to specific sections/roles",
+ 'endi' => "Enable/disable automatic $gpterm enrollment for ".
+ "users in specified roles and sections",
+ 'adds' => "If automatic $gpterm enrollment is enabled, when a user is assigned a ".lc($crstype)."-wide or section-specific role, he/she will automatically be added as a member of the $gpterm, with start and end access dates defined by the default dates set for the $gpterm, unless he/she is already a $gpterm member, with access dates that permit either current or future $gpterm access.",
+ 'drops' => "If automatic $gpterm disenrollment is enabled, when a user's role is expired, access to the $gpterm will be terminated unless the user continues to have other ".lc($crstype)."-wide or section-specific active or future roles which receive automatic membership in the $gpterm.",
+ 'pirs' => "Pick roles and sections for automatic $gpterm enrollment",
'curr' => 'Currently set to',
'on' => 'on',
'off' => 'off',
- 'auad' => 'Automatically enable group membership when roles are added?',
- 'auex' => 'Automatically expire group membership when roles are removed?',
- 'mapr' => 'Mapping of roles and sections affected by automatic group enrollment/disenrollment follows scheme chosen below.',
+ 'auad' => "Automatically enable $gpterm membership when roles are added?",
+ 'auex' => "Automatically expire $gpterm membership when roles are removed?",
+ 'mapr' => "Mapping of roles and sections affected by automatic $gpterm enrollment/disenrollment follows scheme chosen below.",
);
&automapping($r,$action,$tabcol,$stored,\%lt,$img1);
$r->print('
@@ -3115,7 +3298,7 @@ sub mapping_options {
');
&mapping_settings($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,\%lt,
- $stored,$img2);
+ $stored,$img2,$crstype);
return;
}
@@ -3175,7 +3358,8 @@ sub automapping {
}
sub mapping_settings {
- my ($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,$lt,$stored,$image) = @_;
+ my ($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,$lt,$stored,$image,
+ $crstype) = @_;
my @sections = keys(%{$sectioncount});
if (@sections > 0) {
@sections = sort {$a cmp $b} @sections;
@@ -3201,7 +3385,7 @@ sub mapping_settings {
my $rowNum = 0;
my $rowColor;
foreach my $role (@roles) {
- my $plrole=&Apache::lonnet::plaintext($role);
+ my $plrole=&Apache::lonnet::plaintext($role,$crstype);
my $sections_sel;
if (@sections > 0) {
if ($role eq 'cc') {
@@ -3261,10 +3445,10 @@ sub my_custom_roles {
}
sub modify_menu {
- my ($r,$groupname,$page) = @_;
+ my ($r,$groupname,$page,$gpterm) = @_;
my @menu =
(
- { text => 'Modify default group settings',
+ { text => "Modify default $gpterm settings",
help => 'Course_Modify_Group',
state => 'change_settings',
branch => 'settings',
@@ -3275,7 +3459,7 @@ sub modify_menu {
state => 'change_members',
branch => 'members',
},
- { text => 'Add member(s) to the group',
+ { text => "Add member(s) to the $gpterm",
help => 'Course_Group_Add_Members',
state => 'add_members',
branch => 'adds',
@@ -3389,16 +3573,16 @@ sub date_setting_table {
}
sub create_homepage {
- my ($cdom,$cnum,$name,$groupinfo,$tools) = @_;
+ my ($cdom,$cnum,$name,$groupinfo,$tools,$gpterm,$ucgpterm) = @_;
my $functionality = join(',',@{$tools});
- my $content = &Apache::lonnet::unescape($$groupinfo{description});
+ my $content = &unescape($$groupinfo{description});
$content=~s/\s+$//s;
$content=~s/^\s+//s;
$content=~s/\ $//s;
$content=&Apache::lonfeedback::clear_out_html($content,1);
my %pageinfo = (
- 'aaa_title' => 'Group: '.$name,
+ 'aaa_title' => "$ucgpterm: $name",
'abb_links' => $functionality,
'bbb_content' => $content,
'ccc_webreferences' => '',
@@ -3444,22 +3628,22 @@ function toggleTools(field,caller) {
}
sub validate_groupname {
- my ($groupname,$action,$cdom,$cnum) = @_;
+ my ($groupname,$action,$cdom,$cnum,$gpterm,$ucgpterm,$crstype) = @_;
my %sectioncount = &Apache::loncommon::get_sections($cdom,$cnum);
my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
my %lt = &Apache::lonlocal::texthash (
- igna => 'Invalid group name',
- tgne => 'The group name entered ',
- grna => 'Group names and section names used in a course '.
- 'must be unique.',
- isno => 'is not a valid name.',
- gnmo => 'Group names may only contain letters, numbers '.
- 'or underscores.',
- cnnb => 'can not be used as it is the name of ',
- inth => ' in this course.',
- thgr => '- does not correspond to the name of an existing'.
- ' group ',
+ igna => "Invalid $gpterm name",
+ tgne => "The $gpterm name entered ",
+ grna => "$ucgpterm names and section names used in a ".
+ "$crstype must be unique.",
+ isno => "is not a valid name.",
+ gnmo => "$ucgpterm names may only contain letters, ".
+ "numbers or underscores.",
+ cnnb => "can not be used as it is the name of ",
+ inth => " in this $crstype",
+ thgr => "- does not correspond to the name of an ".
+ "existing $gpterm",
);
my $exitmsg = ''.$lt{'igna'}.'