--- loncom/homework/caparesponse/caparesponse.pm 2002/11/08 20:36:27 1.71 +++ loncom/homework/caparesponse/caparesponse.pm 2002/12/02 17:06:09 1.75 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.71 2002/11/08 20:36:27 sakharuk Exp $ +# $Id: caparesponse.pm,v 1.75 2002/12/02 17:06:09 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -113,6 +113,8 @@ sub start_numericalresponse { } } elsif ($target eq 'meta') { $result=&Apache::response::meta_package_write('numericalresponse'); + } elsif ($target eq 'answer' || $target eq 'grade') { + &Apache::response::reset_params(); } return $result; } @@ -120,6 +122,9 @@ sub start_numericalresponse { sub end_numericalresponse { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $result = ''; + if (!$Apache::lonxml::default_homework_loaded) { + &Apache::lonxml::default_homework_load($safeeval); + } if ( $target eq 'grade' ) { if ( defined $ENV{'form.submitted'}) { &Apache::response::setup_params($$tagstack[-1]); @@ -170,7 +175,7 @@ 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{'; + #$result='\vskip 0 mm The correct answer is \\texttt{'; } for (my $i=0; $i <= $#answers; $i++) { my $answer=$answers[$i]; @@ -188,15 +193,18 @@ sub end_numericalresponse { &Apache::lonxml::debug("no format answer :$answer:"); $formatted="$answer,"; } - if ($target eq 'tex') {$formatted=&Apache::lonxml::latex_special_symbols($formatted);} - $result.=$formatted; - } + if ($target eq 'tex') { + $formatted=''; + #$formatted=&Apache::lonxml::latex_special_symbols($formatted); + } + $result.=$formatted; + } chop $result; if ($target eq 'web') { $result.=" $unit.
"; } elsif ($target eq 'tex') { - $result.=&Apache::lonxml::latex_special_symbols($unit); - $result.="}. \\vskip 0 mm "; + #$result.=&Apache::lonxml::latex_special_symbols($unit); + #$result.="}. \\vskip 0 mm "; } } if ($Apache::lonhomework::type eq 'exam') { @@ -355,8 +363,8 @@ sub end_numericalresponse { } } if ($target eq 'answer') { - if ($high) { $ans.=' ['.$low.','.$high.'] '; } - if ($sighigh) { $ans.= "Sig $siglow - $sighigh"; } + if ($high) { $ans.=' ['.$low.','.$high.']'; } + if ($sighigh) { $ans.= " Sig $siglow - $sighigh"; } $result.=&Apache::response::answer_part($$tagstack[-1],$ans); } elsif ($target eq 'analyze') { push (@{ $Apache::lonhomework::analyze{"$part_id.answer"} },