From: Mike G. v. a. <we...@ma...> - 2008-03-26 02:56:59
|
Log Message: ----------- Fixed bug in base64Q subroutine Modified Files: -------------- pg/macros: AppletObjects.pl PG.pl PGbasicmacros.pl Revision Data ------------- Index: AppletObjects.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/AppletObjects.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -Lmacros/AppletObjects.pl -Lmacros/AppletObjects.pl -u -r1.5 -r1.6 --- macros/AppletObjects.pl +++ macros/AppletObjects.pl @@ -52,7 +52,7 @@ function base64Q(str) { - return !str.match(/<XML/i && !str.match(/<?xml/i)); + return ( !str.match(/<XML/i) && !str.match(/<?xml/i)); } function submitAction() { Index: PGbasicmacros.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGbasicmacros.pl,v retrieving revision 1.49 retrieving revision 1.50 diff -Lmacros/PGbasicmacros.pl -Lmacros/PGbasicmacros.pl -u -r1.49 -r1.50 --- macros/PGbasicmacros.pl +++ macros/PGbasicmacros.pl @@ -306,6 +306,41 @@ ); } +sub NAMED_HIDDEN_ANS_RULE { # this is used to hold information being passed into and out of applets + # -- preserves state -- identical to NAMED_ANS_RULE except input type "hidden" + my($name,$col) = @_; + my $answer_value = ''; + $answer_value = ${$inputs_ref}{$name} if defined(${$inputs_ref}{$name}); + if ($answer_value =~ /\0/ ) { + my @answers = split("\0", $answer_value); + $answer_value = shift(@answers); # use up the first answer + $rh_sticky_answers->{$name}=\@answers; + # store the rest -- beacuse this stores to a main:; variable + # it must be evaluated at run time + $answer_value= '' unless defined($answer_value); + } elsif (ref($answer_value) eq 'ARRAY') { + my @answers = @{ $answer_value}; + $answer_value = shift(@answers); # use up the first answer + $rh_sticky_answers->{$name}=\@answers; + # store the rest -- beacuse this stores to a main:; variable + # it must be evaluated at run time + $answer_value= '' unless defined($answer_value); + } + + $answer_value =~ tr/\\$@`//d; #`## make sure student answers can not be interpolated by e.g. EV3 + $answer_value =~ s/\s+/ /g; ## remove excessive whitespace from student answer + $name = RECORD_ANS_NAME($name); + + my $tcol = $col/2 > 3 ? $col/2 : 3; ## get max + $tcol = $tcol < 40 ? $tcol : 40; ## get min + + MODES( + TeX => "\\mbox{\\parbox[t]{${tcol}ex}{\\hrulefill}}", + Latex2HTML => qq!\\begin{rawhtml}<INPUT TYPE=TEXT SIZE=$col NAME=\"$name\" VALUE = \"\">\\end{rawhtml}!, + HTML => qq!<INPUT TYPE=HIDDEN SIZE=$col NAME="$name" VALUE="$answer_value">!. + qq!<INPUT TYPE=HIDDEN NAME="previous_$name" VALUE="$answer_value">! + ); +} sub NAMED_ANS_RULE_OPTION { # deprecated &NAMED_ANS_RULE_EXTENSION; } Index: PG.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PG.pl,v retrieving revision 1.34 retrieving revision 1.35 diff -Lmacros/PG.pl -Lmacros/PG.pl -u -r1.34 -r1.35 --- macros/PG.pl +++ macros/PG.pl @@ -155,6 +155,7 @@ # and Safe::Root2 (the current one) # There is a good chance they won't be properly updated in one or the other of these compartments. + # @main::PG_ANSWER_ENTRY_ORDER = (); # $main::ANSWER_PREFIX = 'AnSwEr'; # %main::PG_FLAGS=(); #global flags @@ -164,6 +165,9 @@ # $main::hintExists =0; # %main::gifs_created = (); eval(q! + # set perl to use capital E for scientific notation: e.g. 5.4E-05 instead of 5.4e-05 + $#="%G"; #FIXME -- check that this works + @main::PG_ANSWER_ENTRY_ORDER = (); $main::ANSWER_PREFIX = 'AnSwEr'; %main::PG_FLAGS=(); #global flags |