--- loncom/homework/hint.pm 2000/12/21 18:13:33 1.2 +++ loncom/homework/hint.pm 2001/01/04 22:52:03 1.3 @@ -4,25 +4,80 @@ use strict; use Apache::lonnet; sub BEGIN { - &Apache::lonxml::register('Apache::hinttags',('hintgroup','hintpart')); + &Apache::lonxml::register('Apache::hinttags',('hintgroup','hintpart','numericalhint')); } +@Apache::hint::which=(); sub start_hintgroup { my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; - my $id=$Apache::inputtags::part; - my $numtries=$Apache::lonhomework::history{"resource.$id.tries"}; - if ( $numtries eq '') { $numtries = 0; } - my $hinttries=&Apache::lonnet::EXT("resource.$id.hinttries"); - if ( $hinttries eq '') { $hinttries = 1; } - &Apache::lonxml::debug("found :$id:$numtries:$hinttries:"); - if ( $numtries < $hinttries ) { + my $skiptoend='1'; + my $result; + + if ($target ne 'meta' || $target ne 'grade') { + my $id=$Apache::inputtags::part; + my $numtries=$Apache::lonhomework::history{"resource.$id.tries"}; + if ( $numtries eq '') { $numtries = 0; } + my $hinttries=&Apache::lonnet::EXT("resource.$id.hinttries"); + if ( $hinttries eq '') { $hinttries = 1; } + &Apache::lonxml::debug("found :$id:$numtries:$hinttries:"); + if ( $numtries > $hinttries ) { + $skiptoend='0'; + if ($target eq 'web') {$result='
';} + } + } + if ($skiptoend) { &Apache::lonxml::get_all_text("/hintgroup",$$parser[$#$parser]); } - return ''; + @Apache::hint::which=(); + return $result; } sub end_hintgroup { + my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; + my $result; + + if ($target ne 'meta' || $target ne 'grade') { + my $id=$Apache::inputtags::part; + my $numtries=$Apache::lonhomework::history{"resource.$id.tries"}; + if ( $numtries eq '') { $numtries = 0; } + my $hinttries=&Apache::lonnet::EXT("resource.$id.hinttries"); + if ( $hinttries eq '') { $hinttries = 1; } + &Apache::lonxml::debug("found :$id:$numtries:$hinttries:"); + if ( $numtries > $hinttries ) { + if ($target eq 'web') {$result=' |