1 |
pjm2 |
1.1 |
<?php |
2 |
|
|
|
3 |
pjm2 |
1.10 |
// Navigation for the i-scream reports. |
4 |
pjm2 |
1.1 |
// pjm2@ukc.ac.uk |
5 |
|
|
|
6 |
|
|
|
7 |
pjm2 |
1.14 |
function isReportEmpty($filename) { |
8 |
|
|
if (filesize($filename) < 33) { |
9 |
|
|
return TRUE; |
10 |
|
|
} |
11 |
|
|
return FALSE; |
12 |
|
|
} |
13 |
|
|
|
14 |
pjm2 |
1.1 |
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 |
pjm2 |
1.10 |
<? include("title.inc"); ?> |
42 |
pjm2 |
1.6 |
|
43 |
pjm2 |
1.11 |
<hr weight="1" color="#9999ff"> |
44 |
|
|
|
45 |
|
|
<b>Most recent reports available</b> |
46 |
pjm2 |
1.12 |
<form method="GET" action="browser.php"> |
47 |
pjm2 |
1.11 |
<? |
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 |
pjm2 |
1.12 |
<form method="GET" action="browser.php"> |
73 |
pjm2 |
1.6 |
<select size="1" name="machine_name"> |
74 |
pjm2 |
1.13 |
<? 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 |
pjm2 |
1.11 |
<? include("$day/machine_name.inc"); ?> |
81 |
pjm2 |
1.6 |
</select> |
82 |
|
|
|
83 |
|
|
<select size="1" name="report"> |
84 |
pjm2 |
1.13 |
<? 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 |
pjm2 |
1.11 |
<? include("$day/report.inc"); ?> |
91 |
pjm2 |
1.6 |
</select> |
92 |
pjm2 |
1.1 |
|
93 |
pjm2 |
1.11 |
<input type="hidden" name="day" value="<? echo $day ?>"> |
94 |
pjm2 |
1.8 |
<input type="submit" name="submit" value="Show"> |
95 |
pjm2 |
1.6 |
</form> |
96 |
pjm2 |
1.11 |
|
97 |
|
|
<hr weight="1" color="#9999ff"> |
98 |
|
|
|
99 |
|
|
<? } ?> |
100 |
pjm2 |
1.1 |
|
101 |
pjm2 |
1.6 |
</p> |
102 |
pjm2 |
1.1 |
|
103 |
pjm2 |
1.2 |
|
104 |
|
|
<? |
105 |
pjm2 |
1.8 |
if ($submit == "Show" && $machine_name && $report) { |
106 |
pjm2 |
1.11 |
|
107 |
|
|
include("$day/$machine_name/$report/i-maxmin.txt"); |
108 |
|
|
|
109 |
pjm2 |
1.12 |
$url = escapeshellcmd("$day/$machine_name/$report/i-chart.gif"); |
110 |
pjm2 |
1.14 |
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 |
pjm2 |
1.11 |
|
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> </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 |
pjm2 |
1.2 |
else { |
147 |
|
|
echo "<p>The report could not be found.</p>"; |
148 |
|
|
} |
149 |
pjm2 |
1.11 |
echo "<hr weight=\"1\" color=\"#9999ff\">"; |
150 |
pjm2 |
1.2 |
} |
151 |
|
|
|
152 |
pjm2 |
1.1 |
?> |
153 |
pjm2 |
1.6 |
|
154 |
pjm2 |
1.13 |
<? include("bottom.inc"); ?> |