Fixed snapshots view in string data

This commit is contained in:
fermin831 2018-05-07 19:40:38 +02:00
parent e0cf024990
commit 57fb63bd91
3 changed files with 22 additions and 10 deletions

View File

@ -2162,6 +2162,18 @@ function is_snapshot_data ($data) {
return is_image_data($data);
}
/**
* Check if text is too long to put it into a black screen
*
* @param string Data value
* @return bool True if black window should be displayed
*/
function is_text_to_black_string ($data) {
if (is_image_data($data)) return false;
// Consider large text if data is greater than 200 characters
return ((int)strlen($data)) > 200;
}
/**
* Create an invisible div with a provided ID and value to
* can retrieve it from javascript with function get_php_value(name)

View File

@ -3815,11 +3815,10 @@ function ui_print_module_string_value($value, $id_agente_module,
$value = io_safe_input($value);
}
$is_snapshot = is_snapshot_data($value);
$is_large_image = is_text_to_black_string ($value);
if (($config['command_snapshot']) && ($is_snapshot)) {
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$handle = "snapshot" . "_" . $id_agente_module;
$url = 'include/procesos.php?agente=' . $id_agente_module;
$win_handle = dechex(crc32($handle));
@ -3828,7 +3827,7 @@ function ui_print_module_string_value($value, $id_agente_module,
"id=" . $id_agente_module .
"&refr=" . $current_interval .
"&label=" . rawurlencode(urlencode(io_safe_output($module_name))) . "','" . $win_handle . "', 700,480)";
if (is_image_data($value)) {
if ($is_snapshot) {
$salida = '<a href="javascript:' . $link . '">' .
html_print_image("images/photo.png", true,
array("border" => '0',

View File

@ -1372,8 +1372,9 @@ if (!empty($result)) {
}
$is_snapshot = is_snapshot_data ( $module_value );
$is_large_image = is_text_to_black_string ( $module_value );
if (($config['command_snapshot']) && ($is_snapshot)) {
if (($config['command_snapshot']) && ($is_snapshot || $is_large_image)) {
$link = ui_get_snapshot_link( array(
'id_module' => $row['id_agente_modulo'],
'last_data' => $row['datos'],
@ -1382,7 +1383,7 @@ if (!empty($result)) {
'module_name' => $row['module_name']
));
if(!is_image_data($row['datos'])){
if($is_large_image){
$salida = '<a href="javascript:' . $link . '">' .
html_print_image('images/default_list.png', true,
array('border' => '0',