Mercurial > laserkard
view 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 |
line wrap: on
line source
1 #!/usr/bin/perl4 use List::Util qw(first max maxstr min minstr reduce shuffle sum);5 use Storable;6 use CGI::Ajax;7 use CGI;11 my $q = new CGI;15 my %hash = (16 'template_material' => \&template_material,20 'materials_template' => \&materials_template,21 'display' => \&display,22 'inputbox_template' => \&inputbox_template,25 'change_rules' => \&change_rules);29 my $pjx = CGI::Ajax->new(%hash);30 #$pjx->JSDEBUG(1);31 #$pjx->DEBUG(1);33 print $pjx->build_html($q,\&gen); # this outputs the html for the page40 sub template_material41 {43 $all = shift;44 $all =~ m/_(.*)/;46 $materialcolor = $1;49 $r = "$materialcolor50 <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\">56 ";58 return $r;59 }63 sub display64 {65 $all = shift;69 $t ="$all70 <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;74 }79 sub materials_template{81 $newvar = shift;83 my $t = $newvar;85 $newvar =~ m/([^_]*)_/;86 $newvar = $1;88 #return (($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked');90 $y = "$t<br>".(($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked')."91 <form id=\"radiobuttons\">92 <h3>PICK your Materials?: </h3>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>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>110 </form>111 ";116 }118 sub inputbox_template119 {120 $all = shift;121 return $all;122 }135 sub gen136 {137 open FILE, "<./buy2.html";138 return do { local $/; <FILE> };140 };