22 |
|
return $matches[1]; |
23 |
|
} |
24 |
|
|
25 |
< |
function printAlert($machine, $alert) { |
25 |
> |
function printAlert($machine, $alert, $small="") { |
26 |
|
|
27 |
|
include("alerts_config.inc.php"); |
28 |
|
|
40 |
|
$alertLevel = $alertLevelNames[$alertLevel]; |
41 |
|
$initialAlertTime = strftime("%x %X", intval($initialAlertTime / 1000)); |
42 |
|
|
43 |
< |
if ($small) { |
44 |
< |
|
43 |
> |
if ($small == "true") { |
44 |
> |
echo <<<EOT |
45 |
> |
<tr> |
46 |
> |
<td> |
47 |
> |
<font size="2">$attributeName <font color="$alertColour"><b>$alertLevel</b></font></font> |
48 |
> |
</td> |
49 |
> |
</tr> |
50 |
> |
EOT; |
51 |
|
} |
52 |
|
else { |
53 |
|
echo <<<EOT |
79 |
|
|
80 |
|
} |
81 |
|
|
82 |
< |
function printReports($machine) { |
82 |
> |
function printReports($machine, $small="") { |
83 |
|
# Get a list of all files in the machine's directory. |
84 |
|
include("alerts_config.inc.php"); |
85 |
|
$alertArray = getdirArray("$alertDirectory/$machine", 'rsort'); |
86 |
|
|
87 |
< |
echo <<<EOT |
88 |
< |
<p> </p> |
89 |
< |
<table border="0" cellpadding="3" cellspacing="2" bgcolor="#000066" width="100%"> |
90 |
< |
<tr> |
91 |
< |
<td> |
92 |
< |
<font color="white"> |
93 |
< |
<b> |
94 |
< |
Current alerts for $machine |
95 |
< |
</b> |
96 |
< |
<font size="2"> |
97 |
< |
<br>Sorted by time, latest first. |
98 |
< |
</font> |
99 |
< |
</font> |
100 |
< |
</td> |
101 |
< |
</tr> |
102 |
< |
<tr> |
103 |
< |
<td bgcolor="white"> |
87 |
> |
if ($small == "true") { |
88 |
> |
echo <<<EOT |
89 |
> |
<table border="0" cellpadding="2" cellspacing="0" bgcolor="#ffffff" width="100%"> |
90 |
> |
<tr> |
91 |
> |
<td bgcolor="#000066"> |
92 |
> |
<font color="white"><b>$machine</b></font> |
93 |
> |
</td> |
94 |
> |
</tr> |
95 |
> |
EOT; |
96 |
> |
} |
97 |
> |
else { |
98 |
> |
echo <<<EOT |
99 |
> |
<p> </p> |
100 |
> |
<table border="0" cellpadding="3" cellspacing="2" bgcolor="#000066" width="100%"> |
101 |
> |
<tr> |
102 |
> |
<td> |
103 |
> |
<font color="white"> |
104 |
> |
<b> |
105 |
> |
Current alerts for $machine |
106 |
> |
</b> |
107 |
> |
<font size="2"> |
108 |
> |
<br>Sorted by time, latest first. |
109 |
> |
</font> |
110 |
> |
</font> |
111 |
> |
</td> |
112 |
> |
</tr> |
113 |
> |
<tr> |
114 |
> |
<td bgcolor="white"> |
115 |
|
|
116 |
|
EOT; |
117 |
|
|
118 |
< |
printLine(""); |
118 |
> |
printLine(""); |
119 |
> |
} |
120 |
|
|
121 |
|
if ($alertArray != FALSE) { |
122 |
|
|
127 |
|
} |
128 |
|
|
129 |
|
foreach ($alerts as $alert) { |
130 |
< |
printAlert($machine, $alert); |
130 |
> |
printAlert($machine, $alert, $small); |
131 |
|
} |
132 |
|
} |
133 |
|
else { |
135 |
|
printLine(""); |
136 |
|
} |
137 |
|
|
138 |
< |
echo <<<EOT |
139 |
< |
</td> |
140 |
< |
</tr> |
141 |
< |
</table> |
138 |
> |
if ($small == "true") { |
139 |
> |
echo "</table>"; |
140 |
> |
} |
141 |
> |
else { |
142 |
> |
echo <<<EOT |
143 |
> |
</td> |
144 |
> |
</tr> |
145 |
> |
</table> |
146 |
|
EOT; |
147 |
+ |
} |
148 |
|
} |
149 |
|
|
150 |
|
|
152 |
|
|
153 |
|
<? include($titleHTML); ?> |
154 |
|
|
155 |
< |
<? printLine("Display the latest alerts for a host"); ?> |
155 |
> |
<? printLine("Latest alerts for hosts"); ?> |
156 |
|
|
157 |
+ |
<? if (!$hideform) { ?> |
158 |
+ |
|
159 |
|
<form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>"> |
160 |
|
<? |
161 |
|
|
173 |
|
print "</select>"; |
174 |
|
|
175 |
|
?> |
176 |
+ |
<input type="hidden" name="small" value="<?=$small?>"> |
177 |
|
<input type="submit" name="submit" value="Display"> |
178 |
|
</form> |
179 |
|
|
180 |
+ |
<? } ?> |
181 |
+ |
|
182 |
|
<? if ($machine) { |
183 |
|
|
184 |
|
printLine(""); |
187 |
|
$machine_array = getdirArray($alertDirectory, 'asort'); |
188 |
|
if ($machine_array != FALSE) { |
189 |
|
foreach ($machine_array as $machine) { |
190 |
< |
printReports($machine); |
190 |
> |
printReports($machine, $small); |
191 |
|
} |
192 |
|
} |
193 |
|
} |
194 |
|
else { |
195 |
< |
printReports($machine); |
195 |
> |
printReports($machine, $small); |
196 |
|
} |
197 |
|
|
198 |
|
} |