From 14201a4081dfd33d909178967c60b171230cd566 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 14 Jun 2012 11:52:27 +0000 Subject: [PATCH] 2012-06-14 Miguel de Dios * include/functions_agents.php: deprecated the function with bad and crazy name "agents_get_module_id" and changed for the function with more clear mind name "agents_get_agent_id_by_module_id". * godmode/alerts/configure_alert_compound.php, godmode/reporting/reporting_builder.list_items.php: changed the calls of the deprecate function "agents_get_module_id". MERGED FROM 4.0.2 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6547 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 ++++++ .../alerts/configure_alert_compound.php | 37 +++++++++++-------- .../reporting_builder.list_items.php | 9 +++-- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b4d71f9770..d0c1a06917 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2012-06-14 Miguel de Dios + + * include/functions_agents.php: deprecated the function with bad and + crazy name "agents_get_module_id" and changed for the function with + more clear mind name "agents_get_agent_id_by_module_id". + + * godmode/alerts/configure_alert_compound.php, + godmode/reporting/reporting_builder.list_items.php: changed the + calls of the deprecate function "agents_get_module_id". + + MERGED FROM 4.0.2 + 2012-06-14 Ramon Novoa * include/functions_graph.php: Merged from 4.0 branch. Added history diff --git a/pandora_console/godmode/alerts/configure_alert_compound.php b/pandora_console/godmode/alerts/configure_alert_compound.php index a924e1b213..bbca849825 100644 --- a/pandora_console/godmode/alerts/configure_alert_compound.php +++ b/pandora_console/godmode/alerts/configure_alert_compound.php @@ -391,7 +391,7 @@ if ($step == 2) { 5, 7, true); $table->data[4][0] = __('Actions'); - switch ($config['dbtype']){ + switch ($config['dbtype']) { case "mysql": case "postgresql": $table->data[4][1] = html_print_select_from_sql ('SELECT id, name FROM talert_actions ORDER BY name', @@ -401,8 +401,8 @@ if ($step == 2) { $table->data[4][1] = html_print_select_from_sql ('SELECT id, dbms_lob.substr(name,4000,1) as name FROM talert_actions ORDER BY dbms_lob.substr(name,4000,1)', 'action', '', '', __('Select'), 0, true, false, false).' '; break; - } - + } + $table->data[4][1] .= html_print_button (__('Add'), 'add_action', false, '', 'class="sub next"', true); $table->data[4][1] .= '
'; @@ -416,7 +416,7 @@ if ($step == 2) { $table->data[4][1] .= ' '.__('matches of the alert'); $table->data[4][1] .= ui_print_help_icon("alert-matches", true); $table->data[4][1] .= ''; -*/ +*/ $table->data['actions'][0] = __('Assigned actions'); $table->data['actions'][1] = '
    '; if ($id) { @@ -432,7 +432,8 @@ if ($step == 2) { $table->data['actions'][1] .= __('Always'); else $table->data['actions'][1] .= __('On').' '.$action['fires_min']; - } else { + } + else { if ($action['fires_min'] == 0) $table->data['actions'][1] .= __('Until').' '.$action['fires_max']; else @@ -442,14 +443,15 @@ if ($step == 2) { $table->data['actions'][1] .= ')'; $table->data['actions'][1] .= ''; $table->data['actions'][1] .= html_print_image('images/cross.png', true, array("title" => __('Delete'))); - $table->data['actions'][1] .= ''; + $table->data['actions'][1] .= ''; $table->data['actions'][1] .= html_print_input_hidden ('actions[]', $action['id'], true); $table->data['actions'][1] .= ''; } } $table->data['actions'][1] .= '
'; -} else if ($step == 3) { +} +else if ($step == 3) { /* Alert recover */ if (! $recovery_notify) { $table->rowstyle = array (); @@ -469,7 +471,8 @@ if ($step == 2) { $table->data['field3'][0] = __('Field 3'); $table->data['field3'][1] = html_print_textarea ('field3_recovery', 10, 30, $field3_recovery, '', true); -} else { +} +else { /* Step 1 by default */ $table->size = array (); $table->size[0] = '20%'; @@ -484,7 +487,7 @@ if ($step == 2) { if ($id) { $table->rowstyle['conditions'] = ''; } - + $table->data[0][0] = __('Name'); $table->data[0][1] = html_print_input_text ('name', $name, '', 35, 255, true); @@ -494,7 +497,7 @@ if ($step == 2) { $table->data[2][0] = __('Description'); $table->data[2][1] = html_print_textarea ('description', 10, 30, $description, '', true); - + $table->data[3][0] = __('Condition'); $table->data[3][0] .= ''; $table->colspan[3][0] = 2; @@ -526,7 +529,7 @@ if ($step == 2) { $data[0] = ''; $data[0] .= html_print_image("images/delete.png", true); $data[0] .= ''; - $idAgent = agents_get_module_id($alert['id_agent_module']); + $idAgent = agents_get_agent_id_by_module_id($alert['id_agent_module']); $nameAgent = agents_get_name($idAgent); $data[1] = '' . $nameAgent . ''; $data[2] = modules_get_agentmodule_name ($alert['id_agent_module']); @@ -550,7 +553,8 @@ if ($step == 2) { /* If it's the last step it will redirect to compound lists */ if ($step >= LAST_STEP) { echo '
'; -} else { +} +else { echo ''; } html_print_table ($table); @@ -560,13 +564,15 @@ echo '
'; if ($id) { html_print_input_hidden ('id', $id); html_print_input_hidden ('update_compound', 1); -} else { +} +else { html_print_input_hidden ('create_compound', 1); } if ($step >= LAST_STEP) { html_print_submit_button (__('Finish'), 'finish', false, 'class="sub upd"'); -} else { +} +else { html_print_input_hidden ('step', $step + 1); html_print_submit_button (__('Next'), 'next', false, 'class="sub next"'); } @@ -612,7 +618,8 @@ if ($step == 1) { if (! $id_agent) { $table_alerts->class = 'invisible'; - } else { + } + else { $alerts = agents_get_alerts_simple ($id_agent); if (empty ($alerts)) { diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 434e995abd..75423b3684 100644 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -273,7 +273,6 @@ foreach ($items as $item) { $connection = metaconsole_get_connection($server_name); if (metaconsole_load_external_db($connection) != NOERR) { //ui_print_error_message ("Error connecting to ".$server_name); - } } @@ -284,8 +283,9 @@ foreach ($items as $item) { $row[3] = ''; } else { - $row[2] = ui_print_truncate_text(agents_get_name(agents_get_module_id($item['id_agent_module'])), 35); - $row[3] = ui_print_truncate_text(db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])), 35); + $row[2] = ui_print_truncate_text(agents_get_name(agents_get_agent_id_by_module_id($item['id_agent_module'])), 35); + $module_name_db = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])); + $row[3] = ui_print_truncate_text(io_safe_output($module_name_db), 35); } } else { @@ -295,7 +295,8 @@ foreach ($items as $item) { $row [3] = ''; } else { - $row[3] = ui_print_truncate_text(db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])),35); + $module_name_db = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])) + $row[3] = ui_print_truncate_text(io_safe_output($module_name_db),35); } }