--- loncom/homework/caparesponse/caparesponse.pm 2003/04/18 07:12:13 1.93
+++ loncom/homework/caparesponse/caparesponse.pm 2003/04/21 17:51:46 1.94
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.93 2003/04/18 07:12:13 albertel Exp $
+# $Id: caparesponse.pm,v 1.94 2003/04/21 17:51:46 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -147,7 +147,7 @@ sub end_numericalresponse {
$safeeval);
my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
my $status = $Apache::inputtags::status['-1'];
- if ($award =~ /^correct/ || $status eq "SHOW_ANSWER" ) {
+ if ($award =~ /^correct/ || $status eq "SHOW_ANSWER" || $ENV{'form.texaward'} eq 'SHOW_ANSWER') {
my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
$safeeval);
my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
@@ -155,7 +155,9 @@ sub end_numericalresponse {
if ($target eq 'web') {
$result="
The correct answer is ";
} elsif ($target eq 'tex') {
- #$result='\vskip 0 mm The correct answer is \\texttt{';
+ if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') {
+ $result='\vskip 0 mm The correct answer is \\texttt{ ';
+ }
}
for (my $i=0; $i <= $#answers; $i++) {
my $answer=$answers[$i];
@@ -173,7 +175,9 @@ sub end_numericalresponse {
&Apache::lonxml::debug("no format answer :$answer:");
$formatted="$answer,";
}
-
+ if ($ENV{'form.texaward'} eq 'SHOW_ANSWER') {
+ $result.=$formatted;
+ }
if ($target eq 'tex') {
$formatted='';
#$formatted=&Apache::lonxml::latex_special_symbols($formatted);
@@ -183,9 +187,11 @@ sub end_numericalresponse {
chop $result;
if ($target eq 'web') {
$result.=" $unit.
";
- } elsif ($target eq 'tex') {
- #$result.=&Apache::lonxml::latex_special_symbols($unit);
- #$result.="}. \\vskip 0 mm ";
+ } 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') {