# HG changeset patch # User rlm # Date 1264647883 18000 # Node ID ef8615de8a9cc6e15a642daf1afde5fad99467cc # Parent c4747d955ac8ef36d30562d2009042178af79c82 [svn r43] implemented form memory diff -r c4747d955ac8 -r ef8615de8a9c awesome_js/robert.js --- a/awesome_js/robert.js Mon Jan 25 13:38:05 2010 -0500 +++ b/awesome_js/robert.js Wed Jan 27 22:04:43 2010 -0500 @@ -1,9 +1,258 @@ -window.Robert = (function () { +function defaults() +{ +alias = "Robert Mac"; +email = "rlm@mit.edu"; +occupation = ""; +company = ""; +phone = ""; +website = ""; +lineArt = ""; +} -var separator = /[, ]+/, - elements = /^(circle|rect|path|ellipse|text|image)$/, -Paper = function () {}, +function drawElement(obj) +{ + +} + +function redraw(style) +{ + +if (style == "bold") +{ + + + +if(typeof d_alias != 'undefined' ){d_alias.remove();} +if(typeof d_email != 'undefined' ){d_email.remove();} +if(typeof d_occupation != 'undefined' ){d_occupation.remove();} +if(typeof d_company != 'undefined' ){d_company.remove();} +if(typeof d_phone != 'undefined' ){d_phone.remove();} +if(typeof d_website != 'undefined' ){d_website.remove();} +if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} + + + +var oText = document.getElementById('Name'); +var text_val = oText.value; +d_alias = raphe.print(10, 160, text_val, raphe.getFont('HelveticaNeue', 700), 60); +d_alias.attr('stroke', '#6a6a6a'); +d_alias.attr('fill', 'none') +var c = d_alias.getBBox().width; +d_alias.translate((485 - c)/2,0); + + +var oText = document.getElementById('Email'); +var text_val = oText.value; + +d_email = raphe.print(280, 270, text_val, raphe.getFont("HelveticaNeue", 700), 25); +d_email.attr('stroke', '#6a6a6a'); +d_email.attr('fill', 'TRANSPARENT'); + + + + +} + + +if (style == "arrow") +{ + +if(typeof d_alias != 'undefined' ){d_alias.remove();} +if(typeof d_email != 'undefined' ){d_email.remove();} +if(typeof d_occupation != 'undefined' ){d_occupation.remove();} +if(typeof d_company != 'undefined' ){d_company.remove();} +if(typeof d_phone != 'undefined' ){d_phone.remove();} +if(typeof d_website != 'undefined' ){d_website.remove();} +if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} + + +var oText = document.getElementById('Name'); +var text_val = oText.value; +d_alias = raphe.print(40, 110, text_val, raphe.getFont('HelveticaNeue', 700), 55); +d_alias.attr('stroke', '#6a6a6a'); +d_alias.attr('fill', 'none') + + + +var oText = document.getElementById('Company'); +var text_val = oText.value; + +d_company = raphe.print(40, 155, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_company.attr('stroke', '#6a6a6a'); +d_company.attr('fill', 'TRANSPARENT'); + + +var oText = document.getElementById('Occupation'); +var text_val = oText.value; + +d_occupation = raphe.print(40, 190, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_occupation.attr('stroke', '#6a6a6a'); +d_occupation.attr('fill', 'TRANSPARENT'); + + +var oText = document.getElementById('Email'); +var text_val = oText.value; + +d_email = raphe.print(280, 270, text_val, raphe.getFont("HelveticaNeue", 700), 25); +d_email.attr('stroke', '#6a6a6a'); +d_email.attr('fill', 'TRANSPARENT'); + + +d_lineArt = raphe.path("M 2 272 L 258 272"); +d_lineArt.attr('stroke', '#6a6a6a'); + +} + + +if (style == "classic") +{ + +if(typeof d_alias != 'undefined' ){d_alias.remove();} +if(typeof d_email != 'undefined' ){d_email.remove();} +if(typeof d_occupation != 'undefined' ){d_occupation.remove();} +if(typeof d_company != 'undefined' ){d_company.remove();} +if(typeof d_phone != 'undefined' ){d_phone.remove();} +if(typeof d_website != 'undefined' ){d_website.remove();} +if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} + + +var oText = document.getElementById('Email'); +var text_val = oText.value; + +d_email = raphe.print(0, 42, text_val, raphe.getFont("HelveticaNeue", 700), 29); +d_email.attr('stroke', '#6a6a6a'); +d_email.attr('fill', 'TRANSPARENT'); +var c = d_email.getBBox().width; +d_email.translate((510 - c)/2,0); + + +var oText = document.getElementById('Phone'); +var text_val = oText.value; + +d_phone = raphe.print(0, 75, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_phone.attr('stroke', '#6a6a6a'); +d_phone.attr('fill', 'TRANSPARENT'); +var c = d_phone.getBBox().width; +d_phone.translate((510 - c)/2,0); + + + + +var oText = document.getElementById('Name'); +var text_val = oText.value; +d_alias = raphe.print(0, 164, text_val, raphe.getFont('HelveticaNeue', 800), 47); +d_alias.attr('stroke', '#6a6a6a'); +d_alias.attr('fill', 'none') +var c = d_alias.getBBox().width; +d_alias.translate((510 - c)/2,0); + + +var oText = document.getElementById('Company'); +var text_val = oText.value; +d_company = raphe.print(0, 247, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_company.attr('stroke', '#6a6a6a'); +d_company.attr('fill', 'TRANSPARENT'); +var c = d_company.getBBox().width; +d_company.translate((510 - c)/2,0); + + +var oText = document.getElementById('Occupation'); +var text_val = oText.value; + +d_occupation = raphe.print(0, 278, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_occupation.attr('stroke', '#6a6a6a'); +d_occupation.attr('fill', 'TRANSPARENT'); +var c = d_occupation.getBBox().width; +d_occupation.translate((510 - c)/2,0); + + + + +var oText = document.getElementById('Website'); +var text_val = oText.value; + +d_website = raphe.print(0, 0, text_val, raphe.getFont("HelveticaNeue", 700), 21); +d_website.attr('stroke', '#6a6a6a'); +d_website.attr('fill', 'TRANSPARENT'); + +var c = d_website.getBBox().width; +d_website.translate((317 - c)/2,0); + +d_website.translate(0, -490); +d_website.rotate(90,0,0); +} + + +if (style == "direct") +{ + +if(typeof d_alias != 'undefined' ){d_alias.remove();} +if(typeof d_email != 'undefined' ){d_email.remove();} +if(typeof d_occupation != 'undefined' ){d_occupation.remove();} +if(typeof d_company != 'undefined' ){d_company.remove();} +if(typeof d_phone != 'undefined' ){d_phone.remove();} +if(typeof d_website != 'undefined' ){d_website.remove();} +if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} + + + +var oText = document.getElementById('Name'); +var text_val = oText.value; +d_alias = raphe.print(37, 70, text_val, raphe.getFont('HelveticaNeue', 700), 55); +d_alias.attr('stroke', '#6a6a6a'); +d_alias.attr('fill', 'none') + + +var oText = document.getElementById('Occupation'); +var text_val = oText.value; +d_occupation = raphe.print(37, 120, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_occupation.attr('stroke', '#6a6a6a'); +d_occupation.attr('fill', 'TRANSPARENT'); + + +var oText = document.getElementById('Company'); +var text_val = oText.value; +d_company = raphe.print(37, 178, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_company.attr('stroke', '#6a6a6a'); +d_company.attr('fill', 'TRANSPARENT'); + + + +var oText = document.getElementById('Phone'); +var text_val = oText.value; +d_phone = raphe.print(37, 210, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_phone.attr('stroke', '#6a6a6a'); +d_phone.attr('fill', 'TRANSPARENT'); + + +var oText = document.getElementById('Email'); +var text_val = oText.value; +d_email = raphe.print(37, 240, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_email.attr('stroke', '#6a6a6a'); +d_email.attr('fill', 'TRANSPARENT'); + + +var oText = document.getElementById('Website'); +var text_val = oText.value; +d_website = raphe.print(37, 270, text_val, raphe.getFont("HelveticaNeue", 700), 27); +d_website.attr('stroke', '#6a6a6a'); +d_website.attr('fill', 'TRANSPARENT'); + +d_lineArt = raphe.path("M 350 165 L 512 165 M 350 173 L 512 173 M 350 181 L 512 181 M 350 189 L 512 189 M 350 197 L 512 197 M 350 213 L 512 213 M 350 205 L 512 205 M 350 221 L 512 221"); +d_lineArt.attr('stroke', '#6a6a6a'); + + + +} + + + + + +} + + diff -r c4747d955ac8 -r ef8615de8a9c buy.html --- a/buy.html Mon Jan 25 13:38:05 2010 -0500 +++ b/buy.html Wed Jan 27 22:04:43 2010 -0500 @@ -81,270 +81,17 @@ +
+PERL::INITIALVALUES +
- diff -r c4747d955ac8 -r ef8615de8a9c buy.pl --- a/buy.pl Mon Jan 25 13:38:05 2010 -0500 +++ b/buy.pl Wed Jan 27 22:04:43 2010 -0500 @@ -5,6 +5,7 @@ use Storable; use CGI::Ajax; use CGI; +use JSON; @@ -20,17 +21,41 @@ 'inputbox' => \&inputbox, 'display' => \&display, 'change_rules' => \&change_rules, -'vanish' => \&vanish +'vanish' => \&vanish, +'updateForm' => \&updateForm ); my $pjx = CGI::Ajax->new(%hash); -#$pjx->JSDEBUG(1); -#$pjx->DEBUG(1); -print $pjx->build_html($q,\&gen,{-Cache_Control => 'no-store, no-cache, must-revalidate', -Pragma => 'no-cache'}); # this outputs the html for the page +# this outputs the html for the page +print $pjx->build_html($q,\&gen,{-Cache_Control => 'no-store, no-cache, must-revalidate', -Pragma => 'no-cache'}); + + + +sub updateForm + +{ + + + $key = shift; + $value = shift; + $hashString = shift; + + $perl_hash = decode_json $hashString; + + %fieldHash = %$perl_hash; + + + $fieldHash{$key} = $value; + $ref = \%fieldHash; + + $utf8_encoded_json_text = encode_json $ref ; + return $utf8_encoded_json_text; + +} @@ -97,19 +122,44 @@
-
+ +
-
+
-
+
- +
@@ -148,7 +198,15 @@ #grab the type of template we'll be using <<<< $type = shift; -# return $type; + + $hashString = shift; + #return $hashString; + + $perl_hash = decode_json $hashString; + + %fieldHash = %$perl_hash; + + # we have to care about both the type of template and the material and the color. these are stored in $type>>>> #Then, update with a special custon paypal form, taken from the paypal folder and specially designed for that particular template. @@ -157,8 +215,6 @@ #take care of everythign but acrylic clear type - - { local( $/, *FH ) ; open( FH, "<./paypal/$type.paylist" ) or die "sudden flaming death\n"; @@ -169,20 +225,32 @@ #every type has it's own associated paylist file the contains the things we need $z = '
".$z.'
'; -return $z; +foreach my $key ( keys %fieldHash ) +{ +my $replace = $fieldHash{$key}; + +#id="Name" value = "PERL::NAME" + + +$z =~ s/id="$key"/id="$key" value = "$replace"/g; } +return $z; +} + + + sub display { @@ -250,13 +318,24 @@ $b = &display("big_acrylic_clear"); $a =~ s/PERL-REPLACE::DISPLAY/$b/; -$b = &inputbox("big_acrylic_clear"); +$initials = <
Name:   -

Company:   -

Occupation:   -

Email:   - diff -r c4747d955ac8 -r ef8615de8a9c paypal/basic_acrylic_green.paylist --- a/paypal/basic_acrylic_green.paylist Mon Jan 25 13:38:05 2010 -0500 +++ b/paypal/basic_acrylic_green.paylist Wed Jan 27 22:04:43 2010 -0500 @@ -105,28 +105,32 @@
Line 1:   -

Line 2:   -

Line 3:   -

Line 4:   - diff -r c4747d955ac8 -r ef8615de8a9c paypal/big_acrylic_clear.paylist --- a/paypal/big_acrylic_clear.paylist Mon Jan 25 13:38:05 2010 -0500 +++ b/paypal/big_acrylic_clear.paylist Wed Jan 27 22:04:43 2010 -0500 @@ -105,14 +105,16 @@
Name:   -

Email:   - diff -r c4747d955ac8 -r ef8615de8a9c paypal/big_acrylic_green.paylist --- a/paypal/big_acrylic_green.paylist Mon Jan 25 13:38:05 2010 -0500 +++ b/paypal/big_acrylic_green.paylist Wed Jan 27 22:04:43 2010 -0500 @@ -105,14 +105,16 @@
Line 1:   -

Line 2:   - diff -r c4747d955ac8 -r ef8615de8a9c paypal/classic_acrylic_clear.paylist --- a/paypal/classic_acrylic_clear.paylist Mon Jan 25 13:38:05 2010 -0500 +++ b/paypal/classic_acrylic_clear.paylist Wed Jan 27 22:04:43 2010 -0500 @@ -105,42 +105,48 @@
Email:   -

Phone:   -

Name:   -

Company:   -

Occupation:   -

Website:   - diff -r c4747d955ac8 -r ef8615de8a9c paypal/classic_acrylic_green.paylist --- a/paypal/classic_acrylic_green.paylist Mon Jan 25 13:38:05 2010 -0500 +++ b/paypal/classic_acrylic_green.paylist Wed Jan 27 22:04:43 2010 -0500 @@ -105,42 +105,48 @@
Line 1:   -

Line 2:   -

Line 3:   -

Line 4:   -

Line 5:   -

Side:   - diff -r c4747d955ac8 -r ef8615de8a9c paypal/generate_paylists.pm --- a/paypal/generate_paylists.pm Mon Jan 25 13:38:05 2010 -0500 +++ b/paypal/generate_paylists.pm Wed Jan 27 22:04:43 2010 -0500 @@ -23,7 +23,7 @@ COSTS_NAMES => ['40 cards -- $125', '3 cards -- $15'], COSTS_CODE => ['40 cards @125.00', '3 cards @15.00'], INITIAL_PRICE => '$125.00', - DEFAULTS => ['jbond@mi6.co.uk','123.456.7890','James Bond','MI6','Secret Agent','http://www.jamesbond.com'], + DEFAULTS => ['PERL::EMAIL','PERL','James Bond','MI6','Secret Agent','http://www.jamesbond.com'], @_, # argument pair list goes here ); $short_form = $args{SHORT_FORM}; @@ -136,13 +136,14 @@ $start = < PERL::OPT:   -
OHYEAH -$start =~ s/PERL::SHORT/$short_form/; +$start =~ s/PERL::SHORT/$short_form/g; my $input = ""; diff -r c4747d955ac8 -r ef8615de8a9c paypal/lines_acrylic_clear.paylist --- a/paypal/lines_acrylic_clear.paylist Mon Jan 25 13:38:05 2010 -0500 +++ b/paypal/lines_acrylic_clear.paylist Wed Jan 27 22:04:43 2010 -0500 @@ -105,42 +105,48 @@
Name:   -

