version 1.78, 2003/02/27 20:31:34
|
version 1.84, 2003/03/21 15:33:46
|
Line 144 sub end_numericalresponse {
|
Line 144 sub end_numericalresponse {
|
$response =~ s/\'/\\\'/g; |
$response =~ s/\'/\\\'/g; |
&Apache::lonxml::debug("current $response"); |
&Apache::lonxml::debug("current $response"); |
my $expression="&caparesponse_check_list('".$response."','". |
my $expression="&caparesponse_check_list('".$response."','". |
$$parstack[$#$parstack]; |
$$parstack[-1]; |
foreach my $key (keys(%Apache::inputtags::params)) { |
foreach my $key (keys(%Apache::inputtags::params)) { |
$expression.= ';my $'. #' |
$expression.= ';my $'. #' |
$key.'="'.$Apache::inputtags::params{$key}.'"'; |
$key.'="'.$Apache::inputtags::params{$key}.'"'; |
Line 223 sub end_numericalresponse {
|
Line 223 sub end_numericalresponse {
|
my $powers_number = 8; #default values for number of powers |
my $powers_number = 8; #default values for number of powers |
my $symb; |
my $symb; |
if ($ENV{'form.symb'}=~/___\d+___/) {$symb=$ENV{'form.symb'};} else {$symb=$ENV{'request.symb'};} |
if ($ENV{'form.symb'}=~/___\d+___/) {$symb=$ENV{'form.symb'};} else {$symb=$ENV{'request.symb'};} |
my $randomseed = srand(&Apache::lonnet::rndseed($symb,$ENV{'request.course.id'}, |
|
$ENV{'user.domain'},$ENV{'user.name'})); |
&Apache::response::setrandomnumber(); |
my $ind=1+int(rand()*($factors_number-1)); |
my $ind=&Math::Random::random_uniform_integer(1,0,$#powers); |
my $factor = $factors[$ind]; |
|
$ind=1+int(rand()*($powers_number-1)); |
|
my $power = $powers[$ind]; |
my $power = $powers[$ind]; |
|
$ind=&Math::Random::random_uniform_integer(1,0,$#factors); |
|
my $factor = $factors[$ind]; |
for ($ind=0;$ind<$number_of_bubbles;$ind++) { |
for ($ind=0;$ind<$number_of_bubbles;$ind++) { |
$bubbles_values[$ind] = $answers[0]*$factor**($power-$powers[$powers_number-$ind-1]); |
$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', |
my @alphabet=('A'..'Z'); |
'Q','R','S','T','U','V','W','X','Y','Z'); |
|
if ($target eq 'web') { |
if ($target eq 'web') { |
if ($$tagstack[-1] eq 'numericalresponse') { |
if ($$tagstack[-1] eq 'numericalresponse') { |
my $id=$Apache::inputtags::response[-1]; |
my $id=$Apache::inputtags::response[-1]; |
|
$result.=' (<i>in '.$unit.'</i>)<br /><br />'; |
$result.= '<table border="1"><tr>'; |
$result.= '<table border="1"><tr>'; |
for ($ind=0;$ind<$number_of_bubbles;$ind++) { |
for ($ind=0;$ind<$number_of_bubbles;$ind++) { |
my $ans; |
my $ans; |
Line 262 sub end_numericalresponse {
|
Line 262 sub end_numericalresponse {
|
$result.= '<br /><br /><font color="red"> Formula have to be entered here! </font><br /><br />'; |
$result.= '<br /><br /><font color="red"> Formula have to be entered here! </font><br /><br />'; |
} |
} |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
if (defined $unit and $Apache::lonhomework::type eq 'exam') { |
|
$result.=' \textit{(in} \verb|'.$unit.'|\textit{)} '; |
|
} |
if ($$tagstack[-1] eq 'numericalresponse') { |
if ($$tagstack[-1] eq 'numericalresponse') { |
my $max_val = 0; |
my $max_val = 0; |
if ($formats[0]=~m/^(\d+)E([^\d]*)(\d*)$/) { |
if ($formats[0]=~m/^(\d+)E([^\d]*)(\d*)$/) { |
Line 329 sub end_numericalresponse {
|
Line 332 sub end_numericalresponse {
|
&Apache::lonxml::increment_counter(); |
&Apache::lonxml::increment_counter(); |
} else { |
} else { |
$result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}'; |
$result.='\fbox{\fbox{\parbox{\textwidth-5mm}{\strut\\\\\strut\\\\\strut\\\\\strut\\\\\strut\\\\\strut\\\\}}}'; |
$result.= '\begin{enumerate}\item[\textbf{'.$Apache::lonxml::counter.'}.]\textit{Live blank on scoring form}\vskip 0 mm \end{enumerate}'; |
my $id = $Apache::inputtags::part; |
&Apache::lonxml::increment_counter(); |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
} |
my $repetition = int $weight/9; |
|
if ($weight % 9 != 0) {$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'; |
|
&Apache::lonxml::increment_counter(); |
|
} |
|
$result.= '\end{enumerate}'; |
|
} |
} |
} |
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |