Revision ee132ba1
Added by Renato Botelho over 12 years ago
usr/local/www/widgets/widgets/gateways.widget.php | ||
---|---|---|
42 | 42 |
?> |
43 | 43 |
|
44 | 44 |
<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0"> |
45 |
<tr> |
|
46 |
<td width="10%" class="listhdrr">Name</td> |
|
47 |
<td width="10%" class="listhdrr">Gateway</td> |
|
48 |
<td width="10%" class="listhdrr">RTT</td> |
|
49 |
<td width="10%" class="listhdrr">Loss</td> |
|
50 |
<td width="30%" class="listhdrr">Status</td> |
|
51 |
</tr> |
|
52 | 45 |
<?php foreach ($a_gateways as $gname => $gateway) { ?> |
53 | 46 |
<tr> |
54 |
<td class="listlr" id="gateway<?= $counter; ?>"> |
|
55 |
<?=$gateway['name'];?> |
|
47 |
<td class="vncellt" width="30%" id="gateway<?php echo $counter; ?>"> |
|
48 |
<strong> |
|
49 |
<?php echo htmlspecialchars($gateway['name']); ?> |
|
50 |
</strong> |
|
56 | 51 |
<?php $counter++; ?> |
57 | 52 |
</td> |
58 |
<td class="listr" align="center" id="gateway<?= $counter; ?>"> |
|
59 |
<?php |
|
60 |
if (is_ipaddr($gateway['gateway'])) |
|
61 |
echo $gateway['gateway']; |
|
62 |
else { |
|
63 |
if($gateway['ipprotocol'] == "inet") |
|
64 |
echo get_interface_gateway($gateway['friendlyiface']); |
|
65 |
if($gateway['ipprotocol'] == "inet6") |
|
66 |
echo get_interface_gateway_v6($gateway['friendlyiface']); |
|
67 |
} |
|
68 |
?> |
|
69 |
<?php $counter++; ?> |
|
70 |
</td> |
|
71 |
<td class="listr" align="center" id="gateway<?= $counter; ?>"> |
|
72 |
<?php |
|
73 |
if ($gateways_status[$gname]) |
|
74 |
echo $gateways_status[$gname]['delay']; |
|
75 |
else |
|
76 |
echo gettext("Pending"); |
|
77 |
?> |
|
78 |
<?php $counter++; ?> |
|
79 |
</td> |
|
80 |
<td class="listr" align="center" id="gateway<?= $counter; ?>"> |
|
81 |
<?php |
|
82 |
if ($gateways_status[$gname]) |
|
83 |
echo $gateways_status[$gname]['loss']; |
|
84 |
else |
|
85 |
echo gettext("Pending"); |
|
86 |
?> |
|
87 |
<?php $counter++; ?> |
|
88 |
</td> |
|
89 |
<td class="listr" id="gateway<?=$counter?>" > |
|
90 |
<table border="0" cellpadding="0" cellspacing="2"> |
|
91 |
<?php |
|
92 |
if ($gateways_status[$gname]) { |
|
93 |
if (stristr($gateways_status[$gname]['status'], "down")) { |
|
94 |
$online = "Offline"; |
|
95 |
$bgcolor = "#F08080"; // lightcoral |
|
96 |
} elseif (stristr($gateways_status[$gname]['status'], "loss")) { |
|
97 |
$online = "Packetloss"; |
|
98 |
$bgcolor = "#F0E68C"; // khaki |
|
99 |
} elseif (stristr($gateways_status[$gname]['status'], "delay")) { |
|
100 |
$online = "Latency"; |
|
101 |
$bgcolor = "#F0E68C"; // khaki |
|
102 |
} elseif ($gateways_status[$gname]['status'] == "none") { |
|
103 |
$online = "Online"; |
|
104 |
$bgcolor = "#90EE90"; // lightgreen |
|
105 |
} elseif ($gateways_status[$gname]['status'] == "") { |
|
106 |
$online = "Pending"; |
|
107 |
$bgcolor = "#D3D3D3"; // lightgray |
|
108 |
} |
|
109 |
} else { |
|
110 |
$online = gettext("Unknown"); |
|
111 |
$bgcolor = "#ADD8E6"; // lightblue |
|
112 |
} |
|
113 |
echo "<tr><td bgcolor=\"$bgcolor\"> $online </td></tr>\n"; |
|
114 |
$counter++; |
|
115 |
?> |
|
116 |
</table> |
|
53 |
<td width="70%" class="listr"> |
|
54 |
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
55 |
<tr> |
|
56 |
<td class="vncellt" width="100%"> |
|
57 |
<div id="gateway<?php echo $counter; ?>" style="display:inline"> |
|
58 |
<?php |
|
59 |
if (is_ipaddr($gateway['gateway'])) |
|
60 |
echo htmlspecialchars($gateway['gateway']); |
|
61 |
else { |
|
62 |
if($gateway['ipprotocol'] == "inet") |
|
63 |
echo htmlspecialchars(get_interface_gateway($gateway['friendlyiface'])); |
|
64 |
if($gateway['ipprotocol'] == "inet6") |
|
65 |
echo htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface'])); |
|
66 |
} |
|
67 |
$counter++; |
|
68 |
?> |
|
69 |
</div> |
|
70 |
</td> |
|
71 |
</tr> |
|
72 |
</table> |
|
73 |
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
74 |
<tr> |
|
75 |
<td width="20%" class="listhdrr">RTT</td> |
|
76 |
<td width="20%" class="listhdrr">Loss</td> |
|
77 |
<td width="60%" class="listhdrr">Status</td> |
|
78 |
</tr> |
|
79 |
<tr> |
|
80 |
<td class="listlr" align="center" id="gateway<?php echo $counter; ?>"> |
|
81 |
<?php |
|
82 |
if ($gateways_status[$gname]) |
|
83 |
echo htmlspecialchars($gateways_status[$gname]['delay']); |
|
84 |
else |
|
85 |
echo gettext("Pending"); |
|
86 |
?> |
|
87 |
<?php $counter++; ?> |
|
88 |
</td> |
|
89 |
<td class="listr" align="center" id="gateway<?php echo $counter; ?>"> |
|
90 |
<?php |
|
91 |
if ($gateways_status[$gname]) |
|
92 |
echo htmlspecialchars($gateways_status[$gname]['loss']); |
|
93 |
else |
|
94 |
echo gettext("Pending"); |
|
95 |
?> |
|
96 |
<?php $counter++; ?> |
|
97 |
</td> |
|
98 |
<td class="listr" id="gateway<?php echo $counter ?>" > |
|
99 |
<table border="0" cellpadding="0" cellspacing="2"> |
|
100 |
<?php |
|
101 |
if ($gateways_status[$gname]) { |
|
102 |
if (stristr($gateways_status[$gname]['status'], "down")) { |
|
103 |
$online = "Offline"; |
|
104 |
$bgcolor = "#F08080"; // lightcoral |
|
105 |
} elseif (stristr($gateways_status[$gname]['status'], "loss")) { |
|
106 |
$online = "Packetloss"; |
|
107 |
$bgcolor = "#F0E68C"; // khaki |
|
108 |
} elseif (stristr($gateways_status[$gname]['status'], "delay")) { |
|
109 |
$online = "Latency"; |
|
110 |
$bgcolor = "#F0E68C"; // khaki |
|
111 |
} elseif ($gateways_status[$gname]['status'] == "none") { |
|
112 |
$online = "Online"; |
|
113 |
$bgcolor = "#90EE90"; // lightgreen |
|
114 |
} elseif ($gateways_status[$gname]['status'] == "") { |
|
115 |
$online = "Pending"; |
|
116 |
$bgcolor = "#D3D3D3"; // lightgray |
|
117 |
} |
|
118 |
} else { |
|
119 |
$online = gettext("Unknown"); |
|
120 |
$bgcolor = "#ADD8E6"; // lightblue |
|
121 |
} |
|
122 |
echo "<tr><td bgcolor=\"$bgcolor\"> $online </td></tr>\n"; |
|
123 |
$counter++; |
|
124 |
?> |
|
125 |
</table> |
|
126 |
</td> |
|
127 |
</tr> |
|
128 |
</table> |
|
117 | 129 |
</td> |
118 | 130 |
</tr> |
119 | 131 |
<?php } // foreach ?> |
Also available in: Unified diff
Change gateways widget layout to better accomodate long ipv6 addresses. It should fix #2790