diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 4033e7616f..fa75a7b452 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -930,10 +930,10 @@ You can of course remove the warnings, that's why we include the source and do n $agents = agents_get_group_agents($group); if ((empty($agents)) || $agents == -1) $agents = array(); - $sql_log = 'SELECT source + $sql_log = 'SELECT source AS k, source AS v FROM tagente,tagent_module_log - WHERE tagente.id_agente = tagent_module_log.id_agent '; - + WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0'; + if (!empty($agents)) { $index = 0; foreach ($agents as $key => $a) { @@ -947,7 +947,7 @@ You can of course remove the warnings, that's why we include the source and do n } $sql_log .= ")"; } - html_print_select_from_sql ($sql_log, 'source', $source, '', __('All'), '', false, false, false); + html_print_select_from_sql ($sql_log, 'source', $source, 'onselect=source_change_agents();', __('All'), '', false, false, false); ?> @@ -1066,9 +1066,15 @@ You can of course remove the warnings, that's why we include the source and do n $value) { @@ -1089,6 +1095,7 @@ You can of course remove the warnings, that's why we include the source and do n } } html_print_select($agents2, 'id_agents2[]', $agents_select, $script = '', "", 0, false, true, true, '', false, "min-width: 180px"); + echo ""; ?> @@ -3522,4 +3529,22 @@ function set_last_value_period() { $("#row_period").show(); } } + +function source_change_agents() { + $("#id_agents2").empty(); + $("#spinner_hack").show(); + jQuery.post ("ajax.php", + {"page" : "operation/agentes/ver_agente", + "get_agents_source_json" : 1, + "source" : $("#source").val() + }, + function (data, status) { + for (var clave in data) { + $("#id_agents2").append(''); + } + $("#spinner_hack").hide(); + }, + "json" + ); +} diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 1fe124f841..e2f531017b 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -44,6 +44,7 @@ if (is_ajax ()) { $get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip"); $get_group_status_tooltip = (bool) get_parameter ("get_group_status_tooltip"); $get_agent_id = (bool) get_parameter ("get_agent_id"); + $get_agents_source_json = (bool) get_parameter ("get_agents_source_json"); $cluster_mode = (bool) get_parameter ("cluster_mode",0); $agent_alias = get_parameter('alias', ''); $agents_inserted = get_parameter('agents_inserted', array()); @@ -1001,6 +1002,29 @@ if (is_ajax ()) { return; } + if ($get_agents_source_json) { + $source = get_parameter('source', ''); + + if (empty($source)) { + $sql_report_log = 'SELECT id_agente, alias + FROM tagente, tagent_module_log + WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0'; + } else { + $sql_report_log = 'SELECT id_agente, alias + FROM tagente, tagent_module_log + WHERE tagente.id_agente = tagent_module_log.id_agent AND tagente.disabled = 0 AND tagent_module_log.source like "'. $source.'"'; + } + + $all_agent_log = db_get_all_rows_sql($sql_report_log); + + foreach ($all_agent_log as $key => $value) { + $agents2[$value['id_agente']] = $value['alias']; + } + + echo json_encode($agents2); + return; + } + return; }