From a64e0feba3a40a859b575cc737a21068bc3bda59 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 31 Aug 2017 16:13:28 +0200 Subject: [PATCH] fixed minor error view snapshot WUX --- .../operation/agentes/estado_agente.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php index c58c72bdd2..8dfe1a8814 100644 --- a/pandora_console/operation/agentes/estado_agente.php +++ b/pandora_console/operation/agentes/estado_agente.php @@ -102,7 +102,34 @@ if (is_ajax ()) { echo json_encode (false); return; } - echo json_encode (modules_get_last_value ($id_module)); + + $module_value = modules_get_last_value ($id_module); + if (is_numeric($row['value']) && !modules_is_string_type($module['id_tipo_modulo'])){ + $value = $module_value; + } + else{ + // If carriage returns present... then is a "Snapshot" data (full command output) + $is_snapshot = is_snapshot_data ( $module_value ); + + $module = modules_get_agentmodule($id_module); + + if (($config['command_snapshot']) && ($is_snapshot)){ + $handle = "snapshot"."_".$module["id_agente_modulo"]; + $url = 'include/procesos.php?agente='.$module["id_agente_modulo"]; + $win_handle = dechex(crc32($handle)); + + $link ="winopeng_var('operation/agentes/snapshot_view.php?id=".$module["id_agente_modulo"]."&refr=".$module["current_interval"]."&label=".$module["nombre"]."','".$win_handle."', 700,480)"; + + $value = '' . html_print_image("images/default_list.png", true, array("border" => '0', "alt" => "", "title" => __("Snapshot view"))) . '   '; + } + else { + $value = ui_print_module_string_value( + $module_value, $module["id_agente_modulo"], + $module["current_interval"], $module["module_name"]); + } + } + + echo json_encode ($value); return; }