From: Mike G. v. a. <we...@ma...> - 2008-09-12 14:19:25
|
Log Message: ----------- Update behavior of hint so that it will always print for instructors. Tags: ---- rel-2-4-patches Modified Files: -------------- pg/macros: PGbasicmacros.pl Revision Data ------------- Index: PGbasicmacros.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGbasicmacros.pl,v retrieving revision 1.47.2.2.2.4 retrieving revision 1.47.2.2.2.5 diff -Lmacros/PGbasicmacros.pl -Lmacros/PGbasicmacros.pl -u -r1.47.2.2.2.4 -r1.47.2.2.2.5 --- macros/PGbasicmacros.pl +++ macros/PGbasicmacros.pl @@ -994,27 +994,55 @@ } - sub hint { my @in = @_; my $out = ''; - - PG_restricted_eval(q!$main::hintExists =1; - $main::numOfAttempts = 0 unless defined($main::numOfAttempts); - !); + my $permissionLevel = PG_restricted_eval(q!$main::envir{permissionLevel}!); + my $PRINT_FILE_NAMES_PERMISSION_LEVEL = PG_restricted_eval(q!$envir->{'PRINT_FILE_NAMES_PERMISSION_LEVEL'}!); + my $printHintForInstructor = $permissionLevel >= $PRINT_FILE_NAMES_PERMISSION_LEVEL; + my $showHint = PG_restricted_eval(q!$main::showHint!); + my $displayHint = PG_restricted_eval(q!$envir->{'displayHintsQ'}!); + PG_restricted_eval(q!$main::hintExists =1!); + my $attempts = PG_restricted_eval(q!$main::numOfAttempts = 0 unless defined($main::numOfAttempts);!); if ($displayMode eq 'TeX') { - $out = ''; # do nothing since hints are not available for download - } elsif (($envir->{'displayHintsQ'}) and - PG_restricted_eval(q!($main::numOfAttempts >= $main::showHint)!)) + if ($printHintForInstructor) { + $out = join(' ',@in, "$BR(Show hint after $showHint attempts. ) $BR"); + } else { + $out = ''; # do nothing since hints are not available for download for students + } + } elsif ($printHintForInstructor) { # always print hints for instructor types + $out = join(' ',@in, "$BR(Show hint after $showHint attempts. )$BR "); + } elsif ( $displayHint and ( $attempts > $showHint )) { ## the second test above prevents a hint being shown if a doctored form is submitted - {$out = join(' ',@in);} # show hint + $out = join(' ',@in); + } # show hint $out ; } +# sub hint { +# my @in = @_; +# my $out = ''; +# +# PG_restricted_eval(q!$main::hintExists =1; +# $main::numOfAttempts = 0 unless defined($main::numOfAttempts); +# !); +# +# if ($displayMode eq 'TeX') { +# $out = ''; # do nothing since hints are not available for download +# } elsif (($envir->{'displayHintsQ'}) and +# PG_restricted_eval(q!($main::numOfAttempts >= $main::showHint)!)) +# +# ## the second test above prevents a hint being shown if a doctored form is submitted +# +# {$out = join(' ',@in);} # show hint +# +# $out ; +# } + sub HINT { TEXT("$BR" . hint(@_) . "$BR") if hint(@_); |