2013-03-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/reporting_builder.item_editor.php, include/functions_ui.php, include/functions_reporting.php, include/constants.php, include/ajax/reporting.ajax.php, include/ajax/agent.php, operation/agentes/ver_agente.php: fixed the graphs and the autocomplete. Fixes: #3606284 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7771 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
b8c348d69d
commit
154c735914
|
@ -1,3 +1,13 @@
|
|||
2013-03-04 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/reporting/reporting_builder.item_editor.php,
|
||||
include/functions_ui.php, include/functions_reporting.php,
|
||||
include/constants.php, include/ajax/reporting.ajax.php,
|
||||
include/ajax/agent.php, operation/agentes/ver_agente.php: fixed the
|
||||
graphs and the autocomplete.
|
||||
|
||||
Fixes: #3606284
|
||||
|
||||
2013-03-04 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_alerts.php: Update the fired
|
||||
|
|
|
@ -626,6 +626,7 @@ html_print_input_hidden('id_item', $idItem);
|
|||
|
||||
html_print_input_hidden('id_agent', $idAgent);
|
||||
html_print_input_hidden ('server_name', $server_name);
|
||||
html_print_input_hidden ('id_server', '');
|
||||
|
||||
|
||||
$params = array();
|
||||
|
@ -1043,9 +1044,13 @@ function print_SLA_list($width, $action, $idItem = null) {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
|
||||
$idAgent = db_get_value_filter('id_agente',
|
||||
'tagente_modulo',
|
||||
array('id_agente_modulo' => $item['id_agent_module']));
|
||||
$nameAgent = agents_get_name ($idAgent);
|
||||
$nameModule = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
|
||||
$nameModule = db_get_value_filter('nombre',
|
||||
'tagente_modulo',
|
||||
array('id_agente_modulo' => $item['id_agent_module']));
|
||||
|
||||
$server_name_element = '';
|
||||
if ($meta && $server_name != '')
|
||||
|
@ -1093,9 +1098,9 @@ function print_SLA_list($width, $action, $idItem = null) {
|
|||
$params['javascript_is_function_select'] = true;
|
||||
$params['selectbox_id'] = 'id_agent_module_sla';
|
||||
$params['add_none_module'] = false;
|
||||
$params['use_input_server'] = true;
|
||||
$params['input_server_id'] = 'hidden-server_name';
|
||||
if ($meta) {
|
||||
$params['use_input_id_server'] = true;
|
||||
$params['input_id_server_id'] = 'hidden-id_server';
|
||||
$params['disabled_javascript_on_blur_function'] = true;
|
||||
}
|
||||
ui_print_agent_autocomplete_input($params);
|
||||
|
@ -1123,8 +1128,8 @@ function print_General_list($width, $action, $idItem = null) {
|
|||
global $meta;
|
||||
if (!isset($meta))
|
||||
$meta = false;
|
||||
|
||||
|
||||
|
||||
|
||||
include_once($config['homedir'] . '/include/functions_html.php');
|
||||
?>
|
||||
<table class="databox" id="general_list" border="0" cellpadding="4" cellspacing="4" width="98%">
|
||||
|
@ -1209,9 +1214,9 @@ function print_General_list($width, $action, $idItem = null) {
|
|||
$params['javascript_is_function_select'] = true;
|
||||
$params['selectbox_id'] = 'id_agent_module_general';
|
||||
$params['add_none_module'] = false;
|
||||
$params['use_input_server'] = true;
|
||||
$params['input_server_id'] = 'hidden-server_name_general';
|
||||
if ($meta) {
|
||||
$params['use_input_id_server'] = true;
|
||||
$params['input_id_server_id'] = 'hidden-id_server';
|
||||
$params['disabled_javascript_on_blur_function'] = true;
|
||||
}
|
||||
ui_print_agent_autocomplete_input($params);
|
||||
|
@ -1480,7 +1485,7 @@ function deleteGeneralRow(id_row) {
|
|||
function addSLARow() {
|
||||
var nameAgent = $("input[name=agent_sla]").val();
|
||||
var idAgent = $("input[name=id_agent_sla]").val();
|
||||
var serverName = $("input[name=server_name]").val();
|
||||
var serverId = $("input[name=id_server]").val();
|
||||
var idModule = $("#id_agent_module_sla").val();
|
||||
var nameModule = $("#id_agent_module_sla :selected").text();
|
||||
var slaMin = $("input[name=sla_min]").val();
|
||||
|
@ -1527,7 +1532,7 @@ function addSLARow() {
|
|||
params.push("sla_min=" + slaMin);
|
||||
params.push("sla_max=" + slaMax);
|
||||
params.push("sla_limit=" + slaLimit);
|
||||
params.push("server_name=" + serverName);
|
||||
params.push("server_id=" + serverId);
|
||||
|
||||
params.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
|
@ -1550,7 +1555,7 @@ function addSLARow() {
|
|||
$(".delete_button", row).attr('href', 'javascript: deleteSLARow(' + data['id'] + ');');
|
||||
$("#list_sla").append($(row).html());
|
||||
$("input[name=id_agent_sla]").val('');
|
||||
$("input[name=server_name]").val('');
|
||||
$("input[name=id_server]").val('');
|
||||
$("input[name=agent_sla]").val('');
|
||||
$("#id_agent_module_sla").empty();
|
||||
$("#id_agent_module_sla").attr('disabled', 'true');
|
||||
|
@ -1570,7 +1575,7 @@ function addSLARow() {
|
|||
function addGeneralRow() {
|
||||
var nameAgent = $("input[name=agent_general]").val();
|
||||
var idAgent = $("input[name=id_agent_general]").val();
|
||||
var serverName = $("input[name=server_name_general]").val();
|
||||
var serverId = $("input[name=id_server]").val();
|
||||
var idModule = $("#id_agent_module_general").val();
|
||||
var operation = $("#id_operation_module_general").val();
|
||||
var nameModule = $("#id_agent_module_general :selected").text();
|
||||
|
@ -1626,7 +1631,7 @@ function addGeneralRow() {
|
|||
params.push("add_general=1");
|
||||
params.push("id=" + $("input[name=id_item]").val());
|
||||
params.push("id_module=" + idModule);
|
||||
params.push("server_name_general=" + serverName);
|
||||
params.push("id_server=" + serverId);
|
||||
params.push("operation=" + operation);
|
||||
|
||||
params.push("page=include/ajax/reporting.ajax");
|
||||
|
@ -1650,12 +1655,12 @@ function addGeneralRow() {
|
|||
$("#list_general").append($(row).html());
|
||||
|
||||
$("input[name=id_agent_general]").val('');
|
||||
$("input[name=server_name_general]").val('');
|
||||
$("input[name=id_server]").val('');
|
||||
$("input[name=agent_general]").val('');
|
||||
$("#id_operation_module_general").val('avg');
|
||||
$("#id_agent_module_general").empty();
|
||||
$("#id_agent_module_general").attr('disabled', 'true');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -242,7 +242,8 @@ elseif ($search_agents && ($config['metaconsole'] == 1) && defined('METACONSOLE'
|
|||
$data[] = array('id' => $agent['id_agente'],
|
||||
'name' => io_safe_output($agent['nombre']),
|
||||
'ip' => io_safe_output($agent['direccion']),
|
||||
'filter' => 'agent');
|
||||
'filter' => 'agent',
|
||||
'id_server' => $server['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +266,8 @@ elseif ($search_agents && ($config['metaconsole'] == 1) && defined('METACONSOLE'
|
|||
$data[] = array('id' => $agent['id_agente'],
|
||||
'name' => io_safe_output($agent['nombre']),
|
||||
'ip' => io_safe_output($agent['direccion']),
|
||||
'filter' => 'address');
|
||||
'filter' => 'address',
|
||||
'id_server' => $server['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,13 +284,15 @@ elseif ($search_agents && ($config['metaconsole'] == 1) && defined('METACONSOLE'
|
|||
$filter_description[] = '(UPPER(nombre) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(direccion) NOT LIKE UPPER(\'%'.$string.'%\') AND UPPER(comentarios) LIKE UPPER(\'%'.$string.'%\'))';
|
||||
break;
|
||||
}
|
||||
$agents = agents_get_agents($filter_description, array ('id_agente', 'nombre', 'direccion'));
|
||||
$agents = agents_get_agents($filter_description,
|
||||
array ('id_agente', 'nombre', 'direccion'));
|
||||
if ($agents !== false) {
|
||||
foreach ($agents as $agent) {
|
||||
$data[] = array('id' => $agent['id_agente'],
|
||||
'name' => io_safe_output($agent['nombre']),
|
||||
'ip' => io_safe_output($agent['direccion']),
|
||||
'filter' => 'description');
|
||||
'filter' => 'description',
|
||||
'id_server' => $server['id']);
|
||||
}
|
||||
}
|
||||
//Restore db connection
|
||||
|
|
|
@ -65,7 +65,17 @@ if ($add_sla) {
|
|||
$sla_limit = get_parameter('sla_limit', 0);
|
||||
$sla_max = get_parameter('sla_max', 0);
|
||||
$sla_min = get_parameter('sla_min', 0);
|
||||
$server_name = get_parameter('server_name', '');
|
||||
$server_id = (int)get_parameter('server_id', 0);
|
||||
|
||||
$include_enterprise = enterprise_include("include/functions_metaconsole.php");
|
||||
|
||||
if ($include_enterprise !== ENTERPRISE_NOT_HOOK) {
|
||||
$connection = metaconsole_get_connection_by_id($server_id);
|
||||
}
|
||||
if (empty($connection)) {
|
||||
$connection = array();
|
||||
$connection['server_name'] = '';
|
||||
}
|
||||
|
||||
$result = db_process_sql_insert('treport_content_sla_combined', array(
|
||||
'id_report_content' => $id,
|
||||
|
@ -73,7 +83,7 @@ if ($add_sla) {
|
|||
'sla_max' => $sla_max,
|
||||
'sla_min' => $sla_min,
|
||||
'sla_limit' => $sla_limit,
|
||||
'server_name' => $server_name));
|
||||
'server_name' => $connection['server_name']));
|
||||
|
||||
if ($result === false) {
|
||||
$data['correct'] = 0;
|
||||
|
@ -89,13 +99,23 @@ if ($add_sla) {
|
|||
|
||||
if ($add_general) {
|
||||
$id_module = get_parameter('id_module', 0);
|
||||
$server_name = get_parameter('server_name_general', '');
|
||||
$id_server = (int)get_parameter('id_server', 0);
|
||||
$operation = get_parameter('operation', '');
|
||||
|
||||
$include_enterprise = enterprise_include("include/functions_metaconsole.php");
|
||||
|
||||
if ($include_enterprise !== ENTERPRISE_NOT_HOOK) {
|
||||
$connection = metaconsole_get_connection_by_id($id_server);
|
||||
}
|
||||
if (empty($connection)) {
|
||||
$connection = array();
|
||||
$connection['server_name'] = '';
|
||||
}
|
||||
|
||||
$result = db_process_sql_insert('treport_content_item', array(
|
||||
'id_report_content' => $id,
|
||||
'id_agent_module' => $id_module,
|
||||
'server_name' => $server_name,
|
||||
'server_name' => $connection['server_name'],
|
||||
'operation' => $operation));
|
||||
|
||||
if ($result === false) {
|
||||
|
|
|
@ -258,4 +258,13 @@ define ('SERVER_TYPE_WEB', 9);
|
|||
define ('SERVER_TYPE_EVENT', 10);
|
||||
define ('SERVER_TYPE_ENTERPRISE_ICMP', 11);
|
||||
define ('SERVER_TYPE_ENTERPRISE_SNMP', 12);
|
||||
|
||||
/* REPORTS */
|
||||
define ('REPORT_TOP_N_MAX', 1);
|
||||
define ('REPORT_TOP_N_MIN', 2);
|
||||
define ('REPORT_TOP_N_AVG', 0);
|
||||
|
||||
define ('REPORT_TOP_N_ONLY_GRAPHS', 2);
|
||||
define ('REPORT_TOP_N_SHOW_TABLE_GRAPS', 1);
|
||||
define ('REPORT_TOP_N_ONLY_TABLE', 0);
|
||||
?>
|
||||
|
|
|
@ -3286,11 +3286,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
}
|
||||
|
||||
// SLA items sorted descending ()
|
||||
if ($content['top_n'] == 2){
|
||||
if ($content['top_n'] == 2) {
|
||||
arsort($sla_showed_values);
|
||||
}
|
||||
// SLA items sorted ascending
|
||||
else if ($content['top_n'] == 1){
|
||||
else if ($content['top_n'] == 1) {
|
||||
asort($sla_showed_values);
|
||||
}
|
||||
|
||||
|
@ -4831,17 +4831,15 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$top_n = $content['top_n'];
|
||||
|
||||
switch ($top_n) {
|
||||
//Max
|
||||
case 1:
|
||||
case REPORT_TOP_N_MAX:
|
||||
$type_top_n = __('Max');
|
||||
break;
|
||||
//Min
|
||||
case 2:
|
||||
case REPORT_TOP_N_MIN:
|
||||
$type_top_n = __('Min');
|
||||
break;
|
||||
//Nothing or Average
|
||||
case 0: //If nothing is selected then it will be shown the average data
|
||||
case 3:
|
||||
case REPORT_TOP_N_AVG:
|
||||
default:
|
||||
//If nothing is selected then it will be shown the average data
|
||||
$type_top_n = __('Avg');
|
||||
break;
|
||||
}
|
||||
|
@ -4879,7 +4877,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
break;
|
||||
}
|
||||
|
||||
if ($show_graph == 0 || $show_graph == 1) {
|
||||
if ($show_graph != REPORT_TOP_N_ONLY_GRAPHS) {
|
||||
$table1->width = '99%';
|
||||
$table1->data = array ();
|
||||
$table1->head = array ();
|
||||
|
@ -4911,17 +4909,15 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
|
||||
|
||||
switch ($top_n) {
|
||||
//Max
|
||||
case 1:
|
||||
case REPORT_TOP_N_MAX:
|
||||
$value = reporting_get_agentmodule_data_max ($row['id_agent_module'], $content['period']);
|
||||
break;
|
||||
//Min
|
||||
case 2:
|
||||
case REPORT_TOP_N_MIN:
|
||||
$value = reporting_get_agentmodule_data_min ($row['id_agent_module'], $content['period']);
|
||||
break;
|
||||
//Nothing or Average
|
||||
case 0: //If nothing is selected then it will be shown the average data
|
||||
case 3:
|
||||
case REPORT_TOP_N_AVG:
|
||||
default:
|
||||
//If nothing is selected then it will be shown the average data
|
||||
$value = reporting_get_agentmodule_data_average ($row['id_agent_module'], $content['period']);
|
||||
break;
|
||||
}
|
||||
|
@ -5044,10 +5040,13 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
|
||||
$table->colspan[3][0] = 3;
|
||||
$data = array();
|
||||
if ($show_graph == 1 || $show_graph == 2) {
|
||||
if ($show_graph != REPORT_TOP_N_ONLY_TABLE) {
|
||||
|
||||
$data[0] = pie3d_graph(false, $data_pie_graph,
|
||||
$sizgraph_w, $sizgraph_h, __("other"), ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'], $config['font_size']);
|
||||
$sizgraph_w, $sizgraph_h, __("other"),
|
||||
ui_get_full_url(false, true, false, false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
|
||||
$config['fontpath'], $config['font_size']);
|
||||
|
||||
|
||||
array_push ($table->data, $data);
|
||||
//Display bars graph
|
||||
|
@ -5055,7 +5054,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$table->style[0] .= 'text-align:center';
|
||||
$height = count($data_pie_graph)*20+35;
|
||||
$data = array();
|
||||
$data[0] = hbar_graph(false, $data_hbar, $sizgraph_w, $height, array(), array(), "", "", true, ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true);
|
||||
$data[0] = hbar_graph(false, $data_hbar, $sizgraph_w,
|
||||
$height, array(), array(), "", "", true,
|
||||
ui_get_full_url(false, true, false, false) . '/', $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true);
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
|
|
@ -2379,57 +2379,68 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$return = $parameters['return'];
|
||||
}
|
||||
|
||||
|
||||
$input_name = uniqid('agent_autocomplete_'); //Default value
|
||||
if (isset($parameters['input_name'])) {
|
||||
$input_name = $parameters['input_name'];
|
||||
}
|
||||
|
||||
|
||||
$input_id = 'text-' . $input_name; //Default value
|
||||
if (isset($parameters['input_id'])) {
|
||||
$input_id = $parameters['input_id'];
|
||||
}
|
||||
|
||||
|
||||
$selectbox_group = ''; //Default value
|
||||
if (isset($parameters['selectbox_group'])) {
|
||||
$selectbox_group = $parameters['selectbox_group'];
|
||||
}
|
||||
|
||||
|
||||
//Default value
|
||||
$icon_image = html_print_image('images/lightning.png', true, false, true);
|
||||
if (isset($parameters['icon_image'])) {
|
||||
$icon_image = $parameters['icon_image'];
|
||||
}
|
||||
|
||||
|
||||
$value = ''; //Default value
|
||||
if (isset($parameters['value'])) {
|
||||
$value = $parameters['value'];
|
||||
}
|
||||
|
||||
|
||||
$show_helptip = true; //Default value
|
||||
if (isset($parameters['show_helptip'])) {
|
||||
$show_helptip = $parameters['show_helptip'];
|
||||
}
|
||||
|
||||
|
||||
$helptip_text = __("Type at least two characters to search."); //Default value
|
||||
if (isset($parameters['helptip_text'])) {
|
||||
$helptip_text = $parameters['helptip_text'];
|
||||
}
|
||||
|
||||
|
||||
$use_hidden_input_idagent = false; //Default value
|
||||
if (isset($parameters['use_hidden_input_idagent'])) {
|
||||
$use_hidden_input_idagent = $parameters['use_hidden_input_idagent'];
|
||||
}
|
||||
|
||||
|
||||
$print_hidden_input_idagent = false; //Default value
|
||||
if (isset($parameters['print_hidden_input_idagent'])) {
|
||||
$print_hidden_input_idagent = $parameters['print_hidden_input_idagent'];
|
||||
}
|
||||
|
||||
|
||||
$hidden_input_idagent_name = uniqid('agent_autocomplete_idagent_'); //Default value
|
||||
if (isset($parameters['hidden_input_idagent_name'])) {
|
||||
$hidden_input_idagent_name = $parameters['hidden_input_idagent_name'];
|
||||
}
|
||||
|
||||
|
||||
$hidden_input_idagent_id = 'hidden-' . $input_name; //Default value
|
||||
if (isset($parameters['hidden_input_idagent_id'])) {
|
||||
$hidden_input_idagent_id = $parameters['hidden_input_idagent_id'];
|
||||
|
@ -2440,61 +2451,103 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$hidden_input_idagent_value = $parameters['hidden_input_idagent_value'];
|
||||
}
|
||||
|
||||
|
||||
$size = 30; //Default value
|
||||
if (isset($parameters['size'])) {
|
||||
$size = $parameters['size'];
|
||||
}
|
||||
|
||||
|
||||
$maxlength = 100; //Default value
|
||||
if (isset($parameters['maxlength'])) {
|
||||
$maxlength = $parameters['maxlength'];
|
||||
}
|
||||
|
||||
|
||||
$disabled = false; //Default value
|
||||
if (isset($parameters['disabled'])) {
|
||||
$disabled = $parameters['disabled'];
|
||||
}
|
||||
|
||||
|
||||
$selectbox_id = 'id_agent_module'; //Default value
|
||||
if (isset($parameters['selectbox_id'])) {
|
||||
$selectbox_id = $parameters['selectbox_id'];
|
||||
}
|
||||
|
||||
|
||||
$add_none_module = true; //Default value
|
||||
if (isset($parameters['add_none_module'])) {
|
||||
$add_none_module = $parameters['add_none_module'];
|
||||
}
|
||||
|
||||
|
||||
$none_module_text = '--'; //Default value
|
||||
if (isset($parameters['none_module_text'])) {
|
||||
$none_module_text = $parameters['none_module_text'];
|
||||
}
|
||||
|
||||
|
||||
$print_input_server = false; //Default value
|
||||
if (isset($parameters['print_input_server'])) {
|
||||
$print_input_server = $parameters['print_input_server'];
|
||||
}
|
||||
|
||||
|
||||
$print_input_id_server = false; //Default value
|
||||
if (isset($parameters['print_input_id_server'])) {
|
||||
$print_input_id_server = $parameters['print_input_id_server'];
|
||||
}
|
||||
|
||||
|
||||
$use_input_server = false; //Default value
|
||||
if (isset($parameters['use_input_server'])) {
|
||||
$use_input_server = $parameters['use_input_server'];
|
||||
}
|
||||
|
||||
|
||||
$use_input_id_server = false; //Default value
|
||||
if (isset($parameters['use_input_id_server'])) {
|
||||
$use_input_id_server = $parameters['use_input_id_server'];
|
||||
}
|
||||
|
||||
|
||||
$input_server_name = uniqid('server_'); //Default value
|
||||
if (isset($parameters['input_server_name'])) {
|
||||
$input_server_name = $parameters['input_server_name'];
|
||||
}
|
||||
|
||||
|
||||
$input_id_server_name = uniqid('server_'); //Default value
|
||||
if (isset($parameters['input_id_server_id'])) {
|
||||
$input_id_server_id = $parameters['input_id_server_id'];
|
||||
}
|
||||
|
||||
|
||||
$input_server_id = 'hidden-' . $input_server_name; //Default value
|
||||
if (isset($parameters['input_server_id'])) {
|
||||
$input_server_id = $parameters['input_server_id'];
|
||||
}
|
||||
|
||||
|
||||
$input_id_server_id = 'hidden-' . $input_id_server_name; //Default value
|
||||
if (isset($parameters['input_id_server_id'])) {
|
||||
$input_id_server_id = $parameters['input_id_server_id'];
|
||||
}
|
||||
|
||||
|
||||
$input_server_value = ''; //Default value
|
||||
if (isset($parameters['input_server_value'])) {
|
||||
$input_server_value = $parameters['input_server_value'];
|
||||
}
|
||||
|
||||
|
||||
$input_id_server_value = ''; //Default value
|
||||
if (isset($parameters['input_id_server_value'])) {
|
||||
$input_id_server_value = $parameters['input_id_server_value'];
|
||||
}
|
||||
|
||||
|
||||
$metaconsole_enabled = false; //Default value
|
||||
if (isset($parameters['metaconsole_enabled'])) {
|
||||
$metaconsole_enabled = $parameters['metaconsole_enabled'];
|
||||
|
@ -2507,6 +2560,12 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$metaconsole_enabled = false;
|
||||
}
|
||||
|
||||
$spinner_image = html_print_image('images/spinner.gif', true, false, true);
|
||||
if (isset($parameters['spinner_image'])) {
|
||||
$spinner_image = $parameters['spinner_image'];
|
||||
}
|
||||
|
||||
|
||||
// Javascript configurations
|
||||
//------------------------------------------------------------------
|
||||
$javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false); //Default value
|
||||
|
@ -2514,6 +2573,8 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$javascript_ajax_page = $parameters['javascript_ajax_page'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$javascript_function_action_after_select = ''; //Default value
|
||||
$javascript_function_action_after_select_js_call = ''; //Default value
|
||||
if (isset($parameters['javascript_function_action_after_select'])) {
|
||||
|
@ -2522,6 +2583,8 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$javascript_function_action_after_select . '();';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($parameters['javascript_function_action_after_select_js_call'])) {
|
||||
if ($javascript_function_action_after_select_js_call !=
|
||||
$parameters['javascript_function_action_after_select_js_call']) {
|
||||
|
@ -2530,6 +2593,8 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$javascript_function_action_into_source = ''; //Default value
|
||||
$javascript_function_action_into_source_js_call = ''; //Default value
|
||||
if (isset($parameters['javascript_function_action_into_source'])) {
|
||||
|
@ -2538,6 +2603,8 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$javascript_function_action_into_source . '();';
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isset($parameters['javascript_function_action_into_source_js_call'])) {
|
||||
if ($javascript_function_action_into_source_js_call !=
|
||||
$parameters['javascript_function_action_into_source_js_call']) {
|
||||
|
@ -2546,23 +2613,30 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$javascript = true; //Default value
|
||||
if (isset($parameters['javascript'])) {
|
||||
$javascript = $parameters['javascript'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$javascript_is_function_select = false; //Default value
|
||||
if (isset($parameters['javascript_is_function_select'])) {
|
||||
$javascript_is_function_select = $parameters['javascript_is_function_select'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$javascript_name_function_select = 'function_select_' . $input_name; //Default value
|
||||
if (isset($parameters['javascript_name_function_select'])) {
|
||||
$javascript_name_function_select = $parameters['javascript_name_function_select'];
|
||||
}
|
||||
|
||||
$javascript_code_function_select = '';
|
||||
$javascript_code_function_select .= '
|
||||
|
||||
|
||||
$javascript_code_function_select = '
|
||||
function function_select_' . $input_name . '(agent_name) {
|
||||
|
||||
$("#' . $selectbox_id . '").empty ();
|
||||
|
@ -2578,7 +2652,16 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
}
|
||||
|
||||
if (' . ((int)$metaconsole_enabled) . ') {
|
||||
inputs.push ("server_name=" + $("#' . $input_server_id . '").val());
|
||||
if ((' . ((int)$use_input_server) . ')
|
||||
|| (' . ((int)$print_input_server) . ')) {
|
||||
inputs.push ("server_name=" + $("#' . $input_server_id . '").val());
|
||||
}
|
||||
|
||||
if ((' . ((int)$use_input_id_server) . ')
|
||||
|| (' . ((int)$print_input_id_server) . ')) {
|
||||
inputs.push ("server_id=" + $("#' . $input_id_server_id . '").val());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((' . ((int)$print_hidden_input_idagent) . ')
|
||||
|
@ -2619,13 +2702,19 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$javascript_code_function_select = $parameters['javascript_code_function_select'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//============ INIT javascript_change_ajax_params ==================
|
||||
//Default value
|
||||
$javascript_page = 'include/ajax/agent';
|
||||
if (isset($parameters['javascript_page'])) {
|
||||
$javascript_page = $parameters['javascript_page'];
|
||||
}
|
||||
|
||||
$javascript_change_ajax_params_original = array('page' => '"' . $javascript_page . '"',
|
||||
|
||||
|
||||
$javascript_change_ajax_params_original = array(
|
||||
'page' => '"' . $javascript_page . '"',
|
||||
'search_agents' => 1,
|
||||
'id_group' => 'function() {
|
||||
var group_id = 0;
|
||||
|
@ -2637,7 +2726,7 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
return group_id;
|
||||
}',
|
||||
'q' => 'term');
|
||||
|
||||
|
||||
if (!$metaconsole_enabled) {
|
||||
$javascript_change_ajax_params_original['force_local'] = 1;
|
||||
}
|
||||
|
@ -2676,12 +2765,10 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$javascript_change_ajax_params_text .= '"' . $key . '":' . $param_ajax;
|
||||
}
|
||||
$javascript_change_ajax_params_text .= '};';
|
||||
//============ END javascript_change_ajax_params ===================
|
||||
|
||||
|
||||
|
||||
$spinner_image = html_print_image('images/spinner.gif', true, false, true);
|
||||
|
||||
|
||||
$javascript_function_change = ''; //Default value
|
||||
$javascript_function_change .='
|
||||
function set_functions_change_autocomplete_' . $input_name . '() {
|
||||
|
@ -2714,7 +2801,7 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
else {
|
||||
//Check if other terms cached start with same
|
||||
//letters.
|
||||
//TODO: At the moment disabled
|
||||
//TODO: At the moment DISABLED CODE
|
||||
/*
|
||||
for (i = 1; i < term.length; i++) {
|
||||
var term_match = term.substr(0, term.length - i);
|
||||
|
@ -2772,7 +2859,9 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
select: function( event, ui ) {
|
||||
var agent_name = ui.item.name;
|
||||
var agent_id = ui.item.id;
|
||||
var server_name;
|
||||
var server_name = "";
|
||||
var server_id = "";
|
||||
|
||||
|
||||
if (' . ((int)$metaconsole_enabled) . ') {
|
||||
server_name = ui.item.server;
|
||||
|
@ -2781,6 +2870,12 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
server_name = ui.item.ip;
|
||||
}
|
||||
|
||||
|
||||
if ((' . ((int)$use_input_id_server) . ')
|
||||
|| (' . ((int)$print_input_id_server) . ')) {
|
||||
server_id = ui.item.id_server;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Put the name
|
||||
|
@ -2797,6 +2892,12 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$("#' . $input_server_id . '").val(server_name);
|
||||
}
|
||||
|
||||
//Put the server id into the hidden input
|
||||
if ((' . ((int)$use_input_id_server) . ')
|
||||
|| (' . ((int)$print_input_id_server) . ')) {
|
||||
$("#' . $input_id_server_id . '").val(server_id);
|
||||
}
|
||||
|
||||
//Call the function to select (example fill the modules)
|
||||
if (' . ((int)$javascript_is_function_select) . ') {
|
||||
' . $javascript_name_function_select . '(agent_name);
|
||||
|
@ -2905,6 +3006,12 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$("#' . $input_server_id . '").val("");
|
||||
}
|
||||
|
||||
//Put the server id into the hidden input
|
||||
if ((' . ((int)$use_input_id_server) . ')
|
||||
|| (' . ((int)$print_input_id_server) . ')) {
|
||||
$("#' . $input_id_server_id . '").val("");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2948,7 +3055,8 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
|
||||
var agent_name = data[0].name;
|
||||
var agent_id = data[0].id;
|
||||
var server_name;
|
||||
var server_name = "";
|
||||
var server_id = "";
|
||||
|
||||
if (' . ((int)$metaconsole_enabled) . ') {
|
||||
server_name = data[0].server;
|
||||
|
@ -2957,6 +3065,11 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
server_name = data[0].ip;
|
||||
}
|
||||
|
||||
if ((' . ((int)$use_input_id_server) . ')
|
||||
|| (' . ((int)$print_input_id_server) . ')) {
|
||||
server_id = data[0].id_server;
|
||||
}
|
||||
|
||||
if ((' . ((int)$print_hidden_input_idagent) . ')
|
||||
|| (' . ((int)$use_hidden_input_idagent) . ')) {
|
||||
$("#' . $hidden_input_idagent_id . '").val(agent_id);
|
||||
|
@ -2968,6 +3081,12 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$("#' . $input_server_id . '").val(server_name);
|
||||
}
|
||||
|
||||
//Put the server id into the hidden input
|
||||
if ((' . ((int)$use_input_id_server) . ')
|
||||
|| (' . ((int)$print_input_id_server) . ')) {
|
||||
$("#' . $input_id_server_id . '").val(server_id);
|
||||
}
|
||||
|
||||
//Call the function to select (example fill the modules)
|
||||
if (' . ((int)$javascript_is_function_select) . ') {
|
||||
' . $javascript_name_function_select . '(agent_name);
|
||||
|
@ -3021,6 +3140,11 @@ function ui_print_agent_autocomplete_input($parameters) {
|
|||
$input_server_value, $input_server_id, true);
|
||||
}
|
||||
|
||||
if ($print_input_id_server) {
|
||||
$html .= html_print_input_hidden_extended($input_id_server_name,
|
||||
$input_id_server_value, $input_id_server_id, true);
|
||||
}
|
||||
|
||||
//Write the javascript
|
||||
if ($javascript) {
|
||||
if ($javascript_tags) {
|
||||
|
|
|
@ -319,6 +319,7 @@ if (is_ajax ()) {
|
|||
$indexed = (bool) get_parameter ('indexed', true);
|
||||
$agentName = (string) get_parameter ('agent_name', null);
|
||||
$server_name = (string) get_parameter ('server_name', null);
|
||||
$server_id = (int) get_parameter ('server_id', 0);
|
||||
/* This will force to get local modules although metaconsole is active, by default get all modules from all nodes */
|
||||
$force_local_modules = (int) get_parameter ('force_local_modules', 0);
|
||||
|
||||
|
@ -333,19 +334,21 @@ if (is_ajax ()) {
|
|||
if (enterprise_include_once ('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
|
||||
if ($server_id > 0) {
|
||||
$connection = metaconsole_get_connection_by_id($server_id);
|
||||
}
|
||||
|
||||
|
||||
if (metaconsole_load_external_db($connection) == NOERR) {
|
||||
|
||||
/* Get all agents if no agent was given */
|
||||
if ($id_agent == 0)
|
||||
$id_agent = array_keys (
|
||||
agents_get_group_agents (
|
||||
array_keys (users_get_groups ()), $search, "none"));
|
||||
|
||||
|
||||
$agent_modules = agents_get_modules ($id_agent,
|
||||
($fields != '' ? explode (',', $fields) : "*"),
|
||||
($filter != '' ? $filter : false), $indexed);
|
||||
|
||||
}
|
||||
// Restore db connection
|
||||
metaconsole_restore_db();
|
||||
|
|
Loading…
Reference in New Issue