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.11 by pjm2, Sun Feb 25 16:21:19 2001 UTC vs.
Revision 1.42 by tdb, Tue May 21 16:47:15 2002 UTC

# Line 1 | Line 1
1   <?php
2  
3 < // Navigation for the i-scream reports.
4 < // pjm2@ukc.ac.uk
3 > #
4 > # i-scream central monitoring system
5 > # http://www.i-scream.org.uk
6 > # 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 + # Navigation for the i-scream reports.
24 + # pjm2@ukc.ac.uk
25 + #
26 + # CONFIGURABLE CONSTANTS: -
27  
28 < function getdirArray($dir='./',$sort='asort') {
29 <    global $dir_file_count;
30 <    if ( is_dir($dir) ) {
31 <        $fd = @opendir($dir);
32 <        while ( ($part = @readdir($fd)) == TRUE ) {
33 <            clearstatcache();
34 <            if ($part != "." && $part != "..") {
35 <                $dir_array[] = $part;
36 <            }
37 <        }
38 <        if($fd == TRUE) {
39 <            closedir($fd);
40 <        }
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;
28 > include("browser_config.inc.php");
29 >
30 > #
31 > # END CONFIGURATION
32 >
33 >
34 >
35 >
36 >
37 > # Used to return whether or not a report data file is empty.
38 > function isReportEmpty($filename, $minFileSize) {
39 >    if (filesize($filename) < $minFileSize) {
40 >        return TRUE;
41      }
42 +    return FALSE;
43   }
44  
45 +
46 + include("iutils.inc.php");
47 +
48   ?>
49  
50 < <? include("title.inc"); ?>
50 > <? include($titleHTML); ?>
51  
52 < <hr weight="1" color="#9999ff">
52 > <hr weight="1" color="<? echo $lineColor ?>">
53  
54   <b>Most recent reports available</b>
55 < <form method="GET" action="">
55 > <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>">
56   <?
57  
58 <    $file_array = getdirArray('/home/cut/pjm2/webpages/reports','rsort');
58 >    $file_array = getdirArray($reportDirectory,'rsort');
59      print "<select size=\"1\" name=\"day\">";
60 +    if ($day) { ?>
61 +        <option selected value="<? echo $day ?>"><? echo $day ?></option>
62 +        <option value="">----------------</option>
63 +    <? }
64      foreach($file_array as $file_name) {
65 <        if (is_dir($file_name)) {
65 >        #if (is_dir($file_name)) {
66 >        if (preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/", $file_name)) {
67              $i++;
68              print "<option value=\"$file_name\">$file_name</option>";
69          }
70 <        if ($i >= 20) {
70 >        if ($i >= $maxDaysShown) {
71              break;
72          }
73      }
# Line 56 | Line 77 | function getdirArray($dir='./',$sort='asort') {
77   <input type="submit" name="submit" value="Go">
78   </form>
79  
80 < <hr weight="1" color="#9999ff">
80 > <hr weight="1" color="<? echo $lineColor ?>">
81  
82   <? if ($day) { ?>
83  
84      <b>Available reports for <? echo $day ?></b>
85  
86 <    <form method="GET" action="">
86 >    <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>">
87       <select size="1" name="machine_name">
88 <      <option selected value="">[select machine]</option>
89 <      <? include("$day/machine_name.inc"); ?>
88 >      <? if ($machine_name) { ?>
89 >        <option selected value="<? echo $machine_name ?>"><? echo $machine_name ?></option>
90 >        <option value="">----------------</option>
91 >      <? } else { ?>
92 >        <option selected value="">[select machine]</option>
93 >      <? } ?>
94 >      <? include("$reportDirectory/$day/$machineNameHTML"); ?>
95       </select>
96  
97       <select size="1" name="report">
98 <      <option selected value="">[select report]</option>
99 <      <? include("$day/report.inc"); ?>
98 >      <? if ($report) { ?>
99 >        <option selected value="<? echo $report ?>"><? echo $report ?></option>
100 >        <option value="">----------------</option>
101 >      <? } else { ?>
102 >        <option selected value="">[select report]</option>
103 >      <? } ?>
104 >      <? include("$reportDirectory/$day/$reportHTML"); ?>
105       </select>
106  
107       <input type="hidden" name="day" value="<? echo $day ?>">
108       <input type="submit" name="submit" value="Show">
109      </form>
110      
111 <    <hr weight="1" color="#9999ff">
111 >    <hr weight="1" color="<? echo $lineColor ?>">
112      
113   <? } ?>
114  
# Line 87 | Line 118 | function getdirArray($dir='./',$sort='asort') {
118   <?
119      if ($submit == "Show" && $machine_name && $report) {
120          
121 <        include("$day/$machine_name/$report/i-maxmin.txt");
122 <        
123 <        $url = escapeshellcmd("$day/$machine_name/$report/chart.gif");
124 <        if (file_exists($url)) {  ?>
125 <          
121 >        $url = "$webRoot/$day/$machine_name/$report/$reportChartFile";
122 >        if (isReportEmpty("$reportDirectory/$day/$machine_name/$report/$reportChartDataFile", $minFileSize)) {
123 >            echo "Host <b>$machine_name</b> did not send any information about <b>$report</b> on <b>$day</b>.  Please select another report.";
124 >        }
125 >        else if (file_exists("$reportDirectory/$day/$machine_name/$report/$reportChartFile")) {  
126 >
127 >            include("$reportDirectory/$day/$machine_name/$report/$reportLimitsFile");
128 >            
129 >            ?>
130 >            
131              <center><b>[<? echo $machine_name; ?>] - <? echo $report; ?></b></center>
132            
133              <table border="0" cellpadding="0" cellspacing="0">
# Line 110 | Line 146 | function getdirArray($dir='./',$sort='asort') {
146               </tr>
147               <tr>
148                <td>&nbsp;</td>
149 <              <td><img src="24hour.gif" width="500" height="39"></td>
149 >              <td><img src="<? echo $scaleImage ?>" width="500" height="39"></td>
150               </tr>
151              </table>
152              
153 <            <hr weigth="1" color="#9999ff">
153 >            <hr weight="1" color="<? echo $lineColor ?>">
154              
155 +            <b>Latest data</b>
156 +            <p>
157 +            Latest set of data received from
158 +            <a href="<? echo "latest.php?machine=$machine_name"; ?>"><?=$machine_name?></a>
159 +            <br>
160 +            Alerts for <a href="alerts.php?machine=<?=$machine_name?>"><?=$machine_name?></a>
161 +
162 +
163 +            <hr weight="1" color="<? echo $lineColor ?>">
164 +            
165              <b>Extra data</b>
166              <p>
167 <            <a href="<? echo "$day/$machine_name/$report/i-data.txt" ?>">Raw plot data</a><br>
168 <            <a href="<? echo "$day/$machine_name/$report/i-chart.gif" ?>">GIF chart</a><br>
169 <            <a href="<? echo "$day/$machine_name/$report/i-maxmin.txt" ?>">PHP y-axis limits include</a>
167 >            <a href="<? echo "$webRoot/$day/$machine_name/$report/$reportChartDataFile" ?>">Raw plot data</a><br>
168 >            <a href="<? echo "$webRoot/$day/$machine_name/$report/$reportChartFile" ?>">GIF chart</a><br>
169 >            <a href="<? echo "$webRoot/$day/$machine_name/$report/$reportLimitsFile" ?>">PHP y-axis limits include</a>
170              
171          <? }
172          else {
173 <            echo "<p>The report could not be found.</p>";
173 >            echo "<p>The report could not be found.  Somebody must have deleted it!</p>";
174          }
175 <        echo "<hr weight=\"1\" color=\"#9999ff\">";
175 >        echo "<hr weight=\"1\" color=\"$lineColor\">";
176      }
177      
178   ?>
179  
180 < <? include("bottom.inc"); ?>
180 > <? include($bottomHTML); ?>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines