Commit version 24.12.13800
This commit is contained in:
@ -6,13 +6,13 @@
|
||||
*
|
||||
* @package observium
|
||||
* @subpackage web
|
||||
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
|
||||
* @copyright (C) Adam Armstrong
|
||||
*
|
||||
*/
|
||||
|
||||
if ($_SESSION['userlevel'] < 7 && !is_entity_write_permitted($device['device_id'], 'device')) {
|
||||
print_error_permission();
|
||||
return;
|
||||
print_error_permission();
|
||||
return;
|
||||
}
|
||||
|
||||
// User level 7-9 only can see config
|
||||
@ -21,94 +21,108 @@ if ($_SESSION['userlevel'] < 7 && !is_entity_write_permitted($device['device_id'
|
||||
// Allow write for users with write permission to this entity
|
||||
$readonly = !is_entity_write_permitted($device['device_id'], 'device');
|
||||
|
||||
$link_array = array('page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'edit');
|
||||
$link_array = ['page' => 'device',
|
||||
'device' => $device['device_id'],
|
||||
'tab' => 'edit'];
|
||||
|
||||
$panes['device'] = 'Device Settings';
|
||||
$panes['snmp'] = 'SNMP';
|
||||
if ($config['geocoding']['enable']) {
|
||||
$panes['geo'] = 'Geolocation';
|
||||
}
|
||||
$panes['mibs'] = 'MIBs';
|
||||
$panes['graphs'] = 'Graphs';
|
||||
$panes['alerts'] = 'Alerts';
|
||||
$panes['ports'] = 'Ports';
|
||||
if ($health_exist['sensors']) {
|
||||
$panes['sensors'] = 'Sensors';
|
||||
}
|
||||
if ($health_exist['status']) {
|
||||
$panes['device'] = 'Device Settings';
|
||||
$panes['snmp'] = 'SNMP';
|
||||
if ($config['geocoding']['enable']) {
|
||||
$panes['geo'] = 'Geolocation';
|
||||
}
|
||||
$panes['mibs'] = 'MIBs';
|
||||
$panes['graphs'] = 'Graphs';
|
||||
$panes['alerts'] = 'Alerts';
|
||||
$panes['ports'] = 'Ports';
|
||||
if ($cache['health_exist'][$device['device_id']]['sensors']) {
|
||||
$panes['sensors'] = 'Sensors';
|
||||
}
|
||||
if ($cache['health_exist'][$device['device_id']]['status']) {
|
||||
$panes['status'] = 'Statuses';
|
||||
}
|
||||
if (safe_count($config['os'][$device['os']]['icons']))
|
||||
{
|
||||
$panes['icon'] = 'Icon';
|
||||
}
|
||||
}
|
||||
// if ($cache['health_exist'][$device['device_id']]['counter']) {
|
||||
// $panes['counter'] = 'Counters';
|
||||
// }
|
||||
|
||||
$panes['modules'] = 'Modules';
|
||||
$panes['modules'] = 'Modules';
|
||||
|
||||
//if ($config['enable_services'])
|
||||
//{
|
||||
//$panes['services'] = 'Services';
|
||||
//}
|
||||
//if ($config['enable_services'])
|
||||
//{
|
||||
//$panes['services'] = 'Services';
|
||||
//}
|
||||
|
||||
// $panes['probes'] = 'Probes';
|
||||
// $panes['probes'] = 'Probes';
|
||||
|
||||
if ($device_loadbalancer_count['netscaler_vsvr']) { $panes['netscaler_vsvrs'] = 'NS vServers'; }
|
||||
if ($device_loadbalancer_count['netscaler_services']) { $panes['netscaler_svcs'] = 'NS Services'; }
|
||||
if ($device_loadbalancer_count['netscaler_vsvr']) {
|
||||
$panes['netscaler_vsvrs'] = 'NS vServers';
|
||||
}
|
||||
if ($device_loadbalancer_count['netscaler_services']) {
|
||||
$panes['netscaler_svcs'] = 'NS Services';
|
||||
}
|
||||
|
||||
if ($device['os'] === 'windows') {
|
||||
$panes['wmi'] = 'WMI';
|
||||
}
|
||||
if ($device['os'] === 'windows') {
|
||||
$panes['wmi'] = 'WMI';
|
||||
}
|
||||
|
||||
if ($config['os'][$device['os']]['ipmi']) {
|
||||
$panes['ipmi'] = 'IPMI';
|
||||
}
|
||||
if (($config['enable_libvirt'] && $device['os'] === 'linux') || // libvirt-vminfo discovery module
|
||||
$device['os_group'] === 'unix' || is_module_enabled($device, 'unix-agent', 'poller')) { // unix-agent
|
||||
$panes['ssh'] = 'SSH';
|
||||
}
|
||||
if ($device['os_group'] === 'unix' || $device['os'] === 'generic')
|
||||
{
|
||||
$panes['agent'] = 'Agent';
|
||||
}
|
||||
if ($device['os_group'] === 'unix' || $device['os'] === 'windows')
|
||||
{
|
||||
$panes['apps'] = 'Applications'; /// FIXME. Deprecated?
|
||||
}
|
||||
if ($config['os'][$device['os']]['ipmi']) {
|
||||
$panes['ipmi'] = 'IPMI';
|
||||
}
|
||||
if (($config['enable_libvirt'] && $device['os'] === 'linux') || // libvirt-vminfo discovery module
|
||||
$device['os_group'] === 'unix' || is_module_enabled($device, 'unix-agent', 'poller')) { // unix-agent
|
||||
$panes['ssh'] = 'SSH';
|
||||
}
|
||||
if (($device['os_group'] === 'unix' || $device['os'] === 'generic') && (is_module_enabled($device, 'unix-agent', 'poller'))) {
|
||||
$panes['agent'] = 'Agent';
|
||||
}
|
||||
if ($device['os_group'] === 'unix' || $device['os'] === 'windows') {
|
||||
$panes['apps'] = 'Applications'; /// FIXME. Deprecated?
|
||||
}
|
||||
|
||||
$navbar['brand'] = "Edit";
|
||||
$navbar['class'] = "navbar-narrow";
|
||||
if ($_SESSION['userlevel'] >= 9) {
|
||||
// Detect (possible) duplicates
|
||||
$duplicates = [];
|
||||
get_device_duplicated($device, $duplicates);
|
||||
if (count($duplicates)) {
|
||||
$panes['duplicates'] = 'Duplicates';
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($panes as $type => $text)
|
||||
{
|
||||
if (!isset($vars['section'])) { $vars['section'] = $type; }
|
||||
$navbar['brand'] = "Edit";
|
||||
$navbar['class'] = "navbar-narrow";
|
||||
|
||||
if ($vars['section'] == $type) { $navbar['options'][$type]['class'] = "active"; }
|
||||
$navbar['options'][$type]['url'] = generate_url($link_array,array('section'=>$type));
|
||||
foreach ($panes as $type => $text) {
|
||||
if (!isset($vars['section'])) {
|
||||
$vars['section'] = $type;
|
||||
}
|
||||
|
||||
if ($vars['section'] == $type) {
|
||||
$navbar['options'][$type]['class'] = "active";
|
||||
}
|
||||
$navbar['options'][$type]['url'] = generate_url($link_array, ['section' => $type]);
|
||||
$navbar['options'][$type]['text'] = $text;
|
||||
}
|
||||
$navbar['options_right']['delete']['url'] = generate_url($link_array,array('section'=>'delete'));
|
||||
$navbar['options_right']['delete']['text'] = 'Delete';
|
||||
$navbar['options_right']['delete']['icon'] = $config['icon']['device-delete'];
|
||||
if ($vars['section'] === 'delete') { $navbar['options_right']['delete']['class'] = 'active'; }
|
||||
print_navbar($navbar);
|
||||
}
|
||||
$navbar['options_right']['delete']['url'] = generate_url($link_array, ['section' => 'delete']);
|
||||
$navbar['options_right']['delete']['text'] = 'Delete';
|
||||
$navbar['options_right']['delete']['icon'] = ':wastebasket:';//$config['icon']['device-delete'];
|
||||
if ($vars['section'] === 'delete') {
|
||||
$navbar['options_right']['delete']['class'] = 'active';
|
||||
}
|
||||
print_navbar($navbar);
|
||||
|
||||
$filename = $config['html_dir'] . '/pages/device/edit/' . $vars['section'] . '.inc.php';
|
||||
if (is_file($filename))
|
||||
{
|
||||
$vars = get_vars('POST'); // Note, on edit pages use only method POST!
|
||||
$filename = $config['html_dir'] . '/pages/device/edit/' . $vars['section'] . '.inc.php';
|
||||
if (is_file($filename)) {
|
||||
$vars = get_vars('POST'); // Note, on edit pages use only method POST!
|
||||
$attribs = get_dev_attribs($device['device_id']);
|
||||
$model = get_model_array($device);
|
||||
$model = get_model_array($device);
|
||||
|
||||
register_html_resource('js', 'js/jquery.serializejson.js');
|
||||
register_html_resource('js', 'js/jquery.serializejson.min.js');
|
||||
include($filename);
|
||||
} else {
|
||||
} else {
|
||||
print_error('<h3>Page does not exist</h4>
|
||||
The requested page does not exist. Please correct the URL and try again.');
|
||||
}
|
||||
}
|
||||
|
||||
unset($filename, $navbar, $panes, $link_array);
|
||||
unset($filename, $navbar, $panes, $link_array, $readonly);
|
||||
|
||||
register_html_title("Settings");
|
||||
|
||||
|
Reference in New Issue
Block a user