version 1.146, 2006/08/01 14:41:46
|
version 1.148, 2006/10/17 17:09:44
|
Line 686 sub setup_params {
|
Line 686 sub setup_params {
|
|
|
{ |
{ |
my @answer_bits; |
my @answer_bits; |
|
my $need_row_start; |
|
|
sub answer_header { |
sub answer_header { |
my ($type,$increment) = @_; |
my ($type,$increment,$rows) = @_; |
my $result; |
my $result; |
if ($env{'form.answer_output_mode'} eq 'tex') { |
if ($env{'form.answer_output_mode'} eq 'tex') { |
undef(@answer_bits); |
undef(@answer_bits); |
Line 701 sub answer_header {
|
Line 702 sub answer_header {
|
} |
} |
push(@answer_bits,$bit); |
push(@answer_bits,$bit); |
} else { |
} else { |
|
my $td = '<td '.(defined($rows)?'rowspan="'.$rows.'"':'').'>'; |
$result = '<table border="1"><tr>'; |
$result = '<table border="1"><tr>'; |
if ($Apache::lonhomework::type eq 'exam') { |
if ($Apache::lonhomework::type eq 'exam') { |
$result .= '<td>'.($Apache::lonxml::counter+$increment). ')</td>'; |
$result .= $td.($Apache::lonxml::counter+$increment). ')</td>'; |
} else { |
} else { |
$result .= '<td>Answer for Part:'.$Apache::inputtags::part.'</td>'; |
$result .= $td.&mt('Answer for Part: [_1]', |
|
$Apache::inputtags::part).'</td>'; |
} |
} |
$result .= "\n"; |
$result .= "\n"; |
|
$need_row_start = 0; |
|
} |
|
return $result; |
|
} |
|
|
|
sub next_answer { |
|
my ($type) = @_; |
|
my $result; |
|
if ($env{'form.answer_output_mode'} eq 'tex') { |
|
# FIXME ... need to do something with tex mode |
|
} else { |
|
$result .= "</tr>"; |
|
$need_row_start = 1; |
} |
} |
return $result; |
return $result; |
} |
} |
|
|
sub answer_part { |
sub answer_part { |
my ($type,$answer) = @_; |
my ($type,$answer,$args) = @_; |
my $result; |
my $result; |
if ($env{'form.answer_output_mode'} eq 'tex') { |
if ($env{'form.answer_output_mode'} eq 'tex') { |
my $to_use='|'; |
if (!$args->{'no_verbatim'}) { |
foreach my $value (32..126) { |
my $to_use='|'; |
my $char=pack('c',$value); |
foreach my $value (32..126) { |
if ($answer !~ /\Q$char\E/) { |
my $char=pack('c',$value); |
$to_use=$char; |
if ($answer !~ /\Q$char\E/) { |
last; |
$to_use=$char; |
|
last; |
|
} |
|
} |
|
if ($answer ne '') { |
|
$answer = '\verb'.$to_use.$answer.$to_use; |
} |
} |
} |
} |
if ($answer ne '') { |
if ($answer ne '') { |
push(@answer_bits,'\verb'.$to_use.$answer.$to_use); |
push(@answer_bits,$answer); |
} |
} |
} else { |
} else { |
$result = '<td>'.$answer.'</td>'; |
if ($need_row_start) { |
|
$result .= '<tr>'; |
|
$need_row_start = 0; |
|
} |
|
$result .= '<td>'.$answer.'</td>'; |
} |
} |
return $result; |
return $result; |
} |
} |