diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 2a4e59c04..7059a269e 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -169,6 +169,8 @@ if ($_SESSION['userlevel'] >= '10') { } echo ' +
  • 'mib_assoc')).'> MIB associations
  • + '; if ($config['navbar']['manage_groups']['hide'] === 0) { diff --git a/html/includes/table/device_mibs.inc.php b/html/includes/table/device_mibs.inc.php index be85f4bcf..bc9af0a24 100644 --- a/html/includes/table/device_mibs.inc.php +++ b/html/includes/table/device_mibs.inc.php @@ -22,14 +22,25 @@ $columns = array( 'last_modified', ); -$params = array( - $_POST['device_id'], -); - -// start of sql definition -$sql = 'SELECT * FROM `device_mibs`'; - -$wheresql = ' WHERE `device_id` = ?'; +if (isset($_POST['device_id'])) { + // device_id supplied - get details for a single device + // used by device MIB page + $params = array( + $_POST['device_id'], + ); + $sql = 'SELECT * FROM `device_mibs`'; + $wheresql = ' WHERE `device_id` = ?'; + $sortcolumns = 3; +} +else { + // device_id not supplied - get details for a all devices + // used by all device MIBs page + $params = array(); + $sql = 'SELECT `d`.`hostname` as `hostname`, `dm`.* FROM `devices` `d`, `device_mibs` `dm`'; + $wheresql = ' WHERE `d`.`device_id` = `dm`.`device_id`'; + array_unshift($columns, 'hostname'); + $sortcolumns = 4; +} // all columns are searchable - search across them if (isset($searchPhrase) && !empty($searchPhrase)) { @@ -45,9 +56,9 @@ if (empty($total)) { $total = 0; } -// sort by first three columns by default +// set up default sort if (!isset($sort) || empty($sort)) { - $sort = implode(', ', array_map("quote_sql_word", array_slice($columns, 0, 3))); + $sort = implode(', ', array_map("quote_sql_word", array_slice($columns, 0, $sortcolumns))); } $sql .= " ORDER BY $sort"; diff --git a/html/pages/mib_assoc.inc.php b/html/pages/mib_assoc.inc.php new file mode 100644 index 000000000..a792e5796 --- /dev/null +++ b/html/pages/mib_assoc.inc.php @@ -0,0 +1,49 @@ + + * + * Author: Paul Gear + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +?> + +

    MIB associations for all devices

    +
    + + + + + + + + + + +
    HostnameModuleMIBIncluded byLast Modified
    +
    + +