Diff for /loncom/homework/caparesponse/caparesponse.pm between versions 1.188 and 1.192

version 1.188, 2006/03/09 00:41:13 version 1.192, 2006/06/19 16:16:21
Line 29 Line 29
 package Apache::caparesponse;  package Apache::caparesponse;
 use strict;  use strict;
 use capa;  use capa;
   use Safe::Hole;
   use Apache::lonmaxima();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
   
Line 247  sub check_submission { Line 249  sub check_submission {
     }      }
           
     if ($tag eq 'formularesponse') {      if ($tag eq 'formularesponse') {
  $$args_ref{'type'}='fml';   if ($$args_ref{'samples'}) {
       $$args_ref{'type'}='fml';
    } else {
       $$args_ref{'type'}='math';
    }
     } elsif ($tag eq 'numericalresponse') {      } elsif ($tag eq 'numericalresponse') {
  $$args_ref{'type'}='float';   $$args_ref{'type'}='float';
     }      }
Line 290  sub end_numericalresponse { Line 296  sub end_numericalresponse {
     my $partid = $Apache::inputtags::part;      my $partid = $Apache::inputtags::part;
     my $id = $Apache::inputtags::response[-1];      my $id = $Apache::inputtags::response[-1];
     my $tag;      my $tag;
       my $safehole = new Safe::Hole;
     $safeeval->share_from('capa',['&caparesponse_capa_check_answer']);      $safeeval->share_from('capa',['&caparesponse_capa_check_answer']);
       $safehole->wrap(\&Apache::lonmaxima::maxima_check,$safeeval,'&maxima_check');
   
     if (scalar(@$tagstack)) { $tag=$$tagstack[-1]; }      if (scalar(@$tagstack)) { $tag=$$tagstack[-1]; }
     if ( $target eq 'grade' && &Apache::response::submitted() ) {      if ( $target eq 'grade' && &Apache::response::submitted() ) {
  &Apache::response::setup_params($tag,$safeeval);   &Apache::response::setup_params($tag,$safeeval);
  if ($Apache::lonhomework::type eq 'exam' &&    if ($Apache::lonhomework::type eq 'exam' && 
     $tag eq 'formularesponse') {      (($tag eq 'formularesponse') || ($tag eq 'mathresponse'))) {
     $increment=&Apache::response::scored_response($partid,$id);      $increment=&Apache::response::scored_response($partid,$id);
  } else {   } else {
     my $response = &Apache::response::getresponse();      my $response = &Apache::response::getresponse();
Line 776  sub start_stringresponse { Line 785  sub start_stringresponse {
   
 sub end_stringresponse {  sub end_stringresponse {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $increment=1;  
     my $result = '';      my $result = '';
     my $part=$Apache::inputtags::part;      my $part=$Apache::inputtags::part;
     my $id=$Apache::inputtags::response[-1];      my $id=$Apache::inputtags::response[-1];
Line 792  sub end_stringresponse { Line 801  sub end_stringresponse {
  $safeeval->share_from('capa',['&caparesponse_capa_check_answer']);   $safeeval->share_from('capa',['&caparesponse_capa_check_answer']);
  if ($Apache::lonhomework::type eq 'exam' ||   if ($Apache::lonhomework::type eq 'exam' ||
     &Apache::response::submitted('scantron')) {      &Apache::response::submitted('scantron')) {
     $increment=&Apache::response::scored_response($part,$id);      &Apache::response::scored_response($part,$id);
   
  } else {   } else {
     my $response = &Apache::response::getresponse();      my $response = &Apache::response::getresponse();
     if ( $response =~ /[^\s]/) {      if ( $response =~ /[^\s]/) {
Line 898  sub end_stringresponse { Line 908  sub end_stringresponse {
     }      }
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||       if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || 
  $target eq 'tex' || $target eq 'analyze') {   $target eq 'tex' || $target eq 'analyze') {
  &Apache::lonxml::increment_counter($increment);   &Apache::lonxml::increment_counter(&Apache::response::repetition());
     }      }
     &Apache::response::end_response;      &Apache::response::end_response;
     return $result;      return $result;

Removed from v.1.188  
changed lines
  Added in v.1.192


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