--- loncom/homework/inputtags.pm 2006/03/09 01:11:12 1.190 +++ loncom/homework/inputtags.pm 2008/07/26 19:11:23 1.244 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.190 2006/03/09 01:11:12 albertel Exp $ +# $Id: inputtags.pm,v 1.244 2008/07/26 19:11:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,6 +31,8 @@ use strict; use Apache::loncommon; use Apache::lonlocal; use Apache::lonnet; +use LONCAPA; + BEGIN { &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline')); @@ -67,6 +69,10 @@ BEGIN { # %Apache::inputtags::answertxt - <*response> tags store correct # answer strings for display by # in this hash. +# %Apache::inputtags::submission_display +# - <*response> tags store improved display +# of submission strings for display by part +# end. sub initialize_inputtags { @Apache::inputtags::input=(); @@ -85,6 +91,7 @@ sub initialize_inputtags { @Apache::inputtags::importlist=(); $Apache::inputtags::response_with_no_part=0; %Apache::inputtags::answertxt=(); + %Apache::inputtags::submission_display=(); } sub check_for_duplicate_ids { @@ -108,8 +115,7 @@ sub check_for_duplicate_ids { sub start_input { my ($parstack,$safeeval)=@_; - my $id = &Apache::lonxml::get_param('id',$parstack,$safeeval); - if ($id eq '') { $id = $Apache::lonxml::curdepth; } + my $id = &Apache::lonxml::get_id($parstack,$safeeval); push (@Apache::inputtags::input,$id); push (@Apache::inputtags::inputlist,$id); return $id; @@ -137,9 +143,9 @@ sub start_textfield { my $resid=$Apache::inputtags::response[-1]; if ($target eq 'web') { $Apache::lonxml::evaluate--; + my $partid=$Apache::inputtags::part; + my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"},'<>&"'); 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 $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval); if ( $cols eq '') { $cols = 80; } my $rows = &Apache::lonxml::get_param('rows',$parstack,$safeeval); @@ -149,7 +155,7 @@ sub start_textfield { if ($addchars) { $result.=&addchars('HWVAL_'.$resid,$addchars); } - push @Apache::lonxml::htmlareafields,'HWVAL_'.$resid; + &Apache::lonhtmlcommon::add_htmlareafields('HWVAL_'.$resid); $result.= '