Updates bringing forms / tables inline with Bootstrap v3, also adds Global search box

This commit is contained in:
laf
2014-01-13 10:05:19 +00:00
parent e3f23a1009
commit fc7404a3c4
35 changed files with 1409 additions and 1077 deletions

View File

@ -40,7 +40,6 @@ exception):
- scripts/*/mysql: GPLv2 only - scripts/*/mysql: GPLv2 only
- check_mk (scripts/observium_agent*): GPLv2 - check_mk (scripts/observium_agent*): GPLv2
- qTip (html/css/jquery.qtip.min.css and html/js/qtip/jquery.qtip.min.js): GPLv2 - qTip (html/css/jquery.qtip.min.css and html/js/qtip/jquery.qtip.min.js): GPLv2
- jqPlot (html/js/jqplot/*): MIT or GPLv2
Introduction Introduction
------------ ------------

145
html/ajax_search.php Executable file
View File

@ -0,0 +1,145 @@
<?php
if (isset($_REQUEST['debug']))
{
ini_set('display_errors', 1);
ini_set('display_startup_errors', 0);
ini_set('log_errors', 0);
ini_set('allow_url_fopen', 0);
ini_set('error_reporting', E_ALL);
}
include_once("../includes/defaults.inc.php");
include_once("../config.php");
include_once("../includes/definitions.inc.php");
include_once("includes/functions.inc.php");
include_once("../includes/functions.php");
include_once("../includes/dbFacile.php");
include_once("../includes/common.php");
include_once("../includes/rewrites.php");
include_once("includes/authenticate.inc.php");
if (!$_SESSION['authenticated']) { echo("unauthenticated"); exit; }
$device = Array();
$ports = Array();
if (isset($_REQUEST['search']))
{
$search = mres($_REQUEST['search']);
if (strlen($search) >0)
{
$found = 0;
if($_REQUEST['type'] == 'device') {
// Device search
$results = dbFetchRows("SELECT * FROM `devices` WHERE `hostname` LIKE '%" . $search . "%' OR `location` LIKE '%" . $search . "%' ORDER BY hostname LIMIT 8");
if (count($results))
{
$found = 1;
$devices = count($results);
foreach ($results as $result)
{
$name = $result['hostname'];
if (strlen($name) > 36) { $name = substr($name, 0, 36) . "..."; }
if($result['disabled'] == 1)
{
$highlight_colour = '#808080';
}
elseif($result['ignored'] == 1 && $result['disabled'] == 0)
{
$highlight_colour = '#000000';
}
elseif($result['status'] == 0 && $result['ignore'] == 0 && $result['disabled'] == 0)
{
$highlight_colour = '#ff0000';
}
elseif($result['status'] == 1 && $result['ignore'] == 0 && $result['disabled'] == 0)
{
$highlight_colour = '#008000';
}
$num_ports = dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE device_id = ?", array($result['device_id']));
$device[]=array('name'=>$name,
'url'=> generate_device_url($result),
'colours'=>$highlight_colour,
'device_ports'=>$num_ports,
'device_image'=>getImageSrc($result),
'device_hardware'=>$result['hardware'],
'device_os'=>$config['os'][$result['os']]['text'],
'version'=>$result['version'],
'location'=>$result['location']);
}
}
$json = json_encode($device);
print_r($json);
exit;
} elseif($_REQUEST['type'] == 'ports') {
// Search ports
$results = dbFetchRows("SELECT `ports`.* AS P,`devices`.* AS D FROM `ports` LEFT JOIN `devices` ON `ports`.`device_id` = `devices`.`device_id` WHERE `ifAlias` LIKE '%" . $search . "%' OR `ifDescr` LIKE '%" . $search . "%' ORDER BY ifDescr LIMIT 8");
if (count($results))
{
$found = 1;
foreach ($results as $result)
{
$name = $result['ifDescr'];
if (strlen($name) > 36)
{
$name = substr($name, 0, 36) . "...";
}
$description = $result['ifAlias'];
if (strlen($description) > 50)
{
$description = substr($description, 0, 50) . "...";
}
if($result['deleted'] == 0 && ($result['ignore'] == 0 || $result['ignore'] == 0) && ($result['ifInErrors_delta'] > 0 || $result['ifOutErrors_delta'] > 0))
{
// Errored ports
$port_colour = '#ffa500';
}
elseif($result['deleted'] == 0 && ($result['ignore'] == 1 || $result['ignore'] == 1))
{
// Ignored ports
$port_colour = '#000000';
}
elseif($result['deleted'] == 0 && $result['ifAdminStatus'] == 'down' && $result['ignore'] == 0 && $result['ignore'] == 0)
{
// Shutdown ports
$port_colour = '#808080';
}
elseif($result['deleted'] == 0 && $result['ifOperStatus'] == 'down' && $result['ifAdminStatus'] == 'up' && $result['ignore'] == 0 && $result['ignore'] == 0)
{
// Down ports
$port_colour = '#ff0000';
}
elseif($result['deleted'] == 0 && $result['ifOperStatus'] == 'up' && $result['ignore'] == 0 && $result['ignore'] == 0)
{
// Up ports
$port_colour = '#008000';
}
$ports[]=array('count'=>count($results),
'url'=>generate_port_url($result),
'name'=>$name,
'description'=>$description,
'colours'=>$highlight_colour,
'hostname'=>$result['hostname']);
}
}
$json = json_encode($ports);
print_r($json);
exit;
}
}
}
?>

View File

@ -1,17 +1,17 @@
<?php <?php
if ($device['status'] == '0') { $class = "div-alert"; } else { $class = "div-normal"; } if ($device['status'] == '0') { $class = "alert-danger"; } else { $class = ""; }
if ($device['ignore'] == '1') if ($device['ignore'] == '1')
{ {
$class = "div-ignore-alert"; $class = "div-ignore-alert";
if ($device['status'] == '1') if ($device['status'] == '1')
{ {
$class = "div-ignore"; $class = "alert-warning";
} }
} }
if ($device['disabled'] == '1') if ($device['disabled'] == '1')
{ {
$class = "div-disabled"; $class = "alert-info";
} }
$type = strtolower($device['os']); $type = strtolower($device['os']);
@ -19,7 +19,7 @@ $type = strtolower($device['os']);
$image = getImage($device); $image = getImage($device);
echo(' echo('
<tr bgcolor="'.$device_colour.'" class="'.$class.'"> <tr bgcolor="'.$device_colour.'" class="alert '.$class.'">
<td width="40" align=center valign=middle style="padding: 21px;">'.$image.'</td> <td width="40" align=center valign=middle style="padding: 21px;">'.$image.'</td>
<td valign=middle style="padding: 0 15px;"><span style="font-size: 20px;">' . generate_device_link($device) . '</span> <td valign=middle style="padding: 0 15px;"><span style="font-size: 20px;">' . generate_device_link($device) . '</span>
<br />' . $device['location'] . '</td> <br />' . $device['location'] . '</td>

View File

@ -11,11 +11,14 @@
* the source code distribution for details. * the source code distribution for details.
*/ */
?> ?>
<script type="text/javascript" src="js/jquery.cycle.all.js"></script>
<script type="text/javascript" src="js/jquery-cycle-boxes.js"></script>
<?php <?php
echo("<div class='right-2-col-fixed'>\n<div class='boxes'>\n"); echo('
<div class="cycle-slideshow"
data-cycle-fx="scrollVert"
data-cycle-timeout="10000"
data-cycle-slides="> div">
');
foreach (get_matching_files($config['html_dir']."/includes/front/", "/^top_.*\.php$/") as $file) { foreach (get_matching_files($config['html_dir']."/includes/front/", "/^top_.*\.php$/") as $file) {
echo("<div class=box>\n"); echo("<div class=box>\n");
@ -23,7 +26,7 @@ foreach (get_matching_files($config['html_dir']."/includes/front/", "/^top_.*\.p
echo("</div>\n"); echo("</div>\n");
} }
echo("</div>\n");
echo("</div>\n"); echo("</div>\n");
?> ?>

View File

@ -8,7 +8,6 @@ $icon = geteventicon($entry['message']);
if ($icon) { $icon = '<img src="images/16/' . $icon . '" />'; } if ($icon) { $icon = '<img src="images/16/' . $icon . '" />'; }
echo('<tr class="eventlog"> echo('<tr class="eventlog">
<td width="0"></td>
<td class="syslog" width="160"> <td class="syslog" width="160">
' . $entry['datetime'] . ' ' . $entry['datetime'] . '
</td>'); </td>');

View File

@ -12,56 +12,46 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
?> ?>
<ul id="menium"> <nav class="navbar-wrapper navbar navbar-default navbar-fixed-top" role="navigation">
<div id="container">
<div class="navbar-header">
<a class="navbar-brand" href="">LibreNMS</a>
</div>
<li><a href="<?php echo(generate_url(array('page'=>'overview'))); ?>" class="drop"><img src="images/16/lightbulb.png" border="0" align="absmiddle" /> Overview</a> <div class="collapse navbar-collapse">
<div class="dropdown_1column"> <ul class="nav navbar-nav">
<div class="col_1"> <li class="dropdown">
<ul> <a href="<?php echo(generate_url(array('page'=>'overview'))); ?>" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/lightbulb.png" border="0" align="absmiddle" /> Overview<b class="caret"></b></a>
<?php if (isset($config['enable_map']) && $config['enable_map']) { <ul class="dropdown-menu">
echo('<li><a href="'.generate_url(array('page'=>'overview')).'"><img src="images/16/map.png" border="0" align="absmiddle" /> Network Map</a></li>'); <?php if (isset($config['enable_map']) && $config['enable_map']) {
} ?> echo(' <li><a href="'.generate_url(array('page'=>'overview')).'"><img src="images/16/map.png" border="0" align="absmiddle" /> Network Map</a></li>');
<li><a href="<?php echo(generate_url(array('page'=>'eventlog'))); ?>"><img src="images/16/report.png" border="0" align="absmiddle" /> Eventlog</a></li> } ?>
<?php if (isset($config['enable_syslog']) && $config['enable_syslog']) { <li><a href="<?php echo(generate_url(array('page'=>'eventlog'))); ?>"><img src="images/16/report.png" border="0" align="absmiddle" /> Eventlog</a></li>
echo('<li><a href="'.generate_url(array('page'=>'syslog')).'"><img src="images/16/page.png" border="0" align="absmiddle" /> Syslog</a></li>'); <?php if (isset($config['enable_syslog']) && $config['enable_syslog']) {
} ?> echo(' <li><a href="'.generate_url(array('page'=>'syslog')).'"><img src="images/16/page.png" border="0" align="absmiddle" /> Syslog</a></li>');
} ?>
<!-- <li><a href="<?php echo(generate_url(array('page'=>'alerts'))); ?>"><img src="images/16/exclamation.png" border="0" align="absmiddle" /> Alerts</a></li> --> <!-- <li><a href="<?php echo(generate_url(array('page'=>'alerts'))); ?>"><img src="images/16/exclamation.png" border="0" align="absmiddle" /> Alerts</a></li> -->
<li><a href="<?php echo(generate_url(array('page'=>'inventory'))); ?>"><img src="images/16/bricks.png" border="0" align="absmiddle" /> Inventory</a></li> <li><a href="<?php echo(generate_url(array('page'=>'inventory'))); ?>"><img src="images/16/bricks.png" border="0" align="absmiddle" /> Inventory</a></li>
</ul> <li role="presentation" class="divider"></li>
</div> <li role="presentation" class="dropdown-header"> Search</li>
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'ipv4'))); ?>"><img src="images/icons/ipv4.png" border="0" align="absmiddle" /> IPv4 Search</a></li>
<div class="col_1"> <li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'ipv6'))); ?>"><img src="images/icons/ipv6.png" border="0" align="absmiddle" /> IPv6 Search</a></li>
<h3>Search</h3> <li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'mac'))); ?>"><img src="images/16/email_link.png" border="0" align="absmiddle" /> MAC Search</a></li>
</div> <li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'arp'))); ?>"><img src="images/16/email_link.png" border="0" align="absmiddle" /> ARP Tables</a></li>
</ul>
<div class="col_1"> </li>
<ul> <li class="dropdown">
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'ipv4'))); ?>"><img src="images/icons/ipv4.png" border="0" align="absmiddle" /> IPv4 Search</a></li> <a href="devices/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/server.png" border="0" align="absmiddle" /> Devices<b class="caret"></b></a>
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'ipv6'))); ?>"><img src="images/icons/ipv6.png" border="0" align="absmiddle" /> IPv6 Search</a></li> <ul class="dropdown-menu">
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'mac'))); ?>"><img src="images/16/email_link.png" border="0" align="absmiddle" /> MAC Search</a></li> <li><a href="devices/"><img src="images/16/server.png" border="0" align="absmiddle" /> All Devices</a></li>
<li><a href="<?php echo(generate_url(array('page'=>'search','search'=>'arp'))); ?>"><img src="images/16/email_link.png" border="0" align="absmiddle" /> ARP Tables</a></li> <li role="presentation" class="divider"></li>
</ul>
</div>
</div>
</li>
<li><a href="devices/" class="drop"><img src="images/16/server.png" border="0" align="absmiddle" /> Devices</a>
<div class="dropdown_4columns"><!-- Begin 4 columns container -->
<div class="col_1">
<ul>
<li><a href="devices/"><img src="images/16/server.png" border="0" align="absmiddle" /> All Devices</a></li>
<li><hr width="140" /></li>
<?php <?php
foreach ($config['device_types'] as $devtype) foreach ($config['device_types'] as $devtype)
{ {
if (in_array($devtype['type'],array_keys($cache['device_types']))) if (in_array($devtype['type'],array_keys($cache['device_types'])))
{ {
echo(' <li><a href="devices/type=' . $devtype['type'] . '/"><img src="images/icons/' . $devtype['icon'] . '" border="0" align="absmiddle" /> ' . $devtype['text'] . '</a></li>'); echo(' <li><a href="devices/type=' . $devtype['type'] . '/"><img src="images/icons/' . $devtype['icon'] . '" border="0" align="absmiddle" /> ' . $devtype['text'] . '</a></li>');
} }
} }
@ -69,21 +59,38 @@ if ($_SESSION['userlevel'] >= '10')
{ {
if (count($cache['device_types'])) if (count($cache['device_types']))
{ {
echo(' echo(' <li role="presentation" class="divider"></li>');
<li><hr width="140" /></li>'); }
if ($config['show_locations'])
{
echo('
<li class="dropdown-submenu">
<a href="#"><img src="images/16/building.png" border="0" align="absmiddle" /> Locations</a>
<ul class="dropdown-menu">
');
if ($config['show_locations_dropdown'])
{
foreach (getlocations() as $location)
{
echo(' <li><a href="devices/location=' . urlencode($location) . '/"><img src="images/16/building.png" border="0" align="absmiddle" /> ' . $location . ' </a></li>');
}
} }
echo(' echo('
<li><a href="addhost/"><img src="images/16/server_add.png" border="0" align="absmiddle" /> Add Device</a></li> </ul>
<li><a href="delhost/"><img src="images/16/server_delete.png" border="0" align="absmiddle" /> Delete Device</a></li>'); </li>
');
}
echo('
<li><a href="addhost/"><img src="images/16/server_add.png" border="0" align="absmiddle" /> Add Device</a></li>
<li><a href="delhost/"><img src="images/16/server_delete.png" border="0" align="absmiddle" /> Delete Device</a></li>');
} }
?> ?>
</ul> </ul>
</li>
</div>
<div id="devices_chart" class="col_3" style="height: 300px">
</div>
<script class="code" type="text/javascript"> <script class="code" type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
@ -112,45 +119,36 @@ $(document).ready(function() {
); );
}); });
</script> </script>
</div>
</li><!-- End 5 columns Item -->
<?php <?php
if ($config['show_services']) if ($config['show_services'])
{ {
?> ?>
<li class="dropdown">
<li><a href="services/" class="drop"><img src="images/16/cog.png" border="0" align="absmiddle" /> Services</a><!-- Begin 4 columns Item --> <a href="services/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/cog.png" border="0" align="absmiddle" /> Services<b class="caret"></b></a>
<ul class="dropdown-menu">
<div class="dropdown_4columns"><!-- Begin 4 columns container --> <li><a href="services/"><img src="images/16/cog.png" border="0" align="absmiddle" /> All Services </a></li>
<div class="col_1">
<ul>
<li><a href="services/"><img src="images/16/cog.png" border="0" align="absmiddle" /> All Services </a></li>
<?php <?php
if ($service_alerts) if ($service_alerts)
{ {
echo(' <li><hr width=140 /></li> echo('
<li><a href="services/status=0/"><img src="images/16/cog_error.png" border="0" align="absmiddle" /> Alerts ('.$service_alerts.')</a></li>'); <li role="presentation" class="divider"></li>
<li><a href="services/status=0/"><img src="images/16/cog_error.png" border="0" align="absmiddle" /> Alerts ('.$service_alerts.')</a></li>');
} }
if ($_SESSION['userlevel'] >= '10') if ($_SESSION['userlevel'] >= '10')
{ {
echo(' echo('
<li><hr width="140" /></li> <li role="presentation" class="divider"></li>
<li><a href="addsrv/"><img src="images/16/cog_add.png" border="0" align="absmiddle" /> Add Service</a></li> <li><a href="addsrv/"><img src="images/16/cog_add.png" border="0" align="absmiddle" /> Add Service</a></li>
<li><a href="delsrv/"><img src="images/16/cog_delete.png" border="0" align="absmiddle" /> Delete Service</a></li>'); <li><a href="delsrv/"><img src="images/16/cog_delete.png" border="0" align="absmiddle" /> Delete Service</a></li>');
} }
?> ?>
</ul> </ul>
</div> </li>
<div id="services_chart" class="col_3" style="height: 300px">
</div>
<script class="code" type="text/javascript"> <script class="code" type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
@ -178,88 +176,58 @@ $(document).ready(function() {
}); });
</script> </script>
</div><!-- End 4 columns container -->
</li><!-- End 4 columns Item -->
<?php <?php
} }
if ($config['show_locations'])
{
?>
<li><a href="locations/" class="drop"><img src="images/16/building.png" border="0" align="absmiddle" /> Locations</a><!-- Begin Home Item -->
<?php
if ($config['show_locations_dropdown'])
{
?>
<div class="dropdown_2columns"><!-- Begin 2 columns container -->
<div class="col_2">
<ul>
<?php
foreach (getlocations() as $location)
{
echo(' <li><a href="devices/location=' . urlencode($location) . '/"><img src="images/16/building.png" border="0" align="absmiddle" /> ' . $location . ' </a></li>');
}
?>
</ul>
</div>
</div><!-- End 4 columns container -->
<?php
}
?>
</li><!-- End 4 columns Item -->
<?php
}
?> ?>
<!-- PORTS --> <!-- PORTS -->
<li class="dropdown">
<li><a href="ports/" class="drop"><img src="images/16/connect.png" border="0" align="absmiddle" /> Ports</a><!-- Begin Home Item --> <a href="ports/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/connect.png" border="0" align="absmiddle" /> Ports<b class="caret"></b></a>
<ul class="dropdown-menu">
<div class="dropdown_4columns"><!-- Begin 2 columns container --> <li><a href="ports/"><img src="images/16/connect.png" border="0" align="absmiddle" /> All Ports</a></li>
<div class="col_1">
<ul>
<li><a href="ports/"><img src="images/16/connect.png" border="0" align="absmiddle" /> All Ports</a></li>
<?php <?php
if ($ports['errored']) if ($ports['errored'])
{ {
echo('<li><a href="ports/errors=1/"><img src="images/16/chart_curve_error.png" border="0" align="absmiddle" /> Errored ('.$ports['errored'].')</a></li>'); echo(' <li><a href="ports/errors=1/"><img src="images/16/chart_curve_error.png" border="0" align="absmiddle" /> Errored ('.$ports['errored'].')</a></li>');
} }
if ($ports['ignored']) if ($ports['ignored'])
{ {
echo('<li><a href="ports/ignore=1/"><img src="images/16/chart_curve_link.png" border="0" align="absmiddle" /> Ignored ('.$ports['ignored'].')</a></li>'); echo(' <li><a href="ports/ignore=1/"><img src="images/16/chart_curve_link.png" border="0" align="absmiddle" /> Ignored ('.$ports['ignored'].')</a></li>');
} }
if ($config['enable_billing']) { echo('<li><a href="bills/"><img src="images/16/money.png" border="0" align="absmiddle" /> Traffic Bills</a></li>'); $ifbreak = 1; } if ($config['enable_billing']) {
echo(' <li><a href="bills/"><img src="images/16/money.png" border="0" align="absmiddle" /> Traffic Bills</a></li>'); $ifbreak = 1;
}
if ($config['enable_pseudowires']) { echo('<li><a href="pseudowires/"><img src="images/16/arrow_switch.png" border="0" align="absmiddle" /> Pseudowires</a></li>'); $ifbreak = 1; } if ($config['enable_pseudowires']) {
echo(' <li><a href="pseudowires/"><img src="images/16/arrow_switch.png" border="0" align="absmiddle" /> Pseudowires</a></li>'); $ifbreak = 1;
}
?> ?>
<?php <?php
if ($_SESSION['userlevel'] >= '5') if ($_SESSION['userlevel'] >= '5')
{ {
echo('<li><hr width="140" /></li>'); echo(' <li role="presentation" class="divider"></li>');
if ($config['int_customers']) { echo('<li><a href="customers/"><img src="images/16/group_link.png" border="0" align="absmiddle" /> Customers</a></li>'); $ifbreak = 1; } if ($config['int_customers']) { echo(' <li><a href="customers/"><img src="images/16/group_link.png" border="0" align="absmiddle" /> Customers</a></li>'); $ifbreak = 1; }
if ($config['int_l2tp']) { echo('<li><a href="iftype/type=l2tp/"><img src="images/16/user.png" border="0" align="absmiddle" /> L2TP</a></li>'); $ifbreak = 1; } if ($config['int_l2tp']) { echo(' <li><a href="iftype/type=l2tp/"><img src="images/16/user.png" border="0" align="absmiddle" /> L2TP</a></li>'); $ifbreak = 1; }
if ($config['int_transit']) { echo('<li><a href="iftype/type=transit/"><img src="images/16/lorry_link.png" border="0" align="absmiddle" /> Transit</a></li>'); $ifbreak = 1; } if ($config['int_transit']) { echo(' <li><a href="iftype/type=transit/"><img src="images/16/lorry_link.png" border="0" align="absmiddle" /> Transit</a></li>'); $ifbreak = 1; }
if ($config['int_peering']) { echo('<li><a href="iftype/type=peering/"><img src="images/16/bug_link.png" border="0" align="absmiddle" /> Peering</a></li>'); $ifbreak = 1; } if ($config['int_peering']) { echo(' <li><a href="iftype/type=peering/"><img src="images/16/bug_link.png" border="0" align="absmiddle" /> Peering</a></li>'); $ifbreak = 1; }
if ($config['int_peering'] && $config['int_transit']) { echo('<li><a href="iftype/type=peering,transit/"><img src="images/16/world_link.png" border="0" align="absmiddle" /> Peering + Transit</a></li>'); $ifbreak = 1; } if ($config['int_peering'] && $config['int_transit']) { echo(' <li><a href="iftype/type=peering,transit/"><img src="images/16/world_link.png" border="0" align="absmiddle" /> Peering + Transit</a></li>'); $ifbreak = 1; }
if ($config['int_core']) { echo('<li><a href="iftype/type=core/"><img src="images/16/brick_link.png" border="0" align="absmiddle" /> Core</a></li>'); $ifbreak = 1; } if ($config['int_core']) { echo(' <li><a href="iftype/type=core/"><img src="images/16/brick_link.png" border="0" align="absmiddle" /> Core</a></li>'); $ifbreak = 1; }
} }
if ($ifbreak) { echo('<li><hr width="140" /></li>'); } if ($ifbreak) {
echo(' <li role="presentation" class="divider"></li>');
}
if (isset($interface_alerts)) if (isset($interface_alerts))
{ {
echo('<li><a href="ports/alerted=yes/"><img src="images/16/link_error.png" border="0" align="absmiddle" /> Alerts ('.$interface_alerts.')</a></li>'); echo(' <li><a href="ports/alerted=yes/"><img src="images/16/link_error.png" border="0" align="absmiddle" /> Alerts ('.$interface_alerts.')</a></li>');
} }
$deleted_ports = 0; $deleted_ports = 0;
@ -272,18 +240,13 @@ foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`delete
} }
?> ?>
<li><a href="ports/state=down/"><img src="images/16/if-disconnect.png" border="0" align="absmiddle" /> Down</a></li> <li><a href="ports/state=down/"><img src="images/16/if-disconnect.png" border="0" align="absmiddle" /> Down</a></li>
<li><a href="ports/state=admindown/"><img src="images/16/if-disable.png" border="0" align="absmiddle" /> Disabled</a></li> <li><a href="ports/state=admindown/"><img src="images/16/if-disable.png" border="0" align="absmiddle" /> Disabled</a></li>
<?php <?php
if ($deleted_ports) { echo('<li><a href="deleted-ports/"><img src="images/16/cross.png" border="0" align="absmiddle" /> Deleted ('.$deleted_ports.')</a></li>'); } if ($deleted_ports) { echo(' <li><a href="deleted-ports/"><img src="images/16/cross.png" border="0" align="absmiddle" /> Deleted ('.$deleted_ports.')</a></li>'); }
?> ?>
</ul>
</div>
<div id="ports_chart" class="col_3" style="height: 300px">
</div>
<script class="code" type="text/javascript"> <script class="code" type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
@ -313,11 +276,8 @@ $(document).ready(function() {
); );
}); });
</script> </script>
</ul>
</div><!-- End 4 columns container --> </li>
</li><!-- End 4 columns Item -->
<?php <?php
// FIXME does not check user permissions... // FIXME does not check user permissions...
@ -331,34 +291,31 @@ $menu_sensors = $used_sensors;
?> ?>
<li><a href="health/" class="drop"><img src="images/icons/sensors.png" border="0" align="absmiddle" /> Health</a><!-- Begin Home Item --> <li class="dropdown">
<a href="health/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/icons/sensors.png" border="0" align="absmiddle" /> Health<b class="caret"></b></a>
<div class="dropdown_1column"><!-- Begin 2 columns container --> <ul class="dropdown-menu">
<div class="col_1"> <li><a href="health/metric=mempool/"><img src="images/icons/memory.png" border="0" align="absmiddle" /> Memory</a></li>
<li><a href="health/metric=processor/"><img src="images/icons/processor.png" border="0" align="absmiddle" /> Processor</a></li>
<ul> <li><a href="health/metric=storage/"><img src="images/icons/storage.png" border="0" align="absmiddle" /> Storage</a></li>
<li><a href="health/metric=mempool/"><img src="images/icons/memory.png" border="0" align="absmiddle" /> Memory</a></li>
<li><a href="health/metric=processor/"><img src="images/icons/processor.png" border="0" align="absmiddle" /> Processor</a></li>
<li><a href="health/metric=storage/"><img src="images/icons/storage.png" border="0" align="absmiddle" /> Storage</a></li>
<?php <?php
if ($menu_sensors) if ($menu_sensors)
{ {
$sep = 0; $sep = 0;
echo('<li><hr width="97%" /></li>'); echo(' <li role="presentation" class="divider"></li>');
} }
foreach (array('fanspeed','humidity','temperature') as $item) foreach (array('fanspeed','humidity','temperature') as $item)
{ {
if ($menu_sensors[$item]) if ($menu_sensors[$item])
{ {
echo('<li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>'); echo(' <li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>');
unset($menu_sensors[$item]);$sep++; unset($menu_sensors[$item]);$sep++;
} }
} }
if ($sep) if ($sep)
{ {
echo('<li><hr width="97%" /></li>'); echo(' <li role="presentation" class="divider"></li>');
$sep = 0; $sep = 0;
} }
@ -366,32 +323,26 @@ foreach (array('current','frequency','power','voltage') as $item)
{ {
if ($menu_sensors[$item]) if ($menu_sensors[$item])
{ {
echo('<li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>'); echo(' <li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>');
unset($menu_sensors[$item]);$sep++; unset($menu_sensors[$item]);$sep++;
} }
} }
if ($sep && array_keys($menu_sensors)) if ($sep && array_keys($menu_sensors))
{ {
echo('<li><hr width="97%" /></li>'); echo(' <li role="presentation" class="divider"></li>');
$sep = 0; $sep = 0;
} }
foreach (array_keys($menu_sensors) as $item) foreach (array_keys($menu_sensors) as $item)
{ {
echo('<li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>'); echo(' <li><a href="health/metric='.$item.'/"><img src="images/icons/'.$item.'.png" border="0" align="absmiddle" /> '.nicecase($item).'</a></li>');
unset($menu_sensors[$item]);$sep++; unset($menu_sensors[$item]);$sep++;
} }
?> ?>
</ul> </ul>
</li>
</div>
</div><!-- End 4 columns container -->
</li><!-- End 4 columns Item -->
<?php <?php
$app_count = dbFetchCell("SELECT COUNT(`app_id`) FROM `applications`"); $app_count = dbFetchCell("SELECT COUNT(`app_id`) FROM `applications`");
@ -399,10 +350,9 @@ $app_count = dbFetchCell("SELECT COUNT(`app_id`) FROM `applications`");
if ($_SESSION['userlevel'] >= '5' && ($app_count) > "0") if ($_SESSION['userlevel'] >= '5' && ($app_count) > "0")
{ {
?> ?>
<li class="dropdown">
<li><a href="apps/" class="drop"><img src="images/icons/apps.png" border="0" align="absmiddle" /> Apps</a><!-- Begin Home Item --> <a href="apps/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/icons/apps.png" border="0" align="absmiddle" /> Apps<b class="caret"></b></a>
<div class="dropdown_1column"><!-- Begin 1 column container --> <ul class="dropdown-menu">
<ul>
<?php <?php
$app_list = dbFetchRows("SELECT `app_type` FROM `applications` GROUP BY `app_type` ORDER BY `app_type`"); $app_list = dbFetchRows("SELECT `app_type` FROM `applications` GROUP BY `app_type` ORDER BY `app_type`");
@ -411,14 +361,11 @@ if ($_SESSION['userlevel'] >= '5' && ($app_count) > "0")
$image = $config['html_dir']."/images/icons/".$row['app_type'].".png"; $image = $config['html_dir']."/images/icons/".$row['app_type'].".png";
$icon = (file_exists($image) ? $row['app_type'] : "apps"); $icon = (file_exists($image) ? $row['app_type'] : "apps");
echo(' echo('
<li><a href="apps/app='.$app['app_type'].'/"><img src="images/icons/'.$icon.'.png" border="0" align="absmiddle" /> '.nicecase($app['app_type']).' </a></li>'); <li><a href="apps/app='.$app['app_type'].'/"><img src="images/icons/'.$icon.'.png" border="0" align="absmiddle" /> '.nicecase($app['app_type']).' </a></li>');
} }
?> ?>
</ul> </ul>
</div> </li>
</li>
<?php <?php
} }
@ -431,17 +378,15 @@ if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf
{ {
?> ?>
<li class="dropdown">
<li><a href="routing/" class="drop"><img src="images/16/arrow_branch.png" border="0" align="absmiddle" /> Routing</a><!-- Begin Home Item --> <a href="routing/" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/arrow_branch.png" border="0" align="absmiddle" /> Routing<b class="caret"></b></a>
<div class="dropdown_1column"><!-- Begin 1 column container --> <ul class="dropdown-menu">
<ul>
<?php <?php
$separator = 0; $separator = 0;
if ($_SESSION['userlevel'] >= '5' && $routing_count['vrf']) if ($_SESSION['userlevel'] >= '5' && $routing_count['vrf'])
{ {
echo('<li><a href="routing/protocol=vrf/"><img src="images/16/layers.png" border="0" align="absmiddle" /> VRFs</a></li>'); echo(' <li><a href="routing/protocol=vrf/"><img src="images/16/layers.png" border="0" align="absmiddle" /> VRFs</a></li>');
$separator++; $separator++;
} }
@ -449,12 +394,11 @@ if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf
{ {
if ($separator) if ($separator)
{ {
echo(' echo(' <li role="presentation" class="divider"></li>');
<li><hr width=140></li>');
$separator = 0; $separator = 0;
} }
echo(' echo('
<li><a href="routing/protocol=ospf/"><img src="images/16/text_letter_omega.png" border="0" align="absmiddle" /> OSPF Devices </a></li>'); <li><a href="routing/protocol=ospf/"><img src="images/16/text_letter_omega.png" border="0" align="absmiddle" /> OSPF Devices </a></li>');
$separator++; $separator++;
} }
@ -463,32 +407,28 @@ if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf
{ {
if ($separator) if ($separator)
{ {
echo(' echo(' <li role="presentation" class="divider"></li>');
<li><hr width=140></li>');
$separator = 0; $separator = 0;
} }
echo(' echo('
<li><a href="routing/protocol=bgp/type=all/graph=NULL/"><img src="images/16/link.png" border="0" align="absmiddle" /> BGP All Sessions </a></li> <li><a href="routing/protocol=bgp/type=all/graph=NULL/"><img src="images/16/link.png" border="0" align="absmiddle" /> BGP All Sessions </a></li>
<li><a href="routing/protocol=bgp/type=external/graph=NULL/"><img src="images/16/world_link.png" border="0" align="absmiddle" /> BGP External</a></li>
<li><a href="routing/protocol=bgp/type=external/graph=NULL/"><img src="images/16/world_link.png" border="0" align="absmiddle" /> BGP External</a></li> <li><a href="routing/protocol=bgp/type=internal/graph=NULL/"><img src="images/16/brick_link.png" border="0" align="absmiddle" /> BGP Internal</a></li>');
<li><a href="routing/protocol=bgp/type=internal/graph=NULL/"><img src="images/16/brick_link.png" border="0" align="absmiddle" /> BGP Internal</a></li>');
} }
// Do Alerts at the bottom // Do Alerts at the bottom
if ($bgp_alerts) if ($bgp_alerts)
{ {
echo(' echo('
<li><hr width=140></li> <li role="presentation" class="divider"></li>
<li><a href="routing/protocol=bgp/adminstatus=start/state=down/"><img src="images/16/link_error.png" border="0" align="absmiddle" /> Alerted BGP (' . $bgp_alerts . ')</a></li> <li><a href="routing/protocol=bgp/adminstatus=start/state=down/"><img src="images/16/link_error.png" border="0" align="absmiddle" /> Alerted BGP (' . $bgp_alerts . ')</a></li>
'); ');
} }
echo(' </ul>'); echo(' </ul>');
?> ?>
</div><!-- End 4 columns container --> </li><!-- End 4 columns container -->
</li><!-- End 4 columns Item -->
<?php <?php
} }
@ -499,15 +439,12 @@ if ($packages)
{ {
?> ?>
<li><a href="<?php echo(generate_url(array('page'=>'packages'))); ?>" class="drop"><img src="images/16/box.png" border="0" align="absmiddle" /> Packages</a> <li class="dropdown">
<div class="dropdown_1column"> <a href="<?php echo(generate_url(array('page'=>'packages'))); ?>" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/box.png" border="0" align="absmiddle" /> Packages<b class="caret"></b></a>
<div class="col_1"> <ul class="dropdown-menu">
<ul>
<li><a href="<?php echo(generate_url(array('page'=>'packages'))); ?>"><img src="images/16/box.png" border="0" align="absmiddle" /> All Packages</a></li> <li><a href="<?php echo(generate_url(array('page'=>'packages'))); ?>"><img src="images/16/box.png" border="0" align="absmiddle" /> All Packages</a></li>
</ul> </ul>
</div> </li>
</div>
</li>
<?php <?php
} # if ($packages) } # if ($packages)
@ -518,52 +455,97 @@ if(is_file("includes/print-menubar-custom.inc.php"))
} }
?> ?>
<li class="menu_right"><a href="#" class="drop"><img src="images/16/wrench.png" border="0" align="absmiddle" /> System</a><!-- Begin Home Item --> </ul>
<div class="dropdown_2columns align_right"><!-- Begin 2 columns container --> <ul class="nav navbar-nav navbar-right">
<li style="padding-top:10px">
<form role="form" class="pull-left form-horizontal">
<div class="form-group row">
<div class="col-md-10">
<input class="input-large search-query" type="search" id="gsearch" name="gsearch" placeholder="Global Search" style="width: 250px">
</div>
<div class="col-md-2">
&nbsp;
</div>
</div>
</form>
</li>
<li class="dropdown">
<?php
if($_SESSION['widescreen'] === 1)
{
echo(' <a href="' . $toggle_url . 'widescreen=no" title="Switch to normal screen width layout">Normal width</a>');
} else {
echo(' <a href="' . $toggle_url . 'widescreen=yes" title="Switch to wide screen layout">Widescreen</a>');
}
<div class="col_1"> ?>
<h2>Settings</h2> </li>
<ul> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-hover="dropdown" data-toggle="dropdown"><img src="images/16/wrench.png" border="0" align="absmiddle" /> System<b class="caret"></b></a>
<ul class="dropdown-menu">
<li role="presentation" class="dropdown-header"> Settings</li>
<li role="presentation" class="divider"></li>
<?php <?php
if ($_SESSION['userlevel'] >= '10') if ($_SESSION['userlevel'] >= '10')
{ {
echo(' echo('
<li><a href="settings/"><img src="images/16/wrench.png" border="0" align="absmiddle" /> Global Settings</a></li>'); <li><a href="settings/"><img src="images/16/wrench.png" border="0" align="absmiddle" /> Global Settings</a></li>');
} }
?> ?>
<li><a href="preferences/"><img src="images/16/wrench_orange.png" border="0" align="absmiddle" /> My Settings</a></li> <li><a href="preferences/"><img src="images/16/wrench_orange.png" border="0" align="absmiddle" /> My Settings</a></li>
</ul> <li role="presentation" class="divider"></li>
</div> <li role="presentation" class="dropdown-header"> Users</li>
<div class="col_1">
<h2>Users</h2>
<ul>
<?php if ($_SESSION['userlevel'] >= '10') <?php if ($_SESSION['userlevel'] >= '10')
{ {
if (auth_usermanagement()) if (auth_usermanagement())
{ {
echo(' echo('
<li><a href="adduser/"><img src="images/16/user_add.png" border="0" align="absmiddle" /> Add User</a></li> <li><a href="adduser/"><img src="images/16/user_add.png" border="0" align="absmiddle" /> Add User</a></li>
<li><a href="deluser/"><img src="images/16/user_delete.png" border="0" align="absmiddle" /> Remove User</a></li> <li><a href="deluser/"><img src="images/16/user_delete.png" border="0" align="absmiddle" /> Remove User</a></li>
'); ');
} }
echo(' echo('
<li><a href="edituser/"><img src="images/16/user_edit.png" border="0" align="absmiddle" /> Edit User</a></li> <li><a href="edituser/"><img src="images/16/user_edit.png" border="0" align="absmiddle" /> Edit User</a></li>
<li><a href="authlog/"><img src="images/16/lock.png" border="0" align="absmiddle" /> Authlog</a></li>'); <li><a href="authlog/"><img src="images/16/lock.png" border="0" align="absmiddle" /> Authlog</a></li>');
} ?> } ?>
<?php
if ($_SESSION['authenticated'])
{
echo('
<li><a href="logout/">Logout</a></li>
');
}
?>
</ul> <li role="presentation" class="divider"></li>
</div> <li><a href="about/"><img src="images/16/information.png" border="0" align="absmiddle" /> About&nbsp;<?php echo($config['project_name']); ?></a></li>
</ul>
</li>
</ul>
<div class="col_2"> </div>
<ul> </div>
<li><a href="about/"><img src="images/16/information.png" border="0" align="absmiddle" /> About&nbsp;<?php echo($config['project_name']); ?></a></li> </div>
</ul> </nav>
</div> <script>
</div> $('#gsearch').typeahead([
{
</li><!-- End Home Item --> name: 'devices',
remote : 'ajax_search.php?search=%QUERY&type=device',
</ul> header: '<h5><strong>Devices</strong></h5>',
template: '<p"><img src="{{device_image}}" border="0" class="img_left"> <small><a href="{{url}}"><strong>{{name}}</strong> | {{device_os}} | {{version}} | {{device_hardware}} with {{device_ports}} port(s) | {{location}}</a></small></p>',
valueKey:"name",
engine: Hogan
},
{
name: 'ports',
remote : 'ajax_search.php?search=%QUERY&type=ports',
header: '<h5><strong>Ports</strong></h5>',
template: '<p><small><a href="{{url}}"><img src="images/icons/port.png" /> <strong>{{name}}</strong> {{hostname}}</a></small></p>',
valueKey: "name",
engine: Hogan
}
]);
</script>

View File

@ -2,8 +2,7 @@
if (device_permitted($entry['device_id'])) if (device_permitted($entry['device_id']))
{ {
echo("<tr class=\"syslog\"> echo("<tr class=\"syslog\">");
<td width=0></td>");
$entry['hostname'] = shorthost($entry['hostname'], 20); $entry['hostname'] = shorthost($entry['hostname'], 20);

View File

@ -33,7 +33,7 @@ if($_SESSION['userlevel'] >= 5)
$ports['errored'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.deleted = '0' AND D.device_id = I.device_id AND (I.ignore = '0' OR D.ignore = '0') AND (I.ifInErrors_delta > '0' OR I.ifOutErrors_delta > '0')"); $ports['errored'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D WHERE I.deleted = '0' AND D.device_id = I.device_id AND (I.ignore = '0' OR D.ignore = '0') AND (I.ifInErrors_delta > '0' OR I.ifOutErrors_delta > '0')");
$services['count'] = dbFetchCell("SELECT COUNT(service_id) FROM services"); $services['count'] = dbFetchCell("SELECT COUNT(service_id) FROM services");
$services['up'] = dbFetchCell("SELECT COUNT(service_id) FROM services WHERE service_status = '1' AND service_ignore ='0'"); $services['up'] = dbFetchCell("SELECT COUNT(service_id) FROM services WHERE service_status = '1' AND service_ignore ='0' AND service_disabled='0'");
$services['down'] = dbFetchCell("SELECT COUNT(service_id) FROM services WHERE service_status = '0' AND service_ignore = '0'"); $services['down'] = dbFetchCell("SELECT COUNT(service_id) FROM services WHERE service_status = '0' AND service_ignore = '0'");
$services['ignored'] = dbFetchCell("SELECT COUNT(service_id) FROM services WHERE service_ignore = '1'"); $services['ignored'] = dbFetchCell("SELECT COUNT(service_id) FROM services WHERE service_ignore = '1'");
$services['disabled'] = dbFetchCell("SELECT COUNT(service_id) FROM services WHERE service_disabled = '1'"); $services['disabled'] = dbFetchCell("SELECT COUNT(service_id) FROM services WHERE service_disabled = '1'");
@ -49,7 +49,7 @@ else
$ports['up'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.deleted = '0' AND P.user_id = ? AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'up'", array($_SESSION['user_id'])); $ports['up'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.deleted = '0' AND P.user_id = ? AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'up'", array($_SESSION['user_id']));
$ports['down'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.deleted = '0' AND P.user_id = ? AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up'", array($_SESSION['user_id'])); $ports['down'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.deleted = '0' AND P.user_id = ? AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up'", array($_SESSION['user_id']));
$ports['disabled'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.deleted = '0' AND P.user_id = ? AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifAdminStatus = 'down'", array($_SESSION['user_id'])); $ports['disabled'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.deleted = '0' AND P.user_id = ? AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifAdminStatus = 'down'", array($_SESSION['user_id']));
$ports['errored'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.deleted = '0' AND P.user_id = ? AND P.device_id = D.device_id AND I.device_id = D.device_id AND (I.in_errors > '0' OR I.out_errors > '0')", array($_SESSION['user_id'])); $ports['errolabel label-danger'] = dbFetchCell("SELECT COUNT(*) FROM ports AS I, devices AS D, devices_perms AS P WHERE I.deleted = '0' AND P.user_id = ? AND P.device_id = D.device_id AND I.device_id = D.device_id AND (I.in_errors > '0' OR I.out_errors > '0')", array($_SESSION['user_id']));
$services['count'] = dbFetchCell("SELECT COUNT(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = ? AND P.device_id = D.device_id AND S.device_id = D.device_id", array($_SESSION['user_id'])); $services['count'] = dbFetchCell("SELECT COUNT(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = ? AND P.device_id = D.device_id AND S.device_id = D.device_id", array($_SESSION['user_id']));
$services['up'] = dbFetchCell("SELECT COUNT(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = ? AND P.device_id = D.device_id AND S.device_id = D.device_id AND service_status = '1' AND service_ignore ='0'", array($_SESSION['user_id'])); $services['up'] = dbFetchCell("SELECT COUNT(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = ? AND P.device_id = D.device_id AND S.device_id = D.device_id AND service_status = '1' AND service_ignore ='0'", array($_SESSION['user_id']));
@ -62,44 +62,52 @@ if ($ports['down']) { $ports['bgcolour'] = "#ffcccc"; } else { $ports['bgcolo
if ($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['bgcolour'] = "transparent"; } if ($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['bgcolour'] = "transparent"; }
?> ?>
<div class="container pull-right">
<table cellpadding="0" cellspacing="0" border="0" width=500> <div class="row">
<tr style="background-color: <?php echo($devices[bgcolour]); ?>"> <div class="col-md-6">
<td width="5"></td> <table class="table table-condensed table-striped">
<td><strong>Devices</strong></td> <thead>
<td><?php echo($devices['count']) ?></td> <tr>
<td> ( </td> <th>&nbsp;</th>
<td style="text-align: right"><span class="green"> <?php echo($devices['up']) ?> up</span></td> <th>Total</th>
<td style="text-align: right"><span class="red"> <?php echo($devices['down']) ?> down</span></td> <th>Up</th>
<td style="text-align: right"><span class="black"> <?php echo($devices['ignored']) ?> ignored</span> </td> <th>Down</th>
<td style="text-align: right"><span class="grey"> <?php echo($devices['disabled']) ?> disabled</span></td> <th>Ignored</th>
<td> ) </td> <th>Disabled</th>
<td width="5"></td> </tr>
</tr> </thead>
<tr style="background-color: <?php echo($ports['bgcolour']) ?>"> <tbody>
<td width="5"></td> <tr>
<td><strong>Ports</strong></td> <td><a href="devices/">Devices</a></td>
<td><?php echo($ports['count']) ?></td> <td><a href="devices/"><span><?php echo($devices['count']) ?></span></a></td>
<td> ( </td> <td><a href="devices/state=up/format=list_detail/"><span class="green"> <?php echo($devices['up']) ?> up</span></a></td>
<td style="text-align: right"><span class="green"> <?php echo($ports['up']) ?> up </span></td> <td><a href="devices/state=down/format=list_detail/"><span class="red"> <?php echo($devices['down']) ?> down</span></a></td>
<td style="text-align: right"><span class="red"> <?php echo($ports['down']) ?> down </span></td> <td><a href="devices/ignore=1/format=list_detail/"><span class="grey"> <?php echo($devices['ignored']) ?> ignored </span></a></td>
<td style="text-align: right"><span class="black"> <?php echo($ports['ignored']) ?> ignored </span></td> <td><a href="devices/disabled=1/format=list_detail/"><span class="black"> <?php echo($devices['disabled']) ?> disabled</span></a></td>
<td style="text-align: right"><span class="grey"> <?php echo($ports['shutdown']) ?> shutdown</span></td> </tr>
<td> ) </td> <tr class="danger">
<td width="5"></td> <td><a href="ports/">Ports</a></td>
</tr> <td><a href="ports/"><span><?php echo($ports['count']) ?></span></a></td>
<td><a href="ports/format=list_detail/state=up/"><span class="green"> <?php echo($ports['up']) ?> up </span></a></td>
<td><a href="ports/format=list_detail/state=down/"><span class="red"> <?php echo($ports['down']) ?> down </span></a></td>
<td><a href="ports/format=list_detail/ignore=1/"><span class="grey"> <?php echo($ports['ignored']) ?> ignored </span></a></td>
<td><a href="ports/format=list_detail/state=admindown/"><span class="black"> <?php echo($ports['shutdown']) ?> shutdown</span></a></td>
</tr>
<?php if ($config['show_services']) { ?> <?php if ($config['show_services']) { ?>
<tr style="background-color: <?php echo($services['bgcolour']) ?>"> <tr>
<td width="5"></td> <td><a href="services/">Services</a></td>
<td><strong>Services</strong></td> <td><a href="services/"><span><?php echo($services['count']) ?></span></a></td>
<td><?php echo($services['count']) ?></td> <td><a href="services/state=up/view=details/"><span class="green"><?php echo($services['up']) ?> up</span></a></td>
<td> ( </td> <td><a href="services/state=down/view=details/"><span class="red"> <?php echo($services['down']) ?> down</span></a></td>
<td style="text-align: right"><span class="green"><?php echo($services['up']) ?> up</span></td> <td><a href="services/ignore=1/view=details/"><span class="grey"> <?php echo($services['ignored']) ?> ignored</span></a></td>
<td style="text-align: right"><span class="red"> <?php echo($services['down']) ?> down</span></td> <td><a href="services/disabled=1/view=details/"><span class="black"> <?php echo($services['disabled']) ?> disabled</span></a></td>
<td style="text-align: right"><span class="black"> <?php echo($services['ignored']) ?> ignored</span> </td> </tr>
<td style="text-align: right"><span class="grey"> <?php echo($services['disabled']) ?> disabled</span></td>
<td> ) </td>
<td width="5"></td>
</tr>
<?php } ?> <?php } ?>
</tbody>
</table> </table>
</div>
<div class="col-md-6">
&nbsp;
</div>
</div>
</div>

View File

@ -141,7 +141,9 @@ if ($config['favicon']) { echo(' <link rel="shortcut icon" href="'.$config['fav
<!--<script type="text/javascript" src="js/sorttable.js"></script>--> <!--<script type="text/javascript" src="js/sorttable.js"></script>-->
<!--<script type="text/javascript" src="js/jquery.min.js"></script>--> <!--<script type="text/javascript" src="js/jquery.min.js"></script>-->
<!--<script type="text/javascript" src="js/jquery-checkbox.js"></script>--> <!--<script type="text/javascript" src="js/jquery-checkbox.js"></script>-->
<!--<script type="text/javascript" src="js/qtip/jquery.qtip-1.0.0-rc3.min.js"></script>--> <!--<script type="text/javascript" src="js/bootstrap.min.js"></script>-->
<!--<script type="text/javascript" src="js/qtip/jquery.qtip.min.js"></script>-->
<!--<link rel="stylesheet" href="css/jquery.qtip.min.css" type="text/css">-->
<!--<?php /* html5.js below from http://html5shim.googlecode.com/svn/trunk/html5.js */ ?>--> <!--<?php /* html5.js below from http://html5shim.googlecode.com/svn/trunk/html5.js */ ?>-->
<!--[if IE]><script src="js/html5.js"></script><![endif]--> <!--[if IE]><script src="js/html5.js"></script><![endif]-->
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="js/jqplot/excanvas.js"></script><![endif]--> <!--[if lt IE 9]><script language="javascript" type="text/javascript" src="js/jqplot/excanvas.js"></script><![endif]-->

View File

@ -62,79 +62,104 @@ $pagetitle[] = "Add host";
?> ?>
<form name="form1" method="post" action=""> <form name="form1" method="post" action="" class="form-horizontal" role="form">
<p>Devices will be checked for Ping and SNMP reachability before being probed. Only devices with recognised OSes will be added.</p> <div class="alert alert-info">Devices will be checked for Ping and SNMP reachability before being probed. Only devices with recognised OSes will be added.</div>
<div class="well well-lg">
<div style="padding: 10px; background: #f0f0f0;"> <div class="form-group">
<table cellpadding=2px> <label for="hostname" class="col-sm-2 control-label">Hostname</label>
<tr> <div class="col-sm-5">
<td><strong>Hostname</strong></td> <input type="text" id="hostname" name="hostname" class="form-control input-sm" placeholder="Hostname">
<td><input type="text" name="hostname" size="32"></td> </div>
</tr> <div class="col-sm-5">
<tr> </div>
<td><strong>SNMP Version</strong></td> </div>
<td> <div class="form-group">
<select name="snmpver"> <label for="snmpver" class="col-sm-2 control-label">SNMP Version</label>
<option value="v1">v1</option> <div class="col-sm-3">
<option value="v2c" selected>v2c</option> <select name="snmpver" id="snmpver" class="form-control input-sm">
<option value="v3">v3</option> <option value="v1">v1</option>
</select> <option value="v2c" selected>v2c</option>
&nbsp;<strong>Port</strong> <input type="text" name="port" size="16"> <option value="v3">v3</option>
</td> </select>
</tr> </div>
<tr> <div class="col-sm-2">
<td colspan=2><strong>SNMPv1/2c Configuration</strong></td> <input type="text" name="port" placeholder="port" class="form-control input-sm">
</tr> </div>
<tr> <div class="col-sm-5">
<td><strong>Community</strong></td> </div>
<td><input type="text" name="community" size="32"></td> </div>
</tr> <div class="form-group">
<tr> <div class="col-sm-12 alert alert-info">
<td colspan=2><strong>SNMPv3 Configuration</strong></td> <label class="control-label text-left input-sm">SNMPv1/2c Configuration</label>
</tr> </div>
<tr> </div>
<td><strong>Auth Level</strong></td> <div class="form-group">
<td> <label for="community" class="col-sm-2 control-label">Community</label>
<select name="authlevel"> <div class="col-sm-5">
<option value="noAuthNoPriv" selected>NoAuthNoPriv</option> <input type="text" name="community" id="community" placeholder="Community" class="form-control input-sm">
<option value="authNoPriv">AuthNoPriv</option> </div>
<option value="authPriv">AuthPriv</option> <div class="col-sm-5">
</select> </div>
</td> </div>
</tr> <div class="form-group">
<tr> <div class="col-sm-12 alert alert-info">
<td><strong>Auth User Name</strong></td> <label class="control-label text-left input-sm">SNMPv3 Configuration</label>
<td><input type="text" name="authname" size="32"></td> </div>
</tr> </div>
<tr> <div class="form-group">
<td><strong>Auth Password</strong></td> <label for="authlevel" class="col-sm-2 control-label">Auth Level</label>
<td><input type="text" name="authpass" size="32"></td> <div class="col-sm-3">
</tr> <select name="authlevel" id="authlevel" class="form-control input-sm">
<tr> <option value="noAuthNoPriv" selected>NoAuthNoPriv</option>
<td><strong>Auth Algorithm</strong></td> <option value="authNoPriv">AuthNoPriv</option>
<td> <option value="authPriv">AuthPriv</option>
<select name="authalgo"> </select>
<option value="MD5" selected>MD5</option> </div>
<option value="SHA">SHA</option> </div>
</select> <div class="form-group">
</td> <label for="authname" class="col-sm-2 control-label">Auth User Name</label>
</tr> <div class="col-sm-3">
<tr> <input type="text" name="authname" id="authname" class="form-control input-sm">
<td><strong>Crypto Password</strong></td> </div>
<td><input type="text" name="cryptopass" size="32"></td> <div class="col-sm-5">
</tr> </div>
<tr> </div>
<td><strong>Crypto Algorithm</strong></td> <div class="form-group">
<td> <label for="authpass" class="col-sm-2 control-label">Auth Password</label>
<select name="cryptoalgo"> <div class="col-sm-3">
<option value="AES" selected>AES</option> <input type="text" name="authpass" id="authpass" placeholder="AuthPass" class="form-control input-sm">
<option value="DES">DES</option> </div>
</select> </div>
</td> <div class="form-group">
</tr> <label for="authalgo" class="col-sm-2 control-label">Auth Algorithm</label>
<tr> <div class="col-sm-3">
<td></td><td><input type="submit" class="submit" name="Submit" value="Add Host"></td> <select name="authalgo" id="authalgo" class="form-control input-sm">
</tr> <option value="MD5" selected>MD5</option>
</table> <option value="SHA">SHA</option>
</select>
</div>
<div class="col-sm-5">
</div>
</div>
<div class="form-group">
<label for="cryptopass" class="col-sm-2 control-label">Crypto Password</label>
<div class="col-sm-3">
<input type="text" name="cryptopass" id="cryptopass" placeholder="Crypto Password" class="form-control input-sm">
</div>
<div class="col-sm-5">
</div>
</div>
<div class="form-group">
<label for="cryptoalgo" class="col-sm-2 control-label">Crypto Algorithm</label>
<div class="col-sm-3">
<select name="cryptoalgo" id="cryptoalgo" class="form-control input-sm">
<option value="AES" selected>AES</option>
<option value="DES">DES</option>
</select>
</div>
<div class="col-sm-5">
</div>
</div>
<button type="submit" class="btn btn-default input-sm" name="Submit">Add Host</button>
</div> </div>
</form> </form>

View File

@ -46,46 +46,55 @@ else
echo(" echo("
<h4>Add Service</h4> <h4>Add Service</h4>
<form id='addsrv' name='addsrv' method='post' action=''> <form id='addsrv' name='addsrv' method='post' action='' class='form-horizontal' role='form'>
<input type=hidden name='addsrv' value='yes'> <div class='well well-lg'>
<table width='200' border='0'> <div class='form-group'>
<tr> <input type='hidden' name='addsrv' value='yes'>
<td> <label for='device' class='col-sm-2 control-label'>Device</label>
Device <div class='col-sm-5'>
</td> <select name='device' class='form-control input-sm'>
<td>
<select name='device'>
$devicesform $devicesform
</select> </select>
</td> </div>
</tr> <div class='col-sm-5'>
<tr> </div>
<td> </div>
Type <div class='form-group'>
</td> <label for='type' class='col-sm-2 control-label'>Type</label>
<td> <div class='col-sm-5'>
<select name='type'> <select name='type' id='type' class='form-control input-sm'>
$servicesform $servicesform
</select> </select>
</td> </div>
</tr> <div class='col-sm-5'>
<tr> </div>
<td width='300'><div align='right'>Description</div></td> </div>
<td colspan='2'><textarea name='descr' cols='50'></textarea></td> <div class='form-group'>
</tr> <label for='descr' class='col-sm-2 control-label'>Description</label>
<tr> <div class='col-sm-5'>
<td width='300'><div align='right'>IP Address</div></td> <textarea name='descr' id='descr' class='form-control input-sm' rows='5'></textarea>
<td colspan='2'><input name='ip'></textarea></td> </div>
</tr> <div class='col-sm-5'>
<tr> </div>
<td width='300'><div align='right'>Parameters</div></td> </div>
<td colspan='2'><input name='params'></textarea></td> <div class='form-group'>
</tr> <label for='ip' class='col-sm-2 control-label'>IP Address</label>
<tr> <div class='col-sm-5'>
</table> <input name='ip' id='ip' class='form-control input-sm' placeholder='IP Address'>
<input type='submit' name='Submit' value='Add' /> </div>
<label><br /> <div class='col-sm-5'>
</label> </div>
</div>
<div class='form-group'>
<label for='params' class='col-sm-2 control-label'>Parameters</label>
<div class='col-sm-5'>
<input name='params' id='params' class='form-control input-sm'>
</div>
<div class='col-sm-5'>
</div>
</div>
<button type='submit' name='Submit' class='btn btn-default input-sm'>Add Service</button>
</div>
</form>"); </form>");
} }

View File

@ -1,7 +1,5 @@
<?php <?php
echo("<div style='margin: 10px;'>");
if ($_SESSION['userlevel'] < '10') if ($_SESSION['userlevel'] < '10')
{ {
include("includes/error-no-perm.inc.php"); include("includes/error-no-perm.inc.php");
@ -44,23 +42,65 @@ else
} }
} }
echo("<form method='post' action='adduser/'> <input type='hidden' value='add' name='action'>"); echo("<form method='post' action='adduser/' class='form-horizontal' role='form'> <input type='hidden' value='add' name='action'>");
echo("Username <input style='margin: 1px;' name='new_username'></input><br />"); echo("
<div class='form-group'>
<label for='new_username' class='col-sm-2 control-label'>Username</label>
<div class='col-sm-4'>
<input name='new_username' class='form-control input-sm'>
</div>
<div class='col-sm-6'>
</div>
</div>");
?> ?>
Password <input style='margin: 1px;' name='new_password' id='new_password' type=password /><br /> <div class='form-group'>
<label for='new_password' class='col-sm-2 control-label'>Password</label>
<div class='col-sm-4'>
<input name='new_password' id='new_password' type=password class='form-control input-sm'>
</div>
<div class='col-sm-6'>
</div>
</div>
<?php <?php
if ($_POST['action'] == "add" && !$_POST['new_password']) if ($_POST['action'] == "add" && !$_POST['new_password'])
{ {
echo("<span class=red>Please enter a password!</span><br />"); echo("<span class=red>Please enter a password!</span><br />");
} }
echo("Realname <input style='margin: 1px;' name='new_realname'></input><br />");
echo("Level <select style='margin: 5px;' name='new_level'> echo("
<option value='1'>Normal User</option> <div class='form-group'>");
<option value='5'>Global Read</option> echo("<label for='new_realname' class='col-sm-2 control-label'>Realname</label>
<option value='10'>Administrator</option> <div class='col-sm-4'>
</select><br />"); <input name='new_realname' class='form-control input-sm'>
echo("<input type='checkbox' checked='checked' style='margin: 1px;' name='can_modify_passwd'></input> Allow the user to change his password.<br /><br />"); </div>
echo(" <input type='submit' Value='Add' >"); <div class='col-sm-6'>
</div>
</div>");
echo("<div class='form-group'>
<label for='new_level' class='col-sm-2 control-label'>Level</label>
<div class='col-sm-4'>
<select name='new_level' class='form-control input-sm'>
<option value='1'>Normal User</option>
<option value='5'>Global Read</option>
<option value='10'>Administrator</option>
</select>
</div>
<div class='col-sm-6'>
</div>
</div>");
echo("<div class='form-group'>
<div class='col-sm-6'>
<div class='checkbox'>
<label>
<input type='checkbox' checked='checked' name='can_modify_passwd'> Allow the user to change his password.
</label>
</div>
</div>
<div class='col-sm-6'>
</div>
</div>");
echo("<button type='submit' class='btn btn-default'>Add</button>");
echo("</form>"); echo("</form>");
} }
else else
@ -69,6 +109,4 @@ else
} }
} }
echo("</div>"); ?>
?>

View File

@ -29,50 +29,78 @@ if ($bill_data['bill_type'] == "cdr") {
?> ?>
<form id="edit" name="edit" method="post" action="" class="form-horizontal"> <form id="edit" name="edit" method="post" action="" class="form-horizontal" role="form">
<input type=hidden name="action" value="update_bill"> <input type=hidden name="action" value="update_bill">
<link rel="stylesheet" href="<?php echo $config["base_url"]; ?>/css/bootstrap.min.css">
<script type="text/javascript"> <script type="text/javascript">
function billType() { function billType() {
$('#cdrDiv').toggle(); $('#cdrDiv').toggle();
$('#quotaDiv').toggle(); $('#quotaDiv').toggle();
} }
</script> </script>
<fieldset> <h3>Bill Properties</h3>
<legend>Bill Properties</legend> <div class="form-group">
<div class="control-group"> <label class="col-sm-2 control-label" for="bill_name"><strong>Description</strong></label>
<label class="control-label" for="bill_name"><strong>Description</strong></label> <div class="col-sm-4">
<div class="controls"> <input class="form-control input-sm" name="bill_name" value="<?php echo $bill_data["bill_name"]; ?>" />
<input class="span4" name="bill_name" value="<?php echo $bill_data["bill_name"]; ?>" /> </div>
<div class="col-sm-6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_type"><strong>Billing Type</strong></label>
<div class="col-sm-10">
<div class="radio">
<label>
<input type="radio" name="bill_type" value="cdr" onchange="javascript: billType();" <?php if ($bill_data['bill_type'] == "cdr") { echo('checked '); } ?>/> CDR 95th
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="bill_type" value="quota" onchange="javascript: billType();" <?php if ($bill_data['bill_type'] == "quota") { echo('checked '); } ?>/> Quota
</label>
</div> </div>
</div> </div>
<div class="control-group"> </div>
<label class="control-label" for="bill_type"><strong>Billing Type</strong></label> <div id="cdrDiv"<?php if ($bill_data['bill_type'] == "quota") { echo(' style="display: none"'); } ?>>
<div class="controls"> <div class="form-group">
<input type="radio" name="bill_type" value="cdr" onchange="javascript: billType();" <?php if ($bill_data['bill_type'] == "cdr") { echo('checked '); } ?>/> CDR 95th <div class="col-sm-2">
<input type="radio" name="bill_type" value="quota" onchange="javascript: billType();" <?php if ($bill_data['bill_type'] == "quota") { echo('checked '); } ?>/> Quota </div>
<div id="cdrDiv"<?php if ($bill_data['bill_type'] == "quota") { echo(' style="display: none"'); } ?>> <div class="col-sm-2">
<input class="span1" type="text" name="bill_cdr" value="<?php echo $cdr['data']; ?>"> <input class="form-control input-sm" type="text" name="bill_cdr" value="<?php echo $cdr['data']; ?>">
<select name="bill_cdr_type" style="width: 233px;"> </div>
<option value="Kbps"<?php echo $cdr['select_kbps']; ?>>Kilobits per second (Kbps)</option> <div class="col-sm-3">
<option value="Mbps"<?php echo $cdr['select_mbps']; ?>>Megabits per second (Mbps)</option> <select name="bill_cdr_type" class="form-control input-sm">
<option value="Gbps"<?php echo $cdr['select_gbps']; ?>>Gigabits per second (Gbps)</option> <option value="Kbps"<?php echo $cdr['select_kbps']; ?>>Kilobits per second (Kbps)</option>
</select> <option value="Mbps"<?php echo $cdr['select_mbps']; ?>>Megabits per second (Mbps)</option>
</div> <option value="Gbps"<?php echo $cdr['select_gbps']; ?>>Gigabits per second (Gbps)</option>
<div id="quotaDiv"<?php if ($bill_data['bill_type'] == "cdr") { echo(' style="display: none"'); } ?>> </select>
<input class="span1" type="text" name="bill_quota" value="<?php echo $quota['data']; ?>"> </div>
<select name="bill_quota_type" style="width: 233px;"> <div class="col-sm-5">
<option value="MB"<?php echo $quota['select_mb']; ?>>Megabytes (MB)</option>
<option value="GB"<?php echo $quota['select_gb']; ?>>Gigabytes (GB)</option>
<option value="TB"<?php echo $quota['select_tb']; ?>>Terabytes (TB)</option>
</select>
</div>
</div> </div>
</div> </div>
<div class="control-group"> </div>
<label class="control-label" for="bill_day"><strong>Billing Day</strong></label> <div id="quotaDiv"<?php if ($bill_data['bill_type'] == "cdr") { echo(' style="display: none"'); } ?>>
<div class="controls"> <div class="form-group">
<select name="bill_day" style="width: 60px;"> <div class="col-sm-2">
</div>
<div class="col-sm-2">
<input class="form-control input-sm" type="text" name="bill_quota" value="<?php echo $quota['data']; ?>">
</div>
<div class="col-sm-2">
<select name="bill_quota_type" class="form-control input-sm">
<option value="MB"<?php echo $quota['select_mb']; ?>>Megabytes (MB)</option>
<option value="GB"<?php echo $quota['select_gb']; ?>>Gigabytes (GB)</option>
<option value="TB"<?php echo $quota['select_tb']; ?>>Terabytes (TB)</option>
</select>
</div>
<div class="col-sm-6">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_day"><strong>Billing Day</strong></label>
<div class="col-sm-2">
<select name="bill_day" class="form-control input">
<?php <?php
for ($x=1;$x<32;$x++) { for ($x=1;$x<32;$x++) {
@ -81,40 +109,38 @@ for ($x=1;$x<32;$x++) {
} }
?> ?>
</select> </select>
</div>
</div> </div>
</fieldset>
<fieldset>
<legend>Optional Information</legend>
<div class="control-group">
<label class="control-label" for="bill_custid"><strong>Customer&nbsp;Reference</strong></label>
<div class="controls">
<input class="span4" type="text" name="bill_custid" value="<?php echo $bill_data['bill_custid']; ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="bill_ref"><strong>Billing Reference</strong></label>
<div class="controls">
<input class="span4" type="text" name="bill_ref" value="<?php echo $bill_data['bill_ref']; ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="bill_notes"><strong>Notes</strong></label>
<div class="controls">
<input class="span4" type="textarea" name="bill_notes" value="<?php echo $bill_data['bill_notes']; ?>" />
</div>
</div>
</fieldset>
<div class="form-actions">
<button type="submit" class="btn btn-success" name="Submit" value="Save" /><i class="icon-ok icon-white"></i> <strong>Save Properties</strong></button>
</div> </div>
<h3>Optional Information</h3>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_custid"><strong>Customer&nbsp;Reference</strong></label>
<div class="col-sm-4">
<input class="form-control input-sm" type="text" name="bill_custid" value="<?php echo $bill_data['bill_custid']; ?>" />
</div>
<div class="col-sm-6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_ref"><strong>Billing Reference</strong></label>
<div class="col-sm-4">
<input class="form-control input-sm" type="text" name="bill_ref" value="<?php echo $bill_data['bill_ref']; ?>" />
</div>
<div class="col-sm-6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_notes"><strong>Notes</strong></label>
<div class="col-sm-4">
<textarea rows="3" class="form-control input-sm" name="bill_notes" value="<?php echo $bill_data['bill_notes']; ?>"></textarea>
</div>
</div>
<button type="submit" class="btn btn-success" name="Submit" value="Save" /><i class="icon-ok icon-white"></i> <strong>Save Properties</strong></button>
</form> </form>
<form class="form-horizontal"> <form class="form-horizontal" role="form">
<fieldset> <h3>Billed Ports</h3>
<legend>Billed Ports</legend> <div class="form-group">
<div class="control-group">
<?php <?php
$ports = dbFetchRows("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D $ports = dbFetchRows("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D
@ -136,8 +162,8 @@ if (is_array($ports))
$portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn); $portbtn = str_replace("overlib('", "overlib('<div style=\'border: 5px solid #e5e5e5; background: #fff; padding: 10px;\'>", $portbtn);
$portbtn = str_replace("<div>',;", "</div></div>',", $portbtn); $portbtn = str_replace("<div>',;", "</div></div>',", $portbtn);
$portalias = (empty($port['ifAlias']) ? "" : " - ".$port['ifAlias'].""); $portalias = (empty($port['ifAlias']) ? "" : " - ".$port['ifAlias']."");
$devicebtn = str_replace("\">".$port['hostname'], "\" style=\"color: #000;\"><i class=\"icon-asterisk\"></i> ".$port['hostname'], $devicebtn); $devicebtn = str_replace("\">".$port['hostname'], "\" style=\"color: #000;\"><i class=\"glyphicon glyphicon-asterisk\"></i> ".$port['hostname'], $devicebtn);
$portbtn = str_replace("\">".strtolower($port['ifName']), "\" style=\"color: #000;\"><i class=\"icon-random\"></i> ".$port['ifName']."".$portalias, $portbtn); $portbtn = str_replace("\">".strtolower($port['ifName']), "\" style=\"color: #000;\"><i class=\"glyphicon glyphicon-random\"></i> ".$port['ifName']."".$portalias, $portbtn);
echo(" <form action=\"\" method=\"post\" name=\"delete".$port['port_id']."\" style=\"display: none;\">\n"); echo(" <form action=\"\" method=\"post\" name=\"delete".$port['port_id']."\" style=\"display: none;\">\n");
echo(" <input type=\"hidden\" name=\"action\" value=\"delete_bill_port\" />\n"); echo(" <input type=\"hidden\" name=\"action\" value=\"delete_bill_port\" />\n");
echo(" <input type=\"hidden\" name=\"port_id\" value=\"".$port['port_id']."\" />\n"); echo(" <input type=\"hidden\" name=\"port_id\" value=\"".$port['port_id']."\" />\n");
@ -164,16 +190,15 @@ if (is_array($ports))
</div> </div>
</fieldset> </fieldset>
</form> </form>
<form action="" method="post" class="form-horizontal"> <form action="" method="post" class="form-horizontal" role="form">
<input type="hidden" name="action" value="add_bill_port" /> <input type="hidden" name="action" value="add_bill_port" />
<input type="hidden" name="bill_id" value="<?php echo $bill_id; ?>" /> <input type="hidden" name="bill_id" value="<?php echo $bill_id; ?>" />
<fieldset> <h3>Add Port</h3>
<legend>Add Port</legend> <div class="form-group">
<div class="control-group"> <label class="col-sm-2 control-label" for="device"><strong>Device</strong></label>
<label class="control-label" for="device"><strong>Device</strong></label> <div class="col-sm-4">
<div class="controls"> <select class="form-control input-sm" id="device" name="device" onchange="getInterfaceList(this)">
<select style="width: 300px;" id="device" name="device" onchange="getInterfaceList(this)"> <option value=''>Select a device</option>
<option value=''>Select a device</option>
<?php <?php
$devices = dbFetchRows("SELECT * FROM `devices` ORDER BY hostname"); $devices = dbFetchRows("SELECT * FROM `devices` ORDER BY hostname");
@ -185,17 +210,18 @@ foreach ($devices as $device)
} }
?> ?>
</select> </select>
</div>
</div> </div>
<div class="control-group"> <div class="col-sm-6">
<label class="control-label" for="port_id"><strong>Interface</strong></label>
<div class="controls">
<select style="width: 300px;" id="port_id" name="port_id"></select>
</div>
</div> </div>
</fieldset>
<div class="form-actions">
<button type="submit" class="btn btn-primary" name="Submit" value=" Add " /><i class="icon-plus-sign icon-white"></i> <strong>Add Interface</strong></button>
</div> </div>
<div class="form-group">
<label class="col-sm-2 control-label" for="port_id"><strong>Interface</strong></label>
<div class="col-sm-4">
<select class="form-control input-sm" id="port_id" name="port_id"></select>
</div>
<div class="col-sm-6">
<div>
</div>
<button type="submit" class="btn btn-primary" name="Submit" value=" Add " /><i class="icon-plus-sign icon-white"></i> <strong>Add Interface</strong></button>
</form> </form>

View File

@ -59,7 +59,6 @@ elseif ($vars['view'] == "add")
?> ?>
<font face="Verdana, Arial, Sans-Serif"><h2>Bill : Add Bill</h2>
<?php <?php
print_optionbar_start(); print_optionbar_start();
@ -76,9 +75,10 @@ elseif ($vars['view'] == "add")
?> ?>
<form name="form1" method="post" action="bills/" class="form-horizontal"> <h3>Bill : Add Bill</h3>
<form name="form1" method="post" action="bills/" class="form-horizontal" role="form">
<input type=hidden name=addbill value=yes> <input type=hidden name=addbill value=yes>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script type="text/javascript"> <script type="text/javascript">
function billType() { function billType() {
$('#cdrDiv').toggle(); $('#cdrDiv').toggle();
@ -113,41 +113,60 @@ if(is_array($port))
} }
?> ?>
<fieldset>
<legend>Bill Properties</legend> <div class="form-group">
<div class="control-group"> <label for="bill_name" class="col-sm-2 control-label"><strong>Description</strong></label>
<label class="control-label" for="bill_name"><strong>Description</strong></label> <div class="col-sm-4">
<div class="controls"> <input class="form-control input-sm" type="text" id="bill_name" name="bill_name" value="<?php echo($port['port_descr_descr']); ?>">
<input class="span4" type="text" name="bill_name" value="<?php echo($port['port_descr_descr']); ?>"> </div>
</div> <div class="col-sm6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_type"><strong>Billing Type</strong></label>
<div class="col-sm-10">
<input type="radio" name="bill_type" value="cdr" checked onchange="javascript: billType();" /> CDR 95th
<input type="radio" name="bill_type" value="quota" onchange="javascript: billType();" /> Quota
</div>
</div>
<div class="form-group">
<div id="cdrDiv">
<div class="col-sm-2">
</div> </div>
<div class="control-group"> <div class="col-sm-3">
<label class="control-label" for="bill_type"><strong>Billing Type</strong></label> <input class="form-control input-sm" type="text" name="bill_cdr">
<div class="controls">
<input type="radio" name="bill_type" value="cdr" checked onchange="javascript: billType();" /> CDR 95th
<input type="radio" name="bill_type" value="quota" onchange="javascript: billType();" /> Quota
<div id="cdrDiv">
<input class="span1" type="text" name="bill_cdr">
<select name="bill_cdr_type" style="width: 233px;">
<option value="Kbps">Kilobits per second (Kbps)</option>
<option value="Mbps" selected>Megabits per second (Mbps)</option>
<option value="Gbps">Gigabits per second (Gbps)</option>
</select>
</div>
<div id="quotaDiv" style="display: none">
<input class="span1" type="text" name="bill_quota">
<select name="bill_quota_type" style="width: 233px;">
<option value="MB">Megabytes (MB)</option>
<option value="GB" selected>Gigabytes (GB)</option>
<option value="TB">Terabytes (TB)</option>
</select>
</div>
</div>
</div> </div>
<div class="control-group"> <div class="col-sm-3">
<label class="control-label" for="bill_day"><strong>Billing Day</strong></label> <select name="bill_cdr_type" class="form-control input-sm">
<div class="controls"> <option value="Kbps">Kilobits per second (Kbps)</option>
<select name="bill_day" style="width: 60px;"> <option value="Mbps" selected>Megabits per second (Mbps)</option>
<option value="Gbps">Gigabits per second (Gbps)</option>
</select>
</div>
<div class="col-sm-4">
</div>
</div>
<div id="quotaDiv" style="display: none">
<div class="col-sm-2">
</div>
<div class="col-sm-3">
<input class="form-control input-sm" type="text" name="bill_quota">
</div>
<div class="col-sm-3">
<select name="bill_quota_type" class="form-control input-sm">
<option value="MB">Megabytes (MB)</option>
<option value="GB" selected>Gigabytes (GB)</option>
<option value="TB">Terabytes (TB)</option>
</select>
</div>
<div class="col-sm-4">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_day"><strong>Billing Day</strong></label>
<div class="col-sm-1">
<select name="bill_day" class="form-control input-sm">
<?php <?php
for ($x=1;$x<32;$x++) { for ($x=1;$x<32;$x++) {
@ -155,35 +174,37 @@ for ($x=1;$x<32;$x++) {
} }
?> ?>
</select> </select>
</div>
</div>
</fieldset>
<fieldset>
<legend>Optional Information</legend>
<div class="control-group">
<label class="control-label" for="bill_custid"><strong>Customer&nbsp;Reference</strong></label>
<div class="controls">
<input class="span4" type="text" name="bill_custid">
</div>
</div>
<div class="control-group">
<label class="control-label" for="bill_ref"><strong>Billing Reference</strong></label>
<div class="controls">
<input class="span4" type="text" name="bill_ref" value="<?php echo($port['port_descr_circuit']); ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="bill_notes"><strong>Notes</strong></label>
<div class="controls">
<input class="span4" type="textarea" name="bill_notes" value="<?php echo($port['port_descr_speed']); ?>">
</div>
</div>
</fieldset>
<div class="form-actions">
<!-- <button class="btn btn-danger"><i class="icon-ban-circle icon-white"></i> Cancel</button> //-->
<button type="submit" class="btn btn-primary"><i class="icon-ok-sign icon-white"></i> <strong>Add Bill</strong></button>
</div> </div>
<div class="col-sm-9">
</div>
</div>
<h3>Optional Information</h3>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_custid"><strong>Customer Reference</strong></label>
<div class="col-sm-4">
<input class="form-control input-sm" type="text" name="bill_custid">
</div>
<div class="col-sm-6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_ref"><strong>Billing Reference</strong></label>
<div class="col-sm-4">
<input class="form-control input-sm" type="text" name="bill_ref" value="<?php echo($port['port_descr_circuit']); ?>">
</div>
<div class="col-sm-6">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="bill_notes"><strong>Notes</strong></label>
<div class="col-sm-4">
<input class="form-control input-sm" type="textarea" name="bill_notes" value="<?php echo($port['port_descr_speed']); ?>">
</div>
<div class="col-sm-6">
</div>
</div>
<button type="submit" class="btn btn-default"><i class="icon-ok-sign icon-white"></i> <strong>Add Bill</strong></button>
</form> </form>
<?php <?php
@ -193,17 +214,16 @@ for ($x=1;$x<32;$x++) {
include("pages/bills/search.inc.php"); include("pages/bills/search.inc.php");
$i=0; $i=0;
echo("<table border=0 cellspacing=0 cellpadding=5 class=devicetable width=100%> echo("<table border='0' cellspacing='0' cellpadding='5' class='table table-condensed'>
<tr style=\"font-weight: bold; \"> <tr>
<td width=\"7\"></td> <th>Billing name</th>
<td width=\"250\">Billing name</td> <th></th>
<td></td> <th>Type</th>
<td>Type</td> <th>Allowed</th>
<td>Allowed</td> <th>Used</th>
<td>Used</td> <th>Overusage</th>
<td style=\"text-align: center;\">Overusage</td> <th></th>
<td width=\"250\"></td> <th></th>
<td width=\"60\"></td>
</tr>"); </tr>");
foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill) foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill)
{ {
@ -245,7 +265,6 @@ for ($x=1;$x<32;$x++) {
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
echo(" echo("
<tr bgcolor='$row_colour'> <tr bgcolor='$row_colour'>
<td></td>
<td><a href='".generate_url(array('page' => "bill", 'bill_id' => $bill['bill_id']))."'><span style='font-weight: bold;' class=interface>".$bill['bill_name']."</span></a><br />".strftime("%F", strtotime($datefrom))." to ".strftime("%F", strtotime($dateto))."</td> <td><a href='".generate_url(array('page' => "bill", 'bill_id' => $bill['bill_id']))."'><span style='font-weight: bold;' class=interface>".$bill['bill_name']."</span></a><br />".strftime("%F", strtotime($datefrom))." to ".strftime("%F", strtotime($dateto))."</td>
<td>$notes</td> <td>$notes</td>
<td>$type</td> <td>$type</td>

View File

@ -3,18 +3,17 @@
$pagetitle[] = "Previous Billing Period"; $pagetitle[] = "Previous Billing Period";
$i=0; $i=0;
echo('<table border=0 cellspacing=0 cellpadding=5 class=devicetable width=100%> echo('<table class="table table-condensed">
<tr style="font-weight: bold;"> <tr>
<td width="7"></td> <th>Billing name</th>
<td width="250">Billing name</td> <th>Type</th>
<td>Type</td> <th>Allowed</th>
<td>Allowed</td> <th>Inbound</th>
<td>Inbound</td> <th>Outbound</th>
<td>Outbound</td> <th>Total</th>
<td>Total</td> <th>95 percentile</th>
<td>95 percentile</td> <th>Overusage</th>
<td style="text-align: center;">Overusage</td> <th></th>
<td width="250"></td>
</tr>'); </tr>');
foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill) foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill)
@ -56,7 +55,6 @@
echo(" echo("
<tr style=\"background: $row_colour;\"> <tr style=\"background: $row_colour;\">
<td></td>
<td><a href=\"".generate_url(array('page' => "bill", 'bill_id' => $bill['bill_id']))."/\"><span style=\"font-weight: bold;\" class=\"interface\">".$bill['bill_name']."</a></span><br />from ".strftime("%x", strtotime($datefrom))." to ".strftime("%x", strtotime($dateto))."</td> <td><a href=\"".generate_url(array('page' => "bill", 'bill_id' => $bill['bill_id']))."/\"><span style=\"font-weight: bold;\" class=\"interface\">".$bill['bill_name']."</a></span><br />from ".strftime("%x", strtotime($datefrom))." to ".strftime("%x", strtotime($dateto))."</td>
<td>$type</td> <td>$type</td>
<td>$allowed</td> <td>$allowed</td>

View File

@ -4,37 +4,35 @@
?> ?>
<table cellpadding=7 cellspacing=0 class=devicetable width=100%> <form method='post' action='' class="form-inline" role="form">
<form method='post' action=''> <div class="form-group">
<tr> Bills
<td width='40' align=center valign=middle><div style='font-weight: bold; font-size: 16px;'>Bills</div></td> </div>
<td width='240'><span style='font-weight: bold; font-size: 14px;'></span> <div class="form-group">
<input type="text" name="hostname" id="hostname" size=40 value="<?php echo($_POST['hostname']); ?>" /> <input type="text" name="hostname" id="hostname" class="form-control input-sm" value="<?php echo($_POST['hostname']); ?>" />
</td> </div>
<td width='100'> <div class="form-group">
<select name='os' id='os'> <select name='os' id='os' class="form-control input-sm">
<option value=''>All Types</option> <option value=''>All Types</option>
<option value=''>CDR</option> <option value=''>CDR</option>
<option value=''>95th</option> <option value=''>95th</option>
<option value=''>Quota</option> <option value=''>Quota</option>
</select> </select>
</td> </div>
<td width='100'> <div class="form-group">
<select name='hardware' id='hardware'> <select name='hardware' id='hardware' class="form-control input-sm">
<option value=''>All States</option> <option value=''>All States</option>
<option value=''>Under Quota</option> <option value=''>Under Quota</option>
<option value=''>Over Quota</option> <option value=''>Over Quota</option>
</select> </select>
</td> </div>
<td width='100'> <div class="form-group">
<select name='location' id='location'> <select name='location' id='location' class="form-control input-sm">
<option value=''>All Customers</option> <option value=''>All Customers</option>
</select> </select>
</td> </div>
<td> <button type="submit" class="btn btn-default input-sm">Search</button>
<input type=submit class=submit value=Search> <div class="form-group">
</td>
<td width='170' style='font-weight:bold; font-size: 12px;'>
<?php <?php
if ($vars['view'] == "history") if ($vars['view'] == "history")
@ -47,13 +45,11 @@
} }
?> ?>
</td> </div>
<td width='80' style='font-weight:bold; font-size: 12px;'> <div class="form-group">
<a href='bills/view=add/'><img src="images/16/add.png" align=absmiddle alt="Add"> Add Bill</a> <a href='bills/view=add/'><img src="images/16/add.png" align=absmiddle alt="Add"> Add Bill</a>
</td> </div>
</tr> </form>
</form>
</table>
<?php <?php

View File

@ -24,21 +24,21 @@ if ($_SESSION['userlevel'] < '5')
echo(" echo("
<h4>Delete Service</h4> <h4>Delete Service</h4>
<form id='addsrv' name='addsrv' method='post' action=''> <form id='addsrv' name='addsrv' method='post' action='' class='form-horizontal' role='form'>
<input type=hidden name='delsrv' value='yes'> <input type=hidden name='delsrv' value='yes'>
<table width='300' border='0'> <div class='well well-lg'>
<tr> <div class='form-group'>
<td> <label for='service' class='col-sm-2 control-label'>Device - Service</label>
Device <div class='col-sm-5'>
</td> <select name='service' id='service' class='form-control input-sm'>
<td>
<select name='service'>
$servicesform $servicesform
</select> </select>
</td> </div>
</tr> <div class='col-sm-5'>
</table> </div>
<input type='submit' name='Submit' value='Delete' /> </div>
<button type='submit' name='Submit' class='btn btn-default input-sm'>Delete</button>
</div>
</form>"); </form>");
} }

View File

@ -5,6 +5,17 @@
if(!isset($vars['format'])) { $vars['format'] = "list_detail"; } if(!isset($vars['format'])) { $vars['format'] = "list_detail"; }
$sql_param = array(); $sql_param = array();
if(isset($vars['state']))
{
if($vars['state'] == 'up')
{
$state = '1';
}
elseif($vars['state'] == 'down')
{
$state = '0';
}
}
if ($vars['hostname']) { $where .= " AND hostname LIKE ?"; $sql_param[] = "%".$vars['hostname']."%"; } if ($vars['hostname']) { $where .= " AND hostname LIKE ?"; $sql_param[] = "%".$vars['hostname']."%"; }
if ($vars['os']) { $where .= " AND os = ?"; $sql_param[] = $vars['os']; } if ($vars['os']) { $where .= " AND os = ?"; $sql_param[] = $vars['os']; }
@ -12,7 +23,12 @@ if ($vars['version']) { $where .= " AND version = ?"; $sql_param[] = $vars[
if ($vars['hardware']) { $where .= " AND hardware = ?"; $sql_param[] = $vars['hardware']; } if ($vars['hardware']) { $where .= " AND hardware = ?"; $sql_param[] = $vars['hardware']; }
if ($vars['features']) { $where .= " AND features = ?"; $sql_param[] = $vars['features']; } if ($vars['features']) { $where .= " AND features = ?"; $sql_param[] = $vars['features']; }
if ($vars['type']) { $where .= " AND type = ?"; $sql_param[] = $vars['type']; } if ($vars['type']) { $where .= " AND type = ?"; $sql_param[] = $vars['type']; }
if ($vars['state']) {
$where .= " AND status= ?"; $sql_param[] = $state;
$where .= " AND disabled='0' AND `ignore`='0'"; $sql_param[] = '';
}
if ($vars['disabled']) { $where .= " AND disabled= ?"; $sql_param[] = $vars['disabled']; }
if ($vars['ignore']) { $where .= " AND `ignore`= ?"; $sql_param[] = $vars['ignore']; }
if ($vars['location'] == "Unset") { $location_filter = ''; } if ($vars['location'] == "Unset") { $location_filter = ''; }
if ($vars['location']) { $location_filter = $vars['location']; } if ($vars['location']) { $location_filter = $vars['location']; }
@ -20,132 +36,6 @@ $pagetitle[] = "Devices";
print_optionbar_start(); print_optionbar_start();
if($vars['searchbar'] != "hide")
{
?>
<form method="post" action="">
<table cellpadding="4" cellspacing="0" class="devicetable" width="100%">
<tr>
<td width="290"><span style="font-weight: bold; font-size: 14px;"></span>
<input type="text" name="hostname" id="hostname" size="38" value="<?php echo($vars['hostname']); ?>" />
</td>
<td width="200">
<select name='os' id='os'>
<option value=''>All OSes</option>
<?php
foreach (dbFetch('SELECT `os` FROM `devices` AS D WHERE 1 GROUP BY `os` ORDER BY `os`') as $data)
{
if ($data['os'])
{
echo("<option value='".$data['os']."'");
if ($data['os'] == $vars['os']) { echo(" selected"); }
echo(">".$config['os'][$data['os']]['text']."</option>");
}
}
?>
</select>
<br />
<select name='version' id='version'>
<option value=''>All Versions</option>
<?php
foreach (dbFetch('SELECT `version` FROM `devices` AS D WHERE 1 GROUP BY `version` ORDER BY `version`') as $data)
{
if ($data['version'])
{
echo("<option value='".$data['version']."'");
if ($data['version'] == $vars['version']) { echo(" selected"); }
echo(">".$data['version']."</option>");
}
}
?>
</select>
</td>
<td width="200">
<select name="hardware" id="hardware">
<option value="">All Platforms</option>
<?php
foreach (dbFetch('SELECT `hardware` FROM `devices` AS D WHERE 1 GROUP BY `hardware` ORDER BY `hardware`') as $data)
{
if ($data['hardware'])
{
echo('<option value="'.$data['hardware'].'"');
if ($data['hardware'] == $vars['hardware']) { echo(" selected"); }
echo(">".$data['hardware']."</option>");
}
}
?>
</select>
<br />
<select name="features" id="features">
<option value="">All Featuresets</option>
<?php
foreach (dbFetch('SELECT `features` FROM `devices` AS D WHERE 1 GROUP BY `features` ORDER BY `features`') as $data)
{
if ($data['features'])
{
echo('<option value="'.$data['features'].'"');
if ($data['features'] == $vars['features']) { echo(" selected"); }
echo(">".$data['features']."</option>");
}
}
?>
</select>
</td>
<td>
<select name="location" id="location">
<option value="">All Locations</option>
<?php
// fix me function?
foreach (getlocations() as $location) // FIXME function name sucks maybe get_locations ?
{
if ($location)
{
echo('<option value="'.$location.'"');
if ($location == $vars['location']) { echo(" selected"); }
echo(">".$location."</option>");
}
}
?>
</select>
<br />
<select name="type" id="type">
<option value="">All Device Types</option>
<?php
foreach (dbFetch('SELECT `type` FROM `devices` AS D WHERE 1 GROUP BY `type` ORDER BY `type`') as $data)
{
if ($data['type'])
{
echo("<option value='".$data['type']."'");
if ($data['type'] == $vars['type']) { echo(" selected"); }
echo(">".ucfirst($data['type'])."</option>");
}
}
?>
</select>
</td>
<td align="center">
<a href="<?php echo(generate_url($vars)); ?>" title="Update the browser URL to reflect the search criteria." >Update URL</a> |
<a href="<?php echo(generate_url(array('page' => 'devices', 'section' => $vars['section'], 'bare' => $vars['bare']))); ?>" title="Reset critera to default." >Reset</a>
<br />
<input type="submit" class="submit" value="Search">
</td>
</tr>
</table>
</form>
<hr />
<?php
}
echo('<span style="font-weight: bold;">Lists</span> &#187; '); echo('<span style="font-weight: bold;">Lists</span> &#187; ');
$menu_options = array('basic' => 'Basic', $menu_options = array('basic' => 'Basic',
@ -219,13 +109,134 @@ foreach ($menu_options as $option => $text)
} else { } else {
echo('<a href="'. generate_url($vars, array('bare' => 'yes')).'">Remove Header</a>'); echo('<a href="'. generate_url($vars, array('bare' => 'yes')).'">Remove Header</a>');
} }
?> ?>
</div> </div>
<?php <?php
print_optionbar_end();
print_optionbar_start();
if($vars['searchbar'] != "hide")
{
?>
<form method="post" action="" class="form-inline" role="form">
<div class="form-group">
<input type="text" name="hostname" id="hostname" size="38" value="<?php echo($vars['hostname']); ?>" class="form-control input-sm" placeholder="Hostname"/>
</div>
<div class="form-group">
<select name='os' id='os' class="form-control input-sm">
<option value=''>All OSes</option>
<?php
foreach (dbFetch('SELECT `os` FROM `devices` AS D WHERE 1 GROUP BY `os` ORDER BY `os`') as $data)
{
if ($data['os'])
{
echo("<option value='".$data['os']."'");
if ($data['os'] == $vars['os']) { echo(" selected"); }
echo(">".$config['os'][$data['os']]['text']."</option>");
}
}
?>
</select>
<br />
<select name='version' id='version' class="form-control input-sm">
<option value=''>All Versions</option>
<?php
foreach (dbFetch('SELECT `version` FROM `devices` AS D WHERE 1 GROUP BY `version` ORDER BY `version`') as $data)
{
if ($data['version'])
{
echo("<option value='".$data['version']."'");
if ($data['version'] == $vars['version']) { echo(" selected"); }
echo(">".$data['version']."</option>");
}
}
?>
</select>
</div>
<div class="form-group">
<select name="hardware" id="hardware" class="form-control input-sm">
<option value="">All Platforms</option>
<?php
foreach (dbFetch('SELECT `hardware` FROM `devices` AS D WHERE 1 GROUP BY `hardware` ORDER BY `hardware`') as $data)
{
if ($data['hardware'])
{
echo('<option value="'.$data['hardware'].'"');
if ($data['hardware'] == $vars['hardware']) { echo(" selected"); }
echo(">".$data['hardware']."</option>");
}
}
?>
</select>
<br />
<select name="features" id="features" class="form-control input-sm">
<option value="">All Featuresets</option>
<?php
foreach (dbFetch('SELECT `features` FROM `devices` AS D WHERE 1 GROUP BY `features` ORDER BY `features`') as $data)
{
if ($data['features'])
{
echo('<option value="'.$data['features'].'"');
if ($data['features'] == $vars['features']) { echo(" selected"); }
echo(">".$data['features']."</option>");
}
}
?>
</select>
</div>
<div class="form-group">
<select name="location" id="location" class="form-control input-sm">
<option value="">All Locations</option>
<?php
// fix me function?
foreach (getlocations() as $location) // FIXME function name sucks maybe get_locations ?
{
if ($location)
{
echo('<option value="'.$location.'"');
if ($location == $vars['location']) { echo(" selected"); }
echo(">".$location."</option>");
}
}
?>
</select>
<br />
<select name="type" id="type" class="form-control input-sm">
<option value="">All Device Types</option>
<?php
foreach (dbFetch('SELECT `type` FROM `devices` AS D WHERE 1 GROUP BY `type` ORDER BY `type`') as $data)
{
if ($data['type'])
{
echo("<option value='".$data['type']."'");
if ($data['type'] == $vars['type']) { echo(" selected"); }
echo(">".ucfirst($data['type'])."</option>");
}
}
?>
</select>
</div>
<div class="form-group">
<a href="<?php echo(generate_url($vars)); ?>" title="Update the browser URL to reflect the search criteria." >Update URL</a> |
<a href="<?php echo(generate_url(array('page' => 'devices', 'section' => $vars['section'], 'bare' => $vars['bare']))); ?>" title="Reset critera to default." >Reset</a>
<br />
<button type="submit" class="btn btn-default input-sm">Search</button>
</div>
</form>
<?php
}
print_optionbar_end(); print_optionbar_end();
$query = "SELECT * FROM `devices` WHERE 1 ".$where." ORDER BY hostname"; $query = "SELECT * FROM `devices` WHERE 1 ".$where." ORDER BY hostname";
@ -262,7 +273,7 @@ if($format == "graph")
} else { } else {
echo('<table cellspacing="0" class="devicetable sortable" width="100%">'); echo('<table class="table table-condensed">');
if ($subformat == "detail" || $subformat == "basic") if ($subformat == "detail" || $subformat == "basic")
{ {
echo('<tr class="tablehead"> echo('<tr class="tablehead">

View File

@ -175,14 +175,22 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
echo("<h3>Select a user to edit</h3>"); echo("<h3>Select a user to edit</h3>");
echo("<form method='post' action=''> echo("<form method='post' action='' class='form-horizontal' role='form'>
<input type='hidden' value='edituser' name='page'> <input type='hidden' value='edituser' name='page'>
<select name='user_id'>"); <div class='col-sm-3'>
<select name='user_id' class='form-control input-sm'>");
foreach ($user_list as $user_entry) foreach ($user_list as $user_entry)
{ {
echo("<option value='" . $user_entry['user_id'] . "'>" . $user_entry['username'] . "</option>"); echo("<option value='" . $user_entry['user_id'] . "'>" . $user_entry['username'] . "</option>");
} }
echo("</select><input type='submit' name='Submit' value='Select'></form>"); echo("</select>
</div>
<div class='col-sm-3'>
<button type='submit' name='Submit' class='btn btn-default'>Select</button>
</div>
<div class='col-sm-6'>
</div>
</form>");
} }
} }

View File

@ -38,29 +38,29 @@ if ($_POST['string'])
?> ?>
<form method="post" action=""> <form method="post" action="" class="form-inline" role="form">
<span style="font-weight: bold;">Event log</span> &#187; <div class="form-group">
<label><strong>Search</strong> <input type="text" name="string" id="string" value="<?php echo($_POST['string']); ?>" placeholder="Search" class="form-control input-sm" />
<input type="text" name="string" id="string" value="<?php echo($_POST['string']); ?>" /> </div>
</label> <div class="form-group">
<label> <label>
<label> <strong>Device</strong>
<strong>Device</strong> </label>
<select name="device" id="device"> <select name="device" id="device" class="form-control input-sm">
<option value="">All Devices</option> <option value="">All Devices</option>
<?php <?php
foreach (get_all_devices() as $hostname) foreach (get_all_devices() as $hostname)
{ {
echo("<option value='".getidbyname($hostname)."'"); echo("<option value='".getidbyname($hostname)."'");
if (getidbyname($hostname) == $_POST['device']) { echo("selected"); } if (getidbyname($hostname) == $_POST['device']) { echo("selected"); }
echo(">".$hostname."</option>"); echo(">".$hostname."</option>");
} }
?> ?>
</select> </select>
</label> </div>
<input type=submit class=submit value=Search> <button type="submit" class="btn btn-default input-sm">Search</button>
</form> </form>
<?php <?php
@ -75,7 +75,7 @@ if ($_SESSION['userlevel'] >= '5')
$param[] = $_SESSION['user_id']; $param[] = $_SESSION['user_id'];
} }
echo('<table cellspacing="0" cellpadding="1" width="100%">'); echo('<table class="table table-condensed">');
foreach (dbFetchRows($query, $param) as $entry) foreach (dbFetchRows($query, $param) as $entry)
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
include_once("includes/front/boxes.inc.php"); include("includes/topnav.inc.php");
function generate_front_box ($frontbox_class, $content) function generate_front_box ($frontbox_class, $content)
{ {
@ -9,9 +9,14 @@ echo("<div class=\"front-box $frontbox_class\">
</div>"); </div>");
} }
echo('
<div class="row">
<div class="col-md-8">
');
echo('<div class=front-page>'); echo('<div class=front-page>');
echo('<div class="status-boxes left-2-col-fluid">'); echo('<div class="status-boxes">');
$count_boxes = 0; $count_boxes = 0;
@ -113,6 +118,20 @@ if ($count_boxes == 0) {
want to start by adding one or more devices in the Devices menu.</p>"); want to start by adding one or more devices in the Devices menu.</p>");
} }
echo('</div>'); echo('</div>');
echo('</div>');
echo('</div>');
echo('
<div class="col-md-4">
');
include_once("includes/front/boxes.inc.php");
echo('
</div>
</div>
<div class="row">
<div class="col-md-12">
');
if ($config['enable_syslog']) if ($config['enable_syslog'])
{ {
@ -122,7 +141,7 @@ if ($config['enable_syslog'])
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20"; $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20";
$query = mysql_query($sql); $query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>"); echo('<table class="table table-bordered">');
while ($entry = mysql_fetch_assoc($query)) while ($entry = mysql_fetch_assoc($query))
{ {
$entry = array_merge($entry, device_by_id_cache($entry['device_id'])); $entry = array_merge($entry, device_by_id_cache($entry['device_id']));
@ -147,7 +166,7 @@ if ($config['enable_syslog'])
$data = mysql_query($query); $data = mysql_query($query);
echo('<table cellspacing="0" cellpadding="1" width="100%">'); echo('<table class="table table-bordered">');
while ($entry = mysql_fetch_assoc($data)) { while ($entry = mysql_fetch_assoc($data)) {
include("includes/print-event.inc.php"); include("includes/print-event.inc.php");
@ -159,4 +178,9 @@ if ($config['enable_syslog'])
echo("</div>"); echo("</div>");
echo('
</div>
</div>
');
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
$datas = array('processor','mempool','storage'); $datas = array('mempool','processor','storage');
if ($used_sensors['temperature']) $datas[] = 'temperature'; if ($used_sensors['temperature']) $datas[] = 'temperature';
if ($used_sensors['humidity']) $datas[] = 'humidity'; if ($used_sensors['humidity']) $datas[] = 'humidity';
if ($used_sensors['fanspeed']) $datas[] = 'fanspeed'; if ($used_sensors['fanspeed']) $datas[] = 'fanspeed';

View File

@ -3,14 +3,14 @@
$graph_type = "mempool_usage"; $graph_type = "mempool_usage";
echo("<div style='margin-top: 5px; padding: 0px;'>"); echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>"); echo("<table class='table table-condensed'>");
echo("<tr class=tablehead> echo("<tr class=tablehead>
<th width=280>Device</th> <th>Device</th>
<th>Memory</th> <th>Memory</th>
<th width=100></th> <th></th>
<th width=280>Usage</th> <th>Usage</th>
<th width=50>Used</th> <th>Used</th>
</tr>"); </tr>");
foreach (dbFetchRows("SELECT * FROM `mempools` AS M, `devices` as D WHERE D.device_id = M.device_id ORDER BY D.hostname") as $mempool) foreach (dbFetchRows("SELECT * FROM `mempools` AS M, `devices` as D WHERE D.device_id = M.device_id ORDER BY D.hostname") as $mempool)

View File

@ -3,13 +3,13 @@
$graph_type = "processor_usage"; $graph_type = "processor_usage";
echo("<div style='margin-top: 5px; padding: 0px;'>"); echo("<div style='margin-top: 5px; padding: 0px;'>");
echo(" <table width=100% cellpadding=6 cellspacing=0>"); echo(" <table class='table table-condensed'>");
echo("<tr class=tablehead> echo("<tr>
<th width=280>Device</th> <th>Device</th>
<th>Processor</th> <th>Processor</th>
<th width=100></th> <th></th>
<th width=280>Usage</th> <th>Usage</th>
</tr>"); </tr>");
foreach (dbFetchRows("SELECT * FROM `processors` AS P, `devices` AS D WHERE D.device_id = P.device_id ORDER BY D.hostname") as $proc) foreach (dbFetchRows("SELECT * FROM `processors` AS P, `devices` AS D WHERE D.device_id = P.device_id ORDER BY D.hostname") as $proc)

View File

@ -3,14 +3,14 @@
$graph_type = "storage_usage"; $graph_type = "storage_usage";
echo("<div style='padding: 5px;'> echo("<div style='padding: 5px;'>
<table width=100% cellspacing=0 cellpadding=6 class='sortable'>"); <table class='table table-condensed'>");
echo("<tr class=tablehead> echo("<tr>
<th width=280>Device</th> <th>Device</th>
<th>Storage</th> <th>Storage</th>
<th width=100></th> <th></th>
<th width=280>Usage</th> <th>Usage</th>
<th width=50>Used</th> <th>Used</th>
</tr>"); </tr>");
foreach (dbFetchRows("SELECT * FROM `storage` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY D.hostname, S.storage_descr") as $drive) foreach (dbFetchRows("SELECT * FROM `storage` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY D.hostname, S.storage_descr") as $drive)

View File

@ -1,13 +1,13 @@
<?php print_optionbar_start('25'); ?> <?php print_optionbar_start('25'); ?>
<form method="post" action=""> <form method="post" action="" class="form-inline" role="form">
<label><strong>Descr</strong> <div class="form-group">
<input type="text" name="string" id="string" value="<?php echo($_POST['string']); ?>" /> <input type="text" name="string" id="string" value="<?php echo($_POST['string']); ?>" placeholder="Description" class="form-control input-sm" />
</label> </div>
<label> <div class="form-group">
<strong>Part No</strong> <strong>Part No</strong>
<select name="part" id="part"> <select name="part" id="part" class="form-control input-sm">
<option value="">All Parts</option> <option value="">All Parts</option>
<?php <?php
foreach (dbFetchRows("SELECT `entPhysicalModelName` FROM `entPhysical` GROUP BY `entPhysicalModelName` ORDER BY `entPhysicalModelName`") as $data) foreach (dbFetchRows("SELECT `entPhysicalModelName` FROM `entPhysical` GROUP BY `entPhysicalModelName` ORDER BY `entPhysicalModelName`") as $data)
@ -18,13 +18,13 @@
} }
?> ?>
</select> </select>
</label> </div>
<label><strong>Serial</strong> <div class="form-group">
<input type="text" name="serial" id="serial" value="<?php echo($_POST['serial']); ?>" /> <input type="text" name="serial" id="serial" value="<?php echo($_POST['serial']); ?>" placeholder="Serial" class="form-control input-sm"/>
</label> </div>
<label> <div class="form-group">
<strong>Device</strong> <strong>Device</strong>
<select name="device" id="device"> <select name="device" id="device" class="form-control input-sm">
<option value="">All Devices</option> <option value="">All Devices</option>
<?php <?php
foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $data) foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $data)
@ -37,10 +37,12 @@
} }
?> ?>
</select> </select>
</label> </div>
<input type="text" size=24 name="device_string" id="device_string" value="<?php if ($_POST['device_string']) { echo($_POST['device_string']); } ?>" /> <div class="form-group">
<input style type=submit class=submit value=Search> <input type="text" size=24 name="device_string" id="device_string" value="<?php if ($_POST['device_string']) { echo($_POST['device_string']); } ?>" placeholder="Description" class="form-control input-sm"/>
</div>
<button type="submit" class="btn btn-default input-sm">Search</button>
</form>
<?php <?php
$pagetitle[] = "Inventory"; $pagetitle[] = "Inventory";
@ -87,7 +89,7 @@ if (isset($_POST['device']) && is_numeric($_POST['device']))
$param[] = $_POST['device']; $param[] = $_POST['device'];
} }
echo("<table cellspacing=0 cellpadding=2 width=100%>"); echo('<table class="table table-condensed">');
echo("<tr><th>Hostname</th><th>Description</th><th>Name</th><th>Part No</th><th>Serial No</th></tr>"); echo("<tr><th>Hostname</th><th>Description</th><th>Name</th><th>Part No</th><th>Serial No</th></tr>");
foreach (dbFetchRows($sql, $param) as $entry) foreach (dbFetchRows($sql, $param) as $entry)
@ -98,4 +100,3 @@ foreach (dbFetchRows($sql, $param) as $entry)
echo("</table>"); echo("</table>");
?> ?>
</table>

View File

@ -8,160 +8,6 @@ if(!isset($vars['format'])) { $vars['format'] = "list_basic"; }
print_optionbar_start(); print_optionbar_start();
if($vars['searchbar'] != "hide")
{
?>
<table style="text-align: left;" cellpadding=0 cellspacing=5 class=devicetable width=100%>
<tr style='padding: 0px;'>
<form method='post' action=''>
<td width='200'>
<select name='device_id' id='device_id' style='width: 180px;'>
<option value=''>All Devices</option>
<?php
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data)
{
echo(' <option value="'.$data['device_id'].'"');
if ($data['device_id'] == $vars['device_id']) { echo("selected"); }
echo(">".$data['hostname']."</option>");
}
?>
</select>
<br />
<input type="hostname" name="hostname" id="hostname" title="Hostname" style='width: 180px;' <?php if (strlen($vars['hostname'])) {echo('value="'.$vars['hostname'].'"');} ?> />
</td>
<td width="120">
<select name="state" id="state" style="width: 100px;">
<option value="">All States</option>
<option value="up" <?php if ($vars['state'] == "up") { echo("selected"); } ?>>Up</option>
<option value="down"<?php if ($vars['state'] == "down") { echo("selected"); } ?>>Down</option>
<option value="admindown" <?php if ($vars['state'] == "admindown") { echo("selected"); } ?>>Shutdown</option>
</select>
<br />
<select name="ifSpeed" id="ifSpeed" style="width: 100px;">
<option value="">All Speeds</option>
<?php
foreach (dbFetchRows("SELECT `ifSpeed` FROM `ports` GROUP BY `ifSpeed` ORDER BY `ifSpeed`") as $data)
{
if ($data['ifSpeed'])
{
echo("<option value='".$data['ifSpeed']."'");
if ($data['ifSpeed'] == $vars['ifSpeed']) { echo("selected"); }
echo(">".humanspeed($data['ifSpeed'])."</option>");
}
}
?>
</select>
</td>
<td width=170>
<select name="ifType" id="ifType" style="width: 150px;">
<option value="">All Media</option>
<?php
foreach (dbFetchRows("SELECT `ifType` FROM `ports` GROUP BY `ifType` ORDER BY `ifType`") as $data)
{
if ($data['ifType'])
{
echo(' <option value="'.$data['ifType'].'"');
if ($data['ifType'] == $vars['ifType']) { echo("selected"); }
echo(">".$data['ifType']."</option>");
}
}
?>
</select>
<br />
<select name="port_descr_type" id="port_descr_type" style="width: 150px;">
<option value="">All Port Types</option>
<?php
$ports = dbFetchRows("SELECT `port_descr_type` FROM `ports` GROUP BY `port_descr_type` ORDER BY `port_descr_type`");
$total = count($ports);
echo("Total: $total");
foreach ($ports as $data)
{
if ($data['port_descr_type'])
{
echo(' <option value="'.$data['port_descr_type'].'"');
if ($data['port_descr_type'] == $vars['port_descr_type']) { echo("selected"); }
echo(">".ucfirst($data['port_descr_type'])."</option>");
}
}
?>
</select>
</td>
<td>
</td>
<td width="220">
<input style="width: 200px;" title="Port Description" type="text" name="ifAlias" id="ifAlias" <?php if (strlen($vars['ifAlias'])) {echo('value="'.$vars['ifAlias'].'"');} ?> />
<select style="width: 200px;" name="location" id="location">
<option value="">All Locations</option>
<?php
// fix me function?
foreach (getlocations() as $location) // FIXME function name sucks maybe get_locations ?
{
if ($location)
{
echo('<option value="'.$location.'"');
if ($location == $vars['location']) { echo(" selected"); }
echo(">".$location."</option>");
}
}
?>
</select>
</td>
<td width=80>
<label for="ignore">
<input type=checkbox id="ignore" name="ignore" value=1 <?php if ($vars['ignore']) { echo("checked"); } ?> ></input> Ignored
</label>
<br />
<label for="disable">
<input type=checkbox id="disable" name="disable" value=1 <?php if ($vars['disable']) { echo("checked"); } ?> > Disabled</input>
</label>
<br />
<label for="deleted">
<input type=checkbox id="deleted" name="deleted" value=1 <?php if ($vars['deleted']) { echo("checked"); } ?> > Deleted</input>
</label>
</td>
<td width=120>
<select name="sort" id="sort" style="width: 110px;">
<?php
$sorts = array('device' => 'Device',
'port' => 'Port',
'speed' => 'Speed',
'traffic' => 'Traffic',
'traffic_in' => 'Traffic In',
'traffic_out' => 'Traffic Out',
'packets' => 'Packets',
'packets_in' => 'Packets In',
'packets_out' => 'Packets Out',
'errors' => 'Errors',
'media' => 'Media',
'descr' => 'Description');
foreach ($sorts as $sort => $sort_text)
{
echo('<option value="'.$sort.'" ');
if ($vars['sort'] == $sort) { echo("selected"); }
echo('>'.$sort_text.'</option>');
}
?>
</select>
</td>
<td style="text-align: center;" width=50>
<input style="align:right; padding: 10px;" type=submit class=submit value=Search></div>
<br />
<a href="<?php echo(generate_url(array('page' => 'ports', 'section' => $vars['section'], 'bare' => $vars['bare']))); ?>" title="Reset critera to default." >Reset</a>
</td>
</form>
</tr>
</table>
<hr />
<?php }
echo('<span style="font-weight: bold;">Lists</span> &#187; '); echo('<span style="font-weight: bold;">Lists</span> &#187; ');
$menu_options = array('basic' => 'Basic', $menu_options = array('basic' => 'Basic',
@ -235,6 +81,154 @@ echo('<div style="float: right;">');
echo('</div>'); echo('</div>');
print_optionbar_end();
print_optionbar_start();
if($vars['searchbar'] != "hide")
{
?>
<form method='post' action='' class='form-inline' role='form'>
<div class="form-group">
<select name='device_id' id='device_id' class='form-control input-sm'>
<option value=''>All Devices</option>
<?php
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data)
{
echo(' <option value="'.$data['device_id'].'"');
if ($data['device_id'] == $vars['device_id']) { echo("selected"); }
echo(">".$data['hostname']."</option>");
}
?>
</select>
<br />
<input type="hostname" name="hostname" id="hostname" title="Hostname" class="form-control input-sm" <?php if (strlen($vars['hostname'])) {echo('value="'.$vars['hostname'].'"');} ?> />
</div>
<div class="form-group">
<select name="state" id="state" class="form-control input-sm">
<option value="">All States</option>
<option value="up" <?php if ($vars['state'] == "up") { echo("selected"); } ?>>Up</option>
<option value="down"<?php if ($vars['state'] == "down") { echo("selected"); } ?>>Down</option>
<option value="admindown" <?php if ($vars['state'] == "admindown") { echo("selected"); } ?>>Shutdown</option>
</select>
<br />
<select name="ifSpeed" id="ifSpeed" class="form-control input-sm">
<option value="">All Speeds</option>
<?php
foreach (dbFetchRows("SELECT `ifSpeed` FROM `ports` GROUP BY `ifSpeed` ORDER BY `ifSpeed`") as $data)
{
if ($data['ifSpeed'])
{
echo("<option value='".$data['ifSpeed']."'");
if ($data['ifSpeed'] == $vars['ifSpeed']) { echo("selected"); }
echo(">".humanspeed($data['ifSpeed'])."</option>");
}
}
?>
</select>
</div>
<div class="form-group">
<select name="ifType" id="ifType" class="form-control input-sm">
<option value="">All Media</option>
<?php
foreach (dbFetchRows("SELECT `ifType` FROM `ports` GROUP BY `ifType` ORDER BY `ifType`") as $data)
{
if ($data['ifType'])
{
echo(' <option value="'.$data['ifType'].'"');
if ($data['ifType'] == $vars['ifType']) { echo("selected"); }
echo(">".$data['ifType']."</option>");
}
}
?>
</select>
<br />
<select name="port_descr_type" id="port_descr_type" class="form-control input-sm">
<option value="">All Port Types</option>
<?php
$ports = dbFetchRows("SELECT `port_descr_type` FROM `ports` GROUP BY `port_descr_type` ORDER BY `port_descr_type`");
$total = count($ports);
echo("Total: $total");
foreach ($ports as $data)
{
if ($data['port_descr_type'])
{
echo(' <option value="'.$data['port_descr_type'].'"');
if ($data['port_descr_type'] == $vars['port_descr_type']) { echo("selected"); }
echo(">".ucfirst($data['port_descr_type'])."</option>");
}
}
?>
</select>
</div>
<div class="form-group">
<input title="Port Description" type="text" name="ifAlias" id="ifAlias" class="form-control input-sm" <?php if (strlen($vars['ifAlias'])) {echo('value="'.$vars['ifAlias'].'"');} ?> />
<select name="location" id="location" class="form-control input-sm">
<option value="">All Locations</option>
<?php
// fix me function?
foreach (getlocations() as $location) // FIXME function name sucks maybe get_locations ?
{
if ($location)
{
echo('<option value="'.$location.'"');
if ($location == $vars['location']) { echo(" selected"); }
echo(">".$location."</option>");
}
}
?>
</select>
</div>
<div class="form-group">
<label for="ignore">Ignored</label>
<input type=checkbox id="ignore" name="ignore" value="1" class="" <?php if ($vars['ignore']) { echo("checked"); } ?> ></input>
<br />
<label for="disable">Disabled</label>
<input type=checkbox id="disable" name="disable" value=1 class="" <?php if ($vars['disable']) { echo("checked"); } ?> ></input>
</label>
<br />
<label for="deleted">Deleted</label>
<input type=checkbox id="deleted" name="deleted" value=1 class="" <?php if ($vars['deleted']) { echo("checked"); } ?> ></input>
</label>
</div>
<div class="form-group">
<select name="sort" id="sort" class="form-control input-sm">
<?php
$sorts = array('device' => 'Device',
'port' => 'Port',
'speed' => 'Speed',
'traffic' => 'Traffic',
'traffic_in' => 'Traffic In',
'traffic_out' => 'Traffic Out',
'packets' => 'Packets',
'packets_in' => 'Packets In',
'packets_out' => 'Packets Out',
'errors' => 'Errors',
'media' => 'Media',
'descr' => 'Description');
foreach ($sorts as $sort => $sort_text)
{
echo('<option value="'.$sort.'" ');
if ($vars['sort'] == $sort) { echo("selected"); }
echo('>'.$sort_text.'</option>');
}
?>
</select>
</div>
<button type="submit" class="btn btn-default input-sm">Search</button>
<a href="<?php echo(generate_url(array('page' => 'ports', 'section' => $vars['section'], 'bare' => $vars['bare']))); ?>" title="Reset critera to default." >Reset</a>
</td>
</form>
</tr>
</table>
<?php }
print_optionbar_end(); print_optionbar_end();
$param = array(); $param = array();
@ -256,6 +250,11 @@ foreach ($vars as $var => $value)
case 'device_id': case 'device_id':
case 'deleted': case 'deleted':
case 'ignore': case 'ignore':
if ($value == 1)
{
$where .= " AND (I.ignore = 1 OR D.ignore = 1) AND I.deleted = 0";
}
break;
case 'disable': case 'disable':
case 'ifSpeed': case 'ifSpeed':
if (is_numeric($value)) if (is_numeric($value))
@ -286,11 +285,11 @@ foreach ($vars as $var => $value)
$param[] = "up"; $param[] = "up";
$param[] = "down"; $param[] = "down";
} elseif($value == "up") { } elseif($value == "up") {
$where .= "AND I.ifAdminStatus = ? AND I.ifOperStatus = ?"; $where .= "AND I.ifAdminStatus = ? AND I.ifOperStatus = ? AND I.ignore = '0' AND D.ignore='0' AND I.deleted='0'";
$param[] = "up"; $param[] = "up";
$param[] = "up"; $param[] = "up";
} elseif($value == "admindown") { } elseif($value == "admindown") {
$where .= "AND I.ifAdminStatus = ?"; $where .= "AND I.ifAdminStatus = ? AND D.ignore = 0";
$param[] = "down"; $param[] = "down";
} }
break; break;

View File

@ -2,7 +2,6 @@
$pagetitle[] = "Preferences"; $pagetitle[] = "Preferences";
echo("<div style='margin: 10px'>");
echo("<h3>User Preferences</h3>"); echo("<h3>User Preferences</h3>");
if ($_POST['action'] == "changepass") if ($_POST['action'] == "changepass")
@ -29,22 +28,40 @@ if ($_POST['action'] == "changepass")
include("includes/update-preferences-password.inc.php"); include("includes/update-preferences-password.inc.php");
echo("<div style='width: 800px; background-color: #fff; padding:5px; margin-bottom:10px; float:left;'>"); echo("<div class='well'>");
echo("</div>");
echo("<div style='width: 300px; float: right;'>");
echo("<div style='background-color: #e5e5e5; border: solid #e5e5e5 10px; margin-bottom:10px;'>");
if (passwordscanchange($_SESSION['username'])) if (passwordscanchange($_SESSION['username']))
{ {
echo("<div style='font-size: 18px; font-weight: bold; margin-bottom: 5px;'>Change Password</div>"); echo("<h3>Change Password</h3>");
echo($changepass_message); echo($changepass_message);
echo("<form method='post' action='preferences/'><input type=hidden name='action' value='changepass'> echo("<form method='post' action='preferences/' class='form-horizontal' role='form'>
<table> <input type=hidden name='action' value='changepass'>
<tr><td>Old Password</td><td><input type=password name=old_pass autocomplete='off'></input></td></tr> <div class='form-group'>
<tr><td>New Password</td><td><input type=password name=new_pass autocomplete='off'></input></td></tr> <label for='old_pass' class='col-sm-2 control-label'>Old Password</label>
<tr><td>New Password</td><td><input type=password name=new_pass2 autocomplete='off'></input></td></tr> <div class='col-sm-4'>
<tr><td></td><td align=right><input type=submit class=submit></td></tr></table></form>"); <input type=password name=old_pass autocomplete='off' class='form-control input-sm'>
</div>
<div class='col-sm-6'>
</div>
</div>
<div class='form-group'>
<label for='new_pass' class='col-sm-2 control-label'>New Password</label>
<div class='col-sm-4'>
<input type=password name=new_pass autocomplete='off' class='form-control input-sm'>
</div>
<div class='col-sm-6'>
</div>
</div>
<div class='form-group'>
<label for='new_pass2' class='col-sm-2'>New Password</label>
<div class='col-sm-4'>
<input type=password name=new_pass2 autocomplete='off' class='form-control input-sm'>
</div>
<div class='col-sm-6'>
</div>
</div>
<button type='submit' class='btn btn-default'>Submit</button>
</form>");
echo("</div>"); echo("</div>");
} }
@ -66,8 +83,6 @@ if ($_SESSION['userlevel'] == '1')
if (!$dev_access) { echo("No access!"); } if (!$dev_access) { echo("No access!"); }
} }
echo("</div>");
echo("</div>");
echo("</div>"); echo("</div>");
?> ?>

View File

@ -1,11 +1,9 @@
<?php print_optionbar_start(28); ?> <?php print_optionbar_start(28); ?>
<table cellpadding="0" cellspacing="0" class="devicetable" width="100%"> <form method="post" action="" class="form-inline" role="form">
<tr> <div class="form-group">
<form method="post" action=""> <select name="device_id" id="device_id" class="form-control input-sm">
<td width="200" style="padding: 1px;"> <option value="">All Devices</option>
<select name="device_id" id="device_id">
<option value="">All Devices</option>
<?php <?php
// Select the devices only with ARP tables // Select the devices only with ARP tables
@ -17,28 +15,24 @@ foreach (dbFetchRows("SELECT D.device_id AS device_id, `hostname` FROM `ipv4_mac
} }
?> ?>
</select> </select>
</td> </div>
<td width="200" style="padding: 1px;">Search by <div class="form-group">
<select name="searchby" id="searchby"> <select name="searchby" id="searchby" class="form-control input-sm">
<option value="mac" <?php if ($_POST['searchby'] != "ip") { echo("selected"); } ?> >MAC Address</option> <option value="mac" <?php if ($_POST['searchby'] != "ip") { echo("selected"); } ?> >MAC Address</option>
<option value="ip" <?php if ($_POST['searchby'] == "ip") { echo("selected"); } ?> >IP Address</option> <option value="ip" <?php if ($_POST['searchby'] == "ip") { echo("selected"); } ?> >IP Address</option>
</select> </select>
</td> </div>
<td> <div class="form-group">
</td> <input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" class="form-control input-sm" placeholder="Address" />
<td width=400> </div>
<input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" /> <button type="submit" class="btn btn-default input-sm">Search</button>
<input style="align:right;" type=submit class=submit value=Search></div>
</td>
</form> </form>
</tr>
</table>
<?php <?php
print_optionbar_end(); print_optionbar_end();
echo('<table width="100%" cellspacing="0" cellpadding="5">'); echo('<table class="table table-condensed">');
$query = "SELECT * FROM `ipv4_mac` AS M, `ports` AS P, `devices` AS D WHERE M.port_id = P.port_id AND P.device_id = D.device_id "; $query = "SELECT * FROM `ipv4_mac` AS M, `ports` AS P, `devices` AS D WHERE M.port_id = P.port_id AND P.device_id = D.device_id ";
if (isset($_POST['searchby']) && $_POST['searchby'] == "ip") if (isset($_POST['searchby']) && $_POST['searchby'] == "ip")

