# HG changeset patch # User rlm # Date 1265184849 18000 # Node ID 95fa4bcc5d67f31c2a0124d7f0de2dd50394a0e9 # Parent 1b5417799713fa6ab6b9d291fd1c6446ddb87558 [svn r52] implemented SVG backend diff -r 1b5417799713 -r 95fa4bcc5d67 Laserkard.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Laserkard.pm Wed Feb 03 03:14:09 2010 -0500 @@ -0,0 +1,480 @@ +package Laserkard; + +use List::Util qw(first max maxstr min minstr reduce shuffle sum); +use Storable; +use CGI::Ajax; +use CGI; +use JSON; +use Laserkard; +use base 'Exporter'; + +our @EXPORT = +qw( +material +template +inputbox +display +change_rules +vanish +updateForm +cardType +); + + + + + +sub cardType +{ + +return $_[0]; + +} + + + +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; + +} + + + + +sub material{ + + $newvar = shift; + + my $t = $newvar; + + $newvar =~ m/([^_]*)_/; + $newvar = $1; + + #return (($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked'); + + #$y = "$t
".(($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked')." + + { + local( $/, *FH ) ; + open( FH, "<./buy_pieces/materials2.html" ) or die "sudden flaming death\n"; + $y = ; + } + + @symbols = qw(PERL::ACRYLIC_CLEAR PERL::ACRYLIC_BLUE PERL::ACRYLIC_GREEN PERL::ALUMINUM_RED PERL::ALUMINUM_BLUE PERL::ALUMINUM_GREEN PERL::ALUMINUM_BLACK); + + for (@symbols) + { + $c = $_; + $c =~ s/PERL:://; + $c =~ tr/[A-Z]/[a-z]/; + $c =~ s/^/_/; + + $b = '"'.$newvar.$c.'"'.(($t =~ m/$c/) ? ' CHECKED ' : ''); + $y =~ s/$_/$b/; + } + + + $first = shift; + if ($first){ $y =~ s/display[^;]*;//g; } + + + + return $y; + + +} + + + +sub template +{ + +$all = shift; +$all =~ m/([^_]*)_(.*)/; + +$materialcolor = $2; +$style = $1; +#here is where we handle important drawing commands relating to the cards. + + + +$r = <
Select Style.
+
+ + + +
+ + + +
+ + + +
+ + + + + +
+ + +HERE + + +%shankHash = +( + +big => template2, +basic => template3, +classic => template1, +lines => template4 +); + +$target = $shankHash{$style}; + + + + +#$r =~ s/inputbox\(\['$target'\], \['inputbox'\]\)\;//; + + + + + +return $r; +} + + + + +sub inputbox +{ + +#grab the type of template we'll be using <<<< + $type = shift; + + $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. +#will probaly eventually create a script to automate the generation of these files. + + +#take care of everythign but acrylic clear type + + { + local( $/, *FH ) ; + open( FH, "<./paypal/$type.paylist" ) or die "sudden flaming death\n"; + $z = ; + } + + +#every type has it's own associated paylist file the contains the things we need + +$z = < +HERE + + + + +$z = $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 +{ + $all = shift; + + + #~ + #~ $t = < + #~ + #~
+#~ +#~ + #~
+ #~ +#~ HERE +#~ +#~ +#~ +#~ $t =~ s/PERL::PIC/$all/g; + + $t = < + +
+ + +
+ +HERE + + return $t; + +} + + +sub genBuy + +{ +return gen("buy.html"); + +} + + +sub genEcho +{ + +return gen("echo.html"); + +} + + +sub gen +{ + + my $target = shift; + + { + local( $/, *FH ) ; + open( FH, "<./$target" ) or die "sudden flaming death\n"; + $a = ; + } + + { + local( $/, *FH ) ; + open( FH, "<./top_menu.include" ) or die "sudden flaming death\n"; + $b = ; + } + + { + local( $/, *FH ) ; + open( FH, "<./cardDefinitions.JSON" ) or die "sudden flaming death\n"; + $c = ; + } + +$a =~s/PERL::DEFS/$c/; + + + +$a =~ s/PERL-REPLACE::TOP_MENU/$b/; #equivalent to , but in perl and with more memory problems :) +$b = &material("void_acrylic_clear",1); +$a =~ s/PERL-REPLACE::MATERIALS/$b/; #let's do it again!!! :) + + + +$b = "big_acrylic_clear"; +$a =~ s/PERL::INITIALCARD/$b/; +$b = &template("big_acrylic_clear"); +$a =~ s/PERL-REPLACE::TEMPLATES/$b/; + +$b = &display("big_acrylic_clear"); +$a =~ s/PERL-REPLACE::DISPLAY/$b/; + +$initials = <The Classic LaserKard. +Balanced and Complete. The original LaserKard. For those that wish to leave no stone unturned. It's all there. +HERE + +$bold = <The Bold Kard. +Austere and Iconic. For those that wish to leave an impression with the power of their name accompanied only by their main method of contact. Bold, period. +HERE + +$arrow = <The Arrow Kard. +Precise and Straightforward. For those that seek to make a statement while being clear and concise. Straight as an arrow. +HERE + +$direct = <The Direct Kard. +Thorough and Distinct. For those that aim to demonstrate their professionalism with style. Push the envelope. Be Direct. +HERE + + + +my %megahash = +( + +'big' => $bold, + +'basic' => $arrow, + +'lines' => $direct, + +'classic' => $classic, + +'big_acrylic_clear' => $bold, + +'classic_acrylic_clear' => $classic, + +'basic_acrylic_clear' => $arrow, + +'lines_acrylic_clear' => $direct +); + + + +my $key = shift; + + +if (!$megahash{$key}){return $key;} + +return $megahash{$key}; + + + + +} + + + + + + + + +# this here function makes the paypal button go away so people know it's working! +sub vanish +{ +return ""; + + +} + +1; + + diff -r 1b5417799713 -r 95fa4bcc5d67 awesome_js/echo.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/awesome_js/echo.js Wed Feb 03 03:14:09 2010 -0500 @@ -0,0 +1,57 @@ +function js_process_func(input) + +{ + + document.getElementById('perlClick').innerHTML = input; + +} + + + +function parseFile() +{ + document.getElementById('output').innerHTML = "function called"; + + var JSONtext = document.getElementById('textEntry').value; + + var hash = new Object(); + hash = eval('(' + JSONtext + ')'); + document.getElementById('output').innerHTML = ""; + document.getElementById('perlClick').innerHTML = ""; + + + for (card in hash) + { + document.getElementById('output').innerHTML = card; + clearAll(); + lineDraw(eval("hash." + card + ".style"), "ff0000"); + + for (prop in eval( "hash." + card + ".fields")) + { + + + + contentRedraw(eval("hash." + card + ".style"), prop, eval( "hash." + card + ".fields." + prop)); + +document.getElementById('output').innerHTML += "
" + eval( "hash." + card + ".fields." + prop); + + } + + for (var ii = 1; ii <= eval("hash." + card + ".number"); ii++) + { + + document.getElementById('perlClick').innerHTML += document.getElementById('disp_contain').innerHTML + "S3ntinEL"; + //echo(['disp_contain', 'perlClick', num], [js_process_func], 'POST'); + } + } + + + var emmm = document.getElementById('sendOff').value; + + + + echo(['perlClick', "args__" + emmm], ['output'], 'POST'); + + + +} diff -r 1b5417799713 -r 95fa4bcc5d67 awesome_js/robert.js --- a/awesome_js/robert.js Mon Feb 01 02:54:59 2010 -0500 +++ b/awesome_js/robert.js Wed Feb 03 03:14:09 2010 -0500 @@ -17,7 +17,7 @@ descHash.lines_acrylic_clear = "

The Direct Kard.

Thorough and Distinct. For those that aim to demonstrate their professionalism with style. Push the envelope. Be Direct."; - +color = 'fefefe'; @@ -74,14 +74,16 @@ } - +//~ function smallRedraw(style,field) +//~ { +//~ //smallRedraw(style,field,"fefefe"); +//~ sRedraw(style,field,'fefefe'); +//~ } function smallRedraw(style,field) { - - - + var JSONtext = document.getElementById('formValues').innerHTML; var hash = new Object(); hash = eval('(' + JSONtext + ')'); @@ -90,7 +92,22 @@ content = unescape(content); -if (prevVal == content){return;} +//if (prevVal == content){return;} + +contentRedraw(style,field, content); + + +} + + + +function contentRedraw(style,field, content) +{ + +//var color = color; + + + posx = 10; posy = 10; @@ -158,7 +175,7 @@ document.getElementById('output').innerHTML = sizzle; -eval ( target +".attr('stroke', '#fefefe');"); +eval ( target +".attr('stroke', '#" + color + "');"); //eval ( target +".attr('stroke', '#fbafcd');"); eval ( target +".attr('fill', 'none');"); @@ -200,6 +217,42 @@ if(typeof d_lineArt != 'undefined' ){d_lineArt.remove();} } + +function lineDraw(style, color) +{ + + + + + +if (style == "bold") +{return;} + + + +if (style == "arrow") +{ +d_lineArt = raphe.path("M 4 272 L 258 272"); +d_lineArt.attr('stroke', "#" + color); +return; +} + + +if (style == "classic") +{return;} + + +if (style == "direct") +{ +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', "#" + color); +return; +} + +} + + + function redraw(style) { @@ -229,9 +282,6 @@ smallRedraw("arrow","Company"); -d_lineArt = raphe.path("M 4 272 L 258 272"); -d_lineArt.attr('stroke', '#fefefe'); - } @@ -261,14 +311,10 @@ smallRedraw("direct","Phone"); smallRedraw("direct","Website"); -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', '#fefefe'); - - } - +lineDraw(style, "fefefe"); diff -r 1b5417799713 -r 95fa4bcc5d67 buy.html --- a/buy.html Mon Feb 01 02:54:59 2010 -0500 +++ b/buy.html Wed Feb 03 03:14:09 2010 -0500 @@ -25,82 +25,32 @@ +PERL-REPLACE::TOP_MENU +
+
PERL-REPLACE::TEMPLATES
+
+ +
+
+
PERL-REPLACE::DISPLAY
+
+ +
PERL-REPLACE::POKEDEX
+
- - - - -PERL-REPLACE::TOP_MENU - - -
- -
PERL-REPLACE::TEMPLATES
- - - -
- - - - - -
- - - -
- -
PERL-REPLACE::DISPLAY
- - - - +
PERL-REPLACE::INPUTBOX
+
PERL-REPLACE::MATERIALS
-
PERL-REPLACE::POKEDEX
+
PERL::INITIALVALUES
+
PERL::INITIALCARD
+
PERL::DEFS
-
+
OUTPUT
-
PERL-REPLACE::INPUTBOX
- - - - - -
PERL-REPLACE::MATERIALS
- - -
- - - - - - - - -
-PERL::INITIALVALUES -
- -
-PERL::INITIALCARD -
- - -
-PERL::DEFS -
- - -
-OUTPUT -
- diff -r 1b5417799713 -r 95fa4bcc5d67 buy.pl --- a/buy.pl Mon Feb 01 02:54:59 2010 -0500 +++ b/buy.pl Wed Feb 03 03:14:09 2010 -0500 @@ -1,29 +1,24 @@ #!/usr/bin/perl -use List::Util qw(first max maxstr min minstr reduce shuffle sum); -use Storable; -use CGI::Ajax; -use CGI; -use JSON; +use Laserkard; my $q = new CGI; +#print Laserkard::gen(); - -my %hash = ( - -'material' => \&material, - -'template' => \&template, -'inputbox' => \&inputbox, -'display' => \&display, -'change_rules' => \&change_rules, -'vanish' => \&vanish, -'updateForm' => \&updateForm, -'cardType' => \&cardType +my %hash = +( +'material' => \&Laserkard::material, +'template' => \&Laserkard::template, +'inputbox' => \&Laserkard::inputbox, +'display' => \&Laserkard::display, +'change_rules' => \&Laserkard::change_rules, +'vanish' => \&Laserkard::vanish, +'updateForm' => \&Laserkard::updateForm, +'cardType' => \&Laserkard::cardType ); @@ -32,441 +27,7 @@ # this outputs the html for the page -print $pjx->build_html($q,\&gen,{-Cache_Control => 'no-store, no-cache, must-revalidate', -Pragma => 'no-cache'}); +print $pjx->build_html($q,\&Laserkard::genBuy,{-Cache_Control => 'no-store, no-cache, must-revalidate', -Pragma => 'no-cache'}); - -sub cardType -{ - -return $_[0]; - -} - - - -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; - -} - - - - -sub material{ - - $newvar = shift; - - my $t = $newvar; - - $newvar =~ m/([^_]*)_/; - $newvar = $1; - - #return (($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked'); - - #$y = "$t
".(($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked')." - - { - local( $/, *FH ) ; - open( FH, "<./buy_pieces/materials2.html" ) or die "sudden flaming death\n"; - $y = ; - } - - @symbols = qw(PERL::ACRYLIC_CLEAR PERL::ACRYLIC_BLUE PERL::ACRYLIC_GREEN PERL::ALUMINUM_RED PERL::ALUMINUM_BLUE PERL::ALUMINUM_GREEN PERL::ALUMINUM_BLACK); - - for (@symbols) - { - $c = $_; - $c =~ s/PERL:://; - $c =~ tr/[A-Z]/[a-z]/; - $c =~ s/^/_/; - - $b = '"'.$newvar.$c.'"'.(($t =~ m/$c/) ? ' CHECKED ' : ''); - $y =~ s/$_/$b/; - } - - - $first = shift; - if ($first){ $y =~ s/display[^;]*;//g; } - - - - return $y; - - -} - - - -sub template -{ - -$all = shift; -$all =~ m/([^_]*)_(.*)/; - -$materialcolor = $2; -$style = $1; -#here is where we handle important drawing commands relating to the cards. - - - -$r = <
Select Style.
-
- - - -
- - - -
- - - -
- - - - - -
-
- -HERE - - -%shankHash = -( - -big => template2, -basic => template3, -classic => template1, -lines => template4 -); - -$target = $shankHash{$style}; - - - - -#$r =~ s/inputbox\(\['$target'\], \['inputbox'\]\)\;//; - - - - - -return $r; -} - - - - -sub inputbox -{ - -#grab the type of template we'll be using <<<< - $type = shift; - - $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. -#will probaly eventually create a script to automate the generation of these files. - - -#take care of everythign but acrylic clear type - - { - local( $/, *FH ) ; - open( FH, "<./paypal/$type.paylist" ) or die "sudden flaming death\n"; - $z = ; - } - - -#every type has it's own associated paylist file the contains the things we need - -$z = < -HERE - - - - -$z = $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 -{ - $all = shift; - - - #~ - #~ $t = < - #~ - #~
-#~ -#~ - #~
- #~ -#~ HERE -#~ -#~ -#~ -#~ $t =~ s/PERL::PIC/$all/g; - - $t = < - -
- - -
- -HERE - - return $t; - -} - - - - -sub gen -{ - { - local( $/, *FH ) ; - open( FH, "<./buy.html" ) or die "sudden flaming death\n"; - $a = ; - } - - { - local( $/, *FH ) ; - open( FH, "<./top_menu.include" ) or die "sudden flaming death\n"; - $b = ; - } - - { - local( $/, *FH ) ; - open( FH, "<./cardDefinitions.JSON" ) or die "sudden flaming death\n"; - $c = ; - } - -$a =~s/PERL::DEFS/$c/; - - - -$a =~ s/PERL-REPLACE::TOP_MENU/$b/; #equivalent to , but in perl and with more memory problems :) -$b = &material("void_acrylic_clear",1); -$a =~ s/PERL-REPLACE::MATERIALS/$b/; #let's do it again!!! :) - - - -$b = "big_acrylic_clear"; -$a =~ s/PERL::INITIALCARD/$b/; -$b = &template("big_acrylic_clear"); -$a =~ s/PERL-REPLACE::TEMPLATES/$b/; - -$b = &display("big_acrylic_clear"); -$a =~ s/PERL-REPLACE::DISPLAY/$b/; - -$initials = <The Classic LaserKard. -Balanced and Complete. The original LaserKard. For those that wish to leave no stone unturned. It's all there. -HERE - -$bold = <The Bold Kard. -Austere and Iconic. For those that wish to leave an impression with the power of their name accompanied only by their main method of contact. Bold, period. -HERE - -$arrow = <The Arrow Kard. -Precise and Straightforward. For those that seek to make a statement while being clear and concise. Straight as an arrow. -HERE - -$direct = <The Direct Kard. -Thorough and Distinct. For those that aim to demonstrate their professionalism with style. Push the envelope. Be Direct. -HERE - - - -my %megahash = -( - -'big' => $bold, - -'basic' => $arrow, - -'lines' => $direct, - -'classic' => $classic, - -'big_acrylic_clear' => $bold, - -'classic_acrylic_clear' => $classic, - -'basic_acrylic_clear' => $arrow, - -'lines_acrylic_clear' => $direct -); - - - -my $key = shift; - - -if (!$megahash{$key}){return $key;} - -return $megahash{$key}; - - - - -} - - - - - - - - -# this here function makes the paypal button go away so people know it's working! -sub vanish -{ -return ""; - - -} - +# it's a refrence to a function, not a function itself. diff -r 1b5417799713 -r 95fa4bcc5d67 cardOrders/RobertMcIntyre.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cardOrders/RobertMcIntyre.txt Wed Feb 03 03:14:09 2010 -0500 @@ -0,0 +1,57 @@ +{ + +"bold": + + { + "style" : "bold", + "number" : "7", + "fields": + { + "Name" : "Robert McIntyre", + "Email" : "rlm@mit.edu", + }, + }, +"arrow": + + { + "style" : "arrow", + "number" : "8", + "fields": + { + "Name" : "Robert McIntyre", + "Email" : "rlm@mit.edu", + "Company" : "MIT", + "Occupation" : "Course 6 & 9", + }, + }, +"classic": + + { + "style" : "classic", + "number" : "7", + "fields": + { + "Name" : "Robert McIntyre", + "Email" : "rlm@mit.edu", + "Company" : "MIT", + "Occupation" : "Course 6 & 9", + "Phone" : "617.821.9129", + "Website" : "http://www.rlmcintyre.com", + }, + }, +"direct": + + { + "style" : "direct", + "number" : "8", + "fields": + { + "Name" : "Robert McIntyre", + "Email" : "rlm@mit.edu", + "Company" : "MIT", + "Occupation" : "Course 6 & 9", + "Phone" : "617.821.9129", + "Website" : "http://www.rlmcintyre.com", + }, + }, +} diff -r 1b5417799713 -r 95fa4bcc5d67 echo.css --- a/echo.css Mon Feb 01 02:54:59 2010 -0500 +++ b/echo.css Wed Feb 03 03:14:09 2010 -0500 @@ -6,11 +6,100 @@ div#output { -background-color: #585; +/*background-color: #585;*/ } div#disp_contain { -background-color: #aab; +/*background-color: #aab;*/ } + +div#perlClick +{ +position:absolute; + +top:240px; +right:25px; + +width: 120px; +text-align: center; + +background-color: #4ff; /*sky blue*/ + +} + + +div#sendTo +{ +background-color: #000000; +color:white; +} +div#i_inputbox +{ + +padding-left:10px; +padding-top:10px; +padding-right:0px; +border-style:solid; +border-color:#ffffff; +border-width:1px; +padding-bottom:10px; + +font: bold 22px "helvetica","arial", "sans-serif"; +color: white; + +float:left; +width:520px; +} + + +div#formValues + +{ +color:white; +position: absolute; +top:30px; +left: 15px; +display:none; +} + +div#cardDefs +{ +color:green; +position: absolute; +width: 200px; +top: 90px; +left: 10px; +display:none; +} + +div#currentSpec +{ +color:red; +position: absolute; +width: 200px; +top: 90px; +right: 10px; +display:none; +} + +div#output +{ +color:#fbafcd; +position: absolute; +width: 200px; +top: 130px; +right: 10px; +/*display:none;*/ +} +div#perlClick +{ +color:red; +position: absolute; +width: 200px; +top: 90px; +right: 10px; +display:none; +} + diff -r 1b5417799713 -r 95fa4bcc5d67 echo.html --- a/echo.html Mon Feb 01 02:54:59 2010 -0500 +++ b/echo.html Wed Feb 03 03:14:09 2010 -0500 @@ -3,15 +3,15 @@ - + + - -Laserkard | Design Studio +Laserkard | Echo - - + + @@ -21,39 +21,201 @@ - + -
+PERL-REPLACE::TOP_MENU +
+ +
+ +
+
+
PERL-REPLACE::DISPLAY
+
+ +
PERL-REPLACE::POKEDEX
+
+ +
+
+Fill In your email:
+ +
+
+
+ +
+ ^-- Click here to send SVG file to yourself.
+ (don't click multiple times) +
+ +
+________________________________________
+This text area controls the svg file that will be generated. Be sure to be careful with the quotation marks so that the data format is correct. Please use this sample text as a template for filling out your own card. You will be sent an email for every 30 cards you create. +
+ +
+ +
+ + + + + + + + + + + + + + + +
+
PERL-REPLACE::MATERIALS
+
+ + + + +
PERL::INITIALVALUES
+ +
PERL::INITIALCARD
+ +
PERL::DEFS
+ +
OUTPUT
+ + + + + +
Send this shiz!
+ + + + @@ -61,9 +223,6 @@ - - - diff -r 1b5417799713 -r 95fa4bcc5d67 echo.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/echo.js Wed Feb 03 03:14:09 2010 -0500 @@ -0,0 +1,1 @@ + diff -r 1b5417799713 -r 95fa4bcc5d67 echo.pl --- a/echo.pl Mon Feb 01 02:54:59 2010 -0500 +++ b/echo.pl Wed Feb 03 03:14:09 2010 -0500 @@ -14,6 +14,8 @@ $Data::Dumper::Indent = 1; use Storable; use SVG; +use Laserkard; + my $q = new CGI; @@ -21,6 +23,14 @@ my %hash = ( +'material' => \&Laserkard::material, +'template' => \&Laserkard::template, +'inputbox' => \&Laserkard::inputbox, +'display' => \&Laserkard::display, +'change_rules' => \&Laserkard::change_rules, +'vanish' => \&Laserkard::vanish, +'updateForm' => \&Laserkard::updateForm, +'cardType' => \&Laserkard::cardType, 'echo' => \&echo ); @@ -36,21 +46,13 @@ sub gen { - { - local( $/, *FH ) ; - open( FH, "<./echo.html" ) or die "sudden flaming death\n"; - $a = ; - } - { - local( $/, *FH ) ; - open( FH, "<./top_menu.include" ) or die "sudden flaming death\n"; - $b = ; - } -$a =~ s/PERL-REPLACE::TOP_MENU/$b/; #equivalent to , but in perl and with more memory problems :) + +$a = Laserkard::genEcho(); + @@ -64,26 +66,48 @@ sub echo { - -my $svg = $_[0]; - -my $destination = 'rlm@mit.edu'; - - - - -$svg = &impose($svg); - - - -&mail($svg, $destination); +my $svg = shift; +#my $destination = 'rlm@mit.edu'; -return "done."; + + + + + + +my @cards = split (/S3ntinEL/, $svg); +my $emmmm = shift; +#return $emmmm; + +$cardsPerMail = 30; +##### ok, now we have this awesome array with all the cards we need to print. +# the numbers are right, so now we really just have to impose them. +for $mails(0..int(($#cards) / $cardsPerMail)) +{ + + +my $start = $mails * $cardsPerMail; + +my $end = ($#cards >($start + $cardsPerMail)) ? ($start + $cardsPerMail) : $#cards; + +$svg = &impose(@cards[$start..$end]); +#$svg = &impose($cards[$end]); + +&mail($svg, $emmmm); +} + + + +return "done"; + +return $svg; + + } @@ -96,16 +120,84 @@ #out purpose here is to take that one card, size it correctly, and make appropiate copies #so that our supplier can simply import the file and print. -$sss = $_[0]; -$sss =~ s/^/\n\n\n/; -$sss =~ s/$/\n\n\n/; +my $xml = new XML::Simple; +my @cards = @_; + + +for (0..$#cards) +{ + +$cards[$_] =~ s/^/\n\n\n/; +$cards[$_] =~ s/$/\n\n\n/; # you fucking bitch! -$sss =~ s/Created wit........//; - +$cards[$_] =~ s/Created wit........//; +} # read XML file -my $xml = new XML::Simple; -my $data = $xml->XMLin($sss, ForceArray => 1); + + + + +#print Dumper(%juzz); + + +my $svg= SVG->new(width=>"18in",height=>"14in"); + +#print Dumper($juzz{'path'}[2]); +#print "\n***************************\n"; +#print Dumper($pathData); + + + + +my $base = "scale(0.6057),matrix(1 0 0 -1 0 317), rotate(180),translate(-514,-317)"; + + +my @cardCollection; + +for $name(0..$#cards) #22 letters for 22 cards +{ + + #calcuate the thing's place in the grid: + + $cardsToARow = 5; + $cardsToAColumn = 5; + + my $row = int($name/$cardsToARow); # cards to a row + my $column = int($name % $cardsToAColumn); + + $margin = 25; + $cardWidth = 514*0.6057; + $cardHeight = 317*0.6057; + + + $transX = 40 + ($margin + $cardWidth ) * $column; + $transY = 40 + ($margin + $cardHeight) * $row; + + + + ${"group_".$name} = + $svg->group( + id => "group_".$name, + transform => "translate($transX,$transY),"."$base" + ); + + push @cardCollection, ${"group_".$name}; +} + + + + + + + + + +for ($i = 0; $i <= $#cardCollection; $i++) +{ + + +my $data = $xml->XMLin($cards[$i], ForceArray => 1); my %data = %$data; @@ -123,65 +215,6 @@ ); - - -#print Dumper(%juzz); - - -my $svg= SVG->new(width=>"18in",height=>"12in"); - -#print Dumper($juzz{'path'}[2]); -#print "\n***************************\n"; -#print Dumper($pathData); - - - - -my $base = "scale(0.6057),matrix(1 0 0 -1 0 317), rotate(180),translate(-514,-317)"; - - -my @cardCollection; - -for $name(0..21) #22 letters for 22 cards -{ - - #calcuate the thing's place in the grid: - - $cardsToARow = 5; - $cardsToAColumn = 5; - - my $row = int($name/$cardsToARow); # cards to a row - my $column = int($name % $cardsToAColumn); - - $margin = 25; - $cardWidth = 514*0.6057; - $cardHeight = 317*0.6057; - - - $transX = 40 + ($margin + $cardWidth ) * $column; - $transY = 40 + ($margin + $cardHeight) * $row; - - - - ${"group_".$name} = - $svg->group( - id => "group_".$name, - transform => "translate($transX,$transY),"."$base" - ); - - push @cardCollection, ${"group_".$name}; -} - - - - - - - - -for ($i = 0; $i <= $#cardCollection; $i++) -{ - for $pathData(@{$juzz{'path'}}) { $cardCollection[$i]->tag('path', %{$pathData}); @@ -319,12 +352,7 @@ $attach1 -$boundary -Content-Type: application/octet-stream; name="huh.txt" -Content-Transfer-Encoding: base64 -Content-Disposition: attachment; filename="huh.txt" -$attach2 $boundary-- END_OF_BODY diff -r 1b5417799713 -r 95fa4bcc5d67 images/LaserKard Home Image - blue.eps Binary file images/LaserKard Home Image - blue.eps has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/LaserKard Home Image - cyan.eps Binary file images/LaserKard Home Image - cyan.eps has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/LaserKard Home Image - green.eps Binary file images/LaserKard Home Image - green.eps has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/LaserKard Home Image - orange.eps Binary file images/LaserKard Home Image - orange.eps has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/LaserKard Home Image - purple.eps Binary file images/LaserKard Home Image - purple.eps has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/bl_sm.jpg Binary file images/bl_sm.jpg has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/cy_sm.jpg Binary file images/cy_sm.jpg has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/gr_sm.jpg Binary file images/gr_sm.jpg has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/olbl_sm.jpg Binary file images/olbl_sm.jpg has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/olgr_sm.jpg Binary file images/olgr_sm.jpg has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/olor_sm.jpg Binary file images/olor_sm.jpg has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/or_sm.jpg Binary file images/or_sm.jpg has changed diff -r 1b5417799713 -r 95fa4bcc5d67 images/pr_sm.jpg Binary file images/pr_sm.jpg has changed diff -r 1b5417799713 -r 95fa4bcc5d67 index.php --- a/index.php Mon Feb 01 02:54:59 2010 -0500 +++ b/index.php Wed Feb 03 03:14:09 2010 -0500 @@ -19,7 +19,7 @@
- +
diff -r 1b5417799713 -r 95fa4bcc5d67 log/error_log.log --- a/log/error_log.log Mon Feb 01 02:54:59 2010 -0500 +++ b/log/error_log.log Wed Feb 03 03:14:09 2010 -0500 @@ -357,3 +357,63 @@ [Mon Feb 01 01:34:50 2010] [error] [client 18.236.1.40] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico [Mon Feb 01 02:25:11 2010] [error] [client 18.236.1.40] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico [Mon Feb 01 02:25:18 2010] [error] [client 18.236.1.40] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 09:56:05 2010] [error] [client 18.236.1.40] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 09:56:08 2010] [error] [client 18.236.1.40] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 12:17:52 2010] [error] [client 18.111.53.219] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 12:17:55 2010] [error] [client 18.111.53.219] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 16:23:29 2010] [error] [client 18.238.1.90] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 16:23:33 2010] [error] [client 18.238.1.90] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 17:12:24 2010] [error] [client 18.238.1.90] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 17:12:27 2010] [error] [client 18.238.1.90] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 17:12:27 2010] [error] [client 18.238.1.90] File does not exist: /home/rlm/Desktop/web/laserkard/favicon.ico +[Mon Feb 01 19:58:24 2010] [error] [client 18.238.1.90] malformed header from script. Bad header=