--- loncom/homework/caparesponse/caparesponse.pm 2008/09/13 02:08:33 1.233 +++ loncom/homework/caparesponse/caparesponse.pm 2011/02/26 01:45:02 1.236.12.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.233 2008/09/13 02:08:33 raeburn Exp $ +# $Id: caparesponse.pm,v 1.236.12.2 2011/02/26 01:45:02 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -305,14 +305,11 @@ sub start_numericalresponse { my $hideunit=&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoffunit'); &Apache::lonxml::debug("Got unit $hideunit for $partid $id"); #no way to enter units, with radio buttons - if (lc($hideunit) eq "yes") { + if ((lc($hideunit) eq "yes") && ($Apache::lonhomework::type ne 'exam')) { my $unit=&Apache::lonxml::get_param_var('unit',$parstack, $safeeval); if ($unit =~ /\S/) { $result.=" (in $unit) "; } } - if (($token->[1] eq 'formularesponse') && - ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER')) { - } if ( &Apache::response::show_answer() ) { &set_answertext($tag_internal_answer_name,$target,$token,$tagstack, $parstack,$parser,$safeeval,-1); @@ -611,9 +608,8 @@ sub end_numericalresponse { } if (($target eq 'web') && ($tag eq 'formularesponse') && ($Apache::lonhomework::type ne 'exam') && ($Apache::inputtags::status['-1'] eq 'CAN_ANSWER') - && (&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoneditor') ne 'no')){ - $result.=&Apache::response::edit_mathresponse_button($id,"HWVAL_$id"); -#hier + && (&Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.turnoffeditor') ne 'yes')) { + $result.=&Apache::response::edit_mathresponse_button($id,"HWVAL_$id"); } &Apache::response::setup_prior_tries_hash(\&format_prior_response_numerical); @@ -756,16 +752,17 @@ sub end_numericalresponse { if ($ad ne 'EXACT_ANS' && $ad ne 'APPROX_ANS') { my $error; if ($tag eq 'formularesponse') { - $error=&mt('Computer\'s answer is incorrect ("[_1]").',join(', ',@$response)); + $error=&mt("Computer's answer is incorrect ([_1]).",'"'.join(', ',@$response).'"'); } else { # answer failed check if it is sig figs that is failing my ($ad,$msg)=&check_submission($response,$partid,$id, $tag,$parstack, $safeeval,1); + $error=&mt("Computer's answer is incorrect ([_1]).",'"'.join(', ',@$response).'"').' '; if ($sigline ne '') { - $error=&mt('Computer\'s answer is incorrect ("[_1]"). It is likely that the tolerance range [_2] or significant figures [_3] need to be adjusted.',join(', ',@$response),$tolline,$sigline); + $error.=&mt('It is likely that the tolerance range [_1] or significant figures [_2] need to be adjusted.',$tolline,$sigline); } else { - $error=&mt('Computer\'s answer is incorrect ("[_1]"). It is likely that the tolerance range [_2] needs to be adjusted.',join(', ',@$response),$tolline); + $error.=&mt('It is likely that the tolerance range [_1] needs to be adjusted.',$tolline); } } if ($ad ne 'EXACT_ANS' && $ad ne 'APPROX_ANS') { @@ -1082,6 +1079,7 @@ sub start_stringresponse { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $result; my $id = &Apache::response::start_response($parstack,$safeeval); + undef(%answer); if ($target eq 'meta') { $result=&Apache::response::meta_package_write('stringresponse'); } elsif ($target eq 'edit') {