rlm@0
|
1 #!/usr/bin/perl
|
rlm@0
|
2
|
rlm@0
|
3
|
rlm@0
|
4 use List::Util qw(first max maxstr min minstr reduce shuffle sum);
|
rlm@0
|
5 use Storable;
|
rlm@0
|
6 use CGI::Ajax;
|
rlm@0
|
7 use CGI;
|
rlm@0
|
8
|
rlm@0
|
9
|
rlm@0
|
10
|
rlm@0
|
11 my $q = new CGI;
|
rlm@0
|
12
|
rlm@0
|
13
|
rlm@0
|
14
|
rlm@0
|
15 my %hash = (
|
rlm@0
|
16
|
rlm@0
|
17 'material' => \&material,
|
rlm@0
|
18 'template' => \&template,
|
rlm@0
|
19 'inputbox' => \&inputbox,
|
rlm@0
|
20 'display' => \&display,
|
rlm@0
|
21 'change_rules' => \&change_rules);
|
rlm@0
|
22
|
rlm@0
|
23
|
rlm@0
|
24
|
rlm@0
|
25 my $pjx = CGI::Ajax->new(%hash);
|
rlm@0
|
26 #$pjx->JSDEBUG(1);
|
rlm@0
|
27 #$pjx->DEBUG(1);
|
rlm@0
|
28
|
rlm@0
|
29 print $pjx->build_html($q,\&gen); # this outputs the html for the page
|
rlm@0
|
30
|
rlm@0
|
31
|
rlm@0
|
32
|
rlm@0
|
33
|
rlm@0
|
34
|
rlm@0
|
35 sub material{
|
rlm@0
|
36
|
rlm@0
|
37 $newvar = shift;
|
rlm@0
|
38
|
rlm@0
|
39 my $t = $newvar;
|
rlm@0
|
40
|
rlm@0
|
41 $newvar =~ m/([^_]*)_/;
|
rlm@0
|
42 $newvar = $1;
|
rlm@0
|
43
|
rlm@0
|
44 #return (($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked');
|
rlm@0
|
45
|
rlm@0
|
46 #$y = "$t<br>".(($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked')."
|
rlm@0
|
47 $y = ""."
|
rlm@0
|
48 <form id=\"radiobuttons\">
|
rlm@0
|
49 <h3>PICK your Materials?: </h3>
|
rlm@0
|
50
|
rlm@0
|
51 <div class = \"Acrylic\">
|
rlm@0
|
52 Acrylic:
|
rlm@0
|
53 <input TYPE=\"radio\" onclick=\"template([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); inputbox([\'radio1\'], [\'inputbox\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_acrylic_clear\"".(($t =~ m/_acrylic_clear/) ? 'CHECKED' : '')."><a href=\"\#\">Clear</a>
|
rlm@0
|
54 <input TYPE=\"radio\" onclick=\"template([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); inputbox([\'radio1\'], [\'inputbox\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_acrylic_blue\"".(($t =~ m/_acrylic_blue/) ? 'CHECKED' : '')."><a href=\"\#\">Blue</a>
|
rlm@0
|
55 <input TYPE=\"radio\" onclick=\"template([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); inputbox([\'radio1\'], [\'inputbox\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_acrylic_green\"".(($t =~ m/_acrylic_green/) ? 'CHECKED' : '')."><a href=\"\#\">Green</a>
|
rlm@0
|
56 </div>
|
rlm@0
|
57
|
rlm@0
|
58 <div class = \"Aluminum\">
|
rlm@0
|
59 Aluminum:
|
rlm@0
|
60 <input TYPE=\"radio\" onclick=\"template([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); inputbox([\'radio1\'], [\'inputbox\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_aluminum_red\"".(($t =~ m/_aluminum_red/) ? 'CHECKED' : '')."><a href=\"\#\">Red</a>
|
rlm@0
|
61 <input TYPE=\"radio\" onclick=\"template([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); inputbox([\'radio1\'], [\'inputbox\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_aluminum_blue\"".(($t =~ m/_aluminum_blue/) ? 'CHECKED' : '')."><a href=\"\#\">Blue</a>
|
rlm@0
|
62 <input TYPE=\"radio\" onclick=\"template([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); inputbox([\'radio1\'], [\'inputbox\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_aluminum_green\"".(($t =~ m/_aluminum_green/) ? 'CHECKED' : '')."><a href=\"\#\">Green</a>
|
rlm@0
|
63 <input TYPE=\"radio\" onclick=\"template([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); inputbox([\'radio1\'], [\'inputbox\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_aluminum_black\"".(($t =~ m/_aluminum_black/) ? 'CHECKED' : '')."><a href=\"\#\">Black</a>
|
rlm@0
|
64 </div>
|
rlm@0
|
65
|
rlm@0
|
66
|
rlm@0
|
67 </form>
|
rlm@0
|
68 ";
|
rlm@0
|
69
|
rlm@0
|
70 return $y;
|
rlm@0
|
71
|
rlm@0
|
72
|
rlm@0
|
73 }
|
rlm@0
|
74
|
rlm@0
|
75
|
rlm@0
|
76
|
rlm@0
|
77 sub template
|
rlm@0
|
78 {
|
rlm@0
|
79
|
rlm@0
|
80 $all = shift;
|
rlm@0
|
81 $all =~ m/_(.*)/;
|
rlm@0
|
82
|
rlm@0
|
83 $materialcolor = $1;
|
rlm@0
|
84
|
rlm@0
|
85
|
rlm@0
|
86 $r = "
|
rlm@0
|
87 <input TYPE=\"image\" src = \"./templates/thumbnails/classic_$materialcolor.jpg\" onclick=\"display([\'template1\'], [\'display\']); inputbox([\'template1\'], [\'inputbox\']);material([\'template1\'], [\'materials\']);\" ID=\"template1\" NAME=\"template1\" VALUE=\"classic_$materialcolor\">
|
rlm@0
|
88 <input TYPE=\"image\" src = \"./templates/thumbnails/big_$materialcolor.jpg\" onclick=\"display([\'template2\'], [\'display\']); inputbox([\'template2\'], [\'inputbox\']);material([\'template2\'], [\'materials\']);\" ID=\"template2\" NAME=\"template2\" VALUE=\"big_$materialcolor\">
|
rlm@0
|
89 <input TYPE=\"image\" src = \"./templates/thumbnails/basic_$materialcolor.jpg\" onclick=\"display([\'template3\'], [\'display\']); inputbox([\'template3\'], [\'inputbox\']);material([\'template3\'], [\'materials\']);\" ID=\"template3\" NAME=\"template3\" VALUE=\"basic_$materialcolor\">
|
rlm@0
|
90 <input TYPE=\"image\" src = \"./templates/thumbnails/lines_$materialcolor.jpg\" onclick=\"display([\'template4\'], [\'display\']); inputbox([\'template4\'], [\'inputbox\']);material([\'template4\'], [\'materials\']);\" ID=\"template4\" NAME=\"template4\" VALUE=\"lines_$materialcolor\">
|
rlm@0
|
91
|
rlm@0
|
92
|
rlm@0
|
93 ";
|
rlm@0
|
94
|
rlm@0
|
95 return $r;
|
rlm@0
|
96 }
|
rlm@0
|
97
|
rlm@0
|
98
|
rlm@0
|
99
|
rlm@0
|
100
|
rlm@0
|
101 sub inputbox
|
rlm@0
|
102 {
|
rlm@0
|
103
|
rlm@0
|
104 #grab the type of template we'll be using <<<<
|
rlm@0
|
105 $type = shift;
|
rlm@0
|
106 # return $type;
|
rlm@0
|
107 # we have to care about both the type of template and the material and the color. these are stored in $type>>>>
|
rlm@0
|
108
|
rlm@0
|
109 #Then, update with a special custon paypal form, taken from the paypal folder and specially designed for that particular template.
|
rlm@0
|
110 #will probaly eventually create a script to automate the generation of these files.
|
rlm@0
|
111
|
rlm@0
|
112
|
rlm@0
|
113 #take care of everythign but acrylic clear type
|
rlm@0
|
114 if (not($type =~ m/acrylic_clear/))
|
rlm@0
|
115 {
|
rlm@0
|
116 return "comming soon!";
|
rlm@0
|
117 }
|
rlm@0
|
118
|
rlm@0
|
119
|
rlm@0
|
120 #every type has it's own associated paylist file the contains the things we need
|
rlm@0
|
121 open FILE, "<./paypal/$type.paylist";
|
rlm@0
|
122 return do { local $/; <FILE> };
|
rlm@0
|
123
|
rlm@0
|
124
|
rlm@0
|
125
|
rlm@0
|
126 }
|
rlm@0
|
127
|
rlm@0
|
128
|
rlm@0
|
129
|
rlm@0
|
130
|
rlm@0
|
131
|
rlm@0
|
132
|
rlm@0
|
133
|
rlm@0
|
134
|
rlm@0
|
135 sub display
|
rlm@0
|
136 {
|
rlm@0
|
137 $all = shift;
|
rlm@0
|
138
|
rlm@0
|
139
|
rlm@0
|
140
|
rlm@0
|
141 $t ="$all
|
rlm@0
|
142 <input TYPE=\"image\" src = \"./templates/display/$all.jpg\" onclick=\"template([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"temp1\" NAME=\"temp1\" VALUE=\"\">
|
rlm@0
|
143 ";
|
rlm@0
|
144 return $t;
|
rlm@0
|
145
|
rlm@0
|
146 }
|
rlm@0
|
147
|
rlm@0
|
148
|
rlm@0
|
149
|
rlm@0
|
150
|
rlm@0
|
151 sub gen
|
rlm@0
|
152 {
|
rlm@0
|
153 {
|
rlm@0
|
154 local( $/, *FH ) ;
|
rlm@0
|
155 open( FH, "<./buy.html" ) or die "sudden flaming death\n";
|
rlm@0
|
156 $a = <FH>;
|
rlm@0
|
157 }
|
rlm@0
|
158
|
rlm@0
|
159 {
|
rlm@0
|
160 local( $/, *FH ) ;
|
rlm@0
|
161 open( FH, "<./top_menu.include" ) or die "sudden flaming death\n";
|
rlm@0
|
162 $b = <FH>;
|
rlm@0
|
163 }
|
rlm@0
|
164
|
rlm@0
|
165 $a =~ s/PERL-REPLACE::TOP_MENU/$b/; #equivalent to <?php include("top_menu.html"); ?>, but in perl with more memory problems :)
|
rlm@0
|
166
|
rlm@0
|
167 return $a
|
rlm@0
|
168
|
rlm@0
|
169
|
rlm@0
|
170 };
|
rlm@0
|
171
|
rlm@0
|
172
|