--- loncom/homework/inputtags.pm 2006/09/29 23:04:37 1.207
+++ loncom/homework/inputtags.pm 2006/11/01 23:24:52 1.210
@@ -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.210 2006/11/01 23:24:52 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -283,6 +283,7 @@ sub needs_exam_box {
sub start_textline {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my $result = "";
+ my $input_id = &start_input($parstack,$safeeval);
if ($target eq 'web') {
$Apache::lonxml::evaluate--;
my $partid=$Apache::inputtags::part;
@@ -293,7 +294,14 @@ sub start_textline {
if ($size eq '') { $size=20; } else {
if ($size < 20) { $maxlength=$size; }
}
- my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"},'<>&"');
+ my $oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"};
+ &Apache::lonxml::debug("oldresponse $oldresponse is ".ref($oldresponse));
+
+ if (ref($oldresponse) eq 'ARRAY') {
+ $oldresponse = $oldresponse->[$#Apache::inputtags::inputlist];
+ }
+ $oldresponse = &HTML::Entities::encode($oldresponse,'<>&"');
+
if ($Apache::lonhomework::type ne 'exam') {
my $addchars=&Apache::lonxml::get_param('addchars',$parstack,$safeeval);
$result='';
@@ -321,7 +329,8 @@ sub start_textline {
}
} else {
#right or wrong don't show what was last typed in.
- $result=''.$Apache::inputtags::answertxt{$id}.'';
+ my $count = scalar(@Apache::inputtags::inputlist)-1;
+ $result=''.$Apache::inputtags::answertxt{$id}[$count].'';
#$result='';
}
} elsif ($target eq 'edit') {
@@ -356,6 +365,7 @@ sub end_textline {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
if ($target eq 'web') { $Apache::lonxml::evaluate++; }
elsif ($target eq 'edit') { return ('','no'); }
+ &end_input();
return "";
}
@@ -459,7 +469,7 @@ sub show_past_portfile_submission {
}
my (@file_list,@bad_file_list);
foreach my $file (split(/\s*,\s*/,&unescape($Apache::lonhomework::history{"resource.$part.$id.portfiles"}))) {
- my (undef,undef,$domain,$user)=&Apache::lonxml::whichuser();
+ my (undef,undef,$domain,$user)=&Apache::lonnet::whichuser();
my $url="/uploaded/$domain/$user/portfolio$file";
my $icon=&Apache::loncommon::icon($url);
push(@file_list,'';