--- loncom/homework/caparesponse/caparesponse.pm 2003/04/08 04:17:13 1.92 +++ 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.92 2003/04/08 04:17: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') { @@ -242,13 +248,10 @@ sub end_numericalresponse { $result.='\end{enumerate}'; } else { $result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}'; - my $id = $Apache::inputtags::part; - my $weight = &Apache::lonnet::EXT("resource.$id.weight"); - my $repetition = int $weight/9; - if ($weight % 9 != 0) {$repetition++;} + my $repetition = &Apache::response::repetition(); $result.='\begin{enumerate}'; for (my $i=0;$i<$repetition;$i++) { - $result.='\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Leave blank on scoring form}\vskip 0 mm'; + $result.='\item[\textbf{'.($Apache::lonxml::counter+$i).'}.]\textit{Leave blank on scoring form}\vskip 0 mm'; } $increment=$repetition; $result.= '\end{enumerate}';