ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/php/historical/browser.php
Revision: 1.46
Committed: Sat Jun 30 12:12:48 2007 UTC (16 years, 10 months ago) by tdb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.45: +2 -2 lines
Log Message:
More short tag fixes.

File Contents

# User Rev Content
1 pjm2 1.1 <?php
2    
3 tdb 1.41 #
4     # i-scream central monitoring system
5 tdb 1.43 # http://www.i-scream.org
6 tdb 1.41 # 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 pjm2 1.31 # CONFIGURABLE CONSTANTS: -
24 pjm2 1.16
25 pjm2 1.33 include("browser_config.inc.php");
26 pjm2 1.15
27 pjm2 1.16 #
28     # END CONFIGURATION
29 pjm2 1.15
30 pjm2 1.1
31 pjm2 1.27
32    
33    
34     # Used to return whether or not a report data file is empty.
35 pjm2 1.29 function isReportEmpty($filename, $minFileSize) {
36     if (filesize($filename) < $minFileSize) {
37 pjm2 1.14 return TRUE;
38     }
39     return FALSE;
40     }
41    
42 pjm2 1.27
43 pjm2 1.32 include("iutils.inc.php");
44 pjm2 1.1
45     ?>
46    
47 tdb 1.45 <?php include($titleHTML); ?>
48 pjm2 1.6
49 tdb 1.45 <hr weight="1" color="<?php echo $lineColor ?>">
50 pjm2 1.11
51     <b>Most recent reports available</b>
52 tdb 1.45 <form method="<?php echo $formMethod ?>" action="<?php echo $thisPage ?>">
53     <?php
54 pjm2 1.11
55 pjm2 1.17 $file_array = getdirArray($reportDirectory,'rsort');
56 pjm2 1.11 print "<select size=\"1\" name=\"day\">";
57 pjm2 1.30 if ($day) { ?>
58 tdb 1.45 <option selected value="<?php echo $day ?>"><?php echo $day ?></option>
59 pjm2 1.30 <option value="">----------------</option>
60 tdb 1.45 <?php }
61 pjm2 1.11 foreach($file_array as $file_name) {
62 pjm2 1.34 #if (is_dir($file_name)) {
63 pjm2 1.35 if (preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/", $file_name)) {
64 pjm2 1.11 $i++;
65     print "<option value=\"$file_name\">$file_name</option>";
66     }
67 pjm2 1.16 if ($i >= $maxDaysShown) {
68 pjm2 1.11 break;
69     }
70     }
71     print "</select>";
72    
73     ?>
74     <input type="submit" name="submit" value="Go">
75     </form>
76    
77 tdb 1.45 <hr weight="1" color="<?php echo $lineColor ?>">
78 pjm2 1.11
79 tdb 1.45 <?php if ($day) { ?>
80 pjm2 1.11
81 tdb 1.45 <b>Available reports for <?php echo $day ?></b>
82 pjm2 1.11
83 tdb 1.45 <form method="<?php echo $formMethod ?>" action="<?php echo $thisPage ?>">
84 pjm2 1.6 <select size="1" name="machine_name">
85 tdb 1.45 <?php if ($machine_name) { ?>
86     <option selected value="<?php echo $machine_name ?>"><?php echo $machine_name ?></option>
87 pjm2 1.13 <option value="">----------------</option>
88 tdb 1.45 <?php } else { ?>
89 pjm2 1.13 <option selected value="">[select machine]</option>
90 tdb 1.45 <?php } ?>
91     <?php include("$reportDirectory/$day/$machineNameHTML"); ?>
92 pjm2 1.6 </select>
93    
94     <select size="1" name="report">
95 tdb 1.45 <?php if ($report) { ?>
96     <option selected value="<?php echo $report ?>"><?php echo $report ?></option>
97 pjm2 1.13 <option value="">----------------</option>
98 tdb 1.45 <?php } else { ?>
99 pjm2 1.13 <option selected value="">[select report]</option>
100 tdb 1.45 <?php } ?>
101     <?php include("$reportDirectory/$day/$reportHTML"); ?>
102 pjm2 1.6 </select>
103 pjm2 1.1
104 tdb 1.45 <input type="hidden" name="day" value="<?php echo $day ?>">
105 pjm2 1.8 <input type="submit" name="submit" value="Show">
106 pjm2 1.6 </form>
107 pjm2 1.11
108 tdb 1.45 <hr weight="1" color="<?php echo $lineColor ?>">
109 pjm2 1.11
110 tdb 1.45 <?php } ?>
111 pjm2 1.1
112 pjm2 1.6 </p>
113 pjm2 1.1
114 pjm2 1.2
115 tdb 1.45 <?php
116 pjm2 1.8 if ($submit == "Show" && $machine_name && $report) {
117 pjm2 1.11
118 pjm2 1.38 $url = "$webRoot/$day/$machine_name/$report/$reportChartFile";
119 pjm2 1.37 if (isReportEmpty("$reportDirectory/$day/$machine_name/$report/$reportChartDataFile", $minFileSize)) {
120 pjm2 1.14 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 pjm2 1.39 else if (file_exists("$reportDirectory/$day/$machine_name/$report/$reportChartFile")) {
123    
124     include("$reportDirectory/$day/$machine_name/$report/$reportLimitsFile");
125    
126     ?>
127    
128 tdb 1.45 <center><b>[<?php echo $machine_name; ?>] - <?php echo $report; ?></b></center>
129 pjm2 1.11
130     <table border="0" cellpadding="0" cellspacing="0">
131     <tr>
132     <td align="right" valign="top">
133 tdb 1.45 <font size="2"><?php printf("%.1f", $max_value); ?></font>
134 pjm2 1.11 </td>
135     <td rowspan="2">
136 tdb 1.45 <img src="<?php echo $url; ?>" width="500" height="250">
137 pjm2 1.11 </td>
138     </tr>
139     <tr>
140     <td align="right" valign="bottom">
141 tdb 1.45 <font size="2"><?php echo $min_value; ?></font>
142 pjm2 1.11 </td>
143     </tr>
144     <tr>
145     <td>&nbsp;</td>
146 tdb 1.45 <td><img src="<?php echo $scaleImage ?>" width="500" height="39"></td>
147 pjm2 1.11 </tr>
148     </table>
149    
150 tdb 1.45 <hr weight="1" color="<?php echo $lineColor ?>">
151 pjm2 1.39
152     <b>Latest data</b>
153     <p>
154 pjm2 1.40 Latest set of data received from
155 tdb 1.46 <a href="<?php echo "latest.php?machine=$machine_name"; ?>"><?php echo $machine_name?></a>
156 pjm2 1.40 <br>
157 tdb 1.46 Alerts for <a href="alerts.php?machine=<?php echo $machine_name?>"><?php echo $machine_name?></a>
158 pjm2 1.40
159 pjm2 1.39
160 tdb 1.45 <hr weight="1" color="<?php echo $lineColor ?>">
161 pjm2 1.11
162     <b>Extra data</b>
163     <p>
164 tdb 1.45 <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 pjm2 1.11
168 tdb 1.45 <?php }
169 pjm2 1.2 else {
170 pjm2 1.15 echo "<p>The report could not be found. Somebody must have deleted it!</p>";
171 pjm2 1.2 }
172 pjm2 1.19 echo "<hr weight=\"1\" color=\"$lineColor\">";
173 pjm2 1.2 }
174    
175 pjm2 1.1 ?>
176 pjm2 1.6
177 tdb 1.45 <?php include($bottomHTML); ?>