[LON-CAPA-cvs] cvs: loncom /homework response.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 06 Dec 2005 10:00:08 -0000
albertel Tue Dec 6 05:00:08 2005 EDT
Modified files:
/loncom/homework response.pm
Log:
- better handling of the header bit
- allow for option increment to the counter (for multiple answer lines per part)
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.132 loncom/homework/response.pm:1.133
--- loncom/homework/response.pm:1.132 Tue Dec 6 04:29:34 2005
+++ loncom/homework/response.pm Tue Dec 6 05:00:08 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.132 2005/12/06 09:29:34 albertel Exp $
+# $Id: response.pm,v 1.133 2005/12/06 10:00:08 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -596,10 +596,18 @@
my @answer_bits;
sub answer_header {
- my ($type) = @_;
+ my ($type,$increment) = @_;
my $result;
if ($env{'form.answer_output_mode'} eq 'tex') {
undef(@answer_bits);
+ my $bit;
+ if ($Apache::lonhomework::type eq 'exam') {
+ $bit = ($Apache::lonxml::counter+$increment).') ';
+ } else {
+ $bit .= ' Answer for Part: \verb|'.
+ $Apache::inputtags::part.'| ';
+ }
+ push(@answer_bits,$bit);
} else {
$result = '<table border="1"><tr>';
if ($Apache::lonhomework::type eq 'exam') {
@@ -637,17 +645,9 @@
my ($type) = @_;
my $result;
if ($env{'form.answer_output_mode'} eq 'tex') {
- 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;
- }
+ my $columns = scalar(@answer_bits);
+ $result = ' \vskip 0 mm \begin{tabular}{|'.'c|'x$columns.'}\hline ';
+ $result .= join(' & ',@answer_bits);
$result .= ' \\\\ \\hline \end{tabular} \vskip 0 mm ';
} else {
$result = '</tr></table>';