annotate not-used/buy2.pl @ 73:5fb0e5db5926 laserkard

ready to load live site to server
author Robert McIntyre <rlm@mit.edu>
date Wed, 23 Jun 2010 10:14:46 -0400
parents 599d0315537d
children
rev   line source
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 'template_material' => \&template_material,
rlm@0 17
rlm@0 18
rlm@0 19
rlm@0 20 'materials_template' => \&materials_template,
rlm@0 21 'display' => \&display,
rlm@0 22 'inputbox_template' => \&inputbox_template,
rlm@0 23
rlm@0 24
rlm@0 25 'change_rules' => \&change_rules);
rlm@0 26
rlm@0 27
rlm@0 28
rlm@0 29 my $pjx = CGI::Ajax->new(%hash);
rlm@0 30 #$pjx->JSDEBUG(1);
rlm@0 31 #$pjx->DEBUG(1);
rlm@0 32
rlm@0 33 print $pjx->build_html($q,\&gen); # this outputs the html for the page
rlm@0 34
rlm@0 35
rlm@0 36
rlm@0 37
rlm@0 38
rlm@0 39
rlm@0 40 sub template_material
rlm@0 41 {
rlm@0 42
rlm@0 43 $all = shift;
rlm@0 44 $all =~ m/_(.*)/;
rlm@0 45
rlm@0 46 $materialcolor = $1;
rlm@0 47
rlm@0 48
rlm@0 49 $r = "$materialcolor
rlm@0 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\">
rlm@0 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\">
rlm@0 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\">
rlm@0 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\">
rlm@0 54
rlm@0 55
rlm@0 56 ";
rlm@0 57
rlm@0 58 return $r;
rlm@0 59 }
rlm@0 60
rlm@0 61
rlm@0 62
rlm@0 63 sub display
rlm@0 64 {
rlm@0 65 $all = shift;
rlm@0 66
rlm@0 67
rlm@0 68
rlm@0 69 $t ="$all
rlm@0 70 <input TYPE=\"image\" src = \"./templates/display/$all.jpg\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"temp1\" NAME=\"temp1\" VALUE=\"\">
rlm@0 71 ";
rlm@0 72 return $t;
rlm@0 73
rlm@0 74 }
rlm@0 75
rlm@0 76
rlm@0 77
rlm@0 78
rlm@0 79 sub materials_template{
rlm@0 80
rlm@0 81 $newvar = shift;
rlm@0 82
rlm@0 83 my $t = $newvar;
rlm@0 84
rlm@0 85 $newvar =~ m/([^_]*)_/;
rlm@0 86 $newvar = $1;
rlm@0 87
rlm@0 88 #return (($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked');
rlm@0 89
rlm@0 90 $y = "$t<br>".(($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked')."
rlm@0 91 <form id=\"radiobuttons\">
rlm@0 92 <h3>PICK your Materials?:&nbsp;</h3>
rlm@0 93
rlm@0 94 <div class = \"Acrylic\">
rlm@0 95 Acrylic:
rlm@0 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>
rlm@0 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>
rlm@0 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>
rlm@0 99 </div>
rlm@0 100
rlm@0 101 <div class = \"Aluminum\">
rlm@0 102 Aluminum:
rlm@0 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>
rlm@0 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>
rlm@0 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>
rlm@0 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>
rlm@0 107 </div>
rlm@0 108
rlm@0 109
rlm@0 110 </form>
rlm@0 111 ";
rlm@0 112
rlm@0 113
rlm@0 114
rlm@0 115
rlm@0 116 }
rlm@0 117
rlm@0 118 sub inputbox_template
rlm@0 119 {
rlm@0 120 $all = shift;
rlm@0 121 return $all;
rlm@0 122 }
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 gen
rlm@0 136 {
rlm@0 137 open FILE, "<./buy2.html";
rlm@0 138 return do { local $/; <FILE> };
rlm@0 139
rlm@0 140 };
rlm@0 141
rlm@0 142