View File

@ -1,11 +1,9 @@
<?php print_optionbar_start(28); ?> <?php print_optionbar_start(28); ?>
<table cellpadding="0" cellspacing="0" class="devicetable" width="100%"> <form method="post" action="" class="form-inline" role="form">
<tr> <div class="form-group">
<form method="post" action=""> <select name="device_id" id="device_id" class="form-control input-sm">
<td width="200" style="padding: 1px;"> <option value="">All Devices</option>
<select name="device_id" id="device_id">
<option value="">All Devices</option>
<?php <?php
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data) foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data)
{ {
@ -15,29 +13,25 @@ foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hos
} }
?> ?>
</select> </select>
</td> </div>
<td width="200" style="padding: 1px;"> <div class="form-group">
<select name="interface" id="interface"> <select name="interface" id="interface" class="form-control input-sm">
<option value="">All Interfaces</option> <option value="">All Interfaces</option>
<option value="Loopback%" <?php if ($_POST['interface'] == "Loopback%") { echo("selected"); } ?> >Loopbacks</option> <option value="Loopback%" <?php if ($_POST['interface'] == "Loopback%") { echo("selected"); } ?> >Loopbacks</option>
<option value="Vlan%" <?php if ($_POST['interface'] == "Vlan%") { echo("selected"); } ?> >VLANs</option> <option value="Vlan%" <?php if ($_POST['interface'] == "Vlan%") { echo("selected"); } ?> >VLANs</option>
</select> </select>
</td> </div>
<td> <div class="form-group">
</td> <input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" class="form-control input-sm" placeholder="IPv4 Address"/>
<td width=400> </div>
<input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" /> <button type="submit" class="btn btn-default input-sm">Search</button>
<input style="align:right;" type=submit class=submit value=Search></div>
</td>
</form> </form>
</tr>
</table>
<?php <?php
print_optionbar_end(); print_optionbar_end();
echo('<table width="100%" cellspacing="0" cellpadding="5">'); echo('<table class="table table-condensed">');
$query = "SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D, `ipv4_networks` AS N WHERE I.port_id = A.port_id AND I.device_id = D.device_id AND N.ipv4_network_id = A.ipv4_network_id "; $query = "SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D, `ipv4_networks` AS N WHERE I.port_id = A.port_id AND I.device_id = D.device_id AND N.ipv4_network_id = A.ipv4_network_id ";

