2013-02-12 Sergio Martin <sergio.martin@artica.es>

* include/functions_modules.php
	operation/agentes/estado_ultimopaquete.php
	operation/agentes/estado_monitores.php: Protect the data
	of the string modules from the numeric format
	in the visualization for bug 3600790
	Added snapshot feature to the data view of the modules



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7631 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-02-12 14:57:01 +00:00
parent bb5c5dd554
commit b2614ea891
4 changed files with 66 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2013-02-12 Sergio Martin <sergio.martin@artica.es>
* include/functions_modules.php
operation/agentes/estado_ultimopaquete.php
operation/agentes/estado_monitores.php: Protect the data
of the string modules from the numeric format
in the visualization for bug 3600790
Added snapshot feature to the data view of the modules
2013-02-12 Sergio Martin <sergio.martin@artica.es> 2013-02-12 Sergio Martin <sergio.martin@artica.es>
* godmode/agentes/configurar_agente.php: Changed the call of * godmode/agentes/configurar_agente.php: Changed the call of

View File

@ -699,6 +699,19 @@ function modules_get_type_name ($id_type) {
return (string) db_get_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type); return (string) db_get_value ('nombre', 'ttipo_modulo', 'id_tipo', (int) $id_type);
} }
/**
* Know if a module type is a string or not
*
* @param int $id_type Type id
*
* @return bool true if string. false if not
*/
function modules_is_string_type ($id_type) {
$type_name = modules_get_type_name($id_type);
return (bool)preg_match('/_string$/', $type_name);
}
/** /**
* Get the icon of a module type * Get the icon of a module type
* *

View File

@ -430,7 +430,7 @@ foreach ($modules as $module) {
$salida = "<span style='$style'>$salida</span>"; $salida = "<span style='$style'>$salida</span>";
} }
else { else {
if (is_numeric($module["datos"])){ if (is_numeric($module["datos"]) && !modules_is_string_type($module['id_tipo_modulo'])){
$salida = format_numeric($module["datos"]); $salida = format_numeric($module["datos"]);
// Show units ONLY in numeric data types // Show units ONLY in numeric data types

View File

@ -459,9 +459,9 @@ foreach ($modules as $module) {
else { else {
$graph_type = return_graphtype ($module["id_tipo_modulo"]); $graph_type = return_graphtype ($module["id_tipo_modulo"]);
if ((is_numeric($module["datos"])) && ($module["id_tipo_modulo"] != 23)) { if ((is_numeric($module["datos"])) && !modules_is_string_type($module['id_tipo_modulo'])) {
echo "<td class=".$tdcolor.">"; echo "<td class=".$tdcolor.">";
echo format_for_graph($module["datos"] ); echo format_for_graph($module["datos"]);
} }
else { else {
@ -469,7 +469,36 @@ foreach ($modules as $module) {
else $colspan= 1; else $colspan= 1;
echo "<td class='".$tdcolor."f9' colspan='" . $colspan . "' title='".io_safe_output($module["datos"])."'>"; echo "<td class='".$tdcolor."f9' colspan='" . $colspan . "' title='".io_safe_output($module["datos"])."'>";
io_safe_output(io_safe_output($module["datos"]), 45, false);
$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=".$module["nombre"]."','".$win_handle."', 700,480)";
$out = '<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($module["datos"]),0, 12);
if ($module_value == $sub_string) {
$out = $module_value;
}
else {
$out = "<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) . "" . "</span>";
}
}
echo $out;
} }
echo "</td>"; echo "</td>";
@ -522,4 +551,15 @@ foreach ($modules as $module) {
echo "</td></tr>"; echo "</td></tr>";
} }
echo '</table>'; echo '</table>';
?>
<script type="text/javascript">
function toggle_full_value(id) {
value_title = $("#value_module_" + id).attr('title');
$("#value_module_" + id).attr('title', $("#value_module_text_" + id).html());
$("#value_module_text_" + id).html(value_title);
}
</script>
?> ?>