#!/usr/bin/perl -w # -*- Mode: perl; indent-tabs-mode: nil -*- # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # http://www.mozilla.org/MPL/ # # Software distributed under the License is distributed on an "AS IS" basis, # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # for the specific language governing rights and limitations under the # License. # # The Original Code is the Mozilla graph tool. # # The Initial Developer of the Original Code is AOL Time Warner, Inc. # # Portions created by AOL Time Warner, Inc. are Copyright (C) 2001 # AOL Time Warner, Inc. All Rights Reserved. # # Contributor(s): # Chris McAfee # John Morrison # use CGI::Carp qw(fatalsToBrowser); use CGI::Request; my $req = new CGI::Request; my $TESTNAME = lc($req->param('testname')); my $UNITS = lc($req->param('units')); my $TBOXES = lc($req->param('tboxes')); my $AUTOSCALE = lc($req->param('autoscale')); my $DAYS = lc($req->param('days')); my $LTYPE = lc($req->param('ltype')); my $POINTS = lc($req->param('points')); my $AVG = lc($req->param('avg')); sub make_filenames_list { my ($dir) = @_; my @result; if (-d "$dir") { chdir "$dir"; while(<*>) { if( $_ ne 'config.txt' ) { push @result, $_; } } chdir "../.."; } return @result; } # Print out a list of testnames in db directory sub print_testnames { # HTTP header print "Content-type: text/html\n\n\n"; print "multiquery: testnames"; print "

multiquery: testnames

"; print "

"; print ""; print "
Select one of the following tests:
\n"; print "
    \n"; my @machines = make_filenames_list("db"); my $machines_string = join(" ", @machines); foreach (@machines) { print "
  • $_\n"; } print "
"; } # Print out a list of machines in db/ directory, with links. sub print_machines { my ($testname) = @_; # HTTP header print "Content-type: text/html\n\n\n"; print "$TESTNAME machines"; # XXX Testing, this isn't correct yet. print "\n"; print "

$TESTNAME machines:

"; print "

"; print ""; print "
Select one of the following machines:
\n"; print "
    \n"; my @machines = make_filenames_list("db/$testname"); my $machines_string = join(" ", @machines); # XXX Testing, this isn't correct yet. print "
    \n"; print ""; @machines = ("comet", "sleestack"); foreach(@machines) { print "$_
    \n"; } #print ""; #print "\n"; print "\n"; print "
    \n"; print "
"; } sub show_graphs { # HTTP header print "Content-type: text/html\n\n\n"; print "multiquery: $TESTNAME
\n"; print "\n"; # JS refresh every 30min print "\n"; print "

$TESTNAME: $TBOXES

\n"; # Options print "\n"; print "\n"; # Scale Y-axis print "\n"; # Days, Time-axis print "\n"; # Line style (lines|steps) print "\n"; # Points print "\n"; # Average (on|off) print "\n"; print "\n"; print "
\n"; print "\n"; if($AUTOSCALE) { print "Y-axis: (zoom|"; print "100%"; print ") \n"; } else { print "Y-axis: ("; print "zoom"; print "|100%) \n"; } print "\n"; print "\n"; print "
\n"; print "\n"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "Days:"; if($DAYS) { print "(all data|"; print ""; print ")\n"; } else { print "(all data|"; print ""; print ")\n"; } print "\n"; print "
\n"; print "
\n"; print "\n"; print "Style:"; if($LTYPE eq "steps") { print "("; print "lines"; print "|steps"; print ")"; } else { print "(lines|"; print "steps"; print ")"; } print "\n"; print "\n"; print "\n"; print "Points:"; if($POINTS) { print "(on|"; print "off"; print ")\n"; } else { print "("; print "on"; print "|off)\n"; } print "\n"; print "\n"; print "\n"; print "Average:"; if($AVG) { print "(on|"; print "off"; print ")\n"; } else { print "("; print "on"; print "|off)\n"; } print "\n"; print "
\n"; print "
\n"; print "\n"; my @tbox_array = split(",", $TBOXES); my $i = 0; while($i < @tbox_array) { print "\n"; print "\n"; $i++; if($i < @tbox_array) { print "\n"; $i++; print "\n"; } } print "
\n"; print "\"$tbox_array[$i]"; print "\n"; print "\"$tbox_array[$i]"; print "
\n"; # # Links at the bottom. # # luna,sleestack,mecca,mocha print "
  • \n"; print "Multiqueries: (startup, xulwinopen, pageload, build your own multiquery)"; print "
  • \n"; print "\n"; } # main { if(!$TESTNAME) { print_testnames(); } elsif(!$TBOXES) { print_machines($TESTNAME); } else { show_graphs(); } } exit 0;