version 1.209, 2007/03/01 02:31:29
|
version 1.214, 2007/05/22 00:45:43
|
Line 465 sub add_in_tag_answer {
|
Line 465 sub add_in_tag_answer {
|
my @answer=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval, |
my @answer=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval, |
$response_level); |
$response_level); |
&Apache::lonxml::debug('answer is'.join(':',@answer)); |
&Apache::lonxml::debug('answer is'.join(':',@answer)); |
if (@answer && defined($answer[0])) { |
if (@answer && $answer[0] =~ /\S/) { |
$answer{$tag_internal_answer_name}= {'type' => 'ordered', |
$answer{$tag_internal_answer_name}= {'type' => 'ordered', |
'answers' => [\@answer] }; |
'answers' => [\@answer] }; |
} |
} |
Line 601 sub end_numericalresponse {
|
Line 601 sub end_numericalresponse {
|
} |
} |
} |
} |
} |
} |
&setup_prior_tries_hash(); |
&Apache::response::setup_prior_tries_hash(\&format_prior_response_numerical); |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.='</td></tr>'.&Apache::edit::end_table; |
$result.='</td></tr>'.&Apache::edit::end_table; |
} elsif ($target eq 'answer' || $target eq 'analyze') { |
} elsif ($target eq 'answer' || $target eq 'analyze') { |
Line 792 sub end_numericalresponse {
|
Line 792 sub end_numericalresponse {
|
return $result; |
return $result; |
} |
} |
|
|
sub setup_prior_tries_hash { |
sub format_prior_response_numerical { |
#FIXME support multi answer numericals/formula |
my ($mode,$answer) = @_; |
my $part=$Apache::inputtags::part; |
if (ref($answer)) { |
my $id=$Apache::inputtags::response[-1]; |
my $result = '<table class="LC_prior_numerical"><tr>'; |
foreach my $i (1..$Apache::lonhomework::history{'version'}) { |
foreach my $element (@{ $answer }) { |
my $key = "$i:resource.$part.$id.submission"; |
$result.= '<td><span class="LC_prior_numerical">'. |
next if (!exists($Apache::lonhomework::history{"$key"})); |
&HTML::Entities::encode($element,'"<>&').'</span></td>'; |
$Apache::inputtags::submission_display{$key} = |
} |
'<pre>'.&HTML::Entities::encode($Apache::lonhomework::history{$key}, |
$result.='</tr></table>'; |
'"<>&').'</pre>'; |
return $result; |
} |
} |
|
return '<span class="LC_prior_numerical">'. |
|
&HTML::Entities::encode($answer,'"<>&').'</span>'; |
|
|
} |
} |
|
|
sub check_for_answer_errors { |
sub check_for_answer_errors { |
Line 824 sub check_for_answer_errors {
|
Line 827 sub check_for_answer_errors {
|
use Data::Dumper; |
use Data::Dumper; |
&Apache::lonxml::debug("count dump is ".&Dumper(\%counts)); |
&Apache::lonxml::debug("count dump is ".&Dumper(\%counts)); |
my $expected_number_of_inputs = (keys(%counts))[0]; |
my $expected_number_of_inputs = (keys(%counts))[0]; |
if ( $expected_number_of_inputs != scalar(@Apache::inputtags::inputlist)) { |
if ( $expected_number_of_inputs > 0 |
|
&& $expected_number_of_inputs != scalar(@Apache::inputtags::inputlist)) { |
&Apache::lonxml::error(&mt("Expected [_1] input fields, but there were only [_2] seen.", |
&Apache::lonxml::error(&mt("Expected [_1] input fields, but there were only [_2] seen.", |
$expected_number_of_inputs, |
$expected_number_of_inputs, |
scalar(@Apache::inputtags::inputlist))); |
scalar(@Apache::inputtags::inputlist))); |
Line 1024 sub get_sigrange {
|
Line 1028 sub get_sigrange {
|
return ($sig_ubound,$sig_lbound); |
return ($sig_ubound,$sig_lbound); |
} |
} |
|
|
|
sub format_prior_response_string { |
|
my ($mode,$answer) =@_; |
|
return '<span class="LC_prior_string">'. |
|
&HTML::Entities::encode($answer,'"<>&').'</span>'; |
|
} |
|
|
sub start_stringresponse { |
sub start_stringresponse { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $result; |
my $result; |
Line 1201 sub end_stringresponse {
|
Line 1211 sub end_stringresponse {
|
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.='</td></tr>'.&Apache::edit::end_table; |
$result.='</td></tr>'.&Apache::edit::end_table; |
|
} elsif ($target eq 'web' || $target eq 'tex') { |
|
&Apache::response::setup_prior_tries_hash(\&format_prior_response_string); |
} |
} |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || |
$target eq 'tex' || $target eq 'analyze') { |
$target eq 'tex' || $target eq 'analyze') { |