--- loncom/homework/response.pm 2005/11/29 18:42:54 1.131
+++ loncom/homework/response.pm 2005/12/06 09:29:34 1.132
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.131 2005/11/29 18:42:54 albertel Exp $
+# $Id: response.pm,v 1.132 2005/12/06 09:29:34 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -592,15 +592,22 @@ sub setup_params {
}
}
+{
+ my @answer_bits;
+
sub answer_header {
my ($type) = @_;
my $result;
if ($env{'form.answer_output_mode'} eq 'tex') {
- $result = ' \vskip 0 mm \begin{tabular}{|c|}\hline Answer for Part: \verb|'.
- $Apache::inputtags::part.'| \\\\ \hline ';
+ undef(@answer_bits);
} else {
- $result = '
Answer for Part:'.
- $Apache::inputtags::part. ' | '."\n";
+ $result = '';
+ if ($Apache::lonhomework::type eq 'exam') {
+ $result .= ''.$Apache::lonxml::counter. ') | ';
+ } else {
+ $result .= 'Answer for Part:'.$Apache::inputtags::part.' | ';
+ }
+ $result .= "\n";
}
return $result;
}
@@ -617,7 +624,9 @@ sub answer_part {
last;
}
}
- $result = '\verb'.$to_use.$answer.$to_use.'\\\\ \hline ';
+ if ($answer ne '') {
+ push(@answer_bits,'\verb'.$to_use.$answer.$to_use);
+ }
} else {
$result = ''.$answer.' | ';
}
@@ -628,13 +637,26 @@ sub answer_footer {
my ($type) = @_;
my $result;
if ($env{'form.answer_output_mode'} eq 'tex') {
- $result = ' \end{tabular} \vskip 0 mm ';
+ my $columns = scalar(@answer_bits)+1;
+ $result = ' \vskip 0 mm \begin{tabular}{|'.'c|'x$columns.'}\hline ';
+ if ($Apache::lonhomework::type eq 'exam') {
+ $result .= $Apache::lonxml::counter.') ';
+ } else {
+ $result .= ' Answer for Part: \verb|'.
+ $Apache::inputtags::part.'| ';
+ }
+ foreach my $bit (@answer_bits) {
+ $result.=' & '.$bit;
+ }
+ $result .= ' \\\\ \\hline \end{tabular} \vskip 0 mm ';
} else {
$result = '
';
}
return $result;
}
+}
+
sub showallfoils {
if (defined($env{'form.showallfoils'})) {
my ($symb)=&Apache::lonxml::whichuser();