pandorafms/pandora_console/godmode/massive/massive_edit_agents.php

1219 lines
36 KiB
PHP
Raw Normal View History

<?php
2021-02-12 11:28:13 +01:00
/**
* View for edit agents in Massive Operations
*
* @category Configuration
* @package Pandora FMS
* @subpackage Massive Operations
* @version 1.0.0
* @license See below
*
* ______ ___ _______ _______ ________
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
2021-02-12 11:28:13 +01:00
* Please see http://pandorafms.org for full contribution list
* 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 for version 2.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ============================================================================
*/
// Begin.
check_login();
if (! check_acl($config['id_user'], 0, 'AW')) {
db_pandora_audit(
'ACL Violation',
'Trying to access massive agent deletion section'
);
include 'general/noaccess.php';
return;
}
2022-01-24 12:19:09 +01:00
require_once $config['homedir'].'/include/functions_agents.php';
require_once $config['homedir'].'/include/functions_ui.php';
require_once $config['homedir'].'/include/functions_alerts.php';
require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_servers.php';
require_once $config['homedir'].'/include/functions_gis.php';
require_once $config['homedir'].'/include/functions_users.php';
enterprise_include_once('include/functions_config_agents.php');
if (is_ajax()) {
$get_n_conf_files = (bool) get_parameter('get_n_conf_files');
if ($get_n_conf_files) {
$id_agents = get_parameter('id_agents');
$cont = 0;
foreach ($id_agents as $id_agent) {
$name = agents_get_name($id_agent);
$agent_md5 = md5($name);
if (file_exists($config['remote_config'].'/md5/'.$agent_md5.'.md5')) {
2022-01-21 11:49:30 +01:00
$cont++;
}
}
echo $cont;
return;
}
}
$update_agents = get_parameter('update_agents', 0);
$recursion = get_parameter('recursion');
if ($update_agents) {
$values = [];
if (get_parameter('group', '') != -1) {
$values['id_grupo'] = get_parameter('group');
}
if (!(get_parameter('interval_select') == -1 && empty(get_parameter('interval_text')))) {
if (get_parameter('interval', 0) != 0) {
$values['intervalo'] = get_parameter('interval');
}
}
if (get_parameter('id_os', '') != -1) {
$values['id_os'] = get_parameter('id_os');
}
if (get_parameter('id_parent', '') != '') {
$values['id_parent'] = get_parameter('id_agent_parent', 0);
}
if (get_parameter('server_name', '') != -1) {
$values['server_name'] = get_parameter('server_name');
}
if (get_parameter('description', '') != '') {
$values['comentarios'] = get_parameter('description');
}
if (get_parameter('mode', '') != -1) {
$values['modo'] = get_parameter('mode');
}
if (get_parameter('disabled', '') != -1) {
$values['disabled'] = get_parameter('disabled');
}
if (get_parameter('icon_path', '') != '') {
$values['icon_path'] = get_parameter('icon_path');
}
if (get_parameter('update_gis_data', -1) != -1) {
$values['update_gis_data'] = get_parameter('update_gis_data');
}
if (get_parameter('custom_id', '') != '') {
$values['custom_id'] = get_parameter('custom_id');
}
if (get_parameter('cascade_protection', -1) != -1) {
$values['cascade_protection'] = get_parameter('cascade_protection');
}
if (get_parameter('cascade_protection_module', -1) != -1) {
$values['cascade_protection_module'] = get_parameter('cascade_protection_module');
}
if (get_parameter('delete_conf', 0) != 0) {
$values['delete_conf'] = get_parameter('delete_conf');
}
if (get_parameter('quiet_select', -1) != -1) {
$values['quiet'] = get_parameter('quiet_select');
}
if (get_parameter('safe_mode_change', -1) == 1 && get_parameter('safe_mode_module', '') != '') {
// Get the module name.
$values['safe_mode_module'] = get_parameter('safe_mode_module');
} else if (get_parameter('safe_mode_change', -1) == 0) {
// Disabled Safe Operation Mode.
$values['safe_mode_module'] = '0';
}
$secondary_groups_added = (string) get_parameter('secondary_hidden_added', '');
$secondary_groups_removed = (string) get_parameter('secondary_hidden_removed', '');
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($fields === false) {
$fields = [];
}
$id_agents = get_parameter('id_agents', false);
if (!$id_agents) {
ui_print_error_message(__('No agents selected'));
$id_agents = [];
} else {
if (empty($values) && empty($fields)) {
ui_print_error_message(__('No values changed'));
$id_agents = [];
}
}
// Get the id_agente_modulo to update the 'safe_operation_mode' field.
if (isset($values['safe_mode_module']) && ($values['safe_mode_module'] != '0')) {
foreach ($id_agents as $id_agent) {
$id_module_safe[$id_agent] = db_get_value_filter(
'id_agente_modulo',
'tagente_modulo',
[
'id_agente' => $id_agent,
'nombre' => $values['safe_mode_module'],
]
);
}
}
2022-01-24 12:19:09 +01:00
// CONF FILE DELETION.
if (isset($values['delete_conf'])) {
unset($values['delete_conf']);
$n_deleted = 0;
foreach ($id_agents as $id_agent) {
$agent_md5 = md5(agents_get_name($id_agent));
@unlink(
$config['remote_config'].'/md5/'.$agent_md5.'.md5'
);
$result = @unlink(
$config['remote_config'].'/conf/'.$agent_md5.'.conf'
);
$n_deleted += (int) $result;
}
if ($n_deleted > 0) {
db_pandora_audit('Massive management', 'Delete conf file '.$id_agent);
} else {
db_pandora_audit('Massive management', 'Try to delete conf file '.$id_agent);
}
ui_print_result_message(
$n_deleted > 0,
__('Configuration files deleted successfully').'('.$n_deleted.')',
__('Configuration files cannot be deleted')
);
}
if (empty($values) && empty($fields)) {
$id_agents = [];
}
$n_edited = 0;
$result = false;
foreach ($id_agents as $id_agent) {
$old_interval_value = db_get_value_filter('intervalo', 'tagente', ['id_agente' => $id_agent]);
if (!empty($values)) {
$group_old = false;
$disabled_old = false;
if ($values['id_grupo'] || isset($values['disabled'])) {
$values_old = db_get_row_filter('tagente', ['id_agente' => $id_agent], ['id_grupo', 'disabled']);
if ($values_old['id_grupo']) {
$group_old = $values_old['id_grupo'];
}
if (isset($values['disabled'])) {
$disabled_old = $values_old['disabled'];
}
}
// Get the id_agent_module for this agent to update the 'safe_operation_mode' field.
if (isset($values['safe_mode_module']) && ($values['safe_mode_module'] != '0')) {
$values['safe_mode_module'] = $id_module_safe[$id_agent];
}
$result = db_process_sql_update(
'tagente',
$values,
['id_agente' => $id_agent]
);
if ($result && $config['metaconsole_agent_cache'] == 1) {
$server_name['server_name'] = db_get_sql('SELECT server_name FROM tagente WHERE id_agente ='.$id_agent);
// Force an update of the agent cache.
$result_metaconsole = agent_update_from_cache($id_agent, $values, $server_name);
}
// Update the configuration files.
if ($result && ($old_interval_value != $values['intervalo']) && !empty($values['intervalo'])) {
enterprise_hook(
'config_agents_update_config_token',
[
$id_agent,
'interval',
$values['intervalo'],
]
);
}
if ($disabled_old !== false && $disabled_old != $values['disabled']) {
enterprise_hook(
'config_agents_update_config_token',
[
$id_agent,
'standby',
$values['disabled'],
]
);
// Validate alerts for disabled agents.
if ($values['disabled'] == 1) {
alerts_validate_alert_agent($id_agent);
}
}
if ($group_old || $result) {
if ($group_old && $group_old != null) {
$tpolicy_group_old = db_get_all_rows_sql(
'SELECT id_policy FROM tpolicy_groups
WHERE id_group = '.$group_old
);
} else {
$tpolicy_group_old = db_get_all_rows_sql('SELECT id_policy FROM tpolicy_groups');
}
if ($tpolicy_group_old) {
foreach ($tpolicy_group_old as $key => $value) {
$tpolicy_agents_old = db_get_sql(
'SELECT * FROM tpolicy_agents
WHERE id_policy = '.$value['id_policy'].' AND id_agent = '.$id_agent
);
if ($tpolicy_agents_old) {
$result2 = db_process_sql_update(
'tpolicy_agents',
['pending_delete' => 1],
[
'id_agent' => $id_agent,
'id_policy' => $value['id_policy'],
]
);
}
}
}
if ($values['id_grupo'] && $values['id_grupo'] != null) {
$tpolicy_group_new = db_get_all_rows_sql(
'SELECT id_policy FROM tpolicy_groups
WHERE id_group = '.$values['id_grupo']
);
} else {
$tpolicy_group_new = db_get_all_rows_sql('SELECT id_policy FROM tpolicy_groups');
}
if ($tpolicy_group_new) {
foreach ($tpolicy_group_new as $key => $value) {
$tpolicy_agents_new = db_get_sql(
'SELECT * FROM tpolicy_agents
WHERE id_policy = '.$value['id_policy'].' AND id_agent ='.$id_agent
);
if (!$tpolicy_agents_new) {
db_process_sql_insert(
'tpolicy_agents',
[
'id_policy' => $value['id_policy'],
'id_agent' => $id_agent,
]
);
} else {
$result3 = db_process_sql_update(
'tpolicy_agents',
['pending_delete' => 0],
[
'id_agent' => $id_agent,
'id_policy' => $value['id_policy'],
]
);
}
}
}
}
}
$info = [];
2022-01-24 12:19:09 +01:00
// Update Custom Fields.
foreach ($fields as $field) {
$info[$field['id_field']] = $field['name'];
2021-02-12 11:28:13 +01:00
$value = get_parameter('customvalue_'.$field['id_field']);
if (empty($value) === false) {
$key = $field['id_field'];
2021-02-12 11:28:13 +01:00
$old_value = db_get_all_rows_filter(
'tagent_custom_data',
[
'id_agent' => $id_agent,
'id_field' => $key,
]
);
if ($old_value === false) {
2022-01-24 12:19:09 +01:00
// Create custom field if not exist.
$result = db_process_sql_insert(
'tagent_custom_data',
[
'id_field' => $key,
'id_agent' => $id_agent,
'description' => $value,
]
);
} else {
2021-02-12 11:28:13 +01:00
if ($old_value[0]['description'] !== $value) {
$result = db_process_sql_update(
'tagent_custom_data',
['description' => $value],
[
'id_field' => $key,
'id_agent' => $id_agent,
]
);
}
}
}
}
// Create or Remove the secondary groups.
if (empty($secondary_groups_added) === false
|| empty($secondary_groups_removed) === false
) {
$result = enterprise_hook(
'agents_update_secondary_groups',
[
$id_agent,
explode(',', $secondary_groups_added),
explode(',', $secondary_groups_removed),
]
);
}
$n_edited += (int) $result;
}
if ($result !== false) {
db_pandora_audit(
'Massive management',
'Update agent '.$id_agent,
false,
false,
json_encode($info)
);
} else {
if (isset($id_agent) === true) {
db_pandora_audit(
'Massive management',
'Try to update agent '.$id_agent,
false,
false,
json_encode($info)
);
}
}
ui_print_result_message(
$result !== false,
2021-02-12 11:28:13 +01:00
__('Agents updated successfully (%d)', $n_edited),
__('Agents cannot be updated (maybe there was no field to update)')
);
}
$id_group = 0;
$table = new StdClass();
$table->id = 'delete_table';
2015-06-15 15:50:28 +02:00
$table->class = 'databox filters';
$table->width = '100%';
$table->data = [];
$table->style = [];
2015-06-15 15:50:28 +02:00
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold';
$table->size = [];
$table->size[0] = '15%';
$table->size[1] = '35%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$table->data = [];
$table->data[0][0] = __('Group');
$table->data[0][1] = html_print_select_groups(
false,
'AW',
true,
'id_group',
$id_group,
false,
'',
'',
true
);
$table->data[0][2] = __('Group recursion');
$table->data[0][3] = html_print_checkbox(
'recursion2',
1,
$recursion,
true,
false
);
$status_list = [];
2015-06-08 13:13:09 +02:00
$status_list[AGENT_STATUS_NORMAL] = __('Normal');
$status_list[AGENT_STATUS_WARNING] = __('Warning');
$status_list[AGENT_STATUS_CRITICAL] = __('Critical');
$status_list[AGENT_STATUS_UNKNOWN] = __('Unknown');
2015-06-08 13:13:09 +02:00
$status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal');
$status_list[AGENT_STATUS_NOT_INIT] = __('Not init');
$table->data[1][0] = __('Status');
$table->data[1][1] = html_print_select(
$status_list,
'status_agents',
'selected',
'',
__('All'),
AGENT_STATUS_ALL,
true
);
$table->data[1][2] = __('Show agents');
$table->data[1][3] = html_print_select(
[
0 => 'Only enabled',
1 => 'Only disabled',
],
'disabled',
2,
'',
__('All'),
2,
true,
2022-01-21 11:49:30 +01:00
false,
true,
'',
2022-01-21 11:49:30 +01:00
false,
'width:30%;'
);
2022-01-21 11:49:30 +01:00
$table->data[2][0] = __('Agents');
$table->data[2][0] .= '<span id="agent_loading" class="invisible">';
$table->data[2][0] .= html_print_image('images/spinner.png', true);
$table->data[2][0] .= '</span>';
2022-01-24 12:19:09 +01:00
$all_agents = agents_get_group_agents(
array_keys(users_get_groups($config['id_user'], 'AW', false)),
2022-01-24 16:57:42 +01:00
['disabled' => 2],
2022-01-24 12:19:09 +01:00
'none'
);
$table->data[2][1] = html_print_select(
$all_agents,
'id_agents[]',
0,
false,
'',
'',
true,
2022-01-24 12:19:09 +01:00
true,
true,
'',
false,
'min-width: 500px; max-width: 500px; max-height: 100px',
false,
false,
false,
'',
false,
false,
false,
false,
true,
true,
true
);
2022-01-26 12:17:07 +01:00
echo '<form method="post" autocomplete="off" id="form_agent" action="index.php?sec=gmassive&sec2=godmode/massive/massive_operations&option=edit_agents">';
echo html_print_avoid_autocomplete();
html_print_table($table);
$nombre_agente = '';
$direccion_agente = '';
$id_agente = 0;
$id_parent = 0;
$cascade_protection = 0;
$group = 0;
$interval = '';
$id_os = 0;
$server_name = 0;
$description = '';
echo '<div id="form_agents" style="display:none">';
$table = new StdClass();
2015-06-15 15:50:28 +02:00
$table->width = '100%';
$table->class = 'databox filters';
$table->head = [];
$table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->size[0] = '15%';
$table->size[1] = '35%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$table->data = [];
$modules = db_get_all_rows_sql(
'SELECT id_agente_modulo as id_module, nombre as name FROM tagente_modulo
WHERE id_agente = '.$id_parent
);
if ($modules === false) {
$modules = [];
}
$modules_values = [];
$modules_values[0] = __('Any');
foreach ($modules as $m) {
$modules_values[$m['id_module']] = $m['name'];
}
$table->data[0][0] = __('Parent');
$params = [];
$params['return'] = true;
$params['show_helptip'] = true;
$params['input_name'] = 'id_parent';
2016-10-13 09:55:53 +02:00
$params['print_hidden_input_idagent'] = true;
$params['hidden_input_idagent_name'] = 'id_agent_parent';
$params['hidden_input_idagent_value'] = $id_parent;
$params['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent);
2017-08-30 15:52:28 +02:00
$params['selectbox_id'] = 'cascade_protection_module';
$params['javascript_is_function_select'] = true;
$table->data[0][1] = ui_print_agent_autocomplete_input($params);
$table->data[0][1] .= '<b>'.__('Cascade protection').'</b>'.html_print_select(
[
1 => __('Yes'),
0 => __('No'),
],
'cascade_protection',
-1,
'',
__('No change'),
-1,
true
);
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Module').'&nbsp;';
$table->data[0][1] .= html_print_select(
$modules,
'cascade_protection_module',
$cascade_protection_module,
'',
'',
0,
true
);
$table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w290px inline">';
$table->data[1][1] .= html_print_select_groups(
false,
'AR',
false,
'group',
$group,
'',
__('No change'),
-1,
true,
false,
true,
'',
false,
'width: 150px;'
);
$table->data[1][1] .= '</div>';
$table->data[2][0] = __('Interval');
$table->data[2][1] = html_print_extended_select_for_time(
'interval',
0,
'',
__('No change'),
'0',
10,
true,
'width: 150px',
false
);
$table->data[3][0] = __('OS');
$table->data[3][1] = html_print_select_from_sql(
'SELECT id_os, name FROM tconfig_os',
'id_os',
$id_os,
'',
__('No change'),
-1,
true,
false,
true,
false,
'width: 105px;'
);
$table->data[3][1] .= ' <span id="os_preview">';
$table->data[3][1] .= ui_print_os_icon($id_os, false, true);
$table->data[3][1] .= '</span>';
2022-01-24 12:19:09 +01:00
// Network server.
$none = '';
if ($server_name == '' && $id_agente) {
$none = __('None');
}
$table->data[4][0] = __('Server');
$table->data[4][1] = html_print_select(
servers_get_names(),
'server_name',
$server_name,
'',
__('No change'),
-1,
true,
false,
true,
'',
false,
'width: 150px;'
);
2022-01-24 12:19:09 +01:00
// Description.
$table->data[5][0] = __('Description');
$table->data[5][1] = html_print_input_text(
'description',
$description,
'',
45,
255,
true
);
html_print_table($table);
unset($table);
$custom_id = '';
$mode = -1;
$disabled = -1;
$new_agent = true;
$icon_path = '';
$update_gis_data = -1;
$cascade_protection = -1;
$cascade_protection_module = -1;
$quiet_select = -1;
$table = new StdClass();
2015-06-15 15:50:28 +02:00
$table->width = '100%';
$table->class = 'databox filters';
$table->size[0] = '15%';
$table->size[1] = '35%';
$table->size[2] = '15%';
$table->size[3] = '35%';
$table->head = [];
$table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->data = [];
2022-01-24 12:19:09 +01:00
// Custom ID.
$table->data[0][0] = __('Custom ID');
$table->data[0][1] = html_print_input_text('custom_id', $custom_id, '', 16, 255, true);
// Secondary Groups.
if (enterprise_installed() === true) {
$table->data['secondary_groups_added'][0] = __('Secondary groups added');
$table->data['secondary_groups_added'][1] = html_print_select_agent_secondary(
$agent,
$id_agente,
[
'container' => true,
'id_form' => 'form_agent',
'extra_id' => '_added',
]
);
$table->data['seconsary_groups_removed'][0] = __('Secondary groups remove');
$table->data['seconsary_groups_removed'][1] = html_print_select_agent_secondary(
$agent,
$id_agente,
[
'container' => true,
'id_form' => 'form_agent',
'extra_id' => '_removed',
]
);
}
2022-01-24 12:19:09 +01:00
// Learn mode / Normal mode.
$table->data[1][0] = __('Module definition');
$table->data[1][1] = __('No change').' ';
$table->data[1][1] .= html_print_radio_button_extended(
'mode',
-1,
'',
$mode,
false,
'',
'class="mrgn_right_40px"',
true
);
$table->data[1][1] .= __('Learning mode').' ';
$table->data[1][1] .= html_print_radio_button_extended(
'mode',
1,
'',
$mode,
false,
'',
'class="mrgn_right_40px"',
true
);
$table->data[1][1] .= __('Normal mode').' ';
$table->data[1][1] .= html_print_radio_button_extended(
'mode',
0,
'',
$mode,
false,
'',
'class="mrgn_right_40px"',
true
);
$table->data[1][1] .= __('Autodisable mode').' ';
$table->data[1][1] .= html_print_radio_button_extended(
'mode',
2,
'',
$mode,
false,
'',
'class="mrgn_right_40px"',
true
);
2022-01-24 12:19:09 +01:00
// Status (Disabled / Enabled).
$table->data[2][0] = __('Status');
$table->data[2][1] = __('No change').' ';
$table->data[1][1] .= html_print_radio_button_extended(
'disabled',
-1,
'',
$disabled,
false,
'',
'class="mrgn_right_40px"',
true
);
$table->data[2][1] .= __('Disabled').' ';
$table->data[1][1] .= ui_print_help_tip(
__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'),
true
).' ';
$table->data[1][1] .= html_print_radio_button_extended(
'disabled',
1,
'',
$disabled,
false,
'',
'class="mrgn_right_40px"',
true
);
$table->data[2][1] .= __('Active').' ';
$table->data[1][1] .= html_print_radio_button_extended(
'disabled',
0,
'',
$disabled,
false,
'',
'class="mrgn_right_40px"',
true
);
2022-01-24 12:19:09 +01:00
// Remote configuration.
$table->data[3][0] = __('Remote configuration');
2022-01-24 12:19:09 +01:00
// Delete remote configuration.
$table->data[3][1] = '<div id="delete_configurations" class="invisible">'.__('Delete available remote configurations').' (';
$table->data[3][1] .= '<span id="n_configurations"></span>';
$table->data[3][1] .= ') '.html_print_checkbox_extended('delete_conf', 1, 0, false, '', 'class="mrgn_right_40px"', true).'</div>';
$table->data[3][1] .= '<div id="not_available_configurations" class="invisible"><em>'.__('Not available').'</em></div>';
2011-04-27 Juan Manuel Ramon <juanmanuel.ramon@artica.es> * include/functions_graph.php include/functions_users.php include/functions_events.php include/functions_html.php include/functions_menu.php include/styles/pandora.css include/graphs/functions_pchart.php include/functions_messages.php include/functions_exportserver.php include/functions_modules.php include/functions_reporting.php include/functions_filemanager.php include/functions_groups.php include/functions_gis.php include/functions_networkmap.php include/functions_servers.php include/functions_network_components.php include/functions_visual_map.php include/ajax/skins.ajax.php include/ajax/visual_console_builder.ajax.php include/help/en/help_gis_map_builder.php include/help/en/help_agent_status.php include/help/en/help_eventview.php include/help/en/help_configure_gis_map.php include/help/en/help_cascade_protection.php include/help/en/help_setup_gis_index.php include/help/es/help_gis_map_builder.php include/help/es/help_agent_status.php include/help/es/help_eventview.php include/help/es/help_configure_gis_map.php include/help/es/help_cascade_protection.php include/help/ja/help_gis_map_builder.php include/help/ja/help_agent_status.php include/help/ja/help_eventview.php include/help/ja/help_configure_gis_map.php include/help/ja/help_cascade_protection.php include/help/ja/help_setup_gis_index.php include/functions_ui.php include/functions_incidents.php include/functions.php include/functions_agents.php include/functions_db.php include/functions_fsgraph.php include/functions_extensions.php include/functions_ui_renders.php extensions/insert_data.php extensions/system_info.php extensions/extension_uploader.php extensions/agents_modules.php extensions/dbmanager.php extensions/resource_registration.php extensions/resource_exportation.php extensions/users_connected.php extensions/module_groups.php extensions/update_manager/settings.php extensions/update_manager/main.php operation/incidents/incident.incident.php operation/incidents/incident.php operation/incidents/incident.files.php operation/incidents/incident.tracking.php operation/incidents/incident_detail.php operation/incidents/incident.workunits.php operation/incidents/incident.list.php operation/search_modules.php operation/extensions.php operation/visual_console/render_view.php operation/visual_console/index.php operation/agentes/status_monitor.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/alerts_status.php operation/agentes/estado_generalagente.php operation/agentes/custom_fields.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/alerts_status.functions.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/gis_view.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/graphs.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/search_agents.php operation/search_graphs.php operation/snmpconsole/snmp_view.php operation/users/user_edit.php operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php operation/integria_incidents/incident.files.php operation/integria_incidents/incident.tracking.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident.workunits.php operation/integria_incidents/incident.list.php operation/gis_maps/render_view.php operation/gis_maps/ajax.php operation/gis_maps/index.php operation/events/export_csv.php operation/events/sound_events.php operation/events/events_validate.php operation/events/events_list.php operation/events/events.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php operation/reporting/custom_reporting.php operation/search_reports.php operation/search_maps.php operation/search_results.php operation/search_users.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/tactical.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/events/events.php mobile/operation/servers/view_servers.php mobile/include/user.class.php general/pandora_help.php general/noaccess.php general/login_page.php general/logon_ok.php general/logoff.php general/ui/agents_list.php general/header.php godmode/groups/modu_group_list.php godmode/groups/configure_group.php godmode/groups/configure_modu_group.php godmode/groups/group_list.php godmode/admin_access_logs.php godmode/extensions.php godmode/db/db_sanity.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_event.php godmode/db/db_purge.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/module_manager_editor_network.php godmode/agentes/fields_manager.php godmode/agentes/module_manager_editor_wmi.php godmode/agentes/module_manager_editor_plugin.php godmode/agentes/agent_conf_gis.php godmode/agentes/module_manager_editor_prediction.php godmode/agentes/module_manager.php godmode/agentes/modificar_agente.php godmode/agentes/configurar_agente.php godmode/agentes/configure_field.php godmode/agentes/module_manager_editor.php godmode/agentes/planned_downtime.php godmode/agentes/manage_config_remote.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/servers/manage_recontask_form.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/alert_compounds.php godmode/alerts/alert_list.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/snmpconsole/snmp_alert.php godmode/snmpconsole/snmp_filters.php godmode/setup/file_manager.php godmode/setup/os.list.php godmode/setup/news.php godmode/setup/gis_step_2.php godmode/setup/links.php godmode/setup/setup.php godmode/setup/os.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/gis.php godmode/setup/os.builder.php godmode/setup/setup_visuals.php godmode/users/user_list.php godmode/users/configure_user.php godmode/users/configure_profile.php godmode/gis_maps/configure_gis_map.php godmode/gis_maps/index.php godmode/massive/massive_add_alerts.php godmode/massive/massive_copy_modules.php godmode/massive/massive_delete_agents.php godmode/massive/massive_enable_disable_alerts.php godmode/massive/massive_operations.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_action_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/massive/massive_standby_alerts.php godmode/massive/massive_add_action_alerts.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/module_list.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/modules/manage_network_components_form_plugin.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/graph_builder.main.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/visual_console_builder.php godmode/reporting/reporting_builder.preview.php godmode/reporting/reporting_builder.main.php godmode/reporting/visual_console_builder.data.php godmode/reporting/visual_console_builder.elements.php godmode/reporting/graph_builder.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/reporting/reporting_builder.item_editor.php godmode/reporting/map_builder.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php: Now functions on functions_html.php, functions_gis.php, functions_filemanager.php, functions_exportserver.php have "html_", "gis_", "filemanager_" and "exportserver_" prefix respectively. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4281 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-27 15:43:31 +02:00
$listIcons = gis_get_array_list_icons();
$arraySelectIcon = [];
foreach ($listIcons as $index => $value) {
$arraySelectIcon[$index] = $index;
}
$path = 'images/gis_map/icons/';
// TODO set better method the path
if ($icon_path == '') {
$display_icons = 'none';
2022-01-24 12:19:09 +01:00
// Hack to show no icon. Use any given image to fix not found image errors.
$path_without = 'images/spinner.png';
$path_default = 'images/spinner.png';
$path_ok = 'images/spinner.png';
$path_bad = 'images/spinner.png';
$path_warning = 'images/spinner.png';
} else {
$display_icons = '';
$path_without = $path.$icon_path.'.default.png';
$path_default = $path.$icon_path.'.default.png';
$path_ok = $path.$icon_path.'.ok.png';
$path_bad = $path.$icon_path.'.bad.png';
$path_warning = $path.$icon_path.'.warning.png';
}
$table->data[4][0] = __('Agent icon');
$table->data[4][1] = html_print_select($arraySelectIcon, 'icon_path', $icon_path, 'changeIcons();', __('No change'), '', true).'&nbsp;'.__('Without status').': '.html_print_image($path_without, true, ['id' => 'icon_without_status', 'style' => 'display:'.$display_icons.';']).'&nbsp;'.__('Default').': '.html_print_image($path_default, true, ['id' => 'icon_default', 'style' => 'display:'.$display_icons.';']).'&nbsp;'.__('Ok').': '.html_print_image($path_ok, true, ['id' => 'icon_ok', 'style' => 'display:'.$display_icons.';']).'&nbsp;'.__('Bad').': '.html_print_image($path_bad, true, ['id' => 'icon_bad', 'style' => 'display:'.$display_icons.';']).'&nbsp;'.__('Warning').': '.html_print_image($path_warning, true, ['id' => 'icon_warning', 'style' => 'display:'.$display_icons.';']);
if ($config['activate_gis']) {
$table->data[5][0] = __('Ignore new GIS data:');
$table->data[5][1] = __('No change').' '.html_print_radio_button_extended('update_gis_data', -1, '', $update_gis_data, false, '', 'class="mrgn_right_40px"', true);
$table->data[5][1] .= __('Yes').' '.html_print_radio_button_extended('update_gis_data', 0, '', $update_gis_data, false, '', 'class="mrgn_right_40px"', true);
$table->data[5][1] .= __('No').' '.html_print_radio_button_extended('update_gis_data', 1, '', $update_gis_data, false, '', 'class="mrgn_right_40px"', true);
}
$table->data[6][0] = __('Quiet');
$table->data[6][0] .= ui_print_help_tip(__('The agent still runs but the alerts and events will be stop'), true);
$table->data[6][1] = html_print_select(
[
-1 => __('No change'),
1 => __('Yes'),
0 => __('No'),
],
'quiet_select',
$quiet_select,
'',
'',
0,
true
);
$table->data[7][0] = __('Safe operation mode').': '.ui_print_help_tip(
__(
'This mode allow %s to disable all modules
of this agent while the selected module is on CRITICAL status',
get_product_name()
),
true
);
$table->data[7][1] .= html_print_select(
[
1 => __('Enabled'),
0 => __('Disabled'),
],
'safe_mode_change',
-1,
'',
__('No change'),
-1,
true
).'&nbsp;';
$table->data[7][1] .= __('Module').'&nbsp;'.html_print_select('', 'safe_mode_module', '', '', __('Any'), -1, true).'</div>';
ui_toggle(html_print_table($table, true), __('Advanced options'));
unset($table);
$table = new StdClass();
2015-06-15 15:50:28 +02:00
$table->width = '100%';
$table->class = 'databox filters';
$table->head = [];
$table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->data = [];
$table->size[0] = '15%';
$table->size[1] = '35%';
$table->size[2] = '15%';
$table->size[3] = '35%';
* include/functions_graph.php include/functions_html.php include/functions_messages.php include/db/postgresql.php include/db/mysql.php include/db/oracle.php include/functions_reporting.php include/functions_filemanager.php include/functions_gis.php include/auth/ldap.php include/auth/mysql.php include/functions_networkmap.php include/functions_network_components.php include/ajax/skins.ajax.php include/ajax/reporting.ajax.php include/ajax/visual_console_builder.ajax.php include/ajax/alert_list.ajax.php include/ajax/module.php include/functions_config.php include/functions_api.php include/help/en/help_timesource.php include/help/es/help_timesource.php include/help/ja/help_timesource.php include/config_process.php include/functions_ui.php include/functions_custom_graphs.php include/fgraph.php include/functions_incidents.php include/api.php include/functions_reports.php include/functions_ui_renders.php extensions/insert_data.php extensions/system_info.php extensions/extension_uploader.php extensions/pandora_logs.php extensions/agents_modules.php extensions/update_manager.php extensions/ssh_console.php extensions/dbmanager.php extensions/vnc_view.php extensions/resource_registration.php extensions/resource_exportation.php extensions/users_connected.php extensions/module_groups.php extensions/update_manager/load_updatemanager.php extensions/update_manager/lib/libupdate_manager_client.php extensions/update_manager/lib/libupdate_manager.php extensions/update_manager/lib/libupdate_manager_components.php extensions/update_manager/lib/libupdate_manager_updates.php extensions/update_manager/settings.php extensions/update_manager/main.php extensions/plugin_registration.php operation/incidents/incident.php operation/incidents/incident_detail.php operation/incidents/incident_statistics.php operation/search_modules.php operation/visual_console/render_view.php operation/visual_console/index.php operation/extensions.php operation/agentes/status_monitor.php operation/agentes/export_csv.php operation/agentes/estado_ultimopaquete.php operation/agentes/datos_agente.php operation/agentes/alerts_status.php operation/agentes/estado_generalagente.php operation/agentes/custom_fields.php operation/agentes/estado_agente.php operation/agentes/networkmap.topology.php operation/agentes/networkmap.groups.php operation/agentes/sla_view.php operation/agentes/exportdata.php operation/agentes/gis_view.php operation/agentes/estado_monitores.php operation/agentes/ver_agente.php operation/agentes/graphs.php operation/agentes/agent_fields.php operation/agentes/tactical.php operation/agentes/group_view.php operation/agentes/networkmap.php operation/agentes/stat_win.php operation/servers/view_server.php operation/servers/view_server_detail.php operation/menu.php operation/search_agents.php operation/search_graphs.php operation/snmpconsole/snmp_view.php operation/users/user_edit.php operation/gis_maps/render_view.php operation/gis_maps/ajax.php operation/integria_incidents/incident.php operation/integria_incidents/incident_detail.php operation/integria_incidents/incident_statistics.php operation/events/event_statistics.php operation/events/events_rss.php operation/events/export_csv.php operation/events/sound_events.php operation/events/events_validate.php operation/events/events_list.php operation/events/events_marquee.php operation/events/events.php operation/search_alerts.php operation/messages/message.php operation/reporting/reporting_xml.php operation/reporting/reporting_viewer.php operation/reporting/graph_viewer.php operation/search_reports.php operation/search_maps.php operation/search_users.php extras/pandora_diag.php mobile/operation/agents/monitor_status.php mobile/operation/agents/view_agents.php mobile/operation/agents/view_alerts.php mobile/operation/agents/group_view.php mobile/operation/events/events.php mobile/index.php general/error_authconfig.php general/links_menu.php general/logon_ok.php general/error_dbconfig.php general/ui/agents_list.php general/header.php godmode/groups/modu_group_list.php godmode/groups/configure_group.php godmode/groups/configure_modu_group.php godmode/groups/group_list.php godmode/admin_access_logs.php godmode/db/db_main.php godmode/db/db_audit.php godmode/db/db_sanity.php godmode/db/db_refine.php godmode/db/db_info.php godmode/db/db_event.php godmode/db/db_purge.php godmode/extensions.php godmode/agentes/agent_template.php godmode/agentes/module_manager_editor_common.php godmode/agentes/fields_manager.php godmode/agentes/agent_conf_gis.php godmode/agentes/module_manager_editor_prediction.php godmode/agentes/module_manager.php godmode/agentes/modificar_agente.php godmode/agentes/configurar_agente.php godmode/agentes/configure_field.php godmode/agentes/module_manager_editor.php godmode/agentes/planned_downtime.php godmode/agentes/manage_config_remote.php godmode/agentes/agent_manager.php godmode/servers/recon_script.php godmode/servers/plugin.php godmode/servers/manage_recontask.php godmode/servers/modificar_server.php godmode/servers/manage_recontask_form.php godmode/alerts/alert_list.list.php godmode/alerts/configure_alert_compound.php godmode/alerts/alert_compounds.php godmode/alerts/alert_list.php godmode/alerts/configure_alert_template.php godmode/alerts/alert_templates.php godmode/alerts/configure_alert_action.php godmode/alerts/configure_alert_command.php godmode/alerts/alert_actions.php godmode/alerts/alert_list.builder.php godmode/alerts/alert_commands.php godmode/setup/file_manager.php godmode/setup/os.list.php godmode/setup/news.php godmode/setup/gis_step_2.php godmode/setup/links.php godmode/setup/setup.php godmode/setup/os.php godmode/setup/performance.php godmode/setup/setup_auth.php godmode/setup/gis.php godmode/setup/os.builder.php godmode/setup/setup_visuals.php godmode/snmpconsole/snmp_alert.php godmode/snmpconsole/snmp_filters.php godmode/users/user_list.php godmode/users/configure_profile.php godmode/gis_maps/configure_gis_map.php godmode/gis_maps/index.php godmode/massive/massive_add_alerts.php godmode/massive/massive_copy_modules.php godmode/massive/massive_delete_agents.php godmode/massive/massive_enable_disable_alerts.php godmode/massive/massive_operations.php godmode/massive/massive_delete_profiles.php godmode/massive/massive_edit_agents.php godmode/massive/massive_delete_action_alerts.php godmode/massive/massive_delete_modules.php godmode/massive/massive_add_profiles.php godmode/massive/massive_delete_alerts.php godmode/massive/massive_edit_modules.php godmode/massive/massive_standby_alerts.php godmode/massive/massive_add_action_alerts.php godmode/modules/manage_network_components_form.php godmode/modules/manage_nc_groups_form.php godmode/modules/manage_network_templates.php godmode/modules/module_list.php godmode/modules/manage_network_components_form_common.php godmode/modules/manage_network_components_form_network.php godmode/modules/manage_network_templates_form.php godmode/modules/manage_network_components_form_wmi.php godmode/modules/manage_network_components.php godmode/modules/manage_nc_groups.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/graph_builder.main.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/visual_console_builder.php godmode/reporting/reporting_builder.preview.php godmode/reporting/reporting_builder.main.php godmode/reporting/visual_console_builder.data.php godmode/reporting/visual_console_builder.elements.php godmode/reporting/graph_builder.php godmode/reporting/visual_console_builder.preview.php godmode/reporting/graph_builder.graph_editor.php godmode/reporting/reporting_builder.php godmode/reporting/visual_console_builder.editor.php godmode/reporting/reporting_builder.item_editor.php godmode/reporting/map_builder.php godmode/reporting/graphs.php godmode/reporting/graph_builder.preview.php include/functions_db.php: Added some includes and functions of this code have "db_" prefix. * include/functions.php: Moved function check_login(), check_acl(), dame_nombre_pluginid(), get_os_name() from functions_db.php to functions.php. * include/functions_groups.php: Moved functions get_childrens(), safe_acl_group() and get_parents(), give_disabled_group(), isAllGroups(), get_group_icon(), get_all_groups(), get_id_groups_recursive(), get_user_groups_tree_recursive(), get_group_status(), get_group_name(), get_group_users() from functions_db.php to this code. * include/functions_profile.php: New library with profile functions. Moved functions get_profile_name(), get_profiles(), create_user_profile(), delete_user_profile(), delete_profile() from functions_db.php to this code. Added new parameter in function get_profile() to retrieve profiles with filter conditions applied. * include/functions_users.php: New library with users functions. Moved functions get_users_info(), get_all_model_groups(), get_user_groups(), get_user_groups_tree(), get_user_first_group(), user_access_to_agent() from funtions_db.php to this code. * godmode/users/configure_user.php: Changed get_profile_filter() function to get_profile(). * include/functions_agents.php: Moved functions get_group_agents(), get_agent_modules(), get_agent_module_id(), get_agent_id(), get_agent_name(), get_agent_modules_data_count(), check_alert_fired(), get_agent_interval(), get_agent_os(), give_agentmodule_flag(), agent_add_address(), agent_delete_address(), get_agent_address(), get_agent_with_ip(), get_agent_addresses(), get_agent_status(), delete_agent(), get_agentmodule_group(), get_agent_group() from functions_db.php to this code. * include/functions_modules.php: Moved functions get_agentmodule(), get_agentmodule_id(), get_agentmodule_is_init(), get_agent_modules_count(), get_module_type_name(), get_module_type_icon(), get_agentmodule_agent(), get_agentmodule_agent_name(), get_agentmodule_name(), get_agentmodule_type(), get_monitor_downs_in_period(), get_monitor_last_down_timestamp_in_period(), get_monitors_in_group(), get_monitors_in_agent(), get_monitors_down(), get_moduletype_name(), get_moduletype_description(), get_moduletypes(), get_module_interval(), show_icon_type(), give_modulecategory_name(), give_agent_id_from_module_id(), get_module_status(), get_agent_module_last_value(), get_previous_data(), get_agentmodule_modulegroup(), get_modulegroups(), get_modulegroup_name() from functions_db.php to this code. * include/functions_alerts.php: Moved functions get_alert_type(), get_agent_alert_fired(), get_module_alert_fired(), get_alert_fires_in_period(), get_group_alerts(), get_alerts_fired(), get_alert_last_fire_timestamp_in_period(), get_agentmodule_status(), get_agentmodule_last_status() from functions_db.php to this code. * include/functions_exportserver.php: Moved function dame_nombre_servidorexportacion() from functions_db.php to this code. * include/functions_events.php: Moved functions get_group_events(), get_agent_events(), get_module_events() from functions_db.php to this code. * include/functions_servers.php: Moved functions get_server_name(), show_server_type(), check_server_status(), server_status() from functions_db.php to this code. * include/functions_network_profiles.php: Moved function get_networkprofile_name() from functions_db.php to this code. * include/functions_visual_map.php: Moved functions get_layoutdata_x(), get_layoutdata_y() from fucntions_db.php to this code. * include/functions_io.php: Moved function __() from functions_db.php to this code. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4258 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
2011-04-19 20:42:49 +02:00
$fields = db_get_all_fields_in_table('tagent_custom_fields');
if ($fields === false) {
$fields = [];
}
foreach ($fields as $field) {
$data[0] = '<b>'.$field['name'].'</b>';
$combo = [];
$combo = $field['combo_values'];
$combo = explode(',', $combo);
$combo_values = [];
foreach ($combo as $value) {
$combo_values[$value] = $value;
}
$custom_value = db_get_value_filter('description', 'tagent_custom_data', ['id_field' => $field['id_field'], 'id_agent' => $id_agente]);
if ($custom_value === false) {
$custom_value = '';
}
if ($field['is_password_type']) {
2022-01-26 12:17:07 +01:00
$data[1] = html_print_input_password_avoid_autocomplete();
$data[1] .= html_print_input_text_extended(
'customvalue_'.$field['id_field'],
$custom_value,
'customvalue_'.$field['id_field'],
'',
30,
100,
$view_mode,
'',
'',
true,
true
);
} else {
$data[1] = html_print_textarea('customvalue_'.$field['id_field'], 2, 65, $custom_value, 'class="mrgn_right_30px"', true);
}
if ($field['combo_values'] !== '') {
$data[1] = html_print_input(
[
'type' => 'select_search',
'fields' => $combo_values,
'name' => 'customvalue_'.$field['id_field'],
'selected' => $custom_value,
'nothing' => __('No change'),
'nothing_value' => '',
'return' => true,
'sort' => false,
]
);
};
array_push($table->data, $data);
}
if (!empty($fields)) {
ui_toggle(html_print_table($table, true), __('Custom fields'));
}
echo '<h3 class="error invisible" id="message"> </h3>';
html_print_input_hidden('id_agente', $id_agente);
attachActionButton('update_agents', 'update', $table->width);
2021-02-12 11:28:13 +01:00
// Shown and hide div.
echo '</div></form>';
ui_require_jquery_file('form');
ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('ajaxqueue');
ui_require_jquery_file('bgiframe');
?>
<script type="text/javascript">
/* <![CDATA[ */
var limit_parameters_massive = <?php echo $config['limit_parameters_massive']; ?>;
//Use this function for change 3 icons when change the selectbox
$(document).ready (function () {
var checked = $("#cascade_protection").val();
$("#cascade_protection_module").attr("disabled", 'disabled');
$("#cascade_protection").change(function () {
var checked = $("#cascade_protection").val();
if (checked == 1) {
$("#cascade_protection_module").removeAttr("disabled");
}
else {
$("#cascade_protection_module").val(0);
$("#cascade_protection_module").attr("disabled", 'disabled');
}
});
// Enable Safe Operation Mode if 'Enabled' is selected.
$("#safe_mode_module").attr("disabled", "disabled");
$("#safe_mode_change").on('change', function() {
if ($("#safe_mode_change").val() == 1) {
$("#safe_mode_module").removeAttr("disabled");
refreshSafeModules();
}
else {
$("#safe_mode_module").attr("disabled", "disabled");
$('#safe_mode_module').empty();
$("#safe_mode_module").append($("<option></option>").attr("value", 'Any').html('Any'));
2022-01-24 12:19:09 +01:00
}
});
2022-01-24 12:19:09 +01:00
// Fill modules in Safe Operation Mode.
function refreshSafeModules(){
var idAgents = Array();
jQuery.each ($("#id_agents option:selected"), function (i, val) {
idAgents.push($(val).val());
});
var params = {
"page" : "operation/agentes/ver_agente",
"get_agent_modules_json_for_multiple_agents" : 1,
"id_agent" : idAgents,
"selection_mode": "common"
};
2022-01-24 12:19:09 +01:00
jQuery.post ("ajax.php",
params,
function (data, status) {
$('#safe_mode_module').empty();
if($.type(data) === "object"){
jQuery.each (data, function (id, value) {
option = $("<option></option>").attr("value", value).html(value);
$("#safe_mode_module").append(option);
});
} else {
option = $("<option></option>").attr("value", 'None').html('None');
$("#safe_mode_module").append(option);
}
},
"json"
);
}
$("#form_agent").submit(function() {
var get_parameters_count = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&').length;
var post_parameters_count = $("#form_agent").serializeArray().length;
2022-01-24 12:19:09 +01:00
var count_parameters =
get_parameters_count + post_parameters_count;
2022-01-24 12:19:09 +01:00
if (count_parameters > limit_parameters_massive) {
alert("<?php echo __('Unsucessful sending the data, please contact with your administrator or make with less elements.'); ?>");
return false;
}
});
2022-01-21 11:49:30 +01:00
var disabled;
2022-01-21 11:49:30 +01:00
$("#disabled").change(function () {
disabled = this.value;
$("#id_group").trigger("change");
});
2022-01-21 11:49:30 +01:00
$('#id_agents').on('change', function() {
var idAgents = Array();
jQuery.each ($("#id_agents option:selected"), function (i, val) {
idAgents.push($(val).val());
});
jQuery.post ("ajax.php",
{"page" : "godmode/massive/massive_edit_agents",
"get_n_conf_files" : 1,
"id_agents[]" : idAgents
},
function (data, status) {
if (data == 0) {
$("#delete_configurations").attr("style", "display: none");
$("#not_available_configurations").attr("style", "");
}
else {
$("#n_configurations").text(data);
$("#not_available_configurations").attr("style", "display: none");
$("#delete_configurations").attr("style", "");
}
},
"json"
);
$("#form_agents").attr("style", "");
if($("#safe_mode_change").val() == 1) {
refreshSafeModules();
}
});
2022-01-24 12:19:09 +01:00
$("#id_group").change (function () {
$("#form_agents").attr("style", "display: none");
});
2022-01-24 12:19:09 +01:00
$("select#id_os").pandoraSelectOS ();
2022-01-24 12:19:09 +01:00
var recursion;
$("#checkbox-recursion2").click(function () {
recursion = this.checked ? 1 : 0;
$("#id_group").trigger("change");
});
2022-01-24 12:19:09 +01:00
$("#id_group").pandoraSelectGroupAgent ({
status_agents: function () {
return $("#status_agents").val();
},
agentSelect: "select#id_agents",
privilege: "AW",
recursion: function() {
return recursion;
},
disabled: function() {
return disabled;
}
});
2022-01-24 12:19:09 +01:00
$("#status_agents").change(function() {
$("#id_group").trigger("change");
});
2022-01-24 12:19:09 +01:00
disabled = 2;
2022-01-24 12:19:09 +01:00
//$("#id_group").trigger("change");
});
function changeIcons() {
var icon = $("#icon_path :selected").val();
2022-01-24 12:19:09 +01:00
$("#icon_without_status").attr("src", "images/spinner.png");
$("#icon_default").attr("src", "images/spinner.png");
$("#icon_ok").attr("src", "images/spinner.png");
$("#icon_bad").attr("src", "images/spinner.png");
$("#icon_warning").attr("src", "images/spinner.png");
2022-01-24 12:19:09 +01:00
if (icon.length == 0) {
$("#icon_without_status").attr("style", "display:none;");
$("#icon_default").attr("style", "display:none;");
$("#icon_ok").attr("style", "display:none;");
$("#icon_bad").attr("style", "display:none;");
$("#icon_warning").attr("style", "display:none;");
}
else {
$("#icon_without_status").attr("src",
"<?php echo $path; ?>" + icon + ".default.png");
$("#icon_default").attr("src",
"<?php echo $path; ?>" + icon + ".default.png");
$("#icon_ok").attr("src",
"<?php echo $path; ?>" + icon + ".ok.png");
$("#icon_bad").attr("src",
"<?php echo $path; ?>" + icon + ".bad.png");
$("#icon_warning").attr("src",
"<?php echo $path; ?>" + icon + ".warning.png");
$("#icon_without_status").attr("style", "");
$("#icon_default").attr("style", "");
$("#icon_ok").attr("style", "");
$("#icon_bad").attr("style", "");
$("#icon_warning").attr("style", "");
}
}
</script>