version 1.189, 2006/03/09 01:13:16
|
version 1.190, 2006/06/13 14:58:14
|
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; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::caparesponse',('caparesponse','numericalresponse','stringresponse','formularesponse')); |
&Apache::lonxml::register('Apache::caparesponse',('caparesponse','numericalresponse','stringresponse','formularesponse','mathresponse')); |
} |
} |
|
|
my %answer; |
my %answer; |
Line 248 sub check_submission {
|
Line 250 sub check_submission {
|
|
|
if ($tag eq 'formularesponse') { |
if ($tag eq 'formularesponse') { |
$$args_ref{'type'}='fml'; |
$$args_ref{'type'}='fml'; |
|
} elsif ($tag eq 'mathresponse') { |
|
$$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 294 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 922 sub end_formularesponse {
|
Line 929 sub end_formularesponse {
|
return end_numericalresponse(@_); |
return end_numericalresponse(@_); |
} |
} |
|
|
|
sub start_mathresponse { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
my $result; |
|
if ($target eq 'meta') { |
|
&Apache::response::start_response($parstack,$safeeval); |
|
$result=&Apache::response::meta_package_write('mathresponse'); |
|
&Apache::response::end_response(); |
|
} else { |
|
$result.=&start_numericalresponse(@_); |
|
} |
|
return $result; |
|
} |
|
|
|
sub end_mathresponse { |
|
return end_numericalresponse(@_); |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|