Mercurial > laserkard
comparison not-used/buy2.pl @ 0:599d0315537d laserkard
[svn r1] initial import
author | rlm |
---|---|
date | Wed, 30 Dec 2009 02:01:25 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:599d0315537d |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 | |
4 use List::Util qw(first max maxstr min minstr reduce shuffle sum); | |
5 use Storable; | |
6 use CGI::Ajax; | |
7 use CGI; | |
8 | |
9 | |
10 | |
11 my $q = new CGI; | |
12 | |
13 | |
14 | |
15 my %hash = ( | |
16 'template_material' => \&template_material, | |
17 | |
18 | |
19 | |
20 'materials_template' => \&materials_template, | |
21 'display' => \&display, | |
22 'inputbox_template' => \&inputbox_template, | |
23 | |
24 | |
25 'change_rules' => \&change_rules); | |
26 | |
27 | |
28 | |
29 my $pjx = CGI::Ajax->new(%hash); | |
30 #$pjx->JSDEBUG(1); | |
31 #$pjx->DEBUG(1); | |
32 | |
33 print $pjx->build_html($q,\&gen); # this outputs the html for the page | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 sub template_material | |
41 { | |
42 | |
43 $all = shift; | |
44 $all =~ m/_(.*)/; | |
45 | |
46 $materialcolor = $1; | |
47 | |
48 | |
49 $r = "$materialcolor | |
50 <input TYPE=\"image\" src = \"./templates/thumbnails/classic_$materialcolor.jpg\" onclick=\"display([\'template1\'], [\'display\']); inputbox_template([\'template1\'], [\'inputbox\']);materials_template([\'template1\'], [\'materials\']);\" ID=\"template1\" NAME=\"template1\" VALUE=\"classic_$materialcolor\"> | |
51 <input TYPE=\"image\" src = \"./templates/thumbnails/big_$materialcolor.jpg\" onclick=\"display([\'template2\'], [\'display\']); inputbox_template([\'template2\'], [\'inputbox\']);materials_template([\'template2\'], [\'materials\']);\" ID=\"template2\" NAME=\"template2\" VALUE=\"big_$materialcolor\"> | |
52 <input TYPE=\"image\" src = \"./templates/thumbnails/basic_$materialcolor.jpg\" onclick=\"display([\'template3\'], [\'display\']); inputbox_template([\'template3\'], [\'inputbox\']);materials_template([\'template3\'], [\'materials\']);\" ID=\"template3\" NAME=\"template3\" VALUE=\"basic_$materialcolor\"> | |
53 <input TYPE=\"image\" src = \"./templates/thumbnails/lines_$materialcolor.jpg\" onclick=\"display([\'template4\'], [\'display\']); inputbox_template([\'template4\'], [\'inputbox\']);materials_template([\'template4\'], [\'materials\']);\" ID=\"template4\" NAME=\"template4\" VALUE=\"lines_$materialcolor\"> | |
54 | |
55 | |
56 "; | |
57 | |
58 return $r; | |
59 } | |
60 | |
61 | |
62 | |
63 sub display | |
64 { | |
65 $all = shift; | |
66 | |
67 | |
68 | |
69 $t ="$all | |
70 <input TYPE=\"image\" src = \"./templates/display/$all.jpg\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"temp1\" NAME=\"temp1\" VALUE=\"\"> | |
71 "; | |
72 return $t; | |
73 | |
74 } | |
75 | |
76 | |
77 | |
78 | |
79 sub materials_template{ | |
80 | |
81 $newvar = shift; | |
82 | |
83 my $t = $newvar; | |
84 | |
85 $newvar =~ m/([^_]*)_/; | |
86 $newvar = $1; | |
87 | |
88 #return (($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked'); | |
89 | |
90 $y = "$t<br>".(($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked')." | |
91 <form id=\"radiobuttons\"> | |
92 <h3>PICK your Materials?: </h3> | |
93 | |
94 <div class = \"Acrylic\"> | |
95 Acrylic: | |
96 <input TYPE=\"radio\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_acrylic_clear\"".(($t =~ m/_acrylic_clear/) ? 'CHECKED' : '')."><a href=\"\#\">Clear</a> | |
97 <input TYPE=\"radio\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_acrylic_blue\"".(($t =~ m/_acrylic_blue/) ? 'CHECKED' : '')."><a href=\"\#\">Blue</a> | |
98 <input TYPE=\"radio\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_acrylic_green\"".(($t =~ m/_acrylic_green/) ? 'CHECKED' : '')."><a href=\"\#\">Green</a> | |
99 </div> | |
100 | |
101 <div class = \"Aluminum\"> | |
102 Aluminum: | |
103 <input TYPE=\"radio\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_aluminum_red\"".(($t =~ m/_aluminum_red/) ? 'CHECKED' : '')."><a href=\"\#\">Red</a> | |
104 <input TYPE=\"radio\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_aluminum_blue\"".(($t =~ m/_aluminum_blue/) ? 'CHECKED' : '')."><a href=\"\#\">Blue</a> | |
105 <input TYPE=\"radio\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_aluminum_green\"".(($t =~ m/_aluminum_green/) ? 'CHECKED' : '')."><a href=\"\#\">Green</a> | |
106 <input TYPE=\"radio\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"radio1\" NAME=\"radio1\" VALUE=\"".$newvar."_aluminum_black\"".(($t =~ m/_aluminum_black/) ? 'CHECKED' : '')."><a href=\"\#\">Black</a> | |
107 </div> | |
108 | |
109 | |
110 </form> | |
111 "; | |
112 | |
113 | |
114 | |
115 | |
116 } | |
117 | |
118 sub inputbox_template | |
119 { | |
120 $all = shift; | |
121 return $all; | |
122 } | |
123 | |
124 | |
125 | |
126 | |
127 | |
128 | |
129 | |
130 | |
131 | |
132 | |
133 | |
134 | |
135 sub gen | |
136 { | |
137 open FILE, "<./buy2.html"; | |
138 return do { local $/; <FILE> }; | |
139 | |
140 }; | |
141 | |
142 |