View File

@ -1,11 +1,9 @@
<?php print_optionbar_start(28); ?> <?php print_optionbar_start(28); ?>
<table cellpadding="0" cellspacing="0" class="devicetable" width="100%"> <form method="post" action="" class="form-inline" role="form">
<tr> <div class="form-group">
<form method="post" action=""> <select name="device_id" id="device_id" class="form-control input-sm">
<td width="200"> <option value="">All Devices</option>
<select name="device_id" id="device_id">
<option value="">All Devices</option>
<?php <?php
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data) foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data)
{ {
@ -15,29 +13,25 @@ foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hos
} }
?> ?>
</select> </select>
</td> </div>
<td width="200"> <div class="form-group">
<select name="interface" id="interface"> <select name="interface" id="interface" class="form-control input-sm">
<option value="">All Interfaces</option> <option value="">All Interfaces</option>
<option value="Loopback%" <?php if ($_POST['interface'] == "Loopback%") { echo("selected"); } ?> >Loopbacks</option> <option value="Loopback%" <?php if ($_POST['interface'] == "Loopback%") { echo("selected"); } ?> >Loopbacks</option>
<option value="Vlan%" <?php if ($_POST['interface'] == "Vlan%") { echo("selected"); } ?> >VLANs</option> <option value="Vlan%" <?php if ($_POST['interface'] == "Vlan%") { echo("selected"); } ?> >VLANs</option>
</select> </select>
</td> </div>
<td> <div class="form-group">
</td> <input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" class="form-control input-sm" placeholder="IPv6 Address"/>
<td width=400> </div>
<input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" /> <button type="submit" class="btn btn-default input-sm">Search</button>
<input style="align:right;" type=submit class=submit value=Search></div>
</td>
</form> </form>
</tr>
</table>
<?php <?php
print_optionbar_end(); print_optionbar_end();
echo('<table width="100%" cellspacing="0" cellpadding="5">'); echo('<table class="table table-condensed">');
$query = "SELECT * FROM `ipv6_addresses` AS A, `ports` AS I, `devices` AS D, `ipv6_networks` AS N WHERE I.port_id = A.port_id AND I.device_id = D.device_id AND N.ipv6_network_id = A.ipv6_network_id "; $query = "SELECT * FROM `ipv6_addresses` AS A, `ports` AS I, `devices` AS D, `ipv6_networks` AS N WHERE I.port_id = A.port_id AND I.device_id = D.device_id AND N.ipv6_network_id = A.ipv6_network_id ";

