diff not-used/buy2.pl @ 0:599d0315537d laserkard

[svn r1] initial import
author rlm
date Wed, 30 Dec 2009 02:01:25 -0500
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/not-used/buy2.pl	Wed Dec 30 02:01:25 2009 -0500
     1.3 @@ -0,0 +1,142 @@
     1.4 +#!/usr/bin/perl
     1.5 +
     1.6 +
     1.7 +use List::Util qw(first max maxstr min minstr reduce shuffle sum);
     1.8 +use Storable;
     1.9 +use CGI::Ajax;
    1.10 +use CGI;
    1.11 +
    1.12 +
    1.13 +
    1.14 +my $q = new CGI;
    1.15 +
    1.16 +
    1.17 +
    1.18 +my %hash = ( 
    1.19 +'template_material'	=> \&template_material, 
    1.20 +
    1.21 +
    1.22 +
    1.23 +'materials_template' => \&materials_template,
    1.24 +'display'	=> \&display,
    1.25 +'inputbox_template'	=> \&inputbox_template,
    1.26 +
    1.27 +
    1.28 + 'change_rules' => \&change_rules);
    1.29 +
    1.30 +
    1.31 +
    1.32 +my $pjx = CGI::Ajax->new(%hash);
    1.33 +#$pjx->JSDEBUG(1);
    1.34 +#$pjx->DEBUG(1);
    1.35 +
    1.36 +print $pjx->build_html($q,\&gen); # this outputs the html for the page
    1.37 +
    1.38 +
    1.39 +
    1.40 +
    1.41 +
    1.42 +
    1.43 +sub template_material
    1.44 +{
    1.45 +	
    1.46 +$all = shift;
    1.47 +$all =~ m/_(.*)/;
    1.48 +
    1.49 +$materialcolor = $1;
    1.50 +
    1.51 +	
    1.52 +$r = "$materialcolor	
    1.53 +   <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\">
    1.54 +   <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\">
    1.55 +   <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\"> 
    1.56 +   <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\"> 
    1.57 + 
    1.58 +
    1.59 +";
    1.60 +
    1.61 +return $r;
    1.62 +}
    1.63 +
    1.64 +
    1.65 +
    1.66 +sub display
    1.67 +{
    1.68 +	$all = shift;
    1.69 +	
    1.70 +	
    1.71 +	
    1.72 +	$t ="$all
    1.73 +	<input TYPE=\"image\" src = \"./templates/display/$all.jpg\" onclick=\"template_material([\'radio1\'], [\'templates\']);display([\'radio1\'], [\'display\']); \" ID=\"temp1\" NAME=\"temp1\" VALUE=\"\">
    1.74 +	";
    1.75 +	return $t;
    1.76 +	
    1.77 +}
    1.78 +
    1.79 +
    1.80 +
    1.81 +
    1.82 +sub materials_template{
    1.83 +	
    1.84 +	$newvar = shift;
    1.85 +	
    1.86 +	my $t = $newvar;
    1.87 +	
    1.88 +	$newvar =~ m/([^_]*)_/;
    1.89 +	$newvar = $1;
    1.90 +	
    1.91 +	#return (($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked');
    1.92 +	
    1.93 +	$y = "$t<br>".(($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked')."
    1.94 +	<form id=\"radiobuttons\">
    1.95 +		<h3>PICK your Materials?:&nbsp;</h3>
    1.96 +		
    1.97 +		<div class = \"Acrylic\">
    1.98 +		Acrylic:
    1.99 +		<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>
   1.100 +		<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>
   1.101 +		<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>
   1.102 +		</div>
   1.103 +		
   1.104 +		<div class = \"Aluminum\">
   1.105 +		Aluminum:
   1.106 +		<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>
   1.107 +		<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>
   1.108 +		<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>
   1.109 +		<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>
   1.110 +		</div>
   1.111 +		
   1.112 +	
   1.113 +		</form>
   1.114 +	";
   1.115 +	
   1.116 +	
   1.117 +		
   1.118 +	
   1.119 +}
   1.120 +
   1.121 +sub inputbox_template
   1.122 +{
   1.123 +	$all = shift;
   1.124 +	return $all;
   1.125 +}
   1.126 +
   1.127 +
   1.128 +
   1.129 +
   1.130 +
   1.131 +
   1.132 +
   1.133 +
   1.134 +
   1.135 +
   1.136 +
   1.137 +
   1.138 +sub gen
   1.139 +{
   1.140 +open FILE, "<./buy2.html";
   1.141 +return do { local $/; <FILE> };
   1.142 +
   1.143 +};
   1.144 +
   1.145 +