[LON-CAPA-cvs] cvs: loncom /homework response.pm /homework/caparesponse caparesponse.pm
www
lon-capa-cvs-allow@mail.lon-capa.org
Sat, 05 Apr 2008 15:39:21 -0000
www Sat Apr 5 11:39:21 2008 EDT
Modified files:
/loncom/homework response.pm
/loncom/homework/caparesponse caparesponse.pm
Log:
Bug #4501: answer display too wide for columns
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.188 loncom/homework/response.pm:1.189
--- loncom/homework/response.pm:1.188 Thu Mar 6 11:28:20 2008
+++ loncom/homework/response.pm Sat Apr 5 11:39:17 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# various response type definitons response definition
#
-# $Id: response.pm,v 1.188 2008/03/06 16:28:20 www Exp $
+# $Id: response.pm,v 1.189 2008/04/05 15:39:17 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -790,8 +790,6 @@
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'}) {
@@ -803,12 +801,12 @@
last;
}
}
- my $answerelements=$answer;
+ my $fullanswer=$answer;
$answer='';
- foreach my $element (split(/[\;\:]/,$answerelements)) {
- if ($element ne '') {
- $answer.= '\noindent\verb'.$to_use.$element.$to_use.'\newline';
- }
+ foreach my $element (split(/[\;]/,$fullanswer)) {
+ if ($element ne '') {
+ $answer.= '\verb'.$to_use.$element.$to_use.' \newline';
+ }
}
}
if ($answer ne '') {
@@ -819,8 +817,7 @@
$result .= '<tr>';
$need_row_start = 0;
}
- $answer=~s/\; /\<\/nobr\>\<br \/\>\<nobr\>/gs;
- $result .= '<td><nobr>'.$answer.'</nobr></td>';
+ $result .= '<td>'.$answer.'</td>';
}
return $result;
}
@@ -829,10 +826,13 @@
my ($type) = @_;
my $result;
if ($env{'form.answer_output_mode'} eq 'tex') {
- 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 ';
+ $result = ' \vskip 0 mm \noindent \begin{tabular}{|p{1.5cm}|p{6.8cm}|}\hline ';
+ $result .= $answer_bits[0].'&\vspace*{-4mm}\begin{itemize}';
+ for (my $i=1;$i<=$#answer_bits;$i++) {
+ $result.='\item '.$answer_bits[$i].'\vspace*{-7mm}';
+ }
+ $result .= ' \end{itemize} \\\\ \hline \end{tabular} \vskip 0 mm ';
+ &Apache::lonnet::logthis('Result: '.$result);
} else {
if (!$need_row_start) {
$result .= '</tr>';
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.223 loncom/homework/caparesponse/caparesponse.pm:1.224
--- loncom/homework/caparesponse/caparesponse.pm:1.223 Thu Mar 6 11:28:22 2008
+++ loncom/homework/caparesponse/caparesponse.pm Sat Apr 5 11:39:20 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.223 2008/03/06 16:28:22 www Exp $
+# $Id: caparesponse.pm,v 1.224 2008/04/05 15:39:20 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]";