| … | |
… | |
| 132 | $main::PG_original_problemSeed = $main::problemSeed; |
132 | $main::PG_original_problemSeed = $main::problemSeed; |
| 133 | $main::PG_random_generator = new PGrandom($main::problemSeed) || die "Can't create random number generator."; |
133 | $main::PG_random_generator = new PGrandom($main::problemSeed) || die "Can't create random number generator."; |
| 134 | $main::ans_rule_count = 0; # counts questions |
134 | $main::ans_rule_count = 0; # counts questions |
| 135 | |
135 | |
| 136 | # end unpacking of environment variables. |
136 | # end unpacking of environment variables. |
|
|
137 | $main::QUIZ_PREFIX = '' unless defined($main::QUIZ_PREFIX) |
| 137 | } |
138 | } |
| 138 | |
139 | |
| 139 | # HEADER_TEXT is for material which is destined to be placed in the header of the html problem -- such |
140 | # HEADER_TEXT is for material which is destined to be placed in the header of the html problem -- such |
| 140 | # as javaScript code. |
141 | # as javaScript code. |
| 141 | |
142 | |
| … | |
… | |
| 215 | |
216 | |
| 216 | sub NAMED_ANS{ # store answer evaluators which have been explicitly labeled (submitted in a hash) |
217 | sub NAMED_ANS{ # store answer evaluators which have been explicitly labeled (submitted in a hash) |
| 217 | my @in = @_; |
218 | my @in = @_; |
| 218 | while (@in ) { |
219 | while (@in ) { |
| 219 | my $label = shift @in; |
220 | my $label = shift @in; |
|
|
221 | $label = $main::QUIZ_PREFIX.$label; |
| 220 | my $ans_eval = shift @in; |
222 | my $ans_eval = shift @in; |
| 221 | TEXT("<BR><B>Error in NAMED_ANS:$in[0]</B> |
223 | TEXT("<BR><B>Error in NAMED_ANS:$in[0]</B> |
| 222 | -- inputs must be references to subroutines<BR>") |
224 | -- inputs must be references to subroutines<BR>") |
| 223 | unless ref($ans_eval); |
225 | unless ref($ans_eval); |
| 224 | $PG_ANSWERS_HASH{$label}= $ans_eval; |
226 | $PG_ANSWERS_HASH{$label}= $ans_eval; |
| … | |
… | |
| 231 | } |
233 | } |
| 232 | |
234 | |
| 233 | sub NEW_ANS_NAME { # this keeps track of the answers which are entered implicitly, |
235 | sub NEW_ANS_NAME { # this keeps track of the answers which are entered implicitly, |
| 234 | # rather than with a specific label |
236 | # rather than with a specific label |
| 235 | my $number=shift; |
237 | my $number=shift; |
| 236 | my $label = "$main::ANSWER_PREFIX$number"; |
238 | my $label = "$main::QUIZ_PREFIX$main::ANSWER_PREFIX$number"; |
| 237 | push(@PG_UNLABELED_ANSWERS,$label); |
239 | push(@PG_UNLABELED_ANSWERS,$label); |
| 238 | $label; |
240 | $label; |
| 239 | } |
241 | } |
| 240 | sub ANS_NUM_TO_NAME { # This converts a number to an answer label for use in |
242 | sub ANS_NUM_TO_NAME { # This converts a number to an answer label for use in |
| 241 | # radio button and check box answers. No new answer |
243 | # radio button and check box answers. No new answer |
| 242 | # name is recorded. |
244 | # name is recorded. |
| 243 | my $number=shift; |
245 | my $number=shift; |
| 244 | my $label = "$main::ANSWER_PREFIX$number"; |
246 | my $label = "$main::QUIZ_PREFIX$main::ANSWER_PREFIX$number"; |
| 245 | $label; |
247 | $label; |
| 246 | } |
248 | } |
| 247 | |
249 | |
| 248 | my $vecnum; |
250 | my $vecnum; |
| 249 | |
251 | |