Occupation:   -

Company:   -

Phone:   -

Email:   -

Website:   - diff -r c4747d955ac8 -r ef8615de8a9c paypal/lines_acrylic_green.paylist --- a/paypal/lines_acrylic_green.paylist Mon Jan 25 13:38:05 2010 -0500 +++ b/paypal/lines_acrylic_green.paylist Wed Jan 27 22:04:43 2010 -0500 @@ -105,42 +105,48 @@
Line 1:   -

Line 2:   -

Line 3:   -

Line 4:   -

Line 5:   -

Line 6:   - diff -r c4747d955ac8 -r ef8615de8a9c paypal/make.pl --- a/paypal/make.pl Mon Jan 25 13:38:05 2010 -0500 +++ b/paypal/make.pl Wed Jan 27 22:04:43 2010 -0500 @@ -13,7 +13,7 @@ NAME => 'big_acrylic_clear', FIELDS => ["Name", "Email"], -DEFAULTS => ['James Bond','jbond@mi6.co.uk'], +DEFAULTS => ['PERL::NAME','PERL::EMAIL'], COSTS_NAMES => ['40 cards — $125', '4 cards — $30'], COSTS_CODE => ['40 cards @125.00', '4 cards @30.00'], @@ -34,7 +34,7 @@ NAME => 'basic_acrylic_clear', FIELDS => ["Name", "Company","Occupation","Email"], -DEFAULTS => ['James Bond','MI6','Secret Agent','jbond@mi6.co.uk'], +DEFAULTS => ['PERL::NAME','PERL::COMPANY','PERL::OCCUPATION','PERL::EMAIL'], COSTS_NAMES => ['40 cards — $125', '4 cards — $30'], COSTS_CODE => ['40 cards @125.00', '4 cards @30.00'], @@ -56,7 +56,7 @@ NAME => 'classic_acrylic_clear', FIELDS => ["Email", "Phone","Name","Company","Occupation","Website"], -DEFAULTS => ['jbond@mi6.co.uk','123.456.7890','James Bond','MI6','Secret Agent','http://www.jamesbond.com'], +DEFAULTS => ['PERL::EMAIL','PERL::PHONE','PERL::NAME','PERL::COMPANY','PERL::OCCUPATION','PERL::WEBSITE'], COSTS_NAMES => ['40 cards — $125', '4 cards — $30'], COSTS_CODE => ['40 cards @125.00', '4 cards @30.00'], @@ -79,7 +79,7 @@ NAME => 'lines_acrylic_clear', FIELDS => ["Name", "Occupation","Company","Phone","Email","Website"], -DEFAULTS => ['James Bond','Secret Agent','MI6','123.456.7890','jbond@domain.com','www.domain.com'], +DEFAULTS => ['PERL::NAME','PERL::OCCUPATION','PERL::COMPANY','PERL::PHONE','PERL::EMAIL','PERL::WEBSITE'], COSTS_NAMES => ['40 cards — $125', '4 cards — $30'], COSTS_CODE => ['40 cards @125.00', '4 cards @30.00'], @@ -92,6 +92,26 @@ + + + + + + + +################################################################################################################################## + + + + + + + + + + + + {#classic_acrylic_green &paylist ( @@ -99,7 +119,7 @@ NAME => 'classic_acrylic_green', FIELDS => ["Line 1", "Line 2","Line 3","Line 4","Line 5","Side"], -DEFAULTS => ['jbond@mi6.co.uk','123.456.7890','James Bond','MI6','Secret Agent','http://www.jamesbond.com'], +DEFAULTS => ['PERL::EMAIL','123.456.7890','James Bond','MI6','Secret Agent','http://www.jamesbond.com'], COSTS_NAMES => ['40 cards — $135', '4 cards — $30'], COSTS_CODE => ['40 cards @135.00', '4 cards @30.00'], @@ -117,7 +137,7 @@ NAME => 'big_acrylic_green', FIELDS => ["Line 1", "Line 2"], -DEFAULTS => ['James Bond','jbond@mi6.co.uk'], +DEFAULTS => ['James Bond','PERL::EMAIL'], COSTS_NAMES => ['40 cards — $135', '4 cards — $30'], COSTS_CODE => ['40 cards @135.00', '4 cards @30.00'], diff -r c4747d955ac8 -r ef8615de8a9c sexy.css --- a/sexy.css Mon Jan 25 13:38:05 2010 -0500 +++ b/sexy.css Wed Jan 27 22:04:43 2010 -0500 @@ -253,7 +253,14 @@ } +div#formValues +{ +color:white; +position: absolute; +top:45px; +left: 15px; +}