[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 5209 Revision 5626
304 HTML => qq!<INPUT TYPE=TEXT SIZE=$col NAME="$name" VALUE="$answer_value">!. 304 HTML => qq!<INPUT TYPE=TEXT SIZE=$col NAME="$name" VALUE="$answer_value">!.
305 qq!<INPUT TYPE=HIDDEN NAME="previous_$name" VALUE="$answer_value">! 305 qq!<INPUT TYPE=HIDDEN NAME="previous_$name" VALUE="$answer_value">!
306 ); 306 );
307} 307}
308 308
309sub NAMED_HIDDEN_ANS_RULE { # this is used to hold information being passed into and out of applets
310 # -- preserves state -- identical to NAMED_ANS_RULE except input type "hidden"
311 my($name,$col) = @_;
312 my $answer_value = '';
313 $answer_value = ${$inputs_ref}{$name} if defined(${$inputs_ref}{$name});
314 if ($answer_value =~ /\0/ ) {
315 my @answers = split("\0", $answer_value);
316 $answer_value = shift(@answers); # use up the first answer
317 $rh_sticky_answers->{$name}=\@answers;
318 # store the rest -- beacuse this stores to a main:; variable
319 # it must be evaluated at run time
320 $answer_value= '' unless defined($answer_value);
321 } elsif (ref($answer_value) eq 'ARRAY') {
322 my @answers = @{ $answer_value};
323 $answer_value = shift(@answers); # use up the first answer
324 $rh_sticky_answers->{$name}=\@answers;
325 # store the rest -- beacuse this stores to a main:; variable
326 # it must be evaluated at run time
327 $answer_value= '' unless defined($answer_value);
328 }
329
330 $answer_value =~ tr/\\$@`//d; #`## make sure student answers can not be interpolated by e.g. EV3
331 $answer_value =~ s/\s+/ /g; ## remove excessive whitespace from student answer
332 $name = RECORD_ANS_NAME($name);
333
334 my $tcol = $col/2 > 3 ? $col/2 : 3; ## get max
335 $tcol = $tcol < 40 ? $tcol : 40; ## get min
336
337 MODES(
338 TeX => "\\mbox{\\parbox[t]{${tcol}ex}{\\hrulefill}}",
339 Latex2HTML => qq!\\begin{rawhtml}<INPUT TYPE=TEXT SIZE=$col NAME=\"$name\" VALUE = \"\">\\end{rawhtml}!,
340 HTML => qq!<INPUT TYPE=HIDDEN SIZE=$col NAME="$name" VALUE="$answer_value">!.
341 qq!<INPUT TYPE=HIDDEN NAME="previous_$name" VALUE="$answer_value">!
342 );
343}
309sub NAMED_ANS_RULE_OPTION { # deprecated 344sub NAMED_ANS_RULE_OPTION { # deprecated
310 &NAMED_ANS_RULE_EXTENSION; 345 &NAMED_ANS_RULE_EXTENSION;
311} 346}
312 347
313sub NAMED_ANS_RULE_EXTENSION { 348sub NAMED_ANS_RULE_EXTENSION {

Legend:
Removed from v.5209  
changed lines
  Added in v.5626

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9