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.1 by pjm2, Sat Feb 3 22:34:02 2001 UTC vs.
Revision 1.14 by pjm2, Fri Mar 2 09:13:09 2001 UTC

# Line 1 | Line 1
1   <?php
2  
3 < // A test navigation thingy.
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) ) {
# Line 29 | Line 36 | function getdirArray($dir='./',$sort='asort') {
36      }
37   }
38  
32    include("day.inc");
33
34    if ($submit == "bung") {
35        $url = escapeshellcmd("$day/$machine_name/$report/chart.gif");
36        Header("Location: $url");
37        exit;
38    }
39   ?>
40  
41 < <html>
42 < <body bgcolor="eeeeff">
41 > <? include("title.inc"); ?>
42  
43 < <font face="arial, sans-serif">
45 < <h4>I-scream report browser</h4>
46 < </font>
43 > <hr weight="1" color="#9999ff">
44  
45 < <hr>
45 > <b>Most recent reports available</b>
46 > <form method="GET" action="browser.php">
47 > <?
48  
49 < <font face="arial, sans-serif" size="2">
50 < <b>View reports for <? echo "$day" ?></b>
51 < </font>
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 < <p>
62 > ?>
63 > <input type="submit" name="submit" value="Go">
64 > </form>
65  
66 < <form method="GET" action="browser.php">
57 <  <select size="1" name="machine_name">
58 <   <? include("machine_name.inc"); ?>
59 <  </select>
66 > <hr weight="1" color="#9999ff">
67  
68 <  <select size="1" name="report">
62 <   <? include("report.inc"); ?>
63 <  </select>
68 > <? if ($day) { ?>
69  
70 <  <input type="submit" name="submit" value="bung">
70 >    <b>Available reports for <? echo $day ?></b>
71  
72 < </form>
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 < </p>
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 < <hr>
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>
74 < <font face="arial, sans-serif" size="2">
75 < <b>Or browse all dates</b>
76 < </font>
77 < </p>
101 >    </p>
102  
79 <?
103  
104 <    $file_array = getdirArray('/home/cut/pjm2/webpages/reports','asort');
105 <    foreach($file_array as $file_name) {
106 <        if (is_dir($file_name)) {
107 <            print "+ <a href=\"$file_name\">$file_name</a><br>";
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 <
151 >    
152   ?>
153  
154 < </body>
91 < </html>
154 > <? include("bottom.inc"); ?>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines