ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/php/graphs/graphs.php
Revision: 1.6
Committed: Fri Mar 11 12:23:31 2005 UTC (19 years, 2 months ago) by tdb
Branch: MAIN
Changes since 1.5: +3 -3 lines
Log Message:
Updates from skel (Daniel Piddock):

 - Fix undefined variable warnings
 - Comment out auto-scroll code since it doesn't really work
 - Fix some minor formatting problems

Also various other updates to the main page and comments.

File Contents

# User Rev Content
1 tdb 1.1 <?php
2    
3 tdb 1.2 #
4     # i-scream central monitoring system
5 tdb 1.4 # http://www.i-scream.org
6 tdb 1.2 # 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 tdb 1.1 # Navigation for the i-scream graphs
24 tdb 1.4 # tim@i-scream.org
25 tdb 1.1 #
26     # CONFIGURABLE CONSTANTS: -
27    
28     include("graphs_config.inc.php");
29    
30     #
31     # END CONFIGURATION
32    
33    
34     include("iutils.inc.php");
35    
36 tdb 1.5 if ($formMethod == "GET") {
37 tdb 1.6 $machine_name = isset($_GET['machine_name']) ? $_GET['machine_name'] : "";
38     $graph = isset($_GET['graph']) ? $_GET['graph'] : "";
39     $submit = isset($_GET['submit']) ? $_GET['submit'] : "";
40 tdb 1.5 }
41    
42 tdb 1.1 ?>
43    
44     <? include($titleHTML); ?>
45    
46     <hr weight="1" color="<? echo $lineColor ?>">
47    
48     <b>Graphs available for these machines:</b>
49    
50     <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>">
51     <select size="1" name="machine_name">
52     <? if ($machine_name) { ?>
53     <option selected value="<? echo $machine_name ?>"><? echo $machine_name ?></option>
54     <option value="">----------------</option>
55     <? } else { ?>
56     <option selected value="">[select machine]</option>
57     <? } ?>
58     <?
59     $file_array = getdirArray($imgdir,'asort');
60     foreach($file_array as $file_name) {
61     if(is_dir("$imgdir/$file_name")) { ?>
62     <option value="<? echo $file_name ?>"><? echo $file_name ?></option>
63     <? }
64     }
65     ?>
66     </select>
67    
68     <input type="submit" name="submit" value="Go">
69     </form>
70    
71     <hr weight="1" color="<? echo $lineColor ?>">
72    
73     <? if ($machine_name) { ?>
74    
75     <b>Available graphs for <? echo $machine_name ?></b>
76    
77     <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>">
78     <select size="1" name="graph">
79     <? if ($graph) { ?>
80     <option selected value="<? echo $graph ?>"><? echo tidyName($machine_name, $graph) ?></option>
81     <option value="">----------------</option>
82     <? } else { ?>
83     <option selected value="">[select graph]</option>
84     <? } ?>
85     <?
86     $file_array = getdirArray("$imgdir/$machine_name",'asort');
87     foreach($file_array as $file_name) {
88     if(preg_match("/^(\S+)\-3h.png$/", $file_name, $matches)) { ?>
89     <option value="<? echo $matches[1] ?>"><? echo tidyName($machine_name, $matches[1]) ?></option>
90     <? }
91     }
92     ?>
93     </select>
94    
95     <input type="hidden" name="machine_name" value="<? echo $machine_name ?>">
96     <input type="submit" name="submit" value="Show">
97     </form>
98    
99     <hr weight="1" color="<? echo $lineColor ?>">
100    
101     <? } ?>
102    
103     </p>
104    
105    
106     <?
107     if ($submit == "Show" && $machine_name && $graph) {
108    
109     ?>
110     <center><b>[<? echo $machine_name; ?>] - '<? echo tidyName($machine_name, $graph) ?>' graphs</b></center>
111    
112     <center>
113     <p><b>Last 3 hours :</b><br><img border="0" src="<? echo "$imgwebdir/$machine_name/$graph-3h.png" ?>"></p>
114     <p><b>Last day :</b><br><img border="0" src="<? echo "$imgwebdir/$machine_name/$graph-1d.png" ?>"></p>
115     <p><b>Last week :</b><br><img border="0" src="<? echo "$imgwebdir/$machine_name/$graph-1w.png" ?>"></p>
116     <p><b>Last month :</b><br><img border="0" src="<? echo "$imgwebdir/$machine_name/$graph-1m.png" ?>"></p>
117     <p><b>Last year :</b><br><img border="0" src="<? echo "$imgwebdir/$machine_name/$graph-1y.png" ?>"></p>
118     </center>
119    
120     <hr weight="1" color="<? echo $lineColor ?>">
121    
122     <b>Latest data</b>
123     <p>
124     Latest set of data received from
125     <a href="<? echo "latest.php?machine=$machine_name"; ?>"><?=$machine_name?></a>
126     <br>
127     Alerts for <a href="alerts.php?machine=<?=$machine_name?>"><?=$machine_name?></a>
128    
129    
130     <hr weight="1" color="<? echo $lineColor ?>">
131     <? }
132    
133     ?>
134    
135     <? include($bottomHTML); ?>