[system] / trunk / webwork / system / cgi / cgi-scripts / processProblem8.pl Repository:
ViewVC logotype

Diff of /trunk/webwork/system/cgi/cgi-scripts/processProblem8.pl

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

Revision 204 Revision 336
1420 1420
1421 ## When using flat databases (gdbm, db), we use '&' and '=' to 1421 ## When using flat databases (gdbm, db), we use '&' and '=' to
1422 ## separate values so we must replace all such occurences. We will 1422 ## separate values so we must replace all such occurences. We will
1423 ## replace then by %% and @@. First we escape any of these. 1423 ## replace then by %% and @@. First we escape any of these.
1424 1424
1425# this is now handled by protect_string in DBglue8 as it is specific to the database used
1426
1425 $out_string =~ s/%/\\%\\/g; 1427# $out_string =~ s/%/\\%\\/g;
1426 $out_string =~ s/@/\\@\\/g; 1428# $out_string =~ s/@/\\@\\/g;
1427 $out_string =~ s/&/%%/g; 1429# $out_string =~ s/&/%%/g;
1428 $out_string =~ s/=/@@/g; 1430# $out_string =~ s/=/@@/g;
1429#warn "outstring is |$out_string| \n"; 1431#warn "outstring is |$out_string| \n";
1430 $out_string; 1432 $out_string;
1431} 1433}
1432 1434
1433sub decode_submitted_answers { ## returns a ref to a hash of submitted answers 1435sub decode_submitted_answers { ## returns a ref to a hash of submitted answers
1434 my $in_string = shift; 1436 my $in_string = shift;
1435 1437
1436 ## reverse encoding process. See comments in encode_submitted_answers 1438 ## reverse encoding process. See comments in encode_submitted_answers
1439# this is now handled by unprotect_string in DBglue8 as it is specific to the database used
1440
1437 $in_string =~ s/@@/=/g; 1441# $in_string =~ s/@@/=/g;
1438 $in_string =~ s/%%/&/g; 1442# $in_string =~ s/%%/&/g;
1439 $in_string =~ s/\\@\\/@/g; 1443# $in_string =~ s/\\@\\/@/g;
1440 $in_string =~ s/\\%\\/%/g; 1444# $in_string =~ s/\\%\\/%/g;
1441 1445
1442 $in_string =~ s/##$/## /; # This makes sure that the last element has a value. 1446 $in_string =~ s/##$/## /; # This makes sure that the last element has a value.
1443 # It may cause trouble if this value was supposed to be nil instead of a space. 1447 # It may cause trouble if this value was supposed to be nil instead of a space.
1444 1448
1445 my %saved_answers = split /##/,$in_string; 1449 my %saved_answers = split /##/,$in_string;

Legend:
Removed from v.204  
changed lines
  Added in v.336

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9