--- loncom/homework/hint.pm 2009/06/28 19:40:41 1.76 +++ loncom/homework/hint.pm 2024/09/29 01:58:43 1.79 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # implements the tags that control the hints # -# $Id: hint.pm,v 1.76 2009/06/28 19:40:41 www Exp $ +# $Id: hint.pm,v 1.79 2024/09/29 01:58:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -81,6 +81,10 @@ sub start_hintgroup { } } @Apache::hint::which=(); + if (($#Apache::functionplotresponse::failedrules>=0) && ($target eq 'web')) { + @Apache::hint::which=@Apache::functionplotresponse::failedrules; + undef @Apache::functionplotresponse::failedrules; + } return $result; } @@ -129,6 +133,8 @@ sub start_numericalhint { $token,40). &Apache::loncommon::help_open_topic('Formula_Response_Sampling'); } + $result.=&Apache::edit::text_arg('Pre-Processor Subroutine:','preprocess', + $token,10); $result.=&Apache::edit::end_row(); $result.=&Apache::edit::start_spanning_row(); } elsif ($target eq 'modified') { @@ -136,11 +142,11 @@ sub start_numericalhint { if ($token->[1] eq 'numericalhint') { $constructtag=&Apache::edit::get_new_args($token,$parstack, $safeeval,'name', - 'answer','unit','format'); + 'answer','unit','format','preprocess'); } elsif ($token->[1] eq 'formulahint') { $constructtag=&Apache::edit::get_new_args($token,$parstack, $safeeval,'name','answer', - 'samples'); + 'samples','preprocess'); } if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); @@ -179,16 +185,19 @@ sub end_numericalhint { my $hideunit=&Apache::response::get_response_param($partid.'_'.$submitid,'turnoffunit'); if (lc($hideunit) eq "yes") { delete($$args_ref{'unit'}); } + my $stringify; if ($$tagstack[-1] eq 'formulahint') { if ($$args_ref{'samples'}) { $$args_ref{'type'}='fml'; + $stringify = 1; } else { $$args_ref{'type'}='math'; } } elsif ($$tagstack[-1] eq 'numericalhint') { $$args_ref{'type'}='float'; + $stringify = 1; } - &Apache::caparesponse::add_in_tag_answer($parstack,$safeeval); + &Apache::caparesponse::add_in_tag_answer($parstack,$safeeval,$stringify); my %answer = &Apache::caparesponse::get_answer(); my (@final_awards,@final_msgs,@ans_names); foreach my $ans_name (keys(%answer)) { @@ -377,13 +386,15 @@ sub start_stringhint { [['cs','Case Sensitive'],['ci','Case Insensitive'], ['mc','Case Insensitive, Any Order'], ['re','Regular Expression']],$token); + $result.=&Apache::edit::text_arg('Pre-Processor Subroutine:','preprocess', + $token,10); $result.=&Apache::edit::end_row(); $result.=&Apache::edit::start_spanning_row(); } elsif ($target eq 'modified') { my $constructtag; $constructtag=&Apache::edit::get_new_args($token,$parstack, $safeeval,'name','answer', - 'type'); + 'type','preprocess'); $result = &Apache::edit::rebuild_tag($token); } elsif ($target eq 'web') { &Apache::response::reset_params(); @@ -433,7 +444,11 @@ sub end_stringhint { if ($$args_ref{'type'} eq '') { $$args_ref{'type'} = 'ci'; } - &Apache::caparesponse::add_in_tag_answer($parstack,$safeeval); + my $stringify; + if ($$args_ref{'type'} ne 're') { + $stringify = 1; + } + &Apache::caparesponse::add_in_tag_answer($parstack,$safeeval,$stringify); my (@final_awards,@final_msgs,@ans_names); my %answer = &Apache::caparesponse::get_answer(); foreach my $ans_name (keys(%answer)) {