version 1.73, 2003/04/30 21:19:13
|
version 1.77, 2003/05/14 13:33:00
|
Line 83 sub setrandomnumber {
|
Line 83 sub setrandomnumber {
|
$rndseed=$ENV{'form.rndseed'}; |
$rndseed=$ENV{'form.rndseed'}; |
if (!$rndseed) { $rndseed=time; } |
if (!$rndseed) { $rndseed=time; } |
} else { |
} else { |
my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); |
$rndseed=&Apache::lonnet::rndseed(); |
$rndseed=&Apache::lonnet::rndseed($symb,$courseid,$domain,$name); |
|
} |
} |
&Apache::lonxml::debug("randseed $rndseed"); |
&Apache::lonxml::debug("randseed $rndseed"); |
# $rndseed=unpack("%32i",$rndseed); |
# $rndseed=unpack("%32i",$rndseed); |
$rndseed=$rndseed |
my $rndmod=(&Apache::lonnet::numval($Apache::inputtags::part) << 10); |
+(&Apache::lonnet::numval($Apache::inputtags::part) << 10); |
|
if (defined($Apache::inputtags::response['-1'])) { |
if (defined($Apache::inputtags::response['-1'])) { |
$rndseed=$rndseed |
$rndmod+=&Apache::lonnet::numval($Apache::inputtags::response[-1]); |
+&Apache::lonnet::numval($Apache::inputtags::response['-1']); |
|
} |
} |
&Math::Random::random_set_seed_from_phrase($rndseed); |
if ($rndseed =~/,/) { |
|
my ($num1,$num2)=split(/,/,$rndseed); |
|
$num1+=$rndmod; |
|
$num2+=$rndmod; |
|
$rndseed="$num1,$num2"; |
|
} else { |
|
$rndseed+=$rndmod; |
|
} |
|
&Apache::lonnet::setup_random_from_rndseed($rndseed); |
&Apache::lonxml::debug("randseed $rndseed"); |
&Apache::lonxml::debug("randseed $rndseed"); |
return ''; |
return ''; |
} |
} |
Line 358 sub setup_params {
|
Line 363 sub setup_params {
|
sub answer_header { |
sub answer_header { |
my ($type) = @_; |
my ($type) = @_; |
my $result; |
my $result; |
if ($type eq 'optionresponse' || $type eq 'radiobuttonresponse' ) { |
if ($ENV{'form.answer_output_mode'} eq 'tex') { |
$result = '<table border="1"><tr><th>Answer for Part:'. |
$result = ' \vskip 0 mm \begin{tabular}{|c|}\hline Answer for Part: '. |
$Apache::inputtags::part. '</th></tr><tr>'."\n"; |
$Apache::inputtags::part.' \\\\ \hline '; |
} else { |
} else { |
$result = '<table border="1"><tr><td>Answer for Part:'. |
if ($type eq 'optionresponse' || $type eq 'radiobuttonresponse' ) { |
$Apache::inputtags::part. '</td>'."\n"; |
$result = '<table border="1"><tr><th>Answer for Part:'. |
|
$Apache::inputtags::part. '</th></tr><tr>'."\n"; |
|
} else { |
|
$result = '<table border="1"><tr><td>Answer for Part:'. |
|
$Apache::inputtags::part. '</td>'."\n"; |
|
} |
} |
} |
return $result; |
return $result; |
} |
} |
Line 371 sub answer_header {
|
Line 381 sub answer_header {
|
sub answer_part { |
sub answer_part { |
my ($type,$answer) = @_; |
my ($type,$answer) = @_; |
my $result; |
my $result; |
if ($type eq 'optionresponse' || $type eq 'radiobuttonresponse') { |
if ($ENV{'form.answer_output_mode'} eq 'tex') { |
$result = '<td>'.$answer.'</td>'; |
$result = ' '.$answer.'\\\\ \hline '; |
} else { |
} else { |
$result = '<td>'.$answer.'</td>'; |
if ($type eq 'optionresponse' || $type eq 'radiobuttonresponse') { |
|
$result = '<td>'.$answer.'</td>'; |
|
} else { |
|
$result = '<td>'.$answer.'</td>'; |
|
} |
} |
} |
return $result; |
return $result; |
} |
} |
Line 382 sub answer_part {
|
Line 396 sub answer_part {
|
sub answer_footer { |
sub answer_footer { |
my ($type) = @_; |
my ($type) = @_; |
my $result; |
my $result; |
if ($type eq 'optionresponse' || $type eq 'radiobuttonresponse') { |
if ($ENV{'form.answer_output_mode'} eq 'tex') { |
$result = '</tr></table>'; |
$result = ' \end{tabular} \vskip 0 mm '; |
} else { |
} else { |
$result = '</tr></table>'; |
if ($type eq 'optionresponse' || $type eq 'radiobuttonresponse') { |
|
$result = '</tr></table>'; |
|
} else { |
|
$result = '</tr></table>'; |
|
} |
} |
} |
return $result; |
return $result; |
} |
} |