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.14
Committed: Fri Mar 2 09:13:09 2001 UTC (23 years, 8 months ago) by pjm2
Branch: MAIN
Changes since 1.13: +11 -1 lines
Log Message:
Reports that contain no data are no longer displayed.  This is useful for
reports about windows machines as these do not currently send values for
load.

File Contents

# Content
1 <?php
2
3 // Navigation for the i-scream reports.
4 // pjm2@ukc.ac.uk
5
6
7 function isReportEmpty($filename) {
8 if (filesize($filename) < 33) {
9 return TRUE;
10 }
11 return FALSE;
12 }
13
14 function getdirArray($dir='./',$sort='asort') {
15 global $dir_file_count;
16 if ( is_dir($dir) ) {
17 $fd = @opendir($dir);
18 while ( ($part = @readdir($fd)) == TRUE ) {
19 clearstatcache();
20 if ($part != "." && $part != "..") {
21 $dir_array[] = $part;
22 }
23 }
24 if($fd == TRUE) {
25 closedir($fd);
26 }
27 if (is_array($dir_array)) {
28 $sort($dir_array);
29 $dir_file_count = count($dir_array);
30 Return $dir_array;
31 } else {
32 Return FALSE;
33 }
34 } else {
35 Return FALSE;
36 }
37 }
38
39 ?>
40
41 <? include("title.inc"); ?>
42
43 <hr weight="1" color="#9999ff">
44
45 <b>Most recent reports available</b>
46 <form method="GET" action="browser.php">
47 <?
48
49 $file_array = getdirArray('/home/cut/pjm2/webpages/reports','rsort');
50 print "<select size=\"1\" name=\"day\">";
51 foreach($file_array as $file_name) {
52 if (is_dir($file_name)) {
53 $i++;
54 print "<option value=\"$file_name\">$file_name</option>";
55 }
56 if ($i >= 20) {
57 break;
58 }
59 }
60 print "</select>";
61
62 ?>
63 <input type="submit" name="submit" value="Go">
64 </form>
65
66 <hr weight="1" color="#9999ff">
67
68 <? if ($day) { ?>
69
70 <b>Available reports for <? echo $day ?></b>
71
72 <form method="GET" action="browser.php">
73 <select size="1" name="machine_name">
74 <? if ($machine_name) { ?>
75 <option selected value="<? echo $machine_name ?>"><? echo $machine_name ?></option>
76 <option value="">----------------</option>
77 <? } else { ?>
78 <option selected value="">[select machine]</option>
79 <? } ?>
80 <? include("$day/machine_name.inc"); ?>
81 </select>
82
83 <select size="1" name="report">
84 <? if ($report) { ?>
85 <option selected value="<? echo $report ?>"><? echo $report ?></option>
86 <option value="">----------------</option>
87 <? } else { ?>
88 <option selected value="">[select report]</option>
89 <? } ?>
90 <? include("$day/report.inc"); ?>
91 </select>
92
93 <input type="hidden" name="day" value="<? echo $day ?>">
94 <input type="submit" name="submit" value="Show">
95 </form>
96
97 <hr weight="1" color="#9999ff">
98
99 <? } ?>
100
101 </p>
102
103
104 <?
105 if ($submit == "Show" && $machine_name && $report) {
106
107 include("$day/$machine_name/$report/i-maxmin.txt");
108
109 $url = escapeshellcmd("$day/$machine_name/$report/i-chart.gif");
110 if (isReportEmpty("$day/$machine_name/$report/i-data.txt")) {
111 echo "Host <b>$machine_name</b> did not send any information about <b>$report</b> on <b>$day</b>. Please select another report.";
112 }
113 else if (file_exists($url)) { ?>
114
115 <center><b>[<? echo $machine_name; ?>] - <? echo $report; ?></b></center>
116
117 <table border="0" cellpadding="0" cellspacing="0">
118 <tr>
119 <td align="right" valign="top">
120 <font size="2"><? printf("%.1f", $max_value); ?></font>
121 </td>
122 <td rowspan="2">
123 <img src="<? echo $url; ?>" width="500" height="250">
124 </td>
125 </tr>
126 <tr>
127 <td align="right" valign="bottom">
128 <font size="2"><? echo $min_value; ?></font>
129 </td>
130 </tr>
131 <tr>
132 <td>&nbsp;</td>
133 <td><img src="24hour.gif" width="500" height="39"></td>
134 </tr>
135 </table>
136
137 <hr weigth="1" color="#9999ff">
138
139 <b>Extra data</b>
140 <p>
141 <a href="<? echo "$day/$machine_name/$report/i-data.txt" ?>">Raw plot data</a><br>
142 <a href="<? echo "$day/$machine_name/$report/i-chart.gif" ?>">GIF chart</a><br>
143 <a href="<? echo "$day/$machine_name/$report/i-maxmin.txt" ?>">PHP y-axis limits include</a>
144
145 <? }
146 else {
147 echo "<p>The report could not be found.</p>";
148 }
149 echo "<hr weight=\"1\" color=\"#9999ff\">";
150 }
151
152 ?>
153
154 <? include("bottom.inc"); ?>