View File

@ -1,11 +1,9 @@
<?php print_optionbar_start(28); ?> <?php print_optionbar_start(28); ?>
<table cellpadding="0" cellspacing="0" class="devicetable" width="100%"> <form method="post" action="" class="form-inline" role="form">
<tr> <div class="form-group">
<form method="post" action=""> <select name="device_id" id="device_id" class="form-control input-sm">
<td width="200" style="padding: 1px;"> <option value="">All Devices</option>
<select name="device_id" id="device_id">
<option value="">All Devices</option>
<?php <?php
foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data) foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`") as $data)
{ {
@ -15,29 +13,25 @@ foreach (dbFetchRows("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hos
} }
?> ?>
</select> </select>
</td> </div>
<td width="200" style="padding: 1px;"> <div class="form-group">
<select name="interface" id="interface"> <select name="interface" id="interface" class="form-control input-sm">
<option value="">All Interfaces</option> <option value="">All Interfaces</option>
<option value="Loopback%" <?php if ($_POST['interface'] == "Loopback%") { echo("selected"); } ?> >Loopbacks</option> <option value="Loopback%" <?php if ($_POST['interface'] == "Loopback%") { echo("selected"); } ?> >Loopbacks</option>
<option value="Vlan%" <?php if ($_POST['interface'] == "Vlan%") { echo("selected"); } ?> >VLANs</option> <option value="Vlan%" <?php if ($_POST['interface'] == "Vlan%") { echo("selected"); } ?> >VLANs</option>
</select> </select>
</td> </div>
<td> <div class="form-group">
</td> <input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" class="form-control input-sm" placeholder="Mac Address"/>
<td width=400> </div>
<input type="text" name="address" id="address" size=40 value="<?php echo($_POST['address']); ?>" /> <button type="submit" class="btn btn-default input-sm">Search</button>
<input style="align:right;" type=submit class=submit value=Search></div>
</td>
</form> </form>
</tr>
</table>
<?php <?php
print_optionbar_end(); print_optionbar_end();
echo('<table width="100%" cellspacing="0" cellpadding="5">'); echo('<table class="table table-condensed">');
$query = "SELECT * FROM `ports` AS P, `devices` AS D WHERE P.device_id = D.device_id "; $query = "SELECT * FROM `ports` AS P, `devices` AS D WHERE P.device_id = D.device_id ";
$query .= "AND `ifPhysAddress` LIKE ?"; $query .= "AND `ifPhysAddress` LIKE ?";

View File

@ -9,6 +9,25 @@ echo("<span style='font-weight: bold;'>Services</span> &#187; ");
$menu_options = array('basic' => 'Basic', $menu_options = array('basic' => 'Basic',
'details' => 'Details'); 'details' => 'Details');
$sql_param = array();
if(isset($vars['state']))
{
if($vars['state'] == 'up')
{
$state = '1';
}
elseif($vars['state'] == 'down')
{
$state = '0';
}
}
if ($vars['state']) {
$where .= " AND service_status= ?"; $sql_param[] = $state;
$where .= " AND service_disabled='0' AND `service_ignore`='0'"; $sql_param[] = '';
}
if ($vars['disabled']) { $where .= " AND service_disabled= ?"; $sql_param[] = $vars['disabled']; }
if ($vars['ignore']) { $where .= " AND `service_ignore`= ?"; $sql_param[] = $vars['ignore']; }
if (!$vars['view']) { $vars['view'] = "basic"; } if (!$vars['view']) { $vars['view'] = "basic"; }
$sep = ""; $sep = "";
@ -26,9 +45,7 @@ unset($sep);
print_optionbar_end(); print_optionbar_end();
if ($_GET['status'] == '0') { $where = " AND service_status = '0'"; } else { unset ($where); } echo('<table class="table table-condensed">');
echo("<div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%>");
//echo("<tr class=interface-desc bgcolor='#e5e5e5'><td>Device</td><td>Service</td><td>Status</td><td>Changed</td><td>Checked</td><td>Message</td></tr>"); //echo("<tr class=interface-desc bgcolor='#e5e5e5'><td>Device</td><td>Service</td><td>Status</td><td>Changed</td><td>Checked</td><td>Message</td></tr>");
if ($_SESSION['userlevel'] >= '5') if ($_SESSION['userlevel'] >= '5')
@ -43,7 +60,8 @@ if ($_SESSION['userlevel'] >= '5')
{ {
$device_id = $device['device_id']; $device_id = $device['device_id'];
$device_hostname = $device['hostname']; $device_hostname = $device['hostname'];
foreach (dbFetchRows("SELECT * FROM `services` WHERE `device_id` = ?", array($device['device_id'])) as $service) array_unshift($sql_param,$device_id);
foreach (dbFetchRows("SELECT * FROM `services` WHERE `device_id` = ? $where", $sql_param) as $service)
{ {
include("includes/print-service.inc.php"); include("includes/print-service.inc.php");
@ -72,6 +90,6 @@ if ($_SESSION['userlevel'] >= '5')
unset ($samehost); unset ($samehost);
} }
echo("</table></div>"); echo("</table>");
?> ?>

View File

@ -69,7 +69,7 @@ function print_message($text)
{ {
print Console_Color::convert("%g".$text."%n\n", false); print Console_Color::convert("%g".$text."%n\n", false);
} else { } else {
echo('<div class="messagebox"><img src="/images/16/tick.png" align="absmiddle"> '.$text.'</div>'); echo('<div class="alert alert-success"><img src="/images/16/tick.png" align="absmiddle"> '.$text.'</div>');
} }
} }

View File

@ -179,6 +179,38 @@ function getImage($device)
return $image; return $image;
} }
function getImageSrc($device)
{
global $config;
$device['os'] = strtolower($device['os']);
if ($device['icon'] && file_exists($config['html_dir'] . "/images/os/" . $device['icon'] . ".png"))
{
$image = $config['base_url'] . '/images/os/' . $device['icon'] . '.png';
}
elseif ($config['os'][$device['os']]['icon'] && file_exists($config['html_dir'] . "/images/os/" . $config['os'][$device['os']]['icon'] . ".png"))
{
$image = $config['base_url'] . '/images/os/' . $config['os'][$device['os']]['icon'] . '.png';
} else {
if (file_exists($config['html_dir'] . '/images/os/' . $device['os'] . '.png'))
{
$image = $config['base_url'] . '/images/os/' . $device['os'] . '.png';
}
if ($device['os'] == "linux")
{
$features = strtolower(trim($device['features']));
list($distro) = explode(" ", $features);
if (file_exists($config['html_dir'] . "/images/os/$distro" . ".png"))
{
$image = $config['base_url'] . '/images/os/' . $distro . '.png';
}
}
}
return $image;
}
function renamehost($id, $new, $source = 'console') function renamehost($id, $new, $source = 'console')
{ {
global $config; global $config;