[LON-CAPA-cvs] cvs: loncom /homework response.pm /homework/caparesponse caparesponse.pm
www
lon-capa-cvs-allow@mail.lon-capa.org
Thu, 06 Mar 2008 16:28:22 -0000
www Thu Mar 6 11:28:22 2008 EDT
Modified files:
/loncom/homework response.pm
/loncom/homework/caparesponse caparesponse.pm
Log:
Bug #4501: printing answers runs all over the colums. Now takes up more
vertical space, though
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.187 loncom/homework/response.pm:1.188
--- loncom/homework/response.pm:1.187 Fri Feb 1 17:05:45 2008
+++ loncom/homework/response.pm Thu Mar 6 11:28:20 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.187 2008/02/01 22:05:45 raeburn Exp $
+# $Id: response.pm,v 1.188 2008/03/06 16:28:20 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -790,6 +790,8 @@
sub answer_part {
my ($type,$answer,$args) = @_;
+ &Apache::lonxml::debug("In answerpart :$type:$answer:$args:");
+
my $result;
if ($env{'form.answer_output_mode'} eq 'tex') {
if (!$args->{'no_verbatim'}) {
@@ -801,9 +803,13 @@
last;
}
}
- if ($answer ne '') {
- $answer = '\verb'.$to_use.$answer.$to_use;
- }
+ my $answerelements=$answer;
+ $answer='';
+ foreach my $element (split(/[\;\:]/,$answerelements)) {
+ if ($element ne '') {
+ $answer.= '\noindent\verb'.$to_use.$element.$to_use.'\newline';
+ }
+ }
}
if ($answer ne '') {
push(@answer_bits,$answer);
@@ -813,7 +819,8 @@
$result .= '<tr>';
$need_row_start = 0;
}
- $result .= '<td>'.$answer.'</td>';
+ $answer=~s/\; /\<\/nobr\>\<br \/\>\<nobr\>/gs;
+ $result .= '<td><nobr>'.$answer.'</nobr></td>';
}
return $result;
}
@@ -822,8 +829,8 @@
my ($type) = @_;
my $result;
if ($env{'form.answer_output_mode'} eq 'tex') {
- my $columns = scalar(@answer_bits);
- $result = ' \vskip 0 mm \noindent \begin{tabular}{|'.'c|'x$columns.'}\hline ';
+ my $columns = scalar(@answer_bits)-1;
+ $result = ' \vskip 0 mm \noindent \begin{tabular}{|p{1.5cm}|'.'p{3cm}|'x$columns.'}\hline ';
$result .= join(' & ',@answer_bits);
$result .= ' \\\\ \\hline \end{tabular} \vskip 0 mm ';
} else {
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.222 loncom/homework/caparesponse/caparesponse.pm:1.223
--- loncom/homework/caparesponse/caparesponse.pm:1.222 Wed Mar 5 21:48:23 2008
+++ loncom/homework/caparesponse/caparesponse.pm Thu Mar 6 11:28:22 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.222 2008/03/06 02:48:23 www Exp $
+# $Id: caparesponse.pm,v 1.223 2008/03/06 16:28:22 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -678,12 +678,12 @@
#}
}
if ($high && $tag eq 'numericalresponse') {
- $element.=' ['.$low.','.$high.']';
+ $element.=': ['.$low.','.$high.']';
$tolline .= "[$low, $high]";
}
if (defined($sighigh) && $tag eq 'numericalresponse') {
if ($env{'form.answer_output_mode'} eq 'tex') {
- $element.= " Sig $siglow - $sighigh";
+ $element.= ": Sig $siglow - $sighigh";
} else {
$element.= " Sig <i>$siglow - $sighigh</i>";
$sigline .= "[$siglow, $sighigh]";
@@ -703,7 +703,7 @@
}
}
if ($target eq 'answer') {
- $result.= &Apache::response::answer_part($tag,join(', ',@all_answer_info));
+ $result.= &Apache::response::answer_part($tag,join('; ',@all_answer_info));
}
}