--- loncom/homework/inputtags.pm 2010/08/07 19:24:03 1.266 +++ loncom/homework/inputtags.pm 2011/03/07 22:38:09 1.285 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.266 2010/08/07 19:24:03 raeburn Exp $ +# $Id: inputtags.pm,v 1.285 2011/03/07 22:38:09 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -175,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; } @@ -186,7 +197,6 @@ sub start_textfield { if ($addchars) { $result.=&addchars('HWVAL_'.$resid,$addchars); } - $result .= &Apache::lonhtmlcommon::htmlareaselectactive(); my $textareaclass = 'class="LC_richDetectHtml"'; $result.= '