version 1.164, 2005/02/21 20:39:46
|
version 1.166, 2005/04/07 06:56:22
|
Line 30 package Apache::caparesponse;
|
Line 30 package Apache::caparesponse;
|
use strict; |
use strict; |
use capa; |
use capa; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Apache::lonnet; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::caparesponse',('caparesponse','numericalresponse','stringresponse','formularesponse')); |
&Apache::lonxml::register('Apache::caparesponse',('caparesponse','numericalresponse','stringresponse','formularesponse')); |
Line 348 sub end_numericalresponse {
|
Line 349 sub end_numericalresponse {
|
if ($target eq 'answer') { |
if ($target eq 'answer') { |
if ($high && $tag eq 'numericalresponse') { $ans.=' ['.$low.','.$high.']'; } |
if ($high && $tag eq 'numericalresponse') { $ans.=' ['.$low.','.$high.']'; } |
if (defined($sighigh) && $tag eq 'numericalresponse') { |
if (defined($sighigh) && $tag eq 'numericalresponse') { |
if ($ENV{'form.answer_output_mode'} eq 'tex') { |
if ($env{'form.answer_output_mode'} eq 'tex') { |
$ans.= " Sig $siglow - $sighigh"; |
$ans.= " Sig $siglow - $sighigh"; |
} else { |
} else { |
$ans.= " Sig <i>$siglow - $sighigh</i>"; |
$ans.= " Sig <i>$siglow - $sighigh</i>"; |
Line 361 sub end_numericalresponse {
|
Line 362 sub end_numericalresponse {
|
push (@{ $Apache::lonhomework::analyze{"$part_id.ans_high"} }, $high); |
push (@{ $Apache::lonhomework::analyze{"$part_id.ans_high"} }, $high); |
push (@{ $Apache::lonhomework::analyze{"$part_id.ans_low"} }, $low); |
push (@{ $Apache::lonhomework::analyze{"$part_id.ans_low"} }, $low); |
} |
} |
|
if ($fmt) { |
|
push (@{ $Apache::lonhomework::analyze{"$part_id.format"} }, $fmt); |
|
} |
} |
} |
} |
} |
if (defined($unit) and ($unit ne '') and |
if (defined($unit) and ($unit ne '') and |
$tag eq 'numericalresponse') { |
$tag eq 'numericalresponse') { |
if ($target eq 'answer') { |
if ($target eq 'answer') { |
if ($ENV{'form.answer_output_mode'} eq 'tex') { |
if ($env{'form.answer_output_mode'} eq 'tex') { |
$result.=&Apache::response::answer_part($tag, |
$result.=&Apache::response::answer_part($tag, |
" Unit: $unit "); |
" Unit: $unit "); |
} else { |
} else { |
Line 412 sub get_table_sizes {
|
Line 416 sub get_table_sizes {
|
} |
} |
$cell_width+=8; |
$cell_width+=8; |
my $textwidth; |
my $textwidth; |
if ($ENV{'form.textwidth'} ne '') { |
if ($env{'form.textwidth'} ne '') { |
$ENV{'form.textwidth'}=~/(\d*)\.?(\d*)/; |
$env{'form.textwidth'}=~/(\d*)\.?(\d*)/; |
$textwidth=$1.'.'.$2; |
$textwidth=$1.'.'.$2; |
} else { |
} else { |
$ENV{'textwidth'}=~/(\d+)\.?(\d*)/; |
$env{'form.textwidth'}=~/(\d+)\.?(\d*)/; |
$textwidth=$1.'.'.$2; |
$textwidth=$1.'.'.$2; |
} |
} |
my $bubbles_per_line=int($textwidth/$cell_width); |
my $bubbles_per_line=int($textwidth/$cell_width); |
Line 523 sub get_tolrange {
|
Line 527 sub get_tolrange {
|
sub get_sigrange { |
sub get_sigrange { |
my ($sig)=@_; |
my ($sig)=@_; |
&Apache::lonxml::debug("Got a sig of :$sig:"); |
&Apache::lonxml::debug("Got a sig of :$sig:"); |
my $courseid=$ENV{'request.course.id'}; |
my $courseid=$env{'request.course.id'}; |
if (lc($ENV{"course.$courseid.disablesigfigs"}) eq 'yes') { |
if (lc($env{"course.$courseid.disablesigfigs"}) eq 'yes') { |
return (15,0); |
return (15,0); |
} |
} |
my $sig_lbound; |
my $sig_lbound; |
Line 544 sub get_sigrange {
|
Line 548 sub get_sigrange {
|
($sig_lbound > 15) || |
($sig_lbound > 15) || |
($sig =~/(\+|-)/ ) ) { |
($sig =~/(\+|-)/ ) ) { |
my $errormsg=&mt("Invalid Significant figures detected")." ($sig)"; |
my $errormsg=&mt("Invalid Significant figures detected")." ($sig)"; |
if ($ENV{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
$errormsg.= |
$errormsg.= |
&Apache::loncommon::help_open_topic('Significant_Figures'); |
&Apache::loncommon::help_open_topic('Significant_Figures'); |
} |
} |
Line 708 sub end_stringresponse {
|
Line 712 sub end_stringresponse {
|
$string='Regular Expression'; |
$string='Regular Expression'; |
} |
} |
if ($target eq 'answer') { |
if ($target eq 'answer') { |
if ($ENV{'form.answer_output_mode'} eq 'tex') { |
if ($env{'form.answer_output_mode'} eq 'tex') { |
$result.=&Apache::response::answer_part('stringresponse', |
$result.=&Apache::response::answer_part('stringresponse', |
"$string"); |
"$string"); |
} else { |
} else { |