Diff for /loncom/homework/lonhomework.pm between versions 1.252 and 1.257

version 1.252, 2006/06/20 05:10:00 version 1.257, 2006/07/20 03:57:38
Line 344  sub check_slot_access { Line 344  sub check_slot_access {
  }   }
   
     }      }
   
     if ( $is_correct) {      if ( $is_correct) {
    if ($type eq 'problem') {
       return ($status);
    }
  return ('SHOW_ANSWER');   return ('SHOW_ANSWER');
     }      }
   
     if ( $status eq 'CANNOT_ANSWER' &&       if ( $status eq 'CANNOT_ANSWER' && 
  ($slotstatus ne 'NEEDS_CHECKIN' && $slotstatus ne 'NOT_IN_A_SLOT')) {   ($slotstatus ne 'NEEDS_CHECKIN' && $slotstatus ne 'NOT_IN_A_SLOT')) {
  return ($status,$datemsg);   return ($status,$datemsg);
Line 475  sub check_access { Line 480  sub check_access {
     if (!$first_access) {      if (!$first_access) {
  $status='NOT_YET_VIEWED';   $status='NOT_YET_VIEWED';
  my $due_date = &due_date($id);   my $due_date = &due_date($id);
  $datemsg=&seconds_to_human_length($due_date-time);   my $seconds_left = $due_date - time;
    if ($seconds_left > $interval || $due_date eq '') {
       $seconds_left = $interval;
    }
    $datemsg=&seconds_to_human_length($seconds_left);
     }      }
  }   }
     }      }
Line 505  sub due_date { Line 514  sub due_date {
     my $due_date= &Apache::lonnet::EXT("resource.$part_id.duedate",$symb,      my $due_date= &Apache::lonnet::EXT("resource.$part_id.duedate",$symb,
        $udom,$uname);         $udom,$uname);
     &Apache::lonxml::debug("looking for due_date $part_id $symb $due_date");      &Apache::lonxml::debug("looking for due_date $part_id $symb $due_date");
     if (defined($interval)) {      if ($interval =~ /\d+/) {
  my $first_access=&Apache::lonnet::get_first_access('map',$symb);   my $first_access=&Apache::lonnet::get_first_access('map',$symb);
    &Apache::lonxml::debug("looking for first_access $first_access");
  if (defined($first_access)) {   if (defined($first_access)) {
     $interval = $first_access+$interval;      $interval = $first_access+$interval;
     $date = ($interval < $due_date)? $interval : $due_date;      $date = ($interval < $due_date)? $interval : $due_date;
Line 621  sub setuppermissions { Line 631  sub setuppermissions {
     return '';      return '';
 }  }
   
   sub unset_permissions {
       undef($Apache::lonhomework::queuegrade);
       undef($Apache::lonhomework::modifygrades);
       undef($Apache::lonhomework::viewgrades);
       undef($Apache::lonhomework::browse);
   }
   
 sub setupheader {  sub setupheader {
     my $request=$_[0];      my $request=$_[0];
     &Apache::loncommon::content_type($request,'text/html');      &Apache::loncommon::content_type($request,'text/html');
Line 807  sub editxmlmode { Line 824  sub editxmlmode {
     &Apache::loncommon::helpLatexCheatsheet("Problem_Editor_XML_Index",      &Apache::loncommon::helpLatexCheatsheet("Problem_Editor_XML_Index",
     "Problem Editing Help").      "Problem Editing Help").
     '</td><td>'.      '</td><td>'.
        &Apache::loncommon::help_open_menu('',undef,undef,undef,5,'Authoring').         &Apache::loncommon::help_open_menu(undef,undef,5,'Authoring').
                 '</td></tr></table>';                  '</td></tr></table>';
  if ($cols > 80) { $cols = 80; }   if ($cols > 80) { $cols = 80; }
  if ($cols < 70) { $cols = 70; }   if ($cols < 70) { $cols = 70; }
Line 1020  sub handler { Line 1037  sub handler {
  if ($Apache::lonhomework::browse ne 'F' &&    if ($Apache::lonhomework::browse ne 'F' && 
     $env{'request.state'} ne "construct") {      $env{'request.state'} ne "construct") {
     #should know where we are, so ask      #should know where we are, so ask
     $request->internal_redirect('/adm/ambiguous'); return OK;      &unset_permissions();
       $request->internal_redirect('/adm/ambiguous');
       return OK;
  }   }
     }      }
     if (&setupheader($request)) { return OK; }      if (&setupheader($request)) {
    &unset_permissions();
    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::lonxml::whichuser();      my ($symb) = &Apache::lonxml::whichuser();
Line 1057  sub handler { Line 1079  sub handler {
     #&Apache::lonxml::debug("Spent $td seconds processing");      #&Apache::lonxml::debug("Spent $td seconds processing");
     # always turn off debug messages      # always turn off debug messages
     $Apache::lonxml::debug=0;      $Apache::lonxml::debug=0;
       &unset_permissions();
     return OK;      return OK;
   
 }  }

Removed from v.1.252  
changed lines
  Added in v.1.257


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