Diff for /loncom/homework/lonhomework.pm between versions 1.196 and 1.201

version 1.196, 2005/01/31 21:57:32 version 1.201, 2005/03/21 18:53:51
Line 162  sub send_footer { Line 162  sub send_footer {
     $request->print(&Apache::lontexconvert::footer());      $request->print(&Apache::lontexconvert::footer());
 }  }
   
 $Apache::lonxml::browse='';  sub proctor_checked_in {
       return 0;
   }
   
   $Apache::lonxml::browse='';
 sub check_ip_acc {  sub check_ip_acc {
     my ($acc)=@_;      my ($acc)=@_;
     if (!defined($acc) || $acc =~ /^\s*$/) { return 1; }      if (!defined($acc) || $acc =~ /^\s*$/) { return 1; }
Line 209  sub check_ip_acc { Line 212  sub check_ip_acc {
     }      }
     return $allowed;      return $allowed;
 }  }
   
   sub check_task_access {
       #does it pass normal muster
       my ($status,$datemsg)=&check_access;
       if ($status eq 'SHOW_ANSWER' ||
    $status eq 'CLOSED' ||
    $status eq 'CANNOT_ANSWER' ||
    $status eq 'INVALID_ACCESS' ||
    $status eq 'UNAVAILABLE') {
    return ($status,$datemsg);
       }
   
       
       my ($id)=@_;
       my @slots=split(':',&Apache::lonnet::EXT("resource.$id.available"));
   #    if (!@slots) {
   # return ($status,$datemsg);
   #    }
       my $slotstatus='NOT_IN_A_SLOT';
       foreach my $slot (@slots) {
    &Apache::lonxml::debug("getting $slot");
    my %slot=&Apache::lonnet::get_slot($slot);
    &Apache::lonhomework::showhash(%slot);
    if ($slot{'starttime'} < time &&
       $slot{'endtime'} > time &&
       &check_ip_acc($slot{'ip'})) {
       $slotstatus='IN_A_SLOT';
       last;
    }
       }
       if ($slotstatus eq 'IN_A_SLOT' &&
    &proctor_checked_in()) {
    $slotstatus='CAN_ANSWER';
       }
       return ($slotstatus,$datemsg);
   }
   
 # JB, 9/24/2002: Any changes in this function may require a change  # JB, 9/24/2002: Any changes in this function may require a change
 # in lonnavmaps::resource::getDateStatus.  # in lonnavmaps::resource::getDateStatus.
 sub check_access {  sub check_access {
Line 431  sub setuppermissions { Line 471  sub setuppermissions {
   
 sub setupheader {  sub setupheader {
     my $request=$_[0];      my $request=$_[0];
     if ($ENV{'browser.mathml'}) {      &Apache::loncommon::content_type($request,'text/html');
  &Apache::loncommon::content_type($request,'text/xml');  
     } else {  
  &Apache::loncommon::content_type($request,'text/html');  
     }  
     if (!$Apache::lonxml::debug && ($ENV{'REQUEST_METHOD'} eq 'GET')) {      if (!$Apache::lonxml::debug && ($ENV{'REQUEST_METHOD'} eq 'GET')) {
  &Apache::loncommon::no_cache($request);   &Apache::loncommon::no_cache($request);
     }      }
Line 496  sub analyze_header { Line 532  sub analyze_header {
     if ($ENV{'environment.remote'} eq 'off') {      if ($ENV{'environment.remote'} eq 'off') {
  $bodytag=&Apache::loncommon::bodytag();   $bodytag=&Apache::loncommon::bodytag();
     }      }
     my $result.='<html>      my $html=&Apache::lonxml::xmlbegin();
       my $result.=$html.'
             <head><title>'.&mt("Analyzing a problem").'</title></head>              <head><title>'.&mt("Analyzing a problem").'</title></head>
             '.$bodytag.&Apache::lonxml::message_location().'              '.$bodytag.&Apache::lonxml::message_location().'
             <form name="lonhomework" method="POST" action="'.              <form name="lonhomework" method="POST" action="'.
Line 623  sub editxmlmode { Line 660  sub editxmlmode {
  if ($ENV{'environment.remote'} eq 'off') {   if ($ENV{'environment.remote'} eq 'off') {
     $bodytag=&Apache::loncommon::bodytag();      $bodytag=&Apache::loncommon::bodytag();
  }   }
  $result.='<html>'.$bodytag.&Apache::lonxml::message_location().'   my $html=&Apache::lonxml::xmlbegin();
    $result.=$html.$bodytag.&Apache::lonxml::message_location().'
             <form name="lonhomework" method="POST" action="'.              <form name="lonhomework" method="POST" action="'.
     &HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">'.      &HTML::Entities::encode($ENV{'request.uri'},'<>&"').'">'.
     &Apache::structuretags::remember_problem_state().'      &Apache::structuretags::remember_problem_state().'
Line 636  sub editxmlmode { Line 674  sub editxmlmode {
             <input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" />              <input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" />
             <hr />              <hr />
             ' . $xml_help . '              ' . $xml_help . '
             <textarea rows="'.$rows.'" cols="'.$cols.'" name="editxmltext">'.              <textarea style="width:100%" rows="'.$rows.'" cols="'.$cols.'" name="editxmltext">'.
     &HTML::Entities::encode($problem,'<>&"').'</textarea>      &HTML::Entities::encode($problem,'<>&"').'</textarea>
             </form></body></html>';              </form></body></html>';
  &Apache::lonxml::add_messages(\$result);   &Apache::lonxml::add_messages(\$result);

Removed from v.1.196  
changed lines
  Added in v.1.201


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