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.31 by pjm2, Thu Mar 8 20:55:29 2001 UTC vs.
Revision 1.43 by tdb, Sun Aug 1 10:40:26 2004 UTC

# Line 1 | Line 1
1   <?php
2  
3 + #
4 + # i-scream central monitoring system
5 + # http://www.i-scream.org
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 < # The report directory, and the number of days to display.
9 < $reportDirectory = "/home/cut/pjm2/webpages/reports/historical";
10 < $maxDaysShown = 7;
28 > include("browser_config.inc.php");
29  
12 # Page appearance.
13 $scaleImage = "24hour.gif";
14 $lineColor = "#9999ff";
15
16 # Files to include
17 $titleHTML = "title.inc";
18 $bottomHTML = "bottom.inc";
19 $machineNameHTML = "machine_name.inc";
20 $reportHTML = "report.inc";
21
22 # What are the names of the report files?
23 $reportLimitsFile = "i-maxmin.txt";
24 $reportChartFile = "i-chart.gif";
25 $reportChartDataFile = "i-data.txt";
26
27 # Submission details.
28 $formMethod = "GET";
29 $thisPage = "browser.php";
30
31 # Leave this alone unless you know what you're doing ;)
32 $minFileSize = 33;
33
30   #
31   # END CONFIGURATION
32  
# Line 47 | Line 43 | function isReportEmpty($filename, $minFileSize) {
43   }
44  
45  
46 < # return an array of subdirectories in the current directory.
51 < function getdirArray($dir='./',$sort='asort') {
52 <    global $dir_file_count;
53 <    if ( is_dir($dir) ) {
54 <        $fd = @opendir($dir);
55 <        while ( ($part = @readdir($fd)) == TRUE ) {
56 <            clearstatcache();
57 <            if ($part != "." && $part != "..") {
58 <                if (preg_match("/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/", $part)) {
59 <                    $dir_array[] = $part;
60 <                }
61 <            }
62 <        }
63 <        if($fd == TRUE) {
64 <            closedir($fd);
65 <        }
66 <        if (is_array($dir_array)) {
67 <            $sort($dir_array);
68 <            $dir_file_count = count($dir_array);
69 <            Return $dir_array;
70 <        } else {
71 <            Return FALSE;
72 <        }
73 <    } else {
74 <        Return FALSE;
75 <    }
76 < }
46 > include("iutils.inc.php");
47  
48   ?>
49  
# Line 92 | Line 62 | function getdirArray($dir='./',$sort='asort') {
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          }
# Line 120 | Line 91 | function getdirArray($dir='./',$sort='asort') {
91        <? } else { ?>
92          <option selected value="">[select machine]</option>
93        <? } ?>
94 <      <? include("$day/$machineNameHTML"); ?>
94 >      <? include("$reportDirectory/$day/$machineNameHTML"); ?>
95       </select>
96  
97       <select size="1" name="report">
# Line 130 | Line 101 | function getdirArray($dir='./',$sort='asort') {
101        <? } else { ?>
102          <option selected value="">[select report]</option>
103        <? } ?>
104 <      <? include("$day/$reportHTML"); ?>
104 >      <? include("$reportDirectory/$day/$reportHTML"); ?>
105       </select>
106  
107       <input type="hidden" name="day" value="<? echo $day ?>">
# Line 147 | Line 118 | function getdirArray($dir='./',$sort='asort') {
118   <?
119      if ($submit == "Show" && $machine_name && $report) {
120          
121 <        include("$day/$machine_name/$report/$reportLimitsFile");
122 <        
152 <        $url = escapeshellcmd("$day/$machine_name/$report/$reportChartFile");
153 <        if (isReportEmpty("$day/$machine_name/$report/$reportChartDataFile", $minFileSize)) {
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($url)) {  ?>
126 <          
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 177 | Line 150 | function getdirArray($dir='./',$sort='asort') {
150               </tr>
151              </table>
152              
153 <            <hr weigth="1" color="<? echo $lineColor ?>">
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/$reportChartDataFile" ?>">Raw plot data</a><br>
168 <            <a href="<? echo "$day/$machine_name/$report/$reportChartFile" ?>">GIF chart</a><br>
169 <            <a href="<? echo "$day/$machine_name/$report/$reportLimitsFile" ?>">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 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines