--- loncom/html/adm/helper/resettimes.helper 2012/04/01 16:12:42 1.9
+++ loncom/html/adm/helper/resettimes.helper 2016/05/31 22:04:14 1.11
@@ -70,6 +70,7 @@
my $courseid=$env{'request.course.id'};
my ($uname,$udom,$sec,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
&Apache::lonnet::logthis($helper->{'VARS'}{'delete'});
+ my $needsdeval;
foreach my $escsymb (split(/\|\|\|/,$helper->{'VARS'}{'delete'})) {
my $symb=&Apache::lonnet::unescape($escsymb);
my $key = "$courseid\0$symb";
@@ -81,9 +82,42 @@
$result.="Removing access time from ".
$title.": ".$res.'
';
if ($res eq 'ok') {
- &Apache::lonnet::del('timerinterval',[$key],$udom,$uname);
+ if ($symb ne 'course') {
+ my $what = [];
+ my ($storeunder,@recurseup,$recursed);
+ my $mapp = &Apache::lonnet::deversion((
+ &Apache::lonnet::decode_symb($symb))[2]);
+ if ($symb =~ /\.(page|sequence)$/) {
+ $storeunder = $env{'request.course.id'}.'.'.$mapp.'___(all).0.interval';
+ $what = [$storeunder,'map'];
+ } else {
+ $storeunder = $env{'request.course.id'}.'.'.$symb.'.0.interval';
+ $what = [$storeunder,'resource'];
+ }
+ &Apache::lonnet::del('timerinterval',[$key],$udom,$uname);
+ my $userreply=&Apache::lonnet::resdata($uname,$udom,'user',$mapp,
+ \$recursed,\@recurseup,
+ $env{'request.course.id'},
+ '.','0.interval',($what));
+ if (ref($userreply) eq 'ARRAY') {
+ if ($userreply->[0] =~ /^\d+$/) {
+ if (($userreply->[1] eq 'map') || ($userreply->[1] eq 'resource')) {
+ my %storecontent=($storeunder => $userreply->[0],
+ $storeunder.'.type' => 'date_interval');
+ if (&Apache::lonnet::del
+ ('resourcedata',[keys(%storecontent)],$udom,$uname) eq 'ok') {
+ &Apache::lonparmset::log_parmset(\%storecontent,1,$uname,$udom);
+ $needsdeval = 1;
+ }
+ }
+ }
+ }
+ }
}
}
+ if ($needsdeval) {
+ &Apache::lonnet::devalidateuserresdata($uname,$udom);
+ }
$result=~s/$//;
return $result;
@@ -133,6 +167,18 @@
my $symb=$helper->{'VARS'}{'res2'};
my $key=$env{'request.course.id'}."\0".$symb;
my @names=split(/\|\|\|/,$helper->{'VARS'}{'stu1'});
+ my $what = [];
+ my ($storeunder,@recurseup,$recursed);
+ my $mapp = &Apache::lonnet::deversion((
+ &Apache::lonnet::decode_symb($symb))[2]);
+ if ($symb =~ /\.(page|sequence)$/) {
+ $storeunder = $env{'request.course.id'}.'.'.$mapp.'___(all).0.interval';
+ $what = [$storeunder,'map'];
+ } else {
+ $storeunder = $env{'request.course.id'}.'.'.$symb.'.0.interval';
+ $what = [$storeunder,'resource'];
+ }
+ my %donedeval;
foreach my $name (@names) {
my ($uname,$udom,$sec,$fullname)=split(':',$name);
if (!$fullname) { $fullname="$uname\@$udom"; }
@@ -150,6 +196,26 @@
if ($delres eq 'ok') {
&Apache::lonnet::del('timerinterval',
[$key],$udom,$uname);
+ my $userreply=&Apache::lonnet::resdata($uname,$udom,'user',$mapp,
+ \$recursed,\@recurseup,
+ $env{'request.course.id'},
+ '.','0.interval',($what));
+ if (ref($userreply) eq 'ARRAY') {
+ if ($userreply->[0] =~ /^\d+$/) {
+ if (($userreply->[1] eq 'map') || ($userreply->[1] eq 'resource')) {
+ my %storecontent=($storeunder => $userreply->[0],
+ $storeunder.'.type' => 'date_interval');
+ if (&Apache::lonnet::del
+ ('resourcedata',[keys(%storecontent)],$udom,$uname) eq 'ok') {
+ &Apache::lonparmset::log_parmset(\%storecontent,1,$uname,$udom);
+ unless ($donedeval{$uname.':'.$udom}) {
+ &Apache::lonnet::devalidateuserresdata($uname,$udom);
+ $donedeval{$uname.':'.$udom} = 1;
+ }
+ }
+ }
+ }
+ }
}
}
$result.="\n";