From 74fe9a02281c7457eceaecf517552bc4d02e19fb Mon Sep 17 00:00:00 2001
From: enriquecd <enrique.camargo@artica.com>
Date: Fri, 4 Nov 2016 16:10:46 +0100
Subject: [PATCH] New function pandora ux with metaconsole #90

---
 pandora_console/include/ajax/module.php       |  9 ++++++---
 .../operation/agentes/status_monitor.php      | 20 ++++++++++---------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php
index d6a44771ca..5fd667c2e0 100755
--- a/pandora_console/include/ajax/module.php
+++ b/pandora_console/include/ajax/module.php
@@ -1,5 +1,7 @@
 <?php
 
+if(check_login()){
+
 //Pandora FMS- http://pandorafms.com
 // ==================================================
 // Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
@@ -292,7 +294,7 @@ if ($get_module_detail) {
 						$data[] = 'No data';
 					}
 					else {
-						$data[] = io_safe_input($row[$attr[0]]);
+						$data[] = "<a target='_blank' href='".io_safe_input($row[$attr[0]])."'><img style='width:300px' src='".io_safe_input($row[$attr[0]])."'></a>";
 					}
 				}
 			}
@@ -960,8 +962,8 @@ if ($list_modules) {
 				"refresh=" . SECONDS_10MINUTES . "&amp;" .
 				"draw_events=$draw_events', 'day_".$win_handle."')";
 
-			if(!is_snapshot_data($module['datos'])){
-				$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> &nbsp;&nbsp;';
+if(!is_snapshot_data($module['datos'])){
+			$data[8] .= '<a href="javascript:'.$link.'">' . html_print_image("images/chart_curve.png", true, array("border" => '0', "alt" => "")) . '</a> &nbsp;&nbsp;';
 			}
 			$server_name = '';
 			$data[8] .= "<a href='javascript: " .
@@ -1063,5 +1065,6 @@ if ($get_type) {
 	echo $graph_type;
 	return;
 }
+}
 
 ?>
diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php
index 93d2a186a6..e693fefcfc 100644
--- a/pandora_console/operation/agentes/status_monitor.php
+++ b/pandora_console/operation/agentes/status_monitor.php
@@ -1315,11 +1315,16 @@ if (!empty($result)) {
 				$handle = 'snapshot_' . $row['id_agente_modulo'];
 				$url = 'include/procesos.php?agente=' . $row['id_agente_modulo'];
 				$win_handle = dechex(crc32($handle));
-				
+				if (! defined ('METACONSOLE')) {
 				$link = "winopeng_var('operation/agentes/snapshot_view.php?" .
 					"id=" . $row['id_agente_modulo'] .
 					"&refr=" . $row['current_interval'] .
 					"&label=" . rawurlencode(urlencode(io_safe_output($row['module_name']))) . "','" . $win_handle . "', 700,480)";
+				}
+				else{
+					$link = "winopeng_var('$row[datos]','',700,480)";
+						
+				}
 				if(!is_snapshot_data($row['datos'])){
 				$salida = '<a href="javascript:' . $link . '">' .
 					html_print_image('images/default_list.png', true,
@@ -1479,27 +1484,24 @@ $('#moduletype').click(function(){
 				period = <?php echo SECONDS_1DAY; ?>;
 			}
 		}
+
 		
-		var server_name = '';
-		var extra_parameters = '';
 		if ($('input[name=selection_mode]:checked').val()) {
-			
-			period = $('#period').val();
-			
+	
 			var selection_mode = $('input[name=selection_mode]:checked').val();
 			var date_from = $('#text-date_from').val();
 			var time_from = $('#text-time_from').val();
 			var date_to = $('#text-date_to').val();
 			var time_to = $('#text-time_to').val();
 			
-			extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to;
+			var extra_parameters = '&selection_mode=' + selection_mode + '&date_from=' + date_from + '&date_to=' + date_to + '&time_from=' + time_from + '&time_to=' + time_to;
 		
 		}
 		title = <?php echo "\"" . __("Module: ") . "\"" ?>;
 		$.ajax({
 			type: "POST",
 			url: "<?php echo ui_get_full_url('ajax.php', false, false, false); ?>",
-			data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period + extra_parameters,
+			data: "page=include/ajax/module&get_module_detail=1&server_name="+server_name+"&id_agent="+id_agent+"&id_module=" + module_id+"&offset="+offset+"&period="+period+extra_parameters,
 			dataType: "html",
 			success: function(data) {
 				$("#monitor_details_window").hide ()
@@ -1540,4 +1542,4 @@ $('#moduletype').click(function(){
 			return false;
 		});
 	}
-</script>
+</script>
\ No newline at end of file