[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Thu, 26 Apr 2007 23:15:45 -0000


albertel		Thu Apr 26 19:15:45 2007 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - last of bug#2622, support previous submissions of multiple entry numerical/formula
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.212 loncom/homework/caparesponse/caparesponse.pm:1.213
--- loncom/homework/caparesponse/caparesponse.pm:1.212	Tue Apr 17 19:25:24 2007
+++ loncom/homework/caparesponse/caparesponse.pm	Thu Apr 26 19:15:43 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.212 2007/04/17 23:25:24 albertel Exp $
+# $Id: caparesponse.pm,v 1.213 2007/04/26 23:15:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -465,7 +465,7 @@
     my @answer=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval,
 					      $response_level);
     &Apache::lonxml::debug('answer is'.join(':',@answer));
-    if (@answer && defined($answer[0])) {
+    if (@answer && $answer[0] =~ /\S/) {
 	$answer{$tag_internal_answer_name}= {'type' => 'ordered',
 					     'answers' => [\@answer] };
     }
@@ -794,7 +794,15 @@
 
 sub format_prior_response_numerical {
     my ($mode,$answer) = @_;
-    #FIXME needs to support multianswer modes
+    if (ref($answer)) {
+	my $result = '<table class="LC_prior_numerical"><tr>';
+	foreach my $element (@{ $answer }) {
+	    $result.= '<td><span class="LC_prior_numerical">'.
+		&HTML::Entities::encode($element,'"<>&').'</span></td>';
+	}
+	$result.='</tr></table>';
+	return $result;
+    }
     return '<span class="LC_prior_numerical">'.
 	    &HTML::Entities::encode($answer,'"<>&').'</span>';