[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
raeburn
raeburn at source.lon-capa.org
Mon Feb 10 14:48:56 EST 2020
raeburn Mon Feb 10 19:48:56 2020 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
- Bug 5349: Parameter management by users with a section-specific role ...
- Date shift only applies to date parameters for current section and groups
to which user belongs.
- When displaying the parameter log, changes are shown which affect (a) All
users, (b) users in current section and (c) users in group(s) to which
current user belongs.
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.594 loncom/interface/lonparmset.pm:1.595
--- loncom/interface/lonparmset.pm:1.594 Mon Feb 10 02:11:46 2020
+++ loncom/interface/lonparmset.pm Mon Feb 10 19:48:56 2020
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.594 2020/02/10 02:11:46 raeburn Exp $
+# $Id: lonparmset.pm,v 1.595 2020/02/10 19:48:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5405,6 +5405,18 @@
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
my $sec = $env{'request.course.sec'};
+ my $secgrpregex;
+ if ($sec ne '') {
+ my @groups;
+ if ($env{'request.course.groups'} ne '') {
+ @groups = split(/:/,$env{'request.course.groups'});
+ }
+ if (@groups) {
+ $secgrpregex = '(?:'.join('|',($sec, at groups)).')';
+ } else {
+ $secgrpregex = $sec;
+ }
+ }
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs);
# ugly retro fix for broken version of types
foreach my $key (keys(%data)) {
@@ -5420,7 +5432,7 @@
foreach my $key (keys(%data)) {
if ($data{$key.'.type'}=~/^date_(start|end)$/) {
if ($sec ne '') {
- next unless ($key =~ /^$env{'request.course.id'}\.\[$sec\]\./);
+ next unless ($key =~ /^$env{'request.course.id'}\.\[$secgrpregex\]\./);
}
my $newdate=$data{$key}+$shift;
$$numchanges ++;
@@ -5840,7 +5852,15 @@
text=>"Shifting Dates"});
my $submit_text = &mt('Shift all dates accordingly');
if ($sec ne '') {
- $submit_text = &mt("Shift all dates set explicitly for section '[_1]', accordingly",$sec);
+ my @groups;
+ if ($env{'request.course.groups'} ne '') {
+ @groups = split(/:/,$env{'request.course.groups'});
+ }
+ if (@groups) {
+ $submit_text = &mt("Shift dates set just for your section/group(s), accordingly");
+ } else {
+ $submit_text = &mt("Shift dates set just for your section, accordingly");
+ }
}
my $start_page=&Apache::loncommon::start_page('Shift Dates');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
@@ -5880,11 +5900,23 @@
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted');
$r->print('<h2>'.&mt('Shift Dates').'</h2>');
if ($sec ne '') {
- $r->print('<p>'.
- &mt("Shift all dates set explicitly for section '[_1]', such that [_2] becomes [_3]",
- $sec,&Apache::lonlocal::locallocaltime($env{'form.timebase'}),
- &Apache::lonlocal::locallocaltime($timeshifted)).
- '</p>');
+ my @groups;
+ if ($env{'request.course.groups'} ne '') {
+ @groups = split(/:/,$env{'request.course.groups'});
+ }
+ if (@groups) {
+ $r->print('<p>'.
+ &mt("Shift dates set just for your section/group(s), such that [_1] becomes [_2]",
+ &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
+ &Apache::lonlocal::locallocaltime($timeshifted)).
+ '</p>');
+ } else {
+ $r->print('<p>'.
+ &mt("Shift dates set just for your section, such that [_1] becomes [_2]",
+ &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
+ &Apache::lonlocal::locallocaltime($timeshifted)).
+ '</p>');
+ }
} else {
$r->print('<p>'.&mt('Shifting all dates such that [_1] becomes [_2]',
&Apache::lonlocal::locallocaltime($env{'form.timebase'}),
@@ -6856,6 +6888,12 @@
}
if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); }
}
+ my $numgroups = 0;
+ my @groups;
+ if ($env{'request.course.groups'} ne '') {
+ @groups = split(/:/,$env{'request.course.groups'});
+ $numgroups = scalar(@groups);
+ }
foreach my $id (sort {
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) {
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'}
@@ -6895,7 +6933,8 @@
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)=
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},$typeflag);
if ($env{'request.course.sec'} ne '') {
- next if (($issection ne '') && ($issection ne $env{'request.course.sec'}));
+ next if (($issection ne '') && (!(($issection eq $env{'request.course.sec'}) ||
+ ($numgroups && (grep(/^\Q$issection\E$/, at groups))))));
if ($uname ne '') {
my $stusection = &Apache::lonnet::getsection($uname,$udom,$env{'request.course.id'});
next if (($stusection ne '-1') && ($stusection ne $env{'request.course.sec'}));
More information about the LON-CAPA-cvs
mailing list