--- loncom/homework/inputtags.pm 2010/08/07 19:24:03 1.266 +++ loncom/homework/inputtags.pm 2012/09/14 11:23:58 1.309 @@ -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.309 2012/09/14 11:23:58 goltermann Exp $ # # Copyright Michigan State University Board of Trustees # @@ -60,7 +60,7 @@ use LONCAPA; BEGIN { - &Apache::lonxml::register('Apache::inputtags',('hiddenline','textfield','textline')); + &Apache::lonxml::register('Apache::inputtags',('hiddensubmission','hiddenline','textfield','textline')); } =pod @@ -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 = $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,11 +197,12 @@ sub start_textfield { if ($addchars) { $result.=&addchars('HWVAL_'.$resid,$addchars); } - $result .= &Apache::lonhtmlcommon::htmlareaselectactive(); - my $textareaclass = 'class="LC_richDetectHtml"'; - $result.= '