ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/php/historical/browser.php
(Generate patch)

Comparing projects/cms/source/reports/php/historical/browser.php (file contents):
Revision 1.2 by pjm2, Sat Feb 3 22:35:15 2001 UTC vs.
Revision 1.45 by tdb, Sat Jun 30 11:24:39 2007 UTC

# Line 1 | Line 1
1   <?php
2  
3 < // A test navigation thingy.
4 < // pjm2@ukc.ac.uk
3 > #
4 > # i-scream central monitoring system
5 > # http://www.i-scream.org
6 > # Copyright (C) 2000-2002 i-scream
7 > #
8 > # This program is free software; you can redistribute it and/or
9 > # modify it under the terms of the GNU General Public License
10 > # as published by the Free Software Foundation; either version 2
11 > # of the License, or (at your option) any later version.
12 > #
13 > # This program is distributed in the hope that it will be useful,
14 > # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 > # GNU General Public License for more details.
17 > #
18 > # You should have received a copy of the GNU General Public License
19 > # along with this program; if not, write to the Free Software
20 > # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21 > #
22  
23 + # CONFIGURABLE CONSTANTS: -
24  
25 < function getdirArray($dir='./',$sort='asort') {
8 <    global $dir_file_count;
9 <    if ( is_dir($dir) ) {
10 <        $fd = @opendir($dir);
11 <        while ( ($part = @readdir($fd)) == TRUE ) {
12 <            clearstatcache();
13 <            if ($part != "." && $part != "..") {
14 <                $dir_array[] = $part;
15 <            }
16 <        }
17 <        if($fd == TRUE) {
18 <            closedir($fd);
19 <        }
20 <        if (is_array($dir_array)) {
21 <            $sort($dir_array);
22 <            $dir_file_count = count($dir_array);
23 <            Return $dir_array;
24 <        } else {
25 <            Return FALSE;
26 <        }
27 <    } else {
28 <        Return FALSE;
29 <    }
30 < }
25 > include("browser_config.inc.php");
26  
27 <    include("day.inc");
27 > #
28 > # END CONFIGURATION
29  
34 ?>
30  
36 <html>
37 <body bgcolor="eeeeff">
31  
39 <font face="arial, sans-serif">
40 <h4>I-scream report browser [trial 2.0]</h4>
41 </font>
32  
43 <hr>
33  
34 < <font face="arial, sans-serif" size="2">
35 < <b>View reports for <? echo "$day" ?></b>
36 < </font>
34 > # Used to return whether or not a report data file is empty.
35 > function isReportEmpty($filename, $minFileSize) {
36 >    if (filesize($filename) < $minFileSize) {
37 >        return TRUE;
38 >    }
39 >    return FALSE;
40 > }
41  
49 <p>
42  
43 < <form method="GET" action="">
52 <  <select size="1" name="machine_name">
53 <   <? include("machine_name.inc"); ?>
54 <  </select>
43 > include("iutils.inc.php");
44  
45 <  <select size="1" name="report">
57 <   <? include("report.inc"); ?>
58 <  </select>
45 > ?>
46  
47 <  <input type="submit" name="submit" value="bung">
47 > <?php include($titleHTML); ?>
48  
49 < </form>
49 > <hr weight="1" color="<?php echo $lineColor ?>">
50  
51 < </p>
51 > <b>Most recent reports available</b>
52 > <form method="<?php echo $formMethod ?>" action="<?php echo $thisPage ?>">
53 > <?php
54  
55 < <?
56 <    if ($submit == "bung") {
57 <        $url = escapeshellcmd("$day/$machine_name/$report/chart.gif");
58 <        if (file_exists($url)) {
59 <            echo "<p><img src=\"$url\" width=\"500\" height=\"250\"></p>";
55 >    $file_array = getdirArray($reportDirectory,'rsort');
56 >    print "<select size=\"1\" name=\"day\">";
57 >    if ($day) { ?>
58 >        <option selected value="<?php echo $day ?>"><?php echo $day ?></option>
59 >        <option value="">----------------</option>
60 >    <?php }
61 >    foreach($file_array as $file_name) {
62 >        #if (is_dir($file_name)) {
63 >        if (preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/", $file_name)) {
64 >            $i++;
65 >            print "<option value=\"$file_name\">$file_name</option>";
66          }
67 <        else {
68 <            echo "<p>The report could not be found.</p>";
67 >        if ($i >= $maxDaysShown) {
68 >            break;
69          }
70      }
71 <    
71 >    print "</select>";
72 >
73   ?>
74 + <input type="submit" name="submit" value="Go">
75 + </form>
76  
77 < <hr>
77 > <hr weight="1" color="<?php echo $lineColor ?>">
78  
79 < <p>
82 < <font face="arial, sans-serif" size="2">
83 < <b>Or browse all dates</b>
84 < </font>
85 < </p>
79 > <?php if ($day) { ?>
80  
81 < <?
81 >    <b>Available reports for <?php echo $day ?></b>
82  
83 <    $file_array = getdirArray('/home/cut/pjm2/webpages/reports','asort');
84 <    foreach($file_array as $file_name) {
85 <        if (is_dir($file_name)) {
86 <            print "+ <a href=\"$file_name\">$file_name</a><br>";
83 >    <form method="<?php echo $formMethod ?>" action="<?php echo $thisPage ?>">
84 >     <select size="1" name="machine_name">
85 >      <?php if ($machine_name) { ?>
86 >        <option selected value="<?php echo $machine_name ?>"><?php echo $machine_name ?></option>
87 >        <option value="">----------------</option>
88 >      <?php } else { ?>
89 >        <option selected value="">[select machine]</option>
90 >      <?php } ?>
91 >      <?php include("$reportDirectory/$day/$machineNameHTML"); ?>
92 >     </select>
93 >
94 >     <select size="1" name="report">
95 >      <?php if ($report) { ?>
96 >        <option selected value="<?php echo $report ?>"><?php echo $report ?></option>
97 >        <option value="">----------------</option>
98 >      <?php } else { ?>
99 >        <option selected value="">[select report]</option>
100 >      <?php } ?>
101 >      <?php include("$reportDirectory/$day/$reportHTML"); ?>
102 >     </select>
103 >
104 >     <input type="hidden" name="day" value="<?php echo $day ?>">
105 >     <input type="submit" name="submit" value="Show">
106 >    </form>
107 >    
108 >    <hr weight="1" color="<?php echo $lineColor ?>">
109 >    
110 > <?php } ?>
111 >
112 >    </p>
113 >
114 >
115 > <?php
116 >    if ($submit == "Show" && $machine_name && $report) {
117 >        
118 >        $url = "$webRoot/$day/$machine_name/$report/$reportChartFile";
119 >        if (isReportEmpty("$reportDirectory/$day/$machine_name/$report/$reportChartDataFile", $minFileSize)) {
120 >            echo "Host <b>$machine_name</b> did not send any information about <b>$report</b> on <b>$day</b>.  Please select another report.";
121          }
122 <    }
122 >        else if (file_exists("$reportDirectory/$day/$machine_name/$report/$reportChartFile")) {  
123  
124 +            include("$reportDirectory/$day/$machine_name/$report/$reportLimitsFile");
125 +            
126 +            ?>
127 +            
128 +            <center><b>[<?php echo $machine_name; ?>] - <?php echo $report; ?></b></center>
129 +          
130 +            <table border="0" cellpadding="0" cellspacing="0">
131 +             <tr>
132 +              <td align="right" valign="top">
133 +               <font size="2"><?php printf("%.1f", $max_value);  ?></font>
134 +              </td>
135 +              <td rowspan="2">
136 +               <img src="<?php echo $url; ?>" width="500" height="250">
137 +              </td>
138 +             </tr>
139 +             <tr>
140 +              <td align="right" valign="bottom">
141 +               <font size="2"><?php echo $min_value; ?></font>
142 +              </td>
143 +             </tr>
144 +             <tr>
145 +              <td>&nbsp;</td>
146 +              <td><img src="<?php echo $scaleImage ?>" width="500" height="39"></td>
147 +             </tr>
148 +            </table>
149 +            
150 +            <hr weight="1" color="<?php echo $lineColor ?>">
151 +            
152 +            <b>Latest data</b>
153 +            <p>
154 +            Latest set of data received from
155 +            <a href="<?php echo "latest.php?machine=$machine_name"; ?>"><?php=$machine_name?></a>
156 +            <br>
157 +            Alerts for <a href="alerts.php?machine=<?php=$machine_name?>"><?php=$machine_name?></a>
158 +
159 +
160 +            <hr weight="1" color="<?php echo $lineColor ?>">
161 +            
162 +            <b>Extra data</b>
163 +            <p>
164 +            <a href="<?php echo "$webRoot/$day/$machine_name/$report/$reportChartDataFile" ?>">Raw plot data</a><br>
165 +            <a href="<?php echo "$webRoot/$day/$machine_name/$report/$reportChartFile" ?>">GIF chart</a><br>
166 +            <a href="<?php echo "$webRoot/$day/$machine_name/$report/$reportLimitsFile" ?>">PHP y-axis limits include</a>
167 +            
168 +        <?php }
169 +        else {
170 +            echo "<p>The report could not be found.  Somebody must have deleted it!</p>";
171 +        }
172 +        echo "<hr weight=\"1\" color=\"$lineColor\">";
173 +    }
174 +    
175   ?>
176  
177 < </body>
99 < </html>
177 > <?php include($bottomHTML); ?>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines