version 1.120, 2005/04/07 06:56:22
|
version 1.124, 2005/08/17 16:52:37
|
Line 71 sub start_hintresponse {
|
Line 71 sub start_hintresponse {
|
my ($parstack,$safeeval)=@_; |
my ($parstack,$safeeval)=@_; |
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval); |
if ($id eq '') { $id = $Apache::lonxml::curdepth; } |
if ($id eq '') { $id = $Apache::lonxml::curdepth; } |
push (@Apache::inputtags::response,$id); |
push (@Apache::inputtags::hint,$id); |
push (@Apache::inputtags::responselist,$id); |
push (@Apache::inputtags::hintlist,$id); |
push (@Apache::inputtags::paramstack,[%Apache::inputtags::params]); |
push (@Apache::inputtags::paramstack,[%Apache::inputtags::params]); |
return $id; |
return $id; |
} |
} |
|
|
sub end_hintresponse { |
sub end_hintresponse { |
pop @Apache::inputtags::response; |
pop @Apache::inputtags::hint; |
if (defined($Apache::inputtags::paramstack[-1])) { |
if (defined($Apache::inputtags::paramstack[-1])) { |
%Apache::inputtags::params= |
%Apache::inputtags::params= |
@{ pop(@Apache::inputtags::paramstack) }; |
@{ pop(@Apache::inputtags::paramstack) }; |
Line 505 sub answer_part {
|
Line 505 sub answer_part {
|
my ($type,$answer) = @_; |
my ($type,$answer) = @_; |
my $result; |
my $result; |
if ($env{'form.answer_output_mode'} eq 'tex') { |
if ($env{'form.answer_output_mode'} eq 'tex') { |
$result = ' \verb|'.$answer.'|\\\\ \hline '; |
my $to_use='|'; |
|
foreach my $value (32..126) { |
|
my $char=pack('c',$value); |
|
if ($answer !~ /\Q$char\E/) { |
|
$to_use=$char; |
|
last; |
|
} |
|
} |
|
$result = '\verb'.$to_use.$answer.$to_use.'\\\\ \hline '; |
} else { |
} else { |
$result = '<td>'.$answer.'</td>'; |
$result = '<td>'.$answer.'</td>'; |
} |
} |
Line 573 sub getresponse {
|
Line 581 sub getresponse {
|
sub repetition { |
sub repetition { |
my $id = $Apache::inputtags::part; |
my $id = $Apache::inputtags::part; |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
my $weight = &Apache::lonnet::EXT("resource.$id.weight"); |
|
if (!defined($weight) || ($weight eq '')) { $weight=1; } |
my $repetition = int $weight/9; |
my $repetition = int $weight/9; |
if ($weight % 9 != 0) {$repetition++;} |
if ($weight % 9 != 0) {$repetition++;} |
return $repetition; |
return $repetition; |
Line 738 sub submitted {
|
Line 747 sub submitted {
|
# if the Submit Answer button for this particular part was pressed |
# if the Submit Answer button for this particular part was pressed |
my $partid=$Apache::inputtags::part; |
my $partid=$Apache::inputtags::part; |
if (defined($env{'form.submit_'.$partid})) { return 1; } |
if (defined($env{'form.submit_'.$partid})) { return 1; } |
|
# Submit All button on a .page was pressed |
|
if (defined($env{'form.all_submit'})) { return 1; } |
# otherwise no submission occured |
# otherwise no submission occured |
return 0; |
return 0; |
} |
} |