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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 14 Dec 2006 04:31:35 -0000


albertel		Wed Dec 13 23:31:35 2006 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  - hiddenline works with new numerical/formula semantics
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.210 loncom/homework/inputtags.pm:1.211
--- loncom/homework/inputtags.pm:1.210	Wed Nov  1 18:24:52 2006
+++ loncom/homework/inputtags.pm	Wed Dec 13 23:31:32 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.210 2006/11/01 23:24:52 albertel Exp $
+# $Id: inputtags.pm,v 1.211 2006/12/14 04:31:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -372,12 +372,18 @@
 sub start_hiddenline {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $result = "";
+    my $input_id = &start_input($parstack,$safeeval);
     if ($target eq 'web') {
 	$Apache::lonxml::evaluate--;
 	if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
 	    my $partid=$Apache::inputtags::part;
 	    my $id=$Apache::inputtags::response[-1];
-	    my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"},'<>&"');
+	    my $oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"};
+	    if (ref($oldresponse) eq 'ARRAY') {
+		$oldresponse = $oldresponse->[$#Apache::inputtags::inputlist];
+	    }
+	    $oldresponse = &HTML::Entities::encode($oldresponse,'<>&"');
+
 	    if ($Apache::lonhomework::type ne 'exam') {
 		$result= '<input type="hidden" name="HWVAL_'.$id.'" value="'.
 		    $oldresponse.'" />';
@@ -400,6 +406,7 @@
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     if    ($target eq 'web') { $Apache::lonxml::evaluate++; }
     elsif ($target eq 'edit') { return ('','no'); }
+    &end_input();
     return "";
 }