diff --git a/html/ops/stripchart.cgi b/html/ops/stripchart.cgi deleted file mode 100755 index 5fcd9a1533..0000000000 --- a/html/ops/stripchart.cgi +++ /dev/null @@ -1,466 +0,0 @@ -#! /usr/local/bin/perl - -# The contents of this file are subject to the Mozilla Public License -# Version 1.0 (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 Berkeley Open Infrastructure for Network Computing. -# -# The Initial Developer of the Original Code is the SETI@home project. -# Portions created by the SETI@home project are Copyright (C) 2002 -# University of California at Berkeley. All Rights Reserved. -# -# Contributor(s): -# - -# Stripchart.cgi - Version 2.0 by Matt Lebofsky ( November 4, 2002) -# -# Requires: stripchart -# apache or other CGI-enabled web server -# -# Stripchart.cgi is a web-based GUI interface for stripchart, allowing -# users to display multiple plots from various data sources. -# -# You should only need to edit the variables in the section -# "GLOBAL/DEFAULT VARS" below -# -# Type "stripchart -h" for usage -# -# See doc/stripchart.txt for details - -use CGI; -$query = CGI::new(); -use File::Basename; -use Time::Local; - -##################### -# GLOBAL/DEFAULT VARS -##################### - -# Where are these unix commands located? -$grepexe = "/usr/bin/grep"; - -# Where is the stripchart executable located? -$stripchartexe = "/usr/local/stripchart/stripchart"; - -# What is the default number of stripcharts? -$defaultnumcharts = 4; - -# Any default flags to send to stripchart? -$defaultflags = "-s"; - -# Read in list of datafiles: -$datafilelist = "/usr/local/www/share/cgi-bin/lib/datafiles"; -@datafiles = `$grepexe -v '^#' $datafilelist`; - -# Read in list of queries: -$queryfilelist = "/usr/local/www/share/cgi-bin/lib/querylist"; -@querylist = `$grepexe -v '^#' $queryfilelist`; - -# What time is it right now? -$rightnow = time; -($sec,$min,$hour,$day,$month,$year) = localtime($rightnow); -$sec = ""; -$month++; -$year += 1900; - -# Make file option list based on @datafiles -$optionlist = ""; -foreach $element (@datafiles) { - chomp $element; - $thisop = (split /:/, $element)[1]; - $optionlist .= "\n"; - } - -# Make query option list based on @querylist -$queryoptionlist = ""; -foreach $element (@querylist) { - chomp $element; - ($thisname,$thisquery) = (split /:/, $element)[0,1]; - $queryoptionlist .= "\n"; - } - -# Make year list based on time right now, and other lists -$yearlist = ""; -for ($i = $year; $i> 1999; $i--) { $yearlist .= "\n" } -$monthlist = sprintf("\n",$month); -foreach $i (01 .. 12) { $monthlist .= sprintf("\n",$i) } -$daylist = sprintf("\n",$day); -foreach $i (01 .. 31) { $daylist .= sprintf("\n",$i) } -$hourlist = sprintf("\n",$hour); -foreach $i (00 .. 23) { $hourlist .= sprintf("\n",$i) } -$minlist = sprintf("\n",$min); -for ($i=0; $i<59; $i+=5) { $minlist .= sprintf("\n",$i) } - -# Seconds in a day -$daysecs = 86400; - -############# -# SUBS -############# - -sub to_unix_time { - # same routine as in stripchart - - # no colons and no decimal point? must already be in unix time - if ($_[0] !~ /:/ && $_[0] !~ /\./ ) { return $_[0] } - - # colons = civil time - if ($_[0] =~ /:/) { - (my $year, my $month, my $day, my $hour, my $minute) = split /:/, $_[0]; - $month--; - return timelocal(0,$minute,$hour,$day,$month,$year) - } - - # must be julian date - return (($_[0] - 2440587.5) * $daysecs); - - } - -############# -# MAIN -############# - -# ARE WE JUST PLOTTING A SINGLE GRAPH? -# -# stripchart.cgi calls itself via an "param("flags"); - $outfile = "/tmp/tempout$$" . "." . rand(100000); - print "Content-type: image/gif\n\n"; - `$stripchartexe $flags > $outfile`; - open (OUTFILE,"$outfile"); - while ($dummy=read(OUTFILE,$buffer,1024)) { print $buffer } - close (OUTFILE); - exit 0 - } - -# ARE WE SAVING/DELETING A QUERY? -# -# If the user chose to save or delete a query, act on that and -# then continue on with the standard plots: - -if ($query->param("sqname") ne "") { - $sqname = $query->param("sqname"); - # are we deleting it? - if ($query->param("delq") eq "y") { - @querylist = `$grepexe -v '^$sqname:' $queryfilelist`; - open (QUERYLIST,">$queryfilelist"); - flock (QUERYLIST,2); - foreach $queryline (@querylist) { - print QUERYLIST $queryline - } - } - # must be saving it - else { - # first check to see if query already in the list - $found = 0; - foreach $checkline (@querylist) { - ($key,$value) = split /:/, $checkline; - if ($key eq $sqname) { $found = 1 } - } - # not found - add it to the end - if (!$found) { - open (QUERYLIST,">>$queryfilelist"); - flock (QUERYLIST,2); - $fullquery = $ENV{'QUERY_STRING'}; - $fullquery =~ s/sqname=$sqname//; - print QUERYLIST "$sqname:$fullquery\n"; - close (QUERYLIST); - } - } - } - -# PARSE INCOMING -$datafile1 = $query->param("df1"); - -$numcharts = $query->param("numcharts"); -if ($numcharts == 0) { $numcharts = $defaultnumcharts } - -print $query->header; -print << "EOF"; - -
- - --
-(Note: A set of stripcharts takes upwards to 10-60 seconds to generate) -
- -EOF -