From c2bf93a079fcb31c5f13788c270bca97e51e3661 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Thu, 9 Jun 2011 16:21:29 +0000 Subject: [PATCH] 2011-06-09 Juan Manuel Ramon * include/functions_tags.php operation/agentes/estado_monitores.php: Tooltip with module tag information in this view. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4426 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 6 +++ pandora_console/include/functions_tags.php | 13 ++++++ .../operation/agentes/estado_monitores.php | 45 +++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 971c8ad175..0d9b660900 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2011-06-09 Juan Manuel Ramon + + * include/functions_tags.php + operation/agentes/estado_monitores.php: Tooltip with module tag + information in this view. + 2011-06-09 Juan Manuel Ramon * godmode/agentes/module_manager_editor_common.php diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php index a997abde30..56a63db0bc 100644 --- a/pandora_console/include/functions_tags.php +++ b/pandora_console/include/functions_tags.php @@ -170,6 +170,19 @@ function tags_get_local_modules_count($id){ return $num_modules; } +/** + * Get tag's local module count. + * + * @param array $id Int with tag id info. + * + * @return mixed Int with the tag's count or false. + */ +function tags_get_modules_tag_count($id){ + $num_modules = (int)db_get_value_filter('count(*)', 'ttag_module', array('id_agente_modulo' => $id)); + + return $num_modules; +} + /** * Get tag's policy module count. * diff --git a/pandora_console/operation/agentes/estado_monitores.php b/pandora_console/operation/agentes/estado_monitores.php index 16b474fc21..951b1d071c 100644 --- a/pandora_console/operation/agentes/estado_monitores.php +++ b/pandora_console/operation/agentes/estado_monitores.php @@ -16,6 +16,29 @@ // Load globar vars global $config; +//Ajax tooltip to deploy modules's tag info. +if (is_ajax ()) { + $get_tag_tooltip = (bool) get_parameter ('get_tag_tooltip', 0); + + if ($get_tag_tooltip) { + $id_agente_modulo = (int) get_parameter ('id_agente_modulo'); + if ($id_agente_modulo === false) + return; + $tags = tags_get_module_tags($id_agente_modulo); + + if ($tags === false) + $tags = array(); + + echo '

Tag\'s information

'; + foreach ($tags as $tag) { + echo tags_get_name($tag).'
'; + } + + return; + } + return; +} + if (!isset ($id_agente)) { //This page is included, $id_agente should be passed to it. db_pandora_audit("HACK Attempt", @@ -26,6 +49,7 @@ if (!isset ($id_agente)) { include_once($config['homedir'] . "/include/functions_modules.php"); include_once($config['homedir'] . "/include/functions_servers.php"); +include_once($config['homedir'] . "/include/functions_tags.php"); $id_agent = get_parameter('id_agente'); $url = 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $id_agent; @@ -293,6 +317,11 @@ foreach ($modules as $module) { $data[2] .= '' . html_print_image("images/config.png", true, array("alt" => '0', "border" => "")) . ''; $data[3] = ui_print_string_substr ($module["nombre"], 25, true); + //Adds tag context information + if (tags_get_modules_tag_count($module['id_agente_modulo']) > 0) { + $data[3] .= ' ' . + html_print_image("images/tag_red.png", true, array("id" => 'tag-details-'.$module['id_agente_modulo'], "class" => "img_help")) . ' '; + } $data[4] = ui_print_string_substr ($module["descripcion"], 30, true); $status = STATUS_MODULE_WARNING; @@ -420,4 +449,20 @@ else { unset ($table); unset ($table_data); + +ui_require_css_file ('cluetip'); +ui_require_jquery_file ('cluetip'); ?> + +