[system] / trunk / pg / macros / PGbasicmacros.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/PGbasicmacros.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 5858 Revision 5901
992sub SOLUTION { 992sub SOLUTION {
993 TEXT( solution(@_)) ; 993 TEXT( solution(@_)) ;
994} 994}
995 995
996 996
997
998sub hint { 997sub hint {
999 my @in = @_; 998 my @in = @_;
1000 my $out = ''; 999 my $out = '';
1001 1000 my $permissionLevel = PG_restricted_eval(q!$main::envir{permissionLevel}!);
1001 my $PRINT_FILE_NAMES_PERMISSION_LEVEL = PG_restricted_eval(q!$envir->{'PRINT_FILE_NAMES_PERMISSION_LEVEL'}!);
1002 my $printHintForInstructor = $permissionLevel >= $PRINT_FILE_NAMES_PERMISSION_LEVEL;
1003 my $showHint = PG_restricted_eval(q!$main::showHint!);
1004 my $displayHint = PG_restricted_eval(q!$envir->{'displayHintsQ'}!);
1002 PG_restricted_eval(q!$main::hintExists =1; 1005 PG_restricted_eval(q!$main::hintExists =1!);
1003 $main::numOfAttempts = 0 unless defined($main::numOfAttempts); 1006 my $attempts = PG_restricted_eval(q!$main::numOfAttempts = 0 unless defined($main::numOfAttempts);!);
1004 !);
1005 1007
1006 if ($displayMode eq 'TeX') { 1008 if ($displayMode eq 'TeX') {
1009 if ($printHintForInstructor) {
1010 $out = join(' ',@in, "$BR(Show hint after $showHint attempts. ) $BR");
1011 } else {
1007 $out = ''; # do nothing since hints are not available for download 1012 $out = ''; # do nothing since hints are not available for download for students
1008 } elsif (($envir->{'displayHintsQ'}) and 1013 }
1009 PG_restricted_eval(q!($main::numOfAttempts >= $main::showHint)!)) 1014 } elsif ($printHintForInstructor) { # always print hints for instructor types
1015 $out = join(' ',@in, "$BR(Show hint after $showHint attempts. )$BR ");
1016 } elsif ( $displayHint and ( $attempts > $showHint )) {
1010 1017
1011 ## the second test above prevents a hint being shown if a doctored form is submitted 1018 ## the second test above prevents a hint being shown if a doctored form is submitted
1012 1019
1013 {$out = join(' ',@in);} # show hint 1020 $out = join(' ',@in);
1021 } # show hint
1014 1022
1015 $out ; 1023 $out ;
1016} 1024}
1017 1025
1018 1026

Legend:
Removed from v.5858  
changed lines
  Added in v.5901

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9