rlm@0: #!/usr/bin/perl
rlm@0:
rlm@0:
rlm@0: use List::Util qw(first max maxstr min minstr reduce shuffle sum);
rlm@0: use Storable;
rlm@0: use CGI::Ajax;
rlm@0: use CGI;
rlm@0:
rlm@0:
rlm@0:
rlm@0: my $q = new CGI;
rlm@0:
rlm@0:
rlm@0:
rlm@0: my %hash = (
rlm@0: 'template_material' => \&template_material,
rlm@0:
rlm@0:
rlm@0:
rlm@0: 'materials_template' => \&materials_template,
rlm@0: 'display' => \&display,
rlm@0: 'inputbox_template' => \&inputbox_template,
rlm@0:
rlm@0:
rlm@0: 'change_rules' => \&change_rules);
rlm@0:
rlm@0:
rlm@0:
rlm@0: my $pjx = CGI::Ajax->new(%hash);
rlm@0: #$pjx->JSDEBUG(1);
rlm@0: #$pjx->DEBUG(1);
rlm@0:
rlm@0: print $pjx->build_html($q,\&gen); # this outputs the html for the page
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0: sub template_material
rlm@0: {
rlm@0:
rlm@0: $all = shift;
rlm@0: $all =~ m/_(.*)/;
rlm@0:
rlm@0: $materialcolor = $1;
rlm@0:
rlm@0:
rlm@0: $r = "$materialcolor
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0: ";
rlm@0:
rlm@0: return $r;
rlm@0: }
rlm@0:
rlm@0:
rlm@0:
rlm@0: sub display
rlm@0: {
rlm@0: $all = shift;
rlm@0:
rlm@0:
rlm@0:
rlm@0: $t ="$all
rlm@0:
rlm@0: ";
rlm@0: return $t;
rlm@0:
rlm@0: }
rlm@0:
rlm@0:
rlm@0:
rlm@0:
rlm@0: sub materials_template{
rlm@0:
rlm@0: $newvar = shift;
rlm@0:
rlm@0: my $t = $newvar;
rlm@0:
rlm@0: $newvar =~ m/([^_]*)_/;
rlm@0: $newvar = $1;
rlm@0:
rlm@0: #return (($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked');
rlm@0:
rlm@0: $y = "$t
".(($t =~ m/_acrylic_green/) ? 'CHECKED' : 'notchecked')."
rlm@0: