--- loncom/homework/hint.pm 2006/12/19 00:49:53 1.66 +++ loncom/homework/hint.pm 2008/10/24 16:22:54 1.72 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # implements the tags that control the hints # -# $Id: hint.pm,v 1.66 2006/12/19 00:49:53 albertel Exp $ +# $Id: hint.pm,v 1.72 2008/10/24 16:22:54 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -68,13 +68,12 @@ sub start_hintgroup { $result .= '\keephidden{'; } elsif ($target eq 'edit') { $result.=&Apache::edit::tag_start($target,$token); - $result.=&Apache::edit::select_arg('Show hint even if problem Correct:','showoncorrect',[['no',&mt('No')],['yes',&mt('Yes')]],$token); + $result.=&Apache::edit::select_arg('Show hint even if problem Correct:','showoncorrect',['no','yes'],$token); $result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row(); } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'showoncorrect'); if ($constructtag) { $result =&Apache::edit::rebuild_tag($token); - $result.=&Apache::edit::handle_insert(); } } @Apache::hint::which=(); @@ -141,7 +140,6 @@ sub start_numericalhint { } if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); - $result .= &Apache::edit::handle_insert(); } } elsif ($target eq 'web') { &Apache::response::reset_params(); @@ -162,7 +160,7 @@ sub end_numericalhint { my $partid=$Apache::inputtags::part; my $id=$Apache::inputtags::hint[-1]; - #id submissions occured under + #id submissions occurred under my $submitid=$Apache::inputtags::response[-1]; my $response = $Apache::lonhomework::history{ @@ -178,7 +176,11 @@ sub end_numericalhint { if (lc($hideunit) eq "yes") { delete($$args_ref{'unit'}); } if ($$tagstack[-1] eq 'formulahint') { - $$args_ref{'type'}='fml'; + if ($$args_ref{'samples'}) { + $$args_ref{'type'}='fml'; + } else { + $$args_ref{'type'}='math'; + } } elsif ($$tagstack[-1] eq 'numericalhint') { $$args_ref{'type'}='float'; } @@ -252,7 +254,6 @@ sub start_mathhint { $safeeval,'name','cas', 'args'); $result = &Apache::edit::rebuild_tag($token); - $result .= &Apache::edit::handle_insert(); } elsif ($target eq 'web') { &Apache::response::reset_params(); } @@ -310,7 +311,6 @@ sub start_customhint { $constructtag=&Apache::edit::get_new_args($token,$parstack, $safeeval,'name'); $result = &Apache::edit::rebuild_tag($token); - $result .= &Apache::edit::handle_insert(); } elsif ($target eq 'web') { &Apache::response::reset_params(); } @@ -377,7 +377,6 @@ sub start_stringhint { $safeeval,'name','answer', 'type'); $result = &Apache::edit::rebuild_tag($token); - $result .= &Apache::edit::handle_insert(); } elsif ($target eq 'web') { &Apache::response::reset_params(); } @@ -396,7 +395,7 @@ sub end_stringhint { &Apache::response::setup_params('stringhint',$safeeval); my $partid=$Apache::inputtags::part; my $id=$Apache::inputtags::hint[-1]; - #id submissions occured under + #id submissions occurred under my $submitid=$Apache::inputtags::response[-1]; my $response = $Apache::lonhomework::history{ "resource.$partid.$submitid.submission"}; @@ -423,6 +422,9 @@ sub end_stringhint { my $args_ref = &Apache::caparesponse::setup_capa_args($safeeval,$parstack, \@args,$response); + if ($$args_ref{'type'} eq '') { + $$args_ref{'type'} = 'ci'; + } &Apache::caparesponse::add_in_tag_answer($parstack,$safeeval); my (@final_awards,@final_msgs,@ans_names); my %answer = &Apache::caparesponse::get_answer(); @@ -488,7 +490,6 @@ sub start_hintpart { $safeeval,'on'); if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); - $result.=&Apache::edit::handle_insert(); } } return $result; @@ -518,7 +519,6 @@ sub start_optionhint { 'answer','concept'); if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); - $result .= &Apache::edit::handle_insert(); } } elsif ($target eq 'meta') { $result=&Apache::response::meta_package_write('numericalhint'); @@ -533,7 +533,7 @@ sub end_optionhint { my ($foilmatch,$conceptmatch)=(-1,-1); my $name= &Apache::lonxml::get_param('name',$parstack,$safeeval); my $partid=$Apache::inputtags::part; - #id submissions occured under + #id submissions occurred under my $submitid=$Apache::inputtags::response[-1]; my $part_id="$partid.$submitid"; my %answer; @@ -597,7 +597,6 @@ sub start_radiobuttonhint { 'answer'); if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); - $result .= &Apache::edit::handle_insert(); } } elsif ($target eq 'meta') { $result=&Apache::response::meta_package_write('numericalhint'); @@ -614,7 +613,7 @@ sub end_radiobuttonhint { my $answer=&Apache::lonxml::get_param('answer',$parstack,$safeeval); eval('@answer ='.$answer); my $partid=$Apache::inputtags::part; - #id submissions occured under + #id submissions occurred under my $submitid=$Apache::inputtags::response[-1]; my $part_id="$partid.$submitid"; my $response = $Apache::lonhomework::history{