version 1.184, 2005/12/06 10:01:57
|
version 1.188, 2006/03/09 00:41:13
|
Line 191 sub start_numericalresponse {
|
Line 191 sub start_numericalresponse {
|
$safeeval); |
$safeeval); |
for (my $i=0; $i <= $#answers; $i++) { |
for (my $i=0; $i <= $#answers; $i++) { |
my $answer=$answers[$i]; |
my $answer=$answers[$i]; |
my $format; |
if ( scalar(@$tagstack) |
if ($#formats > 0) { |
&& $tagstack->[-1] ne 'numericalresponse') { |
$format=$formats[$i]; |
$answertxt.=$answer.','; |
} else { |
} else { |
$format=$formats[0]; |
my $format; |
|
if ($#formats > 0) { |
|
$format=$formats[$i]; |
|
} else { |
|
$format=$formats[0]; |
|
} |
|
if ($unit=~/\$/) { $format="\$".$format; $unit=~s/\$//g; } |
|
if ($unit=~/\,/) { $format="\,".$format; $unit=~s/\,//g; } |
|
my $formatted=&format_number($answer,$format,$target, |
|
$safeeval); |
|
$answertxt.=$formatted.','; |
} |
} |
if ($unit=~/\$/) { $format="\$".$format; $unit=~s/\$//g; } |
|
if ($unit=~/\,/) { $format="\,".$format; $unit=~s/\,//g; } |
|
my $formatted=&format_number($answer,$format,$target, |
|
$safeeval); |
|
$answertxt.=$formatted.','; |
|
} |
} |
chop $answertxt; |
chop $answertxt; |
if ($target eq 'web') { |
if ($target eq 'web') { |
Line 357 sub end_numericalresponse {
|
Line 362 sub end_numericalresponse {
|
$bubble_display->[$ind].'</td>'; |
$bubble_display->[$ind].'</td>'; |
} |
} |
$result.='</tr></table>'; |
$result.='</tr></table>'; |
} elsif ($tag eq 'formularesponse') { |
|
$result.= '<br /><br /><font color="red"> |
|
<textarea name="HWVAL_'.$id.'" rows="4" cols="50"> |
|
</textarea></font> <br /><br />'; |
|
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
if ((defined $unit) and ($unit=~/\S/) and ($Apache::lonhomework::type eq 'exam')) { |
if ((defined $unit) and ($unit=~/\S/) and ($Apache::lonhomework::type eq 'exam')) { |
Line 388 sub end_numericalresponse {
|
Line 389 sub end_numericalresponse {
|
} |
} |
$result.='\end{enumerate}'; |
$result.='\end{enumerate}'; |
} else { |
} else { |
$result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}'; |
$increment = &Apache::response::repetition(); |
my $repetition = &Apache::response::repetition(); |
|
$result.='\begin{enumerate}'; |
|
for (my $i=0;$i<$repetition;$i++) { |
|
$result.='\item[\textbf{'.($Apache::lonxml::counter+$i).'}.]\textit{Leave blank on scoring form}\vskip 0 mm'; |
|
} |
|
$increment=$repetition; |
|
$result.= '\end{enumerate}'; |
|
} |
} |
} |
} |
} |
} |
Line 422 sub end_numericalresponse {
|
Line 416 sub end_numericalresponse {
|
|
|
if ($target eq 'answer') { |
if ($target eq 'answer') { |
$result.=&Apache::response::answer_header($tag); |
$result.=&Apache::response::answer_header($tag); |
if ($Apache::lonhomework::type eq 'exam') { |
if ($tag eq 'numericalresponse' |
|
&& $Apache::lonhomework::type eq 'exam') { |
my ($bubble_values,undef,$correct) = &make_numerical_bubbles($partid, |
my ($bubble_values,undef,$correct) = &make_numerical_bubbles($partid, |
$id,$target,$parstack,$safeeval); |
$id,$target,$parstack,$safeeval); |
$result.=&Apache::response::answer_part($tag,$correct); |
$result.=&Apache::response::answer_part($tag,$correct); |
Line 603 sub format_number {
|
Line 598 sub format_number {
|
my $ans; |
my $ans; |
if ($format eq '') { |
if ($format eq '') { |
#What is the number? (integer,decimal,floating point) |
#What is the number? (integer,decimal,floating point) |
if ($number=~/^(\d*\.?\d*)(E|e)(\d*)$/) { |
if ($number=~/^(\d*\.?\d*)(E|e)[+\-]?(\d*)$/) { |
$format = '3e'; |
$format = '3e'; |
} elsif ($number=~/^(\d*)\.(\d*)$/) { |
} elsif ($number=~/^(\d*)\.(\d*)$/) { |
$format = '4f'; |
$format = '4f'; |
Line 850 sub end_stringresponse {
|
Line 845 sub end_stringresponse {
|
$Apache::lonhomework::results{"resource.$part.$id.awardmsg"}=$msg; |
$Apache::lonhomework::results{"resource.$part.$id.awardmsg"}=$msg; |
} |
} |
} |
} |
} elsif ($target eq 'web' || $target eq 'tex') { |
|
my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"}; |
|
my $status = $Apache::inputtags::status['-1']; |
|
if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') { |
|
$result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}'; |
|
$increment = &Apache::response::repetition(); |
|
$result.='\begin{enumerate}'; |
|
for (my $i=0;$i<$increment;$i++) { |
|
$result.='\item[\textbf{'.($Apache::lonxml::counter+$i). |
|
'}.]\textit{Leave blank on scoring form}\vskip 0 mm'; |
|
} |
|
$result.= '\end{enumerate}'; |
|
} |
|
} elsif ($target eq 'answer' || $target eq 'analyze') { |
} elsif ($target eq 'answer' || $target eq 'analyze') { |
if ($target eq 'analyze') { |
if ($target eq 'analyze') { |
push (@{ $Apache::lonhomework::analyze{"parts"} },"$part.$id"); |
push (@{ $Apache::lonhomework::analyze{"parts"} },"$part.$id"); |