Diff for /loncom/homework/lonhomework.pm between versions 1.118 and 1.121

version 1.118, 2003/04/03 20:05:21 version 1.121, 2003/05/08 15:33:15
Line 50  use Apache::essayresponse(); Line 50  use Apache::essayresponse();
 use Apache::externalresponse();  use Apache::externalresponse();
 use Apache::rankresponse();  use Apache::rankresponse();
 use Apache::matchresponse();  use Apache::matchresponse();
   use Apache::chemresponse();
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use HTML::Entities();  use HTML::Entities();
 use Apache::loncommon();  use Apache::loncommon();
Line 65  sub get_target { Line 66  sub get_target {
  && ($ENV{'form.grade_target'} eq 'tex')) {   && ($ENV{'form.grade_target'} eq 'tex')) {
       return ($ENV{'form.grade_target'});        return ($ENV{'form.grade_target'});
     } elsif ( defined($ENV{'form.grade_target'}  )       } elsif ( defined($ENV{'form.grade_target'}  ) 
  && ($Apache::lonhomework::viewgrades == 'F' )) {   && ($Apache::lonhomework::viewgrades eq 'F' )) {
       return ($ENV{'form.grade_target'});        return ($ENV{'form.grade_target'});
     }      }
     
Line 207  sub check_access { Line 208  sub check_access {
     $datemsg = "was due on $lastdate, and answers will be available on $date";      $datemsg = "was due on $lastdate, and answers will be available on $date";
   }    }
   if ($status eq 'CAN_ANSWER') {    if ($status eq 'CAN_ANSWER') {
     #check #tries      #check #tries, and if correct.
     my $tries = $Apache::lonhomework::history{"resource.$id.tries"};      my $tries = $Apache::lonhomework::history{"resource.$id.tries"};
     my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");      my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");
     if ( $tries eq '' ) { $tries = '0'; }      if ( $tries eq '' ) { $tries = '0'; }
     if ( $maxtries eq '' ) { $maxtries = '2'; }       if ( $maxtries eq '' ) { $maxtries = '2'; } 
     if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; }       if ($tries >= $maxtries) { $status = 'CANNOT_ANSWER'; } 
       if($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/) {
    $status = 'CANNOT_ANSWER';
       }
   }    }
   
   if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') &&    if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') &&
Line 285  sub setuppermissions { Line 289  sub setuppermissions {
 }  }
   
 sub setupheader {  sub setupheader {
   my $request=$_[0];      my $request=$_[0];
   if ($ENV{'browser.mathml'}) {      if ($ENV{'browser.mathml'}) {
     $request->content_type('text/xml');   $request->content_type('text/xml');
   } else {      } else {
     $request->content_type('text/html');   $request->content_type('text/html');
   }      }
   if (!$Apache::lonxml::debug && ($ENV{'REQUEST_METHOD'} eq 'GET')) {      $request->content_encoding('UTF-8');
     &Apache::loncommon::no_cache($request);      if (!$Apache::lonxml::debug && ($ENV{'REQUEST_METHOD'} eq 'GET')) {
   }   &Apache::loncommon::no_cache($request);
   $request->send_http_header;      }
   return OK if $request->header_only;      $request->send_http_header;
   return ''      return OK if $request->header_only;
       return ''
 }  }
   
 sub handle_save_or_undo {  sub handle_save_or_undo {
Line 600  sub handler { Line 605  sub handler {
   #my $t0 = [&gettimeofday()];    #my $t0 = [&gettimeofday()];
   my $request=$_[0];    my $request=$_[0];
   
 #  if ( $ENV{'user.name'} eq 'albertel' ) {$Apache::lonxml::debug=1;}  
   $Apache::lonxml::debug=$ENV{'user.debug'};    $Apache::lonxml::debug=$ENV{'user.debug'};
   
   if (&setupheader($request)) { return OK; }    if (&setupheader($request)) { return OK; }

Removed from v.1.118  
changed lines
  Added in v.1.121


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