From: Mike G. v. a. <we...@ma...> - 2010-05-27 02:46:53
|
Log Message: ----------- changed parts of LABELED_ANS (and PGcore::new) so that it properly handles the QUIZ_PREFIX needed by gateway quizzes. Modified Files: -------------- pg/lib: PGcore.pm pg/macros: PG.pl Revision Data ------------- Index: PGcore.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/PGcore.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -Llib/PGcore.pm -Llib/PGcore.pm -u -r1.6 -r1.7 --- lib/PGcore.pm +++ lib/PGcore.pm @@ -83,7 +83,7 @@ ANSWER_PREFIX => 'AnSwEr', ARRAY_PREFIX => 'ArRaY', vec_num => 0, # for distinguishing matrices - QUIZ_PREFIX => '', + QUIZ_PREFIX => $envir->{QUIZ_PREFIX}, SECTION_PREFIX => '', # might be used for sequential (compound) questions? PG_ACTIVE => 1, # turn to zero to stop processing @@ -287,7 +287,7 @@ my @in = @_; while (@in ) { my $label = shift @in; - $label = join("", $self->{QUIZ_PREFIX}, $self->{SECTION_PREFIX}, $label); + #$label = join("", $self->{QUIZ_PREFIX}, $self->{SECTION_PREFIX}, $label); my $ans_eval = shift @in; $self->WARN("<BR><B>Error in LABELED_ANS:|$label|</B> -- inputs must be references to AnswerEvaluator objects or subroutines<BR>") Index: PG.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PG.pl,v retrieving revision 1.45 retrieving revision 1.46 diff -Lmacros/PG.pl -Lmacros/PG.pl -u -r1.45 -r1.46 --- macros/PG.pl +++ macros/PG.pl @@ -100,11 +100,20 @@ } sub LABELED_ANS { - $PG->LABELED_ANS(@_); # returns pointer to the labeled answer group + my @in = @_; + my @out = (); + #prepend labels with the quiz and section prefixes. + while (@in ) { + my $label = shift @in; + $label = join("", $self->{QUIZ_PREFIX}, $self->{SECTION_PREFIX}, $label); + $ans_eval = shift @in; + push @out, $label, $ans_eval; + } + pus$PG->LABELED_ANS(@out); # returns pointer to the labeled answer group } sub NAMED_ANS { - $PG->LABELED_ANS(@_); # returns pointer to the labeled answer group + &LABELED_ANS(@_); # returns pointer to the labeled answer group } sub ANS { |