Change the rossete icon for long strig module values in the console for a dialog. TICKET: #3019

This commit is contained in:
mdtrooper 2016-01-18 16:58:24 +01:00
parent 0015ba5c5a
commit 110241ecc8
5 changed files with 146 additions and 280 deletions

View File

@ -743,14 +743,8 @@ if ($list_modules) {
$last_modulegroup = $module["id_module_group"];
}
//End of title of group
//Fixed the goliat sends the strings from web
//without HTML entities
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
$module['datos'] = io_safe_input($module['datos']);
}
$data = array ();
if (($module["id_modulo"] != 1) && ($module["id_tipo_modulo"] != 100)) {
if ($module["flag"] == 0) {
@ -769,7 +763,7 @@ if ($list_modules) {
else {
$data[0] = '';
}
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if ($module["id_policy_module"] != 0) {
$linked = policies_is_module_linked($module['id_agente_modulo']);
@ -873,8 +867,8 @@ if ($list_modules) {
$data[5] .= clippy_context_help("module_unknow");
}
}
if ($module["id_tipo_modulo"] == 24) {
// log4x
switch($module["datos"]) {
@ -934,87 +928,24 @@ if ($list_modules) {
}
}
else {
//Fixed the goliat sends the strings from web
//without HTML entities
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
$module_value = $module["datos"];
}
else {
$module_value = io_safe_output($module["datos"]);
}
// If carriage returns present... then is a "Snapshot" data (full command output)
$is_snapshot = is_snapshot_data ( $module_value );
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=" . rawurlencode(urlencode(io_safe_output($module["nombre"]))) . "','".$win_handle."', 700,480)";
$salida = '<a href="javascript:'.$link.'">' .
html_print_image("images/default_list.png", true,
array(
"border" => '0',
"alt" => "",
"title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;';
}
else {
//Fixed the goliat sends the strings from web
//without HTML entities
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
$sub_string = substr($module_value, 0, 12);
}
else {
//Fixed the data from Selenium Plugin
if ($module_value != strip_tags($module_value)) {
$module_value = io_safe_input($module_value);
$sub_string = substr($module_value, 0, 12);
}
else {
$sub_string = substr(io_safe_output($module_value),0, 12);
}
}
if ($module_value == $sub_string) {
$salida = $module["datos"];
}
else {
$salida = "<span " .
"id='hidden_value_module_" . $module["id_agente_modulo"] . "'
style='display: none;'>" .
$module_value .
"</span>" .
"<span " .
"id='value_module_" . $module["id_agente_modulo"] . "'
title='" . $module_value . "' " .
"style='white-space: nowrap;'>" .
'<span id="value_module_text_' . $module["id_agente_modulo"] . '">' .
$sub_string . '</span> ' .
"<a href='javascript: toggle_full_value(" . $module["id_agente_modulo"] . ")'>" .
html_print_image("images/rosette.png", true) . "</a>" . "</span>";
}
}
$salida = ui_print_module_string_value(
$module["datos"], $module["id_agente_modulo"],
$module["current_interval"], $module["module_name"]);
}
}
$data[6] = ui_print_module_warn_value ($module["max_warning"], $module["min_warning"], $module["str_warning"], $module["max_critical"], $module["min_critical"], $module["str_critical"]);
$data[7] = $salida;
$graph_type = return_graphtype ($module["id_tipo_modulo"]);
$data[8] = " ";
if ($module['history_data'] == 1) {
$nombre_tipo_modulo = modules_get_moduletype_name ($module["id_tipo_modulo"]);
$handle = "stat".$nombre_tipo_modulo."_".$module["id_agente_modulo"];
$url = 'include/procesos.php?agente='.$module["id_agente_modulo"];
$win_handle=dechex(crc32($module["id_agente_modulo"].$module["nombre"]));
# Show events for boolean modules by default.
if ($graph_type == 'boolean') {
$draw_events = 1;
@ -1031,7 +962,7 @@ if ($list_modules) {
base64_encode($module["nombre"]))) . "&amp;" .
"refresh=" . SECONDS_10MINUTES . "&amp;" .
"draw_events=$draw_events', 'day_".$win_handle."')";
$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: " .
@ -1042,7 +973,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">';
}
@ -1051,11 +982,11 @@ if ($list_modules) {
}
$data[9] .= ui_print_timestamp ($module["utimestamp"], true, array('style' => 'font-size: 7pt'));
$data[9] .= '</span>';
array_push ($table->data, $data);
$rowIndex++;
}
?>
<script type="text/javascript">
/* <![CDATA[ */
@ -1076,15 +1007,7 @@ if ($list_modules) {
.click (function () {
return false;
});
function toggle_full_value(id) {
text = $("#hidden_value_module_" + id).html();
old_text = $("#value_module_text_" + id).html();
$("#hidden_value_module_" + id).html(old_text);
$("#value_module_text_" + id).html(text);
}
/* ]]> */
</script>
<?php

View File

@ -3602,4 +3602,102 @@ function ui_include_time_picker($echo_tags = false) {
ui_get_full_url('include/javascript/i18n/jquery-ui-timepicker-' . substr(get_user_language(), 0, 2) . '.js', false, false, false) . '"></script>';
}
}
function ui_print_module_string_value($value, $id_agente_module,
$current_interval, $module_name = null) {
global $config;
if (is_null($module_name))
$module_name = modules_get_agentmodule_name($id_agente_module);
$id_type_web_content_string = db_get_value('id_tipo',
'ttipo_modulo', 'nombre', 'web_content_string');
$is_web_content_string = (bool)db_get_value_filter('id_agente_modulo',
'tagente_modulo',
array('id_agente_modulo' => $id_agente_module,
'id_tipo_modulo' => $id_type_web_content_string));
//Fixed the goliat sends the strings from web
//without HTML entities
if ($is_web_content_string) {
$value = io_safe_input($value);
}
$is_snapshot = is_snapshot_data($value);
if (($config['command_snapshot']) && ($is_snapshot)) {
$handle = "snapshot" . "_" . $id_agente_module;
$url = 'include/procesos.php?agente=' . $id_agente_module;
$win_handle = dechex(crc32($handle));
$link = "winopeng_var('operation/agentes/snapshot_view.php?" .
"id=" . $id_agente_module .
"&refr=" . $current_interval .
"&label=" . rawurlencode(urlencode(io_safe_output($module_name))) . "','" . $win_handle . "', 700,480)";
$salida = '<a href="javascript:' . $link . '">' .
html_print_image("images/default_list.png", true,
array("border" => '0',
"alt" => "",
"title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;';
}
else {
$sub_string = substr(io_safe_output($value), 0, 12);
if ($value == $sub_string) {
if ($value == 0 && !$sub_string) {
$salida = 0;
}
else {
$salida = $value;
}
}
else {
//Fixed the goliat sends the strings from web
//without HTML entities
if ($is_web_content_string) {
$sub_string = substr($value, 0, 12);
}
else {
//Fixed the data from Selenium Plugin
if ($value != strip_tags($value)) {
$value = io_safe_input($value);
$sub_string = substr($value, 0, 12);
}
else {
$sub_string = substr(io_safe_output($value),0, 12);
}
}
if ($value == $sub_string) {
$salida = $value;
}
else {
$title_dialog =
modules_get_agentmodule_agent_name($id_agente_module) .
" / " . $module_name;
$salida = "<div " .
"id='hidden_value_module_" . $id_agente_module . "'
style='display: none;' title='" . $title_dialog . "'>" .
$value .
"</div>" .
"<span " .
"id='value_module_" . $id_agente_module . "'
style='white-space: nowrap;'>" .
'<span id="value_module_text_' . $id_agente_module . '">' .
$sub_string . '</span> ' .
"<a href='javascript: toggle_full_value(" . $id_agente_module . ")'>" .
html_print_image("images/zoom.png", true) . "</a>" . "</span>";
}
}
}
return $salida;
}
?>

View File

@ -1008,3 +1008,17 @@ function addTinyMCE(elementID) {
if (elementID.length > 0 && !isEmptyObject(tinyMCE))
tinyMCE.EditorManager.execCommand('mceAddControl', true, elementID);
}
function toggle_full_value(id) {
$("#hidden_value_module_" + id).dialog({
resizable: true,
draggable: true,
modal: true,
height: 200,
width: 400,
overlay: {
opacity: 0.5,
background: "black"
}
});
}

View File

@ -988,22 +988,6 @@ foreach ($result as $row) {
if (empty($row['server_name']))
$row['server_name'] = "";
$is_web_content_string = (bool)db_get_value_filter('id_agente_modulo',
'tagente_modulo',
array('id_agente_modulo' => $row['id_agente_modulo'],
'id_tipo_modulo' => $id_type_web_content_string));
//Fixed the goliat sends the strings from web
//without HTML entities
if ($is_web_content_string) {
$row['datos'] = io_safe_input($row['datos']);
}
//Fixed the data from Selenium Plugin
if ($row['datos'] != strip_tags($row['datos'])) {
$row['datos'] = io_safe_input($row['datos']);
}
if ($rowPair)
$table->rowclass[$iterator] = 'rowPair';
else
@ -1229,7 +1213,7 @@ foreach ($result as $row) {
$data[8] = ui_print_module_warn_value($row['max_warning'],
$row['min_warning'], $row['str_warning'], $row['max_critical'],
$row['min_critical'], $row['str_critical']);
if (is_numeric($row["datos"]) && !modules_is_string_type($row['module_type'])) {
if ( $config["render_proc"] ) {
switch($row["module_type"]) {
@ -1245,7 +1229,7 @@ foreach ($result as $row) {
else
$salida = $config["render_proc_fail"];
break;
default:
default:
$salida = format_numeric($row["datos"]);
break;
}
@ -1261,83 +1245,9 @@ foreach ($result as $row) {
}
}
else {
//Fixed the goliat sends the strings from web
//without HTML entities
if ($is_web_content_string) {
$module_value = $row["datos"];
}
else {
$module_value = io_safe_output($row["datos"]);
}
$is_snapshot = is_snapshot_data ( $module_value );
if (($config['command_snapshot']) && ($is_snapshot)) {
$handle = "snapshot" . "_" . $row["id_agente_modulo"];
$url = 'include/procesos.php?agente=' . $row["id_agente_modulo"];
$win_handle = dechex(crc32($handle));
$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)";
$salida = '<a href="javascript:' . $link . '">' .
html_print_image("images/default_list.png", true,
array("border" => '0',
"alt" => "",
"title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;';
}
else {
$sub_string = substr(io_safe_output($row["datos"]), 0, 12);
if ($module_value == $sub_string) {
if ($module_value == 0 && !$sub_string) {
$salida = 0;
}
else {
$salida = $row["datos"];
}
}
else {
//Fixed the goliat sends the strings from web
//without HTML entities
if ($is_web_content_string) {
$sub_string = substr($row["datos"], 0, 12);
}
else {
//Fixed the data from Selenium Plugin
if ($module_value != strip_tags($module_value)) {
$module_value = io_safe_input($module_value);
$sub_string = substr($row["datos"], 0, 12);
}
else {
$sub_string = substr(io_safe_output($row["datos"]),0, 12);
}
}
if ($module_value == $sub_string) {
$salida = $module_value;
}
else {
$salida = "<span " .
"id='hidden_value_module_" . $row["id_agente_modulo"] . "'
style='display: none;'>" .
$module_value .
"</span>" .
"<span " .
"id='value_module_" . $row["id_agente_modulo"] . "'
title='" . $module_value . "' " .
"style='white-space: nowrap;'>" .
'<span id="value_module_text_' . $row["id_agente_modulo"] . '">' .
$sub_string . '</span> ' .
"<a href='javascript: toggle_full_value(" . $row["id_agente_modulo"] . ")'>" .
html_print_image("images/rosette.png", true) . "</a>" . "</span>";
}
}
}
$salida = ui_print_module_string_value(
$row["datos"], $row["id_agente_modulo"],
$row["current_interval"], $row["module_name"]);
}
$data[9] = $salida;
@ -1397,15 +1307,6 @@ ui_require_javascript_file('pandora_modules');
}
});
function toggle_full_value(id) {
text = $("#hidden_value_module_" + id).html();
old_text = $("#value_module_text_" + id).html();
$("#hidden_value_module_" + id).html(old_text);
$("#value_module_text_" + id).html(text);
}
// Show the modal window of an module
function show_module_detail_dialog(module_id, id_agent, server_name, offset, period, module_name) {
if (period == -1) {

View File

@ -66,13 +66,18 @@ else {
$table->align[6] = "left";
$table->align[7] = "left";
$table->align[8] = "left";
$table->data = array ();
$id_type_web_content_string = db_get_value('id_tipo', 'ttipo_modulo',
'nombre', 'web_content_string');
foreach ($modules as $module) {
//~ html_debug_print($module);
$module["datos"] =
modules_get_last_value($module['id_agente_modulo']);
$module["module_name"] = 111;
//To search the monitor status
$status_sql = sprintf('SELECT estado from tagente_estado where id_agente_modulo =' . $module['id_agente_modulo']);
$status_sql = db_process_sql($status_sql);
@ -81,17 +86,7 @@ else {
$utimestamp_sql = sprintf('SELECT utimestamp from tagente_estado where id_agente_modulo =' . $module['id_agente_modulo']);
$utimestamp_sql = db_process_sql($utimestamp_sql);
$utimestamp_sql = $utimestamp_sql[0];
//Fixed the goliat sends the strings from web
//without HTML entities
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
$module['datos'] = io_safe_input($module['datos']);
}
//Fixed the data from Selenium Plugin
if ($module['datos'] != strip_tags($module['datos'])) {
$module['datos'] = io_safe_input($module['datos']);
}
$agentCell = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $module['id_agente'] . '">' .
$module['agent_name'] . '</a>';
@ -99,7 +94,7 @@ else {
$typeCell = ui_print_moduletype_icon($module["id_tipo_modulo"], true);
$intervalCell = modules_get_interval ($module['id_agente_modulo']);
if ($utimestamp_sql['utimestamp'] == 0 &&
(
($module['id_tipo_modulo'] < 21 || $module['id_tipo_modulo'] > 23) &&
@ -185,63 +180,9 @@ else {
$dataCell = format_numeric($module["datos"]);
}
else {
//Fixed the goliat sends the strings from web
//without HTML entities
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
$module_value = $module["datos"];
}
else {
$module_value = io_safe_output($module["datos"]);
}
// There are carriage returns here ?
// If carriage returns present... then is a "Snapshot" data (full command output)
if (($config['command_snapshot']) && (preg_match ("/[\n]+/i", io_safe_output($module["datos"])))) {
$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=".rawurlencode(urlencode(io_safe_output($module["module_name"])))."','".$win_handle."', 700,480)";
$dataCell = '<a href="javascript:'.$link.'">' . html_print_image("images/default_list.png", true, array("border" => '0', "alt" => "", "title" => __("Snapshot view"))) . '</a> &nbsp;&nbsp;';
}
else {
//Fixed the goliat sends the strings from web
//without HTML entities
if ($module['id_tipo_modulo'] == $id_type_web_content_string) {
$sub_string = substr($module_value, 0, 12);
}
else {
//Fixed the data from Selenium Plugin
if ($module_value != strip_tags($module_value)) {
$module_value = io_safe_input($module_value);
$sub_string = substr($module_value, 0, 12);
}
else {
$sub_string = substr(io_safe_output($module_value),0, 12);
}
}
if ($module_value == $sub_string) {
$dataCell = $module_value;
}
else {
$dataCell = "<span " .
"id='hidden_value_module_" . $module["id_agente_modulo"] . "'
style='display: none;'>" .
$module_value .
"</span>" .
"<span " .
"id='value_module_" . $module["id_agente_modulo"] . "'
title='" . $module_value . "' " .
"style='white-space: nowrap;'>" .
'<span id="value_module_text_' . $module["id_agente_modulo"] . '">' .
$sub_string . '</span> ' .
"<a href='javascript: toggle_full_value(" . $module["id_agente_modulo"] . ")'>" .
html_print_image("images/rosette.png", true) . "</a>" . "</span>";
}
}
$dataCell = ui_print_module_string_value(
$module["datos"], $module["id_agente_modulo"],
$module["current_interval"]);
}
if ($module['estado'] == 3) {
@ -251,8 +192,8 @@ else {
$option = array ();
}
$timestampCell = ui_print_timestamp ($utimestamp_sql["utimestamp"], true, $option);
$group_agent = agents_get_agent_group($module['id_agente']);
if (check_acl ($config['id_user'], $group_agent, "AW")) {
@ -289,14 +230,3 @@ else {
ui_pagination ($totalModules);
}
?>
<script type="text/javascript">
function toggle_full_value(id) {
text = $("#hidden_value_module_" + id).html();
old_text = $("#value_module_text_" + id).html();
$("#hidden_value_module_" + id).html(old_text);
$("#value_module_text_" + id).html(text);
}
</script>