device searching

git-svn-id: http://www.observium.org/svn/observer/trunk@360 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong 2009-03-20 13:25:19 +00:00
parent bc214bc6fe
commit 09d54a6112
4 changed files with 90 additions and 5 deletions

View File

@ -28,7 +28,7 @@
# $graph_url = "graph.php?if=$if_id&from=$twoday&to=$now&width=400&height=120&type=bits";
echo("<tr style=\"background-color: $bg; padding: 5px;\" valign=top>
echo("<tr style=\"background-color: $bg; padding: 5px;\" valign=top onmouseover=\"this.style.backgroundColor='#fdd';\" onmouseout=\"this.style.backgroundColor='$bg';\" onclick=\"location.href='/device/".$device['device_id']."/'\" style='cursor: hand;'>
<td valign=top width=300>");
echo(" <span class=list-large>

View File

@ -41,7 +41,7 @@ if(@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id =
echo("
<li class=" . $select['vlans'] . ">
<a href='/device/" . $device['device_id'] . "/vlans/'>
<img src='images/16/vlans.png' align=absmiddle border=0> VLANs
<img src='images/16/vlans.png' align='absmiddle' border='0'> VLANs
</a>
</li>");
}

View File

@ -1,5 +1,89 @@
<table cellpadding=7 cellspacing=0 class=devicetable width=100%>
<form method='post' action=''>
<tr bgcolor='#eeeeee'
<td width='40' align=center valign=middle></td>
<td width='300'><span style='font-weight: bold; font-size: 14px;'></span>
<input type="text" name="hostname" id="hostname" size=40 value="<?php echo($_POST['hostname']); ?>" />
</td>
<td width='200'>
<select name='os' id='os'>
<option value=''>All OSes</option>
<?php
$query = mysql_query("SELECT `os` FROM `devices` GROUP BY `os` ORDER BY `os`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['os']."'");
if($data['os'] == $_POST['os']) { echo("selected"); }
echo(">".$data['os']."</option>");
}
?>
</select>
<br />
<select name='version' id='version'>
<option value=''>All Versions</option>
<?php
$query = mysql_query("SELECT `version` FROM `devices` GROUP BY `version` ORDER BY `version`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['version']."'");
if($data['version'] == $_POST['version']) { echo("selected"); }
echo(">".$data['version']."</option>");
}
?>
</select>
</td>
<td width='200'>
<select name='hardware' id='hardware'>
<option value=''>All Platforms</option>
<?php
$query = mysql_query("SELECT `hardware` FROM `devices` GROUP BY `hardware` ORDER BY `hardware`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['hardware']."'");
if($data['hardware'] == $_POST['hardware']) { echo("selected"); }
echo(">".$data['hardware']."</option>");
}
?>
</select>
<br />
<select name='features' id='features'>
<option value=''>All Featuresets</option>
<?php
$query = mysql_query("SELECT `features` FROM `devices` GROUP BY `features` ORDER BY `features`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['features']."'");
if($data['features'] == $_POST['features']) { echo("selected"); }
echo(">".$data['features']."</option>");
}
?>
</select>
</td>
<td>
<select name='location' id='location'>
<option value=''>All Locations</option>
<?php
$query = mysql_query("SELECT `location` FROM `devices` GROUP BY `location` ORDER BY `location`");
while($data = mysql_fetch_array($query)) {
echo("<option value='".$data['location']."'");
if($data['location'] == $_POST['location']) { echo("selected"); }
echo(">".$data['location']."</option>");
}
?>
</select>
<input type=submit value=Search>
</td>
<td width=10>
</td>
</tr>
</form>
</table>
<?php
if($_POST['hostname']) { $where = " AND hostname LIKE '%".$_POST['hostname']."%'"; }
if($_POST['os']) { $where = " AND os = '".$_POST['os']."'"; }
if($_POST['version']) { $where .= " AND version = '".$_POST['version']."'"; }
if($_POST['hardware']) { $where .= " AND hardware = '".$_POST['hardware']."'"; }
if($_POST['features']) { $where .= " AND features = '".$_POST['features']."'"; }
if($_POST['location']) { $where .= " AND location = '".$_POST['location']."'"; }
if($_GET['location']) { $where = "AND location = '$_GET[location]'"; }
if($_GET['location'] == "Unset") { $where = "AND location = ''"; }
if($_GET['type']) { $where = "AND type = '$_GET[type]'"; }
@ -9,8 +93,9 @@ if($_GET['status'] == "alerted") {
$sql = "select * from devices " . $device_alert_sql . " GROUP BY `device_id` ORDER BY `ignore`, `status`, `os`, `hostname`";
}
$device_query = mysql_query($sql);
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
$device_query = mysql_query($sql);
while($device = mysql_fetch_array($device_query)) {
if( devicepermitted($device['device_id']) ) {
$device['uptime'] = @mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] ."' AND `attrib_type` = 'uptime'"), 0);

View File

@ -1,4 +1,4 @@
<script type="text/javascript" src="js/tw-sack.js"></script>
<script type="text/javascript" src="<?php echo($config['base_url']); ?>/js/tw-sack.js"></script>
<script type="text/javascript">
@ -12,7 +12,7 @@ function getInterfaceList(sel)
var index = ajax.length;
ajax[index] = new sack();
ajax[index].requestFile = 'list_interfaces.php?device_id='+deviceId; // Specifying which file to get
ajax[index].requestFile = '<?php echo($config['base_url']); ?>/ajax/list_interfaces.php?device_id='+deviceId; // Specifying which file to get
ajax[index].onCompletion = function(){ createInterfaces(index) }; // Specify function that will be executed after file has been found
ajax[index].runAJAX(); // Execute AJAX function
}