diff --git a/html/includes/api_functions.inc.php b/html/includes/api_functions.inc.php index 7141e7bbc..9d9576013 100644 --- a/html/includes/api_functions.inc.php +++ b/html/includes/api_functions.inc.php @@ -856,7 +856,7 @@ function list_oxidized() { $app->response->headers->set('Content-Type', 'application/json'); $devices = array(); - foreach (dbFetchRows("SELECT hostname,os FROM `devices` WHERE `status`='1'") as $device) { + foreach (dbFetchRows("SELECT hostname,os FROM `devices` LEFT JOIN devices_attribs AS `DA` ON devices.device_id = DA.device_id AND `DA`.attrib_type='override_Oxidized_disable' WHERE `status`='1' AND (DA.attrib_value = 'false' OR DA.attrib_value IS NULL)") as $device) { $devices[] = $device; } diff --git a/html/includes/forms/override-config.inc.php b/html/includes/forms/override-config.inc.php new file mode 100644 index 000000000..6004710dc --- /dev/null +++ b/html/includes/forms/override-config.inc.php @@ -0,0 +1,48 @@ + + * + * 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 (is_admin() === false) { + $response = array( + 'status' => 'error', + 'message' => 'Need to be admin', + ); + echo _json_encode($response); + exit; +} + +$device['device_id'] = mres($_POST['device_id']); +$attrib = mres($_POST['attrib']); +$state = mres($_POST['state']); +$status = 'error'; +$message = 'Error with config'; + +if (empty($device['device_id'])) { + $message = 'No device passed'; +} +else { + if ($state == true) { + set_dev_attrib($device, $attrib, $state); + } + else { + del_dev_attrib($device, $attrib); + } + $status = 'ok'; + $message = 'Config has been updated'; +} + +$response = array( + 'status' => $status, + 'message' => $message, +); +echo _json_encode($response); diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 003d3a6f0..e29c1d863 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -1167,3 +1167,15 @@ function alert_details($details) { }//end alert_details() +function dynamic_override_config($type, $name, $device) { + $attrib_val = get_dev_attrib($device,$name); + if ($attrib_val == 'true') { + $checked = 'checked'; + } + else { + $checked = ''; + } + if ($type == 'checkbox') { + return ''; + } +}//end dynamic_override_config() diff --git a/html/pages/device/edit.inc.php b/html/pages/device/edit.inc.php index 86cc6d490..fe8a9c259 100644 --- a/html/pages/device/edit.inc.php +++ b/html/pages/device/edit.inc.php @@ -36,6 +36,7 @@ else { } $panes['storage'] = 'Storage'; + $panes['misc'] = 'Misc'; print_optionbar_start(); diff --git a/html/pages/device/edit/misc.inc.php b/html/pages/device/edit/misc.inc.php new file mode 100644 index 000000000..612af03cd --- /dev/null +++ b/html/pages/device/edit/misc.inc.php @@ -0,0 +1,41 @@ + +
+ +
+ '.dynamic_override_config('checkbox','override_Oxidized_disable', $device).' +
+
+ +'; + +?> + +