version 1.111, 2003/09/22 18:38:59
|
version 1.112, 2003/09/22 18:47:59
|
Line 171 sub end_numericalresponse {
|
Line 171 sub end_numericalresponse {
|
my $status = $Apache::inputtags::status['-1']; |
my $status = $Apache::inputtags::status['-1']; |
if ( ($award =~ /^correct/ |
if ( ($award =~ /^correct/ |
&& lc($Apache::lonhomework::problemstatus) ne 'no') |
&& lc($Apache::lonhomework::problemstatus) ne 'no') |
|| $status eq "SHOW_ANSWER" |
|| $status eq "SHOW_ANSWER") { |
|| $ENV{'form.texaward'} eq 'SHOW_ANSWER') { |
|
my (@formats)=&Apache::lonxml::get_param_var('format',$parstack, |
my (@formats)=&Apache::lonxml::get_param_var('format',$parstack, |
$safeeval); |
$safeeval); |
my $unit=&Apache::lonxml::get_param_var('unit',$parstack, |
my $unit=&Apache::lonxml::get_param_var('unit',$parstack, |
$safeeval); |
$safeeval); |
if ($target eq 'web') { |
if ($target eq 'web') { |
$result="<br />The correct answer is "; |
$result="<br />The correct answer is "; |
} elsif ($target eq 'tex') { |
|
if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') { |
|
$result='\vskip 0 mm The correct answer is \\texttt{ '; |
|
} |
|
} |
} |
for (my $i=0; $i <= $#answers; $i++) { |
for (my $i=0; $i <= $#answers; $i++) { |
my $answer=$answers[$i]; |
my $answer=$answers[$i]; |
Line 201 sub end_numericalresponse {
|
Line 196 sub end_numericalresponse {
|
&Apache::lonxml::debug("no format answer :$answer:"); |
&Apache::lonxml::debug("no format answer :$answer:"); |
$formatted="$answer,"; |
$formatted="$answer,"; |
} |
} |
if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') { |
|
$result.=$formatted; |
|
} |
|
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$formatted=''; |
$formatted=''; |
#$formatted=&Apache::lonxml::latex_special_symbols($formatted); |
#$formatted=&Apache::lonxml::latex_special_symbols($formatted); |
Line 213 sub end_numericalresponse {
|
Line 205 sub end_numericalresponse {
|
chop $result; |
chop $result; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$result.=" $unit.<br />"; |
$result.=" $unit.<br />"; |
} elsif ($target eq 'tex') { |
|
if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') { |
|
$result.=&Apache::lonxml::latex_special_symbols($unit); |
|
$result.="}. \\vskip 0 mm "; |
|
} |
|
} |
} |
} |
} |
if ($Apache::lonhomework::type eq 'exam') { |
if ($Apache::lonhomework::type eq 'exam') { |
Line 315 sub end_numericalresponse {
|
Line 302 sub end_numericalresponse {
|
($sighigh,$siglow)=&get_sigrange($Apache::inputtags::params{'sig'}); |
($sighigh,$siglow)=&get_sigrange($Apache::inputtags::params{'sig'}); |
} |
} |
if ($fmt && $$tagstack[-1] eq 'numericalresponse') { |
if ($fmt && $$tagstack[-1] eq 'numericalresponse') { |
|
$fmt=~s/e/E/g; |
$ans = sprintf('%.'.$fmt,$ans); |
$ans = sprintf('%.'.$fmt,$ans); |
if ($high) { |
if ($high) { |
$high=sprintf('%.'.$fmt,$high); |
$high=sprintf('%.'.$fmt,$high); |