--- loncom/homework/caparesponse/caparesponse.pm 2003/05/13 15:27:45 1.98
+++ loncom/homework/caparesponse/caparesponse.pm 2003/05/19 21:15:21 1.102
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.98 2003/05/13 15:27:45 sakharuk Exp $
+# $Id: caparesponse.pm,v 1.102 2003/05/19 21:15:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -309,7 +309,7 @@ sub end_numericalresponse {
if ($Apache::inputtags::params{'sig'}) {
($sighigh,$siglow)=&get_sigrange($Apache::inputtags::params{'sig'});
}
- if ($fmt) {
+ if ($fmt && $$tagstack[-1] eq 'numericalresponse') {
$ans = sprintf('%.'.$fmt,$ans);
if ($high) {
$high=sprintf('%.'.$fmt,$high);
@@ -317,12 +317,12 @@ sub end_numericalresponse {
}
}
if ($target eq 'answer') {
- if ($high) { $ans.=' ['.$low.','.$high.']'; }
- if ($sighigh) {
- if ($ENV{'form.print_answer'} eq 'yes') {
- $ans.= " Sig \\textit{$siglow - $sighigh}";
+ if ($high && $$tagstack[-1] eq 'numericalresponse') { $ans.=' ['.$low.','.$high.']'; }
+ if ($sighigh && $$tagstack[-1] eq 'numericalresponse') {
+ if ($ENV{'form.answer_output_mode'} eq 'tex') {
+ $ans.= " Sig \\textit{$siglow - $sighigh}";
} else {
- $ans.= " Sig $siglow - $sighigh";
+ $ans.= " Sig $siglow - $sighigh";
}
}
$result.=&Apache::response::answer_part($$tagstack[-1],$ans);
@@ -334,9 +334,10 @@ sub end_numericalresponse {
}
}
}
- if ($unit) {
+ if (defined($unit) and ($unit ne '') and
+ $$tagstack[-1] eq 'numericalresponse') {
if ($target eq 'answer') {
- if ($ENV{'form.print_answer'} eq 'yes') {
+ if ($ENV{'form.answer_output_mode'} eq 'tex') {
$result.=&Apache::response::answer_part($$tagstack[-1],
"Unit: \\verb|$unit|");
} else {
@@ -360,8 +361,13 @@ sub end_numericalresponse {
$string='Formula';
}
if ($target eq 'answer') {
- $result.=&Apache::response::answer_part($$tagstack[-1],
- ''.$string.'');
+ if ($ENV{'form.answer_output_mode'} eq 'tex') {
+ $result.=&Apache::response::answer_part($$tagstack[-1],
+ "\\textbf{$string}");
+ } else {
+ $result.=&Apache::response::answer_part($$tagstack[-1],
+ "$string");
+ }
} elsif ($target eq 'analyze') {
push (@{ $Apache::lonhomework::analyze{"$part_id.type"} },
$type);