1 |
pjm2 |
1.1 |
<?php |
2 |
|
|
|
3 |
|
|
// A test navigation thingy. |
4 |
|
|
// pjm2@ukc.ac.uk |
5 |
|
|
|
6 |
|
|
|
7 |
|
|
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 |
|
|
} |
31 |
|
|
|
32 |
|
|
include("day.inc"); |
33 |
|
|
|
34 |
|
|
?> |
35 |
|
|
|
36 |
|
|
<html> |
37 |
pjm2 |
1.4 |
<body bgcolor="#ffffff"> |
38 |
pjm2 |
1.1 |
|
39 |
pjm2 |
1.6 |
<table border="0" align="center" cellpadding="2" cellspacing="5"> |
40 |
|
|
<tr> |
41 |
pjm2 |
1.7 |
<td valign="top"> |
42 |
pjm2 |
1.6 |
<? include("left.inc"); ?> |
43 |
|
|
</td> |
44 |
|
|
<td> |
45 |
|
|
<? include("title.inc"); ?> |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
<font face="arial, sans-serif" size="2"> |
49 |
|
|
<b>View reports for <? echo "$day" ?></b> |
50 |
|
|
</font> |
51 |
|
|
|
52 |
|
|
<p> |
53 |
|
|
|
54 |
|
|
<form method="GET" action=""> |
55 |
|
|
<select size="1" name="machine_name"> |
56 |
pjm2 |
1.8 |
<option selected value="">[select machine]</option> |
57 |
pjm2 |
1.6 |
<? include("machine_name.inc"); ?> |
58 |
|
|
</select> |
59 |
|
|
|
60 |
|
|
<select size="1" name="report"> |
61 |
pjm2 |
1.8 |
<option selected value="">[select report]</option> |
62 |
pjm2 |
1.6 |
<? include("report.inc"); ?> |
63 |
|
|
</select> |
64 |
pjm2 |
1.1 |
|
65 |
pjm2 |
1.8 |
<input type="submit" name="submit" value="Show"> |
66 |
pjm2 |
1.6 |
</form> |
67 |
pjm2 |
1.1 |
|
68 |
pjm2 |
1.6 |
</p> |
69 |
pjm2 |
1.1 |
|
70 |
pjm2 |
1.2 |
|
71 |
|
|
<? |
72 |
pjm2 |
1.8 |
if ($submit == "Show" && $machine_name && $report) { |
73 |
pjm2 |
1.2 |
$url = escapeshellcmd("$day/$machine_name/$report/chart.gif"); |
74 |
|
|
if (file_exists($url)) { |
75 |
pjm2 |
1.7 |
echo "<p><b>[$machine_name] - $report</b><br><img src=\"$url\" width=\"500\" height=\"250\"><br><img src=\"24hour.gif\" width=\"500\" height=\"39\"></p>"; |
76 |
pjm2 |
1.2 |
} |
77 |
|
|
else { |
78 |
|
|
echo "<p>The report could not be found.</p>"; |
79 |
|
|
} |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
?> |
83 |
pjm2 |
1.1 |
|
84 |
|
|
<hr> |
85 |
|
|
|
86 |
|
|
<p> |
87 |
|
|
<font face="arial, sans-serif" size="2"> |
88 |
|
|
<b>Or browse all dates</b> |
89 |
|
|
</font> |
90 |
|
|
</p> |
91 |
|
|
|
92 |
|
|
<? |
93 |
|
|
|
94 |
pjm2 |
1.9 |
$file_array = getdirArray('/home/cut/pjm2/webpages/reports','rsort'); |
95 |
pjm2 |
1.7 |
print "<ul>"; |
96 |
pjm2 |
1.1 |
foreach($file_array as $file_name) { |
97 |
|
|
if (is_dir($file_name)) { |
98 |
pjm2 |
1.7 |
print "<li><a href=\"$file_name\">$file_name</a>"; |
99 |
pjm2 |
1.1 |
} |
100 |
|
|
} |
101 |
pjm2 |
1.7 |
print "</ul>"; |
102 |
pjm2 |
1.1 |
|
103 |
|
|
?> |
104 |
pjm2 |
1.6 |
|
105 |
|
|
<? include("bottom.inc"); ?> |
106 |
pjm2 |
1.1 |
|
107 |
|
|
</body> |
108 |
pjm2 |
1.3 |
</html> |