--- loncom/homework/inputtags.pm 2009/04/16 14:45:47 1.257 +++ loncom/homework/inputtags.pm 2010/12/21 14:56:03 1.271.2.3 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.257 2009/04/16 14:45:47 onken Exp $ +# $Id: inputtags.pm,v 1.271.2.3 2010/12/21 14:56:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -53,6 +53,7 @@ package Apache::inputtags; use HTML::Entities(); use strict; use Apache::loncommon; +use Apache::lonhtmlcommon; use Apache::lonlocal; use Apache::lonnet; use LONCAPA; @@ -174,7 +175,18 @@ sub start_textfield { if ($target eq 'web') { $Apache::lonxml::evaluate--; my $partid=$Apache::inputtags::part; - my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"},'<>&"'); + my ($oldresponse,$newvariation); + if ((($Apache::lonhomework::history{"resource.$partid.type"} eq 'randomizetry') || + ($Apache::lonhomework::type eq 'randomizetry')) && + ($Apache::inputtags::status[-1] eq 'CAN_ANSWER')) { + if ($env{'form.'.$partid.'.rndseed'} ne + $Apache::lonhomework::history{"resource.$partid.rndseed"}) { + $newvariation = 1; + } + } + unless ($newvariation) { + $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$resid.submission"},'<>&"'); + } if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval); if ( $cols eq '') { $cols = 80; } @@ -185,9 +197,10 @@ sub start_textfield { if ($addchars) { $result.=&addchars('HWVAL_'.$resid,$addchars); } - &Apache::lonhtmlcommon::add_htmlareafields('HWVAL_'.$resid); + my $textareaclass = 'class="LC_richDetectHtml"'; $result.= '