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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 12 Oct 2006 16:28:21 -0000


albertel		Thu Oct 12 12:28:21 2006 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
  Log:
  - need textline to register itself
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.207 loncom/homework/inputtags.pm:1.208
--- loncom/homework/inputtags.pm:1.207	Fri Sep 29 19:04:37 2006
+++ loncom/homework/inputtags.pm	Thu Oct 12 12:28:21 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.207 2006/09/29 23:04:37 albertel Exp $
+# $Id: inputtags.pm,v 1.208 2006/10/12 16:28:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -283,6 +283,7 @@
 sub start_textline {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $result = "";
+    my $id = &start_input($parstack,$safeeval);
     if ($target eq 'web') {
 	$Apache::lonxml::evaluate--;
 	my $partid=$Apache::inputtags::part;
@@ -321,7 +322,8 @@
 	    }
 	} else {
 	    #right or wrong don't show what was last typed in.
-	    $result='<b>'.$Apache::inputtags::answertxt{$id}.'</b>';
+	    my $count = scalar(@Apache::inputtags::inputlist)-1;
+	    $result='<b>'.$Apache::inputtags::answertxt{$id}[$count].'</b>';
 	    #$result='';
 	}
     } elsif ($target eq 'edit') {
@@ -356,6 +358,7 @@
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     if    ($target eq 'web') { $Apache::lonxml::evaluate++; }
     elsif ($target eq 'edit') { return ('','no'); }
+    &end_input();
     return "";
 }
 
@@ -514,7 +517,7 @@
     my %fwd_awards = map { ($_,$i++) } @awards;
     my $max=scalar(@awards);
     @awards=reverse(@awards);
-    my $i=0;
+    $i=0;
     my %rev_awards = map { ($_,$i++) } @awards;
 
 sub finalizeawards {