Diff for /loncom/homework/lonhomework.pm between versions 1.349.2.4 and 1.350

version 1.349.2.4, 2015/06/15 20:23:19 version 1.350, 2015/04/15 04:11:20
Line 51  use Apache::functionplotresponse(); Line 51  use Apache::functionplotresponse();
 use Apache::drawimage();  use Apache::drawimage();
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonparmset();  
 use Apache::lonlocal;  use Apache::lonlocal;
 use Time::HiRes qw( gettimeofday tv_interval );  use Time::HiRes qw( gettimeofday tv_interval );
 use HTML::Entities();  use HTML::Entities();
Line 1332  sub update_construct_style { Line 1331  sub update_construct_style {
     }      }
 }  }
   
 #  
 # Sets interval for current user so time left will be zero, either for the entire folder   
 # containing the current resource, or just the resource, depending on value of first item  
 # in interval array retrieved from EXT("resource.0.interval");  
 #  
 sub zero_timer {  
     my ($symb) = @_;  
     my ($hastimeleft,$first_access,$now);  
     my @interval=&Apache::lonnet::EXT("resource.0.interval");  
     if (@interval > 1) {  
         if ($interval[1] eq 'course') {  
             return;  
         } else {  
             my $now = time;  
             my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb);  
             if ($first_access > 0) {  
                 if ($first_access+$interval[0] > $now) {  
                     my $done_time = $now - $first_access;  
                     my $snum = 1;  
                     if ($interval[1] eq 'map') {  
                         $snum = 2;  
                     }  
                     my $result =   
                         &Apache::lonparmset::storeparm_by_symb_inner($symb,'0_interval',  
                                                                      $snum,$done_time,  
                                                                      'date_interval',  
                                                                      $env{'user.name'},  
                                                                      $env{'user.domain'});  
                     return $result;  
                 }  
             }  
         }  
     }  
     return;  
 }  
   
 sub handler {  sub handler {
     #my $t0 = [&gettimeofday()];      #my $t0 = [&gettimeofday()];
     my $request=$_[0];      my $request=$_[0];
   
     $Apache::lonxml::request=$request;      $Apache::lonxml::request=$request;
     $Apache::lonxml::debug=$env{'user.debug'};      $Apache::lonxml::debug=$env{'user.debug'};
     $env{'request.uri'}=$request->uri;      $env{'request.uri'}=$request->uri;
Line 1380  sub handler { Line 1343  sub handler {
     my $file=&Apache::lonnet::filelocation("",$request->uri);      my $file=&Apache::lonnet::filelocation("",$request->uri);
   
     #check if we know where we are      #check if we know where we are
     if ($env{'request.course.fn'} && !&Apache::lonnet::symbread()) {       if ($env{'request.course.fn'} && !&Apache::lonnet::symbread('','',1,1)) {
  # if we are browsing we might not be able to know where we are   # if we are browsing we might not be able to know where we are
  if ($Apache::lonhomework::browse ne 'F' &&    if ($Apache::lonhomework::browse ne 'F' && 
     $env{'request.state'} ne "construct") {      $env{'request.state'} ne "construct") {
Line 1394  sub handler { Line 1357  sub handler {
  &unset_permissions();   &unset_permissions();
  return OK;   return OK;
     }      }
   
     &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:$Apache::lonhomework::modifygrades:$Apache::lonhomework::queuegrade");      &Apache::lonxml::debug("Permissions:$Apache::lonhomework::browse:$Apache::lonhomework::viewgrades:$Apache::lonhomework::modifygrades:$Apache::lonhomework::queuegrade");
     &Apache::lonxml::debug("Problem Mode ".$env{'form.problemmode'});      &Apache::lonxml::debug("Problem Mode ".$env{'form.problemmode'});
     my ($symb) = &Apache::lonnet::whichuser();      my ($symb) = &Apache::lonnet::whichuser();
Line 1425  sub handler { Line 1387  sub handler {
     &newproblem($request);      &newproblem($request);
  }   }
     } else {      } else {
         # Set the event timer to zero if the "done button" was clicked.  The button is  
         # part of the doneButton form created in lonmenu.pm  
         if ($symb && $env{'form.LC_interval_done'} eq 'true') {    
             &zero_timer($symb);  
             undef($env{'form.LC_interval_done'});  
         }  
  # just render the page normally outside of construction space   # just render the page normally outside of construction space
  &Apache::lonxml::debug("not construct");   &Apache::lonxml::debug("not construct");
  &renderpage($request,$file);   &renderpage($request,$file);

Removed from v.1.349.2.4  
changed lines
  Added in v.1.350


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>