--- loncom/homework/hint.pm 2001/01/05 01:14:08 1.4 +++ loncom/homework/hint.pm 2001/02/07 00:27:32 1.7 @@ -2,6 +2,7 @@ package Apache::hinttags; use strict; use Apache::lonnet; +use capa; sub BEGIN { &Apache::lonxml::register('Apache::hinttags',('hintgroup','hintpart','numericalhint')); @@ -26,7 +27,7 @@ sub start_hintgroup { if ($target eq 'web') {$result='
';} } } - if ($skiptoend) { + if ($skiptoend && $target ne 'meta') { &Apache::lonxml::get_all_text("/hintgroup",$$parser[$#$parser]); } @Apache::hint::which=(); @@ -61,6 +62,7 @@ sub end_numericalhint { my $result; if ($target ne 'meta' && $target ne 'grade') { my $args =''; + $safeeval->share_from('capa',['&caparesponse_capa_check_answer']); if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } my $name = &Apache::run::run("{$args;".'return $name}',$safeeval); my $response = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.$Apache::inputtags::response['-1'].submission"}; @@ -71,10 +73,10 @@ sub end_numericalhint { ';my $sig="'.$Apache::inputtags::params{'sig'}.'"'. "');"; $result = &Apache::run::run($expression,$safeeval); + &Apache::lonxml::debug("$expression:result:$result:$Apache::lonxml::curdepth"); my ($awards) = split /:/ , $result; my ($ad) = &Apache::inputtags::finalizeawards(split /,/ , $awards); if ($ad eq 'EXACT_ANS' || $ad eq 'APPROX_ANS') { push (@Apache::hint::which,$name); } - &Apache::lonxml::debug("\n
result:$result:$Apache::lonxml::curdepth
\n"); $result=''; } return $result; @@ -96,10 +98,10 @@ sub start_hintpart { foreach $which (@Apache::hint::which) { if ($which eq $on) { $show = 1; last } } } if (!$show) { - &Apache::lonxml::get_all_text("/problem",$$parser[$#$parser]); + &Apache::lonxml::get_all_text("/hintpart",$$parser[$#$parser]); } } else { - &Apache::lonxml::get_all_text("/problem",$$parser[$#$parser]); + &Apache::lonxml::get_all_text("/hintpart",$$parser[$#$parser]); } return ''; }