mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
split devices/ports into smaller pages. add device/ports/neighbours to show links data in text (as opposed to map)
git-svn-id: http://www.observium.org/svn/observer/trunk@2150 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -153,6 +153,7 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id'])
|
||||
|
||||
if ($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0))
|
||||
{
|
||||
$discovery_links = TRUE;
|
||||
echo('<li class="' . $select['map'] . '">
|
||||
<a href="device/' . $device['device_id'] . '/map/">
|
||||
<img src="images/16/chart_organisation.png" align="absmiddle" border="0" /> Map
|
||||
|
||||
@@ -9,6 +9,7 @@ print_optionbar_start();
|
||||
|
||||
$menu_options = array('basic' => 'Basic',
|
||||
'details' => 'Details',
|
||||
'neighbours' => 'Neighbours',
|
||||
'arp' => 'ARP Table',
|
||||
'adsl' => 'ADSL');
|
||||
|
||||
@@ -55,7 +56,7 @@ if ($_GET['optc'] == thumbs)
|
||||
{
|
||||
$timeperiods = array('-1day','-1week','-1month','-1year');
|
||||
$from = '-1day';
|
||||
echo("<div style='display: block; clear: both; margin: auto;'>");
|
||||
echo("<div style='display: block; clear: both; margin: auto; min-height: 500px;'>");
|
||||
$sql = "select * from ports WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex";
|
||||
$query = mysql_query($sql);
|
||||
unset ($seperator);
|
||||
@@ -75,22 +76,9 @@ if ($_GET['optc'] == thumbs)
|
||||
}
|
||||
echo("</div>");
|
||||
} else {
|
||||
if ($_GET['opta'] == "arp")
|
||||
if ($_GET['opta'] == "arp" || $_GET['opta'] == "adsl" || $_GET['opta'] == "neighbours")
|
||||
{
|
||||
include("arp.inc.php");
|
||||
} elseif ($_GET['opta'] == "adsl") {
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
echo("<tr><th>Port</th><th>Traffic</th><th>Sync Speed</th><th>Attainable Speed</th><th>Attenuation</th><th>SNR Margin</th><th>Output Powers</th></tr>");
|
||||
$i = "0";
|
||||
$interface_query = mysql_query("select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = '".$device['device_id']."' AND A.interface_id = P.interface_id AND P.deleted = '0' ORDER BY `ifIndex` ASC");
|
||||
while ($interface = mysql_fetch_assoc($interface_query))
|
||||
{
|
||||
include("includes/print-interface-adsl.inc.php");
|
||||
$i++;
|
||||
}
|
||||
echo("</table></div>");
|
||||
echo("<div style='min-height: 150px;'></div>");
|
||||
include("ports/".$_GET['opta'].".inc.php");
|
||||
} else {
|
||||
if ($_GET['opta'] == "details") { $port_details = 1; }
|
||||
echo("<div style='margin: 0px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
@@ -102,7 +90,6 @@ if ($_GET['optc'] == thumbs)
|
||||
$i++;
|
||||
}
|
||||
echo("</table></div>");
|
||||
echo("<div style='min-height: 150px;'></div>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
40
html/pages/device/ports/neighbours.inc.php
Normal file
40
html/pages/device/ports/neighbours.inc.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?
|
||||
|
||||
$sql = "SELECT * FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
|
||||
|
||||
$i = "1";
|
||||
|
||||
echo('<tr><th>Local Port</th>
|
||||
<th>Remote Port</th>
|
||||
<th>Remote Device</th>
|
||||
<th></th>
|
||||
</tr>');
|
||||
|
||||
while($neighbour = mysql_fetch_assoc($query))
|
||||
{
|
||||
|
||||
if ($bg_colour == $list_colour_b) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
|
||||
echo('<tr bgcolor="'.$bg_colour.'">');
|
||||
echo("<td>".generate_port_link($neighbour)."<br />".$neighbour['ifAlias']."</td>");
|
||||
|
||||
if(is_numeric($neighbour['remote_interface_id']) && $neighbour['remote_interface_id'])
|
||||
{
|
||||
$remote_port = get_port_by_id($neighbour['remote_interface_id']);
|
||||
$remote_device = device_by_id_cache($remote_port['device_id']);
|
||||
echo("<td>".generate_port_link($remote_port)."<br />".$remote_port['ifAlias']."</td>");
|
||||
echo("<td>".generate_device_link($remote_device)."<br />".$remote_device['hardware']."</td>");
|
||||
} else {
|
||||
echo("<td>".$neighbour['remote_port']."</td>");
|
||||
echo("<td>".$neighbour['remote_hostname']."
|
||||
<br />".$neighbour['remote_platform']."</td>");
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user