diff --git a/html/includes/table/device_mibs.inc.php b/html/includes/table/device_mibs.inc.php
new file mode 100644
index 000000000..086ef4140
--- /dev/null
+++ b/html/includes/table/device_mibs.inc.php
@@ -0,0 +1,91 @@
+
+ *
+ * by Paul Gear
+ * based on code by Søren Friis Rosiak
+ * in commit 054bf3ae209f34a2c3bc8968300722004903df1b
+ *
+ * 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.
+ */
+
+$columns = array(
+ 'module',
+ 'mib',
+ 'included_by',
+ 'last_modified',
+);
+
+function search_phrase_column($c)
+{
+ global $searchPhrase;
+ return "$c LIKE '%$searchPhrase%'";
+}
+
+function quote_sql_word($c)
+{
+ return "`$c`";
+}
+
+
+$params = array(
+ $_POST['device_id'],
+);
+
+// start of sql definition
+$sql = 'SELECT * FROM `device_mibs`';
+
+$wheresql = ' WHERE `device_id` = ?';
+
+// all columns are searchable - search across them
+if (isset($searchPhrase) && !empty($searchPhrase)) {
+ $searchsql = implode(' OR ', array_map("search_phrase_column", array_map("quote_sql_word", $columns)));
+ $wheresql .= " AND ( $searchsql )";
+}
+$sql .= $wheresql;
+
+// get total
+$count_sql = "SELECT COUNT(*) FROM `device_mibs`".$wheresql;
+$total = dbFetchCell($count_sql, $params);
+if (empty($total)) {
+ $total = 0;
+}
+
+// sort by first three columns by default
+if (!isset($sort) || empty($sort)) {
+ $sort = implode(', ', array_map("quote_sql_word", array_slice($columns, 0, 3)));
+}
+$sql .= " ORDER BY $sort";
+
+// select only the required rows
+if (isset($current)) {
+ $limit_low = (($current * $rowCount) - ($rowCount));
+ $limit_high = $rowCount;
+}
+if ($rowCount != -1) {
+ $sql .= " LIMIT $limit_low,$limit_high";
+}
+
+// load data from database into response array
+$response = array();
+foreach (dbFetchRows($sql, $params) as $mib) {
+ $mibrow = array();
+ foreach ($columns as $col) {
+ $mibrow[$col] = $mib[$col];
+ }
+ $response[] = $mibrow;
+}
+
+$output = array(
+ 'current' => $current,
+ 'rowCount' => $rowCount,
+ 'rows' => $response,
+ 'total' => $total,
+);
+echo _json_encode($output);
diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php
index 1bd032684..5fc2c18d2 100644
--- a/html/pages/device.inc.php
+++ b/html/pages/device.inc.php
@@ -371,6 +371,14 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) {
';
+ if (device_permitted($device['device_id'])) {
+ echo '
+
+ MIB
+
+ ';
+ }
+
echo '
diff --git a/html/pages/device/mib.inc.php b/html/pages/device/mib.inc.php
new file mode 100644
index 000000000..f6ecdb9a4
--- /dev/null
+++ b/html/pages/device/mib.inc.php
@@ -0,0 +1,52 @@
+
+ *
+ * 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.
+ */
+
+if (!isset($vars['section'])) {
+ $vars['section'] = "mib";
+}
+?>
+
+ Device MIB associations
+
+
+
+
+ | Module |
+ MIB |
+ Included by |
+ Last Modified |
+
+
+
+
+
+