[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 5903 Revision 5970
996 996
997sub hint { 997sub hint {
998 my @in = @_; 998 my @in = @_;
999 my $out = ''; 999 my $out = '';
1000 my $permissionLevel = PG_restricted_eval(q!$main::envir{permissionLevel}!); 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'}!); 1001 my $PRINT_FILE_NAMES_PERMISSION_LEVEL = (PG_restricted_eval(q!defined( $main::envir{'PRINT_FILE_NAMES_PERMISSION_LEVEL'} )!))?
1002 PG_restricted_eval(q!$main::envir{'PRINT_FILE_NAMES_PERMISSION_LEVEL'}!) : 10000; # protect against undefined values
1002 my $printHintForInstructor = $permissionLevel >= $PRINT_FILE_NAMES_PERMISSION_LEVEL; 1003 my $printHintForInstructor = $permissionLevel >= $PRINT_FILE_NAMES_PERMISSION_LEVEL;
1003 my $showHint = PG_restricted_eval(q!$main::showHint!); 1004 my $showHint = PG_restricted_eval(q!$main::showHint!);
1004 my $displayHint = PG_restricted_eval(q!$envir->{'displayHintsQ'}!); 1005 my $displayHint = PG_restricted_eval(q!$envir{'displayHintsQ'}!);
1005 PG_restricted_eval(q!$main::hintExists =1!); 1006 PG_restricted_eval(q!$main::hintExists =1!);
1006 PG_restricted_eval(q!$main::numOfAttempts = 0 unless defined($main::numOfAttempts);!); 1007 PG_restricted_eval(q!$main::numOfAttempts = 0 unless defined($main::numOfAttempts);!);
1007 my $attempts = PG_restricted_eval(q!$main::numOfAttempts!); 1008 my $attempts = PG_restricted_eval(q!$main::numOfAttempts!);
1008 1009
1009 if ($displayMode eq 'TeX') { 1010 if ($displayMode eq 'TeX') {
1010 if ($printHintForInstructor) { 1011 if ($printHintForInstructor) {
1011 $out = join(' ',@in, "$BR(Show hint after $showHint attempts. ) $BR"); 1012 $out = join(' ', "$BR(Show the student hint after $showHint attempts: ) $BR",@in);
1012 } else { 1013 } else {
1013 $out = ''; # do nothing since hints are not available for download for students 1014 $out = ''; # do nothing since hints are not available for download for students
1014 } 1015 }
1015 } elsif ($printHintForInstructor) { # always print hints for instructor types 1016 } elsif ($printHintForInstructor) { # always print hints for instructor types
1016 $out = join(' ',@in, "$BR(Show hint after $showHint attempts. )$BR "); 1017 $out = join(' ', "$BR(Show the student hint after $showHint attempts: )$BR ", @in);
1017 } elsif ( $displayHint and ( $attempts > $showHint )) { 1018 } elsif ( $displayHint and ( $attempts > $showHint )) {
1018 1019
1019 ## the second test above prevents a hint being shown if a doctored form is submitted 1020 ## the second test above prevents a hint being shown if a doctored form is submitted
1020 1021
1021 $out = join(' ',@in); 1022 $out = join(' ',@in);

Legend:
Removed from v.5903  
changed lines
  Added in v.5970

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9