rlm@0: #!/usr/bin/perl
rlm@0:
rlm@0:
rlm@0: use List::Util qw(first max maxstr min minstr reduce shuffle sum);
rlm@0: use Storable;
rlm@0: use CGI::Ajax;
rlm@0: use CGI;
rlm@0:
rlm@0:
rlm@0:
rlm@0: my $q = new CGI;
rlm@0:
rlm@0:
rlm@0:
rlm@0: my %hash = (
rlm@0:
rlm@0: 'material' => \&material,
rlm@0: 'template' => \&template,
rlm@0: 'inputbox' => \&inputbox,
rlm@0: 'display' => \&display,
rlm@0: 'change_rules' => \&change_rules);
rlm@0:
rlm@0:
rlm@0:
rlm@0: my $pjx = CGI::Ajax->new(%hash);
rlm@0: #$pjx->JSDEBUG(1);
rlm@0: #$pjx->DEBUG(1);
rlm@0:
rlm@0: print $pjx->build_html($q,\&gen); # this outputs the html for the page
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0: sub material{
rlm@0:
rlm@0: $newvar = shift;
rlm@0:
rlm@0: my $t = $newvar;
rlm@0:
rlm@0: $newvar =~ m/([^_]*)_/;
rlm@0: $newvar = $1;
rlm@0:
rlm@0: #return (($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked');
rlm@0:
rlm@0: #$y = "$t ".(($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked')."
rlm@0: $y = ""."
rlm@0:
rlm@0: ";
rlm@0:
rlm@0: return $y;
rlm@0:
rlm@0:
rlm@0: }
rlm@0:
rlm@0:
rlm@0:
rlm@0: sub template
rlm@0: {
rlm@0:
rlm@0: $all = shift;
rlm@0: $all =~ m/_(.*)/;
rlm@0:
rlm@0: $materialcolor = $1;
rlm@0:
rlm@0:
rlm@0: $r = "
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0: ";
rlm@0:
rlm@0: return $r;
rlm@0: }
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0: sub inputbox
rlm@0: {
rlm@0:
rlm@0: #grab the type of template we'll be using <<<<
rlm@0: $type = shift;
rlm@0: # return $type;
rlm@0: # we have to care about both the type of template and the material and the color. these are stored in $type>>>>
rlm@0:
rlm@0: #Then, update with a special custon paypal form, taken from the paypal folder and specially designed for that particular template.
rlm@0: #will probaly eventually create a script to automate the generation of these files.
rlm@0:
rlm@0:
rlm@0: #take care of everythign but acrylic clear type
rlm@0: if (not($type =~ m/acrylic_clear/))
rlm@0: {
rlm@0: return "comming soon!";
rlm@0: }
rlm@0:
rlm@0:
rlm@0: #every type has it's own associated paylist file the contains the things we need
rlm@0: open FILE, "<./paypal/$type.paylist";
rlm@0: return do { local $/; };
rlm@0:
rlm@0:
rlm@0:
rlm@0: }
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0: sub display
rlm@0: {
rlm@0: $all = shift;
rlm@0:
rlm@0:
rlm@0:
rlm@0: $t ="$all
rlm@0:
rlm@0: ";
rlm@0: return $t;
rlm@0:
rlm@0: }
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0: sub gen
rlm@0: {
rlm@0: {
rlm@0: local( $/, *FH ) ;
rlm@0: open( FH, "<./buy.html" ) or die "sudden flaming death\n";
rlm@0: $a = ;
rlm@0: }
rlm@0:
rlm@0: {
rlm@0: local( $/, *FH ) ;
rlm@0: open( FH, "<./top_menu.include" ) or die "sudden flaming death\n";
rlm@0: $b = ;
rlm@0: }
rlm@0:
rlm@0: $a =~ s/PERL-REPLACE::TOP_MENU/$b/; #equivalent to , but in perl with more memory problems :)
rlm@0:
rlm@0: return $a
rlm@0:
rlm@0:
rlm@0: };
rlm@0:
rlm@0: