From 95e68f339557d260bd5c8c469e5924a25f7db0d3 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 17 Aug 2009 16:48:01 +0000 Subject: [PATCH] 2009-08-17 Miguel de Dios * include/functions_db.php, godmode/alerts/configure_alert_compound.php: add function "get_agent_module_id" for optain id_agent from id_agent_module. And add new column in correlation condition that containts the name (and link) of agent. And change ajax of page for show this column in the search form in the bottom. Fixes: 2838000 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1855 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- .../alerts/configure_alert_compound.php | 44 +++++++++++++------ pandora_console/include/functions_db.php | 11 +++++ 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/pandora_console/godmode/alerts/configure_alert_compound.php b/pandora_console/godmode/alerts/configure_alert_compound.php index bd60093495..30320c594a 100644 --- a/pandora_console/godmode/alerts/configure_alert_compound.php +++ b/pandora_console/godmode/alerts/configure_alert_compound.php @@ -448,14 +448,16 @@ if ($step == 2) { $table_alerts->data = array (); $table_alerts->head = array (); $table_alerts->head[0] = ''; - $table_alerts->head[1] = __('Module'); - $table_alerts->head[2] = __('Alert'); - $table_alerts->head[3] = __('Operator'); + $table_alerts->head[1] = __('Agent'); + $table_alerts->head[2] = __('Module'); + $table_alerts->head[3] = __('Alert'); + $table_alerts->head[4] = __('Operator'); $table_alerts->size = array (); $table_alerts->size[0] = '20px'; - $table_alerts->size[1] = '45%'; - $table_alerts->size[2] = '45%'; - $table_alerts->size[3] = '10%'; + $table_alerts->size[1] = '20%'; + $table_alerts->size[2] = '40%'; + $table_alerts->size[3] = '40%'; + $table_alerts->size[4] = '10%'; if ($id) { $conditions = get_alert_compound_elements ($id); @@ -468,15 +470,18 @@ if ($step == 2) { $data[0] = ''; $data[0] .= ''; $data[0] .= ''; - $data[1] = get_alert_template_name ($alert['id_alert_template']); - $data[2] = get_agentmodule_name ($alert['id_agent_module']); + $idAgent = get_agent_module_id($alert['id_agent_module']); + $nameAgent = get_agent_name($idAgent); + $data[1] = '' . $nameAgent . ''; + $data[2] = get_alert_template_name ($alert['id_alert_template']); + $data[3] = get_agentmodule_name ($alert['id_agent_module']); if ($condition['operation'] == 'NOP') { - $data[3] = print_input_hidden ('operations['.$alert['id'].']', 'NOP', true); + $data[4] = print_input_hidden ('operations['.$alert['id'].']', 'NOP', true); } else { - $data[3] = print_select (get_alert_compound_operations (), + $data[4] = print_select (get_alert_compound_operations (), 'operations['.$alert['id'].']', $condition['operation'], '', '', '', true); } - $data[3] .= print_input_hidden ("conditions[]", $alert['id'], true); + $data[4] .= print_input_hidden ("conditions[]", $alert['id'], true); array_push ($table_alerts->data, $data); } @@ -666,6 +671,7 @@ function add_alert () { $("#conditions_list tbody").append (tr); $("#conditions_list").show (); $("#compound-conditions").show (); + return false; } @@ -739,13 +745,23 @@ $(document).ready (function () { .attr ("href", "#condition") .click (add_alert); td = $('').append (a) - .attr ("width", "20px"); + .attr ("width", "20px") + .attr ("id", "img_action"); tr.append (td); + a = $("") + .attr ("id", "view_agent-"+this["id"]) + .attr ("href", "index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" + $("#search_id_agent").val()) + .text($("#search_id_agent :selected").text()); + td = $('').append (a) + .attr ("width", "20%") + .attr ("id", "img_action"); + tr.append (td); + td = $('').append (this["module_name"]) - .attr ("width", "50%"); + .attr ("width", "40%"); tr.append (td); td = $('').append (this["template"]["name"]) - .attr ("width", "50%"); + .attr ("width", "40%"); tr.append (td); $("#alert_list").append (tr); alerts[this["id"]] = this; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index ccc8f0b19c..a7364f9380 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -533,6 +533,17 @@ function dame_grupo_icono ($id_group) { return get_group_icon ($id_group); } +/** + * Get agent id from a module id that it has. + * + * @param int $id_module Id module is list modules this agent. + * + * @return int Id from the agent of the given id module. + */ +function get_agent_module_id ($id_agente_modulo) { + return (int) get_db_value ('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agente_modulo); +} + /**