--- loncom/homework/caparesponse/caparesponse.pm 2003/03/13 16:20:47 1.82 +++ loncom/homework/caparesponse/caparesponse.pm 2003/03/26 18:44:13 1.86 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.82 2003/03/13 16:20:47 sakharuk Exp $ +# $Id: caparesponse.pm,v 1.86 2003/03/26 18:44:13 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -215,9 +215,6 @@ sub end_numericalresponse { my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval); my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval); my $unit=&Apache::lonxml::get_param_var('unit',$parstack,$safeeval); - if (defined $unit and $Apache::lonhomework::type eq 'exam') { - $result.=' \textit{(in} \verb|'.$unit.'|\textit{)} '; - } my $number_of_bubbles = 8; #default values for number of bubbles my @bubbles_values = (); my @factors = (1.13,1.17,1.25,1.33,1.45); #default values of factors @@ -235,11 +232,11 @@ sub end_numericalresponse { for ($ind=0;$ind<$number_of_bubbles;$ind++) { $bubbles_values[$ind] = $answers[0]*($factor**($power-$powers[$#powers-$ind])); } - my @alphabet = ('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P', - 'Q','R','S','T','U','V','W','X','Y','Z'); + my @alphabet=('A'..'Z'); if ($target eq 'web') { if ($$tagstack[-1] eq 'numericalresponse') { my $id=$Apache::inputtags::response[-1]; + if ($unit=~/\S/) {$result.=' (in '.$unit.')

';} $result.= ''; for ($ind=0;$ind<$number_of_bubbles;$ind++) { my $ans; @@ -262,9 +259,12 @@ sub end_numericalresponse { } $result.='
'; } elsif ($$tagstack[-1] eq 'formularesponse') { - $result.= '

Formula have to be entered here!

'; + $result.= '



'; } } elsif ($target eq 'tex') { + if (defined $unit and $Apache::lonhomework::type eq 'exam') { + $result.=' \textit{(in} \verb|'.$unit.'|\textit{)} '; + } if ($$tagstack[-1] eq 'numericalresponse') { my $max_val = 0; if ($formats[0]=~m/^(\d+)E([^\d]*)(\d*)$/) { @@ -331,7 +331,7 @@ sub end_numericalresponse { $result.='\end{enumerate}'; &Apache::lonxml::increment_counter(); } else { - $result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}'; + $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;