Diff for /loncom/homework/lonhomework.pm between versions 1.251 and 1.255

version 1.251, 2006/06/20 03:33:55 version 1.255, 2006/06/30 05:10:29
Line 244  sub check_slot_access { Line 244  sub check_slot_access {
     # does it pass normal muster      # does it pass normal muster
     my ($status,$datemsg)=&check_access($id);      my ($status,$datemsg)=&check_access($id);
           
     my $useslots = &Apache::lonnet::EXT("resource.$id.useslots");      my $useslots = &Apache::lonnet::EXT("resource.0.useslots");
     if ($useslots ne 'resource' && $useslots ne 'map'       if ($useslots ne 'resource' && $useslots ne 'map' 
  && $useslots ne 'map_map') {   && $useslots ne 'map_map') {
  return ($status,$datemsg);   return ($status,$datemsg);
Line 269  sub check_slot_access { Line 269  sub check_slot_access {
     }      }
   
     my @slots=      my @slots=
  (split(':',&Apache::lonnet::EXT("resource.$id.availablestudent")),   (split(':',&Apache::lonnet::EXT("resource.0.availablestudent")),
  split(':',&Apache::lonnet::EXT("resource.$id.available")));   split(':',&Apache::lonnet::EXT("resource.0.available")));
   
 #    if (!@slots) {  #    if (!@slots) {
 # return ($status,$datemsg);  # return ($status,$datemsg);
Line 310  sub check_slot_access { Line 310  sub check_slot_access {
  $checkedin =   $checkedin =
     $Apache::lonhomework::history{"resource.$version.0.checkedin"};      $Apache::lonhomework::history{"resource.$version.0.checkedin"};
     } elsif ($type eq 'problem') {      } elsif ($type eq 'problem') {
  $got_grade = 1;   $got_grade  = 1;
  $checkedin = $Apache::lonhomework::history{"resource.0.checkedin"};   $checkedin  = $Apache::lonhomework::history{"resource.0.checkedin"};
    $is_correct =
       ($Apache::lonhomework::history{"resource.0.solved"} =~/^correct_/);
     }      }
           
     &Apache::lonxml::debug(" slot is $slotstatus checkedin ($checkedin) got_grade ($got_grade) is_correct ($is_correct)");      &Apache::lonxml::debug(" slot is $slotstatus checkedin ($checkedin) got_grade ($got_grade) is_correct ($is_correct)");
Line 324  sub check_slot_access { Line 326  sub check_slot_access {
  return ('WAITING_FOR_GRADE');   return ('WAITING_FOR_GRADE');
     }      }
   
       # no slot is currently open, and has been checked in for this version
       # previous slot is therefore CLOSED, so therefore the problem is
       if (!defined($slot_name)
    && $checkedin 
    && $type eq 'problem') {
    return ('CLOSED',$datemsg);
       }
   
     if ($slotstatus eq 'NOT_IN_A_SLOT'       if ($slotstatus eq 'NOT_IN_A_SLOT' 
  && $checkedin ) {   && $checkedin ) {
   
Line 334  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 611  sub setuppermissions { Line 626  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 797  sub editxmlmode { Line 819  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 1010  sub handler { Line 1032  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 1047  sub handler { Line 1074  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.251  
changed lines
  Added in v.1.255


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