[LON-CAPA-cvs] cvs: loncom /html/adm/helper resettimes.helper

raeburn raeburn at source.lon-capa.org
Thu Mar 17 11:10:10 EDT 2016


raeburn		Thu Mar 17 15:10:10 2016 EDT

  Modified files:              
    /loncom/html/adm/helper	resettimes.helper 
  Log:
  - Bug 6763. Reset access times helper will delete student-specific
              interval parameter set when "Done" button was pushed. 
  
  
Index: loncom/html/adm/helper/resettimes.helper
diff -u loncom/html/adm/helper/resettimes.helper:1.9 loncom/html/adm/helper/resettimes.helper:1.10
--- loncom/html/adm/helper/resettimes.helper:1.9	Sun Apr  1 16:12:42 2012
+++ loncom/html/adm/helper/resettimes.helper	Thu Mar 17 15:10:10 2016
@@ -81,7 +81,35 @@
             $result.="Removing access time from ".
                       $title.": ".$res.'</li><li>';
             if ($res eq 'ok') {
-                &Apache::lonnet::del('timerinterval',[$key],$udom,$uname);
+                if ($symb ne 'course') {
+                    my $what = [];
+                    my ($storeunder, at 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');
+                                &Apache::lonnet::del
+                                    ('resourcedata',[keys(%storecontent)],$udom,$uname);
+                                &Apache::lonparmset::log_parmset(\%storecontent,1,$uname,$udom);
+                            }
+                        }
+                    }
+                }
             }
 	}
         $result=~s/<li>$//;
@@ -133,6 +161,17 @@
         my $symb=$helper->{'VARS'}{'res2'};
         my $key=$env{'request.course.id'}."\0".$symb;
 	my @names=split(/\|\|\|/,$helper->{'VARS'}{'stu1'});
+        my $what = [];
+        my ($storeunder, at 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'];
+        }
 	foreach my $name (@names) {
 	    my ($uname,$udom,$sec,$fullname)=split(':',$name);
 	    if (!$fullname) { $fullname="$uname\@$udom"; }
@@ -150,6 +189,21 @@
                 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');
+                                my $reply = &Apache::lonnet::del
+                                    ('resourcedata',[keys(%storecontent)],$udom,$uname);
+                                &Apache::lonparmset::log_parmset(\%storecontent,1,$uname,$udom);
+                            }
+                        }
+                    }
                 }
 	    }
 	    $result.="</li>\n<li>";




More information about the LON-CAPA-cvs mailing list