From 310b1ef259b50fca208d5c070692811181625bf4 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Fri, 21 Dec 2012 11:11:22 +0000 Subject: [PATCH] 2012-12-21 Sergio Martin * include/functions_ui.php include/functions_events.php: Adapt details view of events to metaconsole links git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7320 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 ++++ pandora_console/include/functions_events.php | 31 ++++++++++++-------- pandora_console/include/functions_ui.php | 6 ++-- 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2ad9f5dc72..bec6bd6145 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2012-12-21 Sergio Martin + + * include/functions_ui.php + include/functions_events.php: Adapt details view of events + to metaconsole links + 2012-12-21 Junichi Satoh * include/help/ja/help_module_interval.php: Translated into Japanese. diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 2e56eb04fe..dcd9e828a2 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1564,6 +1564,17 @@ function events_page_details ($event, $server = "") { global $img_sev; global $config; + // If server is provided, get the hash parameters + if (!empty($server)) { + $hashdata = metaconsole_get_server_hashdata($server); + $hashstring = "&loginhash=auto&loginhash_data=" . $hashdata . "&loginhash_user=" . $config["id_user"]; + $serverstring = $server['server_url'] . "/"; + } + else { + $hashstring = ""; + $serverstring = ""; + } + ///////// // Details ///////// @@ -1600,7 +1611,7 @@ function events_page_details ($event, $server = "") { if (!empty($agent)) { $data = array(); $data[0] = '
'.__('Name').'
'; - $data[1] = ui_print_agent_name ($event["id_agente"], true); + $data[1] = ui_print_agent_name ($event["id_agente"], true, 'agent_medium', '', false, $serverstring, $hashstring); $table_details->data[] = $data; $data = array(); @@ -1645,7 +1656,7 @@ function events_page_details ($event, $server = "") { // Module name $data = array(); $data[0] = '
'.__('Name').'
'; - $data[1] = ''; + $data[1] = ''; $data[1] .= $module['nombre']; $data[1] .= ''; $table_details->data[] = $data; @@ -1659,7 +1670,7 @@ function events_page_details ($event, $server = "") { } else { $module_group = db_get_value('name', 'tmodule_group', 'id_mg', $id_module_group); - $data[1] = ''; + $data[1] = ''; $data[1] .= $module_group; $data[1] .= ''; } @@ -1670,15 +1681,9 @@ function events_page_details ($event, $server = "") { $graph_type = return_graphtype ($module["module_type"]); $win_handle=dechex(crc32($module["id_agente_modulo"].$module["module_name"])); - - if (!empty($server)) { - $hashdata = metaconsole_get_server_hashdata($server); - $link ="winopeng('" . $server['server_url'] . "/operation/agentes/stat_win.php?type=".$graph_type."&period=86400&loginhash=auto&loginhash_data=" . $hashdata . "&loginhash_user=" . $config["id_user"] . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($module["module_name"])."&refresh=600','day_".$win_handle."')"; - } - else { - $link ="winopeng('operation/agentes/stat_win.php?type=".$graph_type."&period=86400&id=" . $module["id_agentmodule"] . "&label=" . base64_encode($module["module_name"]) . "&refresh=600','day_".$win_handle."')"; - } - + + $link ="winopeng('".$serverstring."operation/agentes/stat_win.php?type=".$graph_type."&period=86400&id=" . $module["id_agente_modulo"] . "&label=" . base64_encode($module["module_name"].$hashstring) . "&refresh=600','day_".$win_handle."')"; + $data[1] = ''; $data[1] .= html_print_image('images/chart_curve.png',true); $data[1] .= ''; @@ -1693,7 +1698,7 @@ function events_page_details ($event, $server = "") { if($event["id_alert_am"] != 0) { $data = array(); $data[0] = '
'.__('Source').'
'; - $data[1] = ''; + $data[1] = ''; $standby = db_get_value('standby', 'talert_template_modules', 'id', $event["id_alert_am"]); if(!$standby) { $data[1] .= html_print_image ("images/bell.png", true, diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 69391b8cef..64630e5012 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -603,16 +603,18 @@ function ui_print_os_icon ($id_os, $name = true, $return = false, $apply_skin = * @param bool Whether to return the string or echo it too * @param int Now uses styles to accomplish this * @param string Style of name in css. + * @param string server url to concatenate at the begin of the link + * @param string extra parameters to concatenate in the link * * @return string HTML with agent name and link */ -function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_medium', $style = '', $cutname = false) { +function ui_print_agent_name ($id_agent, $return = false, $cutoff = 'agent_medium', $style = '', $cutname = false, $server_url = '', $extra_params = '') { $agent_name = (string) agents_get_name ($id_agent); $agent_name_full = $agent_name; if ($cutname) { $agent_name = ui_print_truncate_text($agent_name, $cutoff, true, true, true, '[…]', $style); } - $output = ''.$agent_name.''; + $output = ''.$agent_name.''; //TODO: Add a pretty javascript (using jQuery) popup-box with agent details