New function pandora ux, let open pics from base64 image modules #90

This commit is contained in:
enriquecd 2016-10-26 18:39:41 +02:00
parent d32b81ae1b
commit 22973e9f12
3 changed files with 64 additions and 13 deletions

View File

@ -177,7 +177,7 @@ if ($get_module_detail) {
"Data" => array(
"data",
"modules_format_data",
"align" => "left",
"align" => "center",
"width" => "230px"),
);
@ -185,14 +185,14 @@ if ($get_module_detail) {
$columns["Time"] = array(
"utimestamp",
"modules_format_time",
"align" => "left",
"align" => "center",
"width" => "50px");
}
else {
$columns["Timestamp"] = array(
"utimestamp",
"modules_format_timestamp",
"align" => "left",
"align" => "center",
"width" => "50px");
}
@ -249,7 +249,7 @@ if ($get_module_detail) {
foreach ($columns as $col => $attr) {
if ($attr[1] != "modules_format_data") {
$data[] = $attr[1] ($row[$attr[0]]);
$data[] = date('d F Y - h:i:s A', $row['utimestamp']);
}
elseif (($config['command_snapshot']) && (preg_match ("/[\n]+/i", $row[$attr[0]]))) {
@ -303,7 +303,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>";
}
}
}
@ -990,8 +990,10 @@ if ($list_modules) {
base64_encode($module["nombre"]))) . "&amp;" .
"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;';
}
$server_name = '';
$data[8] .= "<a href='javascript: " .
"show_module_detail_dialog(" .
@ -1001,7 +1003,7 @@ if ($list_modules) {
0 . ", " .
SECONDS_1DAY . ", \" " . modules_get_agentmodule_name( $module["id_agente_modulo"] ) . "\")'>". html_print_image ("images/binary.png", true, array ("border" => "0", "alt" => "")) . "</a>";
}
if ($module['estado'] == 3) {
$data[9] = '<span class="redb">';
}

View File

@ -393,19 +393,41 @@ var TreeController = {
if (typeof element.showGraphs != 'undefined' && element.showGraphs != 0) {
// Graph pop-up
if (typeof element.moduleGraph != 'undefined') {
if(element.statusImageHTML.indexOf('data:image')!=-1){
var $graphImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
+'images/chart_curve.png" /> ');
+'images/photo.png" /> ');
}
else{
var $graphImage = $('<img src="'+(controller.baseURL.length > 0 ? controller.baseURL : '')
+'images/chart_curve.png" /> ');
}
$graphImage
.addClass('module-graph')
.click(function (e) {
e.preventDefault();
if(element.statusImageHTML.indexOf('data:image')!=-1){
try {
winopeng(element.moduleGraph.url, element.moduleGraph.handle);
winopeng('operation/agentes/snapshot_view.php?id='+element.id+'&refr=&label='+element.name);
}
catch (error) {
// console.log(error);
}
}
else{
try {
winopeng(element.moduleGraph.url, element.moduleGraph.handle);
}
catch (error) {
// console.log(error);
}
}
});
$content.append($graphImage);

View File

@ -1245,8 +1245,12 @@ if (!empty($result)) {
$link = 'winopeng(\''.$url.'?'.$graph_params_str.'\',\''.$win_handle.'\')';
$data[7] = '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
$data[7] = '';
if(!is_snapshot_data($row['datos'])){
$data[7] = '<a href="javascript:'.$link.'">' . html_print_image('images/chart_curve.png', true, array('border' => '0', 'alt' => '')) . '</a>';
}
$data[7] .= '<a href="javascript: ' .
'show_module_detail_dialog(' .
$row['id_agente_modulo'] . ', '.
@ -1316,12 +1320,19 @@ if (!empty($result)) {
"id=" . $row['id_agente_modulo'] .
"&refr=" . $row['current_interval'] .
"&label=" . rawurlencode(urlencode(io_safe_output($row['module_name']))) . "','" . $win_handle . "', 700,480)";
if(!is_snapshot_data($row['datos'])){
$salida = '<a href="javascript:' . $link . '">' .
html_print_image('images/default_list.png', true,
array('border' => '0',
'alt' => '',
'title' => __('Snapshot view'))) . '</a> &nbsp;&nbsp;';
}else{
$salida = '<a href="javascript:' . $link . '">' .
html_print_image('images/photo.png', true,
array('border' => '0',
'alt' => '',
'title' => __('Snapshot view'))) . '</a> &nbsp;&nbsp;';
}
}
else {
@ -1468,11 +1479,27 @@ $('#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;
}
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,
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 ()