--- loncom/homework/inputtags.pm 2004/03/12 21:14:54 1.135 +++ loncom/homework/inputtags.pm 2005/08/02 18:05:25 1.173 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.135 2004/03/12 21:14:54 albertel Exp $ +# $Id: inputtags.pm,v 1.173 2005/08/02 18:05:25 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,6 +30,7 @@ use HTML::Entities(); use strict; use Apache::loncommon; use Apache::lonlocal; +use Apache::lonnet; BEGIN { &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline')); @@ -42,9 +43,13 @@ sub initialize_inputtags { # list of all input ids seen in this problem @Apache::inputtags::inputlist=(); # list of all current response ids - @Apache::inputtags::response=(); + @Apache::inputtags::hint=(); # list of all response ids seen in this problem @Apache::inputtags::responselist=(); + # list of all current hint ids + @Apache::inputtags::response=(); + # list of all hint ids seen in this problem + @Apache::inputtags::hintlist=(); # list of whether or not a specific response was previously used @Apache::inputtags::previous=(); # submission it was used in @@ -65,12 +70,16 @@ sub initialize_inputtags { @Apache::inputtags::importlist=(); # just used to note whether we have seen a response that isn't in a part $Apache::inputtags::response_with_no_part=0; + # storage location so the begin <*response> tag can generate the correct + # answer string for display by the + %Apache::inputtags::answertxt=(); } sub check_for_duplicate_ids { my %check; foreach my $id (@Apache::inputtags::partlist, @Apache::inputtags::responselist, + @Apache::inputtags::hintlist, @Apache::inputtags::importlist) { $check{$id}++; } @@ -118,19 +127,21 @@ sub start_textfield { $Apache::lonxml::evaluate--; if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { my $partid=$Apache::inputtags::part; - my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"}); + my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"},'<>&"'); my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval); if ( $cols eq '') { $cols = 80; } my $rows = &Apache::lonxml::get_param('rows',$parstack,$safeeval); - if ( $rows eq '') { $rows = 10; } + if ( $rows eq '') { $rows = 16; } my $addchars=&Apache::lonxml::get_param('addchars',$parstack,$safeeval); $result=''; if ($addchars) { $result.=&addchars('HWVAL_'.$resid,$addchars); } - $result.= '