';}
- }
- }
- if ($skiptoend && $target ne 'meta') {
- &Apache::lonxml::get_all_text("/hintgroup",$$parser[$#$parser]);
- }
- @Apache::hint::which=();
- return $result;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+ my $skiptoend='0';
+ my $result;
+
+ if ($target eq 'web') {
+ my $id=$Apache::inputtags::part;
+ my $numtries=$Apache::lonhomework::history{"resource.$id.tries"};
+ if ( $numtries eq '') { $numtries = 0; }
+ my $hinttries=&Apache::response::get_response_param($id,"hinttries",1);
+ &Apache::lonxml::debug("found :$id:$numtries:$hinttries:");
+ my $gradestatus=
+ $Apache::lonhomework::history{"resource.$id.solved"};
+ my $showoncorrect=lc(&Apache::lonxml::get_param('showoncorrect',$parstack,$safeeval));
+ &Apache::lonxml::debug("onc orrect $showoncorrect, $gradestatus");
+ if ( ($showoncorrect ne 'yes' && $gradestatus =~ /^correct/) ||
+ ( $numtries < $hinttries) ) {
+ &Apache::lonxml::debug("Grabbin all");
+ &Apache::lonxml::get_all_text("/hintgroup",$parser);
+ }
+ &Apache::lonxml::startredirection;
+ } elsif ($target eq 'tex') {
+ $result .= '\keephidden{';
+ } elsif ($target eq 'edit') {
+ $result.=&Apache::edit::tag_start($target,$token);
+ $result.=&Apache::edit::select_arg('Show hint when problem Correct:','showoncorrect',[['no',&mt('No')],['yes',&mt('Yes')]]);
+ $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=();
+ return $result;
}
sub end_hintgroup {
- my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;
- my $result;
+ my ($target,$token,$tagstack,$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=' |