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

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

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

Revision 6252 Revision 6256
32 32
33 # initialize main:: variables 33 # initialize main:: variables
34 34
35 $ANSWER_PREFIX = $PG->{ANSWER_PREFIX}; 35 $ANSWER_PREFIX = $PG->{ANSWER_PREFIX};
36 $QUIZ_PREFIX = $PG->{QUIZ_PREFIX}; 36 $QUIZ_PREFIX = $PG->{QUIZ_PREFIX};
37 $showPartialCorrectAnswers = $PG->{PG_FLAGS}->{showPartialCorrectAnswers}; 37 $showPartialCorrectAnswers = $PG->{flags}->{showPartialCorrectAnswers};
38 $showHint = $PG->{PG_FLAGS}->{showHint}; 38 $showHint = $PG->{flags}->{showHint};
39 $solutionExists = $PG->{PG_FLAGS}->{solutionExists}; 39 $solutionExists = $PG->{flags}->{solutionExists};
40 $hintExists = $PG->{PG_FLAGS}->{hintExists}; 40 $hintExists = $PG->{flags}->{hintExists};
41 $pgComment = ''; 41 $pgComment = '';
42 %gifs_created = %{ $PG->{gifs_created}}; 42 %gifs_created = %{ $PG->{gifs_created}};
43 %external_refs = %{ $PG->{external_refs}}; 43 %external_refs = %{ $PG->{external_refs}};
44 44
45 @KEPT_EXTRA_ANSWERS =(); #temporary hack 45 @KEPT_EXTRA_ANSWERS =(); #temporary hack
268 recordSubmittedAnswers refreshCachedImages 268 recordSubmittedAnswers refreshCachedImages
269 hintExists solutionExists 269 hintExists solutionExists
270 ); 270 );
271 while (@elements) { 271 while (@elements) {
272 my $var= shift @elements; 272 my $var= shift @elements;
273 $PG->{PG_FLAGS}->{$var} = ${$var}; 273 $PG->{flags}->{$var} = ${$var};
274 } 274 }
275 $PG->{PG_FLAGS}->{comment} = $pgComment; #KLUDGE #FIXME 275 $PG->{flags}->{comment} = $pgComment; #KLUDGE #FIXME
276 $PG->{PG_FLAGS}->{showHintLimit} = $showHint; #KLUDGE #FIXME 276 $PG->{flags}->{showHintLimit} = $showHint; #KLUDGE #FIXME
277 277
278 278
279 # install problem grader 279 # install problem grader
280 if (defined($PG->{PG_FLAGS}->{PROBLEM_GRADER_TO_USE}) ) { 280 if (defined($PG->{flags}->{PROBLEM_GRADER_TO_USE}) ) {
281 # problem grader defined within problem -- no further action needed 281 # problem grader defined within problem -- no further action needed
282 } elsif ( defined( $rh_envir->{PROBLEM_GRADER_TO_USE} ) ) { 282 } elsif ( defined( $rh_envir->{PROBLEM_GRADER_TO_USE} ) ) {
283 if (ref($rh_envir->{PROBLEM_GRADER_TO_USE}) eq 'CODE' ) { # user defined grader 283 if (ref($rh_envir->{PROBLEM_GRADER_TO_USE}) eq 'CODE' ) { # user defined grader
284 $PG->{PG_FLAGS}->{PROBLEM_GRADER_TO_USE} = $rh_envir->{PROBLEM_GRADER_TO_USE}; 284 $PG->{flags}->{PROBLEM_GRADER_TO_USE} = $rh_envir->{PROBLEM_GRADER_TO_USE};
285 } elsif ($rh_envir->{PROBLEM_GRADER_TO_USE} eq 'std_problem_grader' ) { 285 } elsif ($rh_envir->{PROBLEM_GRADER_TO_USE} eq 'std_problem_grader' ) {
286 if (defined(&std_problem_grader) ){ 286 if (defined(&std_problem_grader) ){
287 $PG->{PG_FLAGS}->{PROBLEM_GRADER_TO_USE} = \&std_problem_grader; # defined in PGanswermacros.pl 287 $PG->{flags}->{PROBLEM_GRADER_TO_USE} = \&std_problem_grader; # defined in PGanswermacros.pl
288 } # std_problem_grader is the default in any case so don't give a warning. 288 } # std_problem_grader is the default in any case so don't give a warning.
289 } elsif ($rh_envir->{PROBLEM_GRADER_TO_USE} eq 'avg_problem_grader' ) { 289 } elsif ($rh_envir->{PROBLEM_GRADER_TO_USE} eq 'avg_problem_grader' ) {
290 if (defined(&avg_problem_grader) ){ 290 if (defined(&avg_problem_grader) ){
291 $PG->{PG_FLAGS}->{PROBLEM_GRADER_TO_USE} = \&avg_problem_grader; # defined in PGanswermacros.pl 291 $PG->{flags}->{PROBLEM_GRADER_TO_USE} = \&avg_problem_grader; # defined in PGanswermacros.pl
292 } 292 }
293 } else { 293 } else {
294 warn "Error: ". $PG->{PG_FLAGS}->{PROBLEM_GRADER_TO_USE} . "is not a known program grader."; 294 warn "Error: ". $PG->{flags}->{PROBLEM_GRADER_TO_USE} . "is not a known program grader.";
295 } 295 }
296 } elsif (defined(&std_problem_grader)) { 296 } elsif (defined(&std_problem_grader)) {
297 $PG->{PG_FLAGS}->{PROBLEM_GRADER_TO_USE} = \&std_problem_grader; # defined in PGanswermacros.pl 297 $PG->{flags}->{PROBLEM_GRADER_TO_USE} = \&std_problem_grader; # defined in PGanswermacros.pl
298 } else { 298 } else {
299 # PGtranslator will install its default problem grader 299 # PGtranslator will install its default problem grader
300 } 300 }
301 301
302 # add javaScripts 302 # add javaScripts
349 #warn "$key is ", join("|",%{$PG->{PG_ANSWERS_HASH}->{$key}}); 349 #warn "$key is ", join("|",%{$PG->{PG_ANSWERS_HASH}->{$key}});
350 } 350 }
351 } 351 }
352 push @KEPT_EXTRA_ANSWERS, keys %{$PG->{PERSISTENCE_HASH}}; 352 push @KEPT_EXTRA_ANSWERS, keys %{$PG->{PERSISTENCE_HASH}};
353 my %PG_ANSWERS_HASH = @PG_ANSWERS; 353 my %PG_ANSWERS_HASH = @PG_ANSWERS;
354 $PG->{PG_FLAGS}->{KEPT_EXTRA_ANSWERS} = \@KEPT_EXTRA_ANSWERS; 354 $PG->{flags}->{KEPT_EXTRA_ANSWERS} = \@KEPT_EXTRA_ANSWERS;
355 $PG->{PG_FLAGS}->{ANSWER_ENTRY_ORDER} = \@PG_ANSWER_ENTRY_ORDER; 355 $PG->{flags}->{ANSWER_ENTRY_ORDER} = \@PG_ANSWER_ENTRY_ORDER;
356 warn "KEPT_EXTRA_ANSWERS", join(" ", @KEPT_EXTRA_ANSWERS), $BR if $ans_debug==1; 356 warn "KEPT_EXTRA_ANSWERS", join(" ", @KEPT_EXTRA_ANSWERS), $BR if $ans_debug==1;
357 warn "PG_ANSWER_ENTRY_ORDER",join(" ",@PG_ANSWER_ENTRY_ORDER), $BR if $ans_debug==1; 357 warn "PG_ANSWER_ENTRY_ORDER",join(" ",@PG_ANSWER_ENTRY_ORDER), $BR if $ans_debug==1;
358 warn "DEBUG messages", join( "$BR",@{$PG->get_debug_messages} ) if $ans_debug==1; 358 warn "DEBUG messages", join( "$BR",@{$PG->get_debug_messages} ) if $ans_debug==1;
359 warn "INTERNAL_DEBUG messages", join( "$BR",@{$PG->get_internal_debug_messages} ) if $ans_debug==1; 359 warn "INTERNAL_DEBUG messages", join( "$BR",@{$PG->get_internal_debug_messages} ) if $ans_debug==1;
360 $STRINGforOUTPUT = join("", @{$PG->{OUTPUT_ARRAY} }); 360 $STRINGforOUTPUT = join("", @{$PG->{OUTPUT_ARRAY} });
363 $STRINGforHEADER_TEXT = join("", @{$PG->{HEADER_ARRAY} }); 363 $STRINGforHEADER_TEXT = join("", @{$PG->{HEADER_ARRAY} });
364 364
365 # warn pretty_print($PG->{PG_ANSWERS_HASH}); 365 # warn pretty_print($PG->{PG_ANSWERS_HASH});
366 #warn "printing another warning"; 366 #warn "printing another warning";
367 367
368 (\$STRINGforOUTPUT, \$STRINGforHEADER_TEXT,\%PG_ANSWERS_HASH, $PG->{PG_FLAGS} , $PG ); 368 (\$STRINGforOUTPUT, \$STRINGforHEADER_TEXT,\%PG_ANSWERS_HASH, $PG->{flags} , $PG );
369} 369}
370################################################################################ 370################################################################################
371# 371#
372# macros from dangerousMacros 372# macros from dangerousMacros
373# 373#
552__END__ 552__END__
553 553
554################################################################################ 554################################################################################
555# WeBWorK Online Homework Delivery System 555# WeBWorK Online Homework Delivery System
556# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/ 556# Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/
557# $CVSHeader: pg/macros/PG.pl,v 1.41 2010/05/14 01:13:12 gage Exp $ 557# $CVSHeader: pg/macros/PG.pl,v 1.42 2010/05/14 12:31:19 gage Exp $
558# 558#
559# This program is free software; you can redistribute it and/or modify it under 559# This program is free software; you can redistribute it and/or modify it under
560# the terms of either: (a) the GNU General Public License as published by the 560# the terms of either: (a) the GNU General Public License as published by the
561# Free Software Foundation; either version 2, or (at your option) any later 561# Free Software Foundation; either version 2, or (at your option) any later
562# version, or (b) the "Artistic License" which comes with this package. 562# version, or (b) the "Artistic License" which comes with this package.

Legend:
Removed from v.6252  
changed lines
  Added in v.6256

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9