2014-06-17 Alejandro Gallardo <alejandro.gallardo@artica.es>

* godmode/agentes/module_manager_editor_common.php,
	  operation/reporting/reporting_viewer.php,
	  operation/agentes/status_monitor.php,
	  include/functions_netflow.php,
	  include/functions_graph.php: Improvements to avoid
	php notices and warnings.

	* godmode/setup/setup_visuals.php,
	  include/functions_config.php: Added a new option
	to choose a custom line thickness for the line between
	the items relations of the visual maps.

	* include/functions_visual_map.php,
	  include/javascript/pandora_visual_console.js: Added
	support to the custom line thickness and fixed some
	problems with the line connections.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10221 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
alexhigh 2014-06-17 15:11:50 +00:00
parent 60bbb3ab6c
commit 6b2049bf5b
10 changed files with 57 additions and 24 deletions

View File

@ -1,3 +1,22 @@
2014-06-17 Alejandro Gallardo <alejandro.gallardo@artica.es>
* godmode/agentes/module_manager_editor_common.php,
operation/reporting/reporting_viewer.php,
operation/agentes/status_monitor.php,
include/functions_netflow.php,
include/functions_graph.php: Improvements to avoid
php notices and warnings.
* godmode/setup/setup_visuals.php,
include/functions_config.php: Added a new option
to choose a custom line thickness for the line between
the items relations of the visual maps.
* include/functions_visual_map.php,
include/javascript/pandora_visual_console.js: Added
support to the custom line thickness and fixed some
problems with the line connections.
2014-06-17 Vanessa Gil <vanessa.gil@artica.es>
* include/javascript/pandora_module.js: Fixed bug

View File

@ -400,7 +400,7 @@ if (preg_match ('/async/', $module_type_name) || $edit) {
'', 5, 10, true, $disabledBecauseInPolicy).ui_print_help_tip (__('Timeout in secs from start of flip flop counting. If this value is exceeded, FF counter is reset. Set to 0 for no timeout.'), true) . '</span>';
}
if (!preg_match ('/async/', $module_type_name) || $edit) {
$table_advanced->data[5][4] .= '<span id="ff_timeout_disable">' . __('Disabled') . ui_print_help_tip (__('This value can be set only in the async modules.'), true) . '</span>';
$table_advanced->data[5][4] = '<span id="ff_timeout_disable">' . __('Disabled') . ui_print_help_tip (__('This value can be set only in the async modules.'), true) . '</span>';
}
/* Tags */

View File

@ -241,6 +241,12 @@ $table->data[$row][1] = html_print_select ($values, 'vc_refr', $config["vc_refr"
$row++;
if (empty($config["vc_line_thickness"])) $config["vc_line_thickness"] = 2;
$table->data[$row][0] = __('Default line thickness for the Visual Console') . ui_print_help_tip(__('This interval will affect to the lines between elements on the Visual Console'), true);
$table->data[$row][1] = html_print_input_text ('vc_line_thickness', $config["vc_line_thickness"], '', 5, 5, true);
$row++;
$table->data[$row][0] = __('Agent size text') . ui_print_help_tip(__('When the agent name have a lot of characters, in some places in Pandora Console it is necesary truncate to N characters.'), true);
$table->data[$row][1] = __('Small:') . html_print_input_text ('agent_size_text_small', $config["agent_size_text_small"], '', 3, 3, true);
$table->data[$row][1] .= ' ' . __('Normal:') . html_print_input_text ('agent_size_text_medium', $config["agent_size_text_medium"], '', 3, 3, true);

View File

@ -413,6 +413,8 @@ function config_update_config () {
$error_update[] = __('Login background');
if (!config_update_value ('vc_refr', get_parameter('vc_refr')))
$error_update[] = __('Default interval for refresh on Visual Console');
if (!config_update_value ('vc_line_thickness', get_parameter('vc_line_thickness')))
$error_update[] = __('Default line thickness for the Visual Console');
if (!config_update_value ('agent_size_text_small', get_parameter('agent_size_text_small')))
$error_update[] = __('Agent size text');
if (!config_update_value ('agent_size_text_medium', get_parameter('agent_size_text_medium')))

View File

@ -3466,10 +3466,10 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
// Fix event and alert scale
$event_max = 2 + (float)$max_value * 1.05;
foreach ($chart as $timestamp => $chart_data) {
if ($chart_data['event'] > 0) {
if (!empty($chart_data['event']) && $chart_data['event'] > 0) {
$chart[$timestamp]['event'] = $event_max;
}
if ($chart_data['alert'] > 0) {
if (!empty($chart_data['alert']) && $chart_data['alert'] > 0) {
$chart[$timestamp]['alert'] = $event_max;
}
}

View File

@ -577,7 +577,15 @@ function netflow_get_data ($start_date, $end_date, $interval_length, $filter, $a
// Address resolution start
if ($get_hostnames) {
if (!isset($hostnames[$line['agg']])) {
$hostname = gethostbyaddr($line['agg']);
$hostname = false;
// Trying to get something like an IP from the description
if (preg_match ("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $line['agg'], $matches) ||
preg_match ("/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:?)|\2))(?4){5}((?4){2}|(25[0-5]|
(2[0-4]|1\d|[1-9])?\d)(\.(?7)){3})/i", $line['agg'], $matches)) {
if ($matches[0]) {
$hostname = gethostbyaddr($line['agg']);
}
}
if ($hostname !== false) {
$hostnames[$line['agg']] = $hostname;
$line['agg'] = $hostname;

View File

@ -326,7 +326,7 @@ function visual_map_print_item($layoutData) {
echo '<script type="text/javascript">';
echo '$(document).ready (function() {
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '"});
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . visual_map_get_color_line_status($parent) . '","thickness":"' . (empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"]) . '"});
});';
echo '</script>';
}
@ -1146,6 +1146,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$line['id'] = $layout_data['id'];
$line['node_begin'] = 'layout-data-' . $layout_data["parent_item"];
$line['node_end'] = 'layout-data-' . $layout_data["id"];
$line['thickness'] = empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"];
switch ($status_parent) {
default:
case VISUAL_MAP_STATUS_UNKNOWN:

View File

@ -29,10 +29,14 @@ function draw_line (line, id_div, editor) {
if (typeof(resize_map) == 'undefined') {
resize_map = 0;
}
var lineThickness = 2;
if (line['thickness'])
lineThickness = line['thickness'];
div = document.getElementById (id_div);
brush = new jsGraphics (div);
brush.setStroke (1);
brush.setStroke (lineThickness);
brush.setColor (line['color']);
have_node_begin_img = $('#'+line['node_begin'] + " img").length;
@ -42,12 +46,7 @@ function draw_line (line, id_div, editor) {
x1 = line['x'];
}
else {
if (resize_map && have_node_begin_img) {
width = parseInt($('#'+line['node_begin'] + " img").css('width'));
}
else {
width = $('#'+line['node_begin']).width();
}
width = $('#'+line['node_begin']).width();
x1 = parseInt($('#'+line['node_begin']).css (selector + 'left')) + (width / 2);
}
@ -55,7 +54,7 @@ function draw_line (line, id_div, editor) {
y1 = line['y1'];
}
else {
if (resize_map && have_node_begin_img) {
if (have_node_begin_img) {
height = parseInt($('#'+line['node_begin'] + " img").css('height'));
}
else {
@ -68,12 +67,7 @@ function draw_line (line, id_div, editor) {
x2 = line['x2'];
}
else {
if (resize_map && have_node_end_img) {
width = parseInt($('#'+line['node_end'] + " img").css('width'));
}
else {
width = $('#'+line['node_end']).width();
}
width = $('#'+line['node_end']).width();
x2 = parseInt($('#'+line['node_end']).css (selector + 'left')) + (width / 2);
}
@ -81,7 +75,7 @@ function draw_line (line, id_div, editor) {
y2 = line['y2'];
}
else {
if (resize_map && have_node_end_img) {
if (have_node_end_img) {
height = parseInt($('#'+line['node_end'] + " img").css('height'));
}
else {

View File

@ -514,9 +514,12 @@ foreach ($custom_fields as $custom_field) {
$row = array();
$row[0] = $custom_field['name'];
$custom_field_value = $ag_custom_fields[$custom_field['id_field']];
if (empty($custom_field_value)) {
$custom_field_value = "";
$custom_field_value = "";
if (!empty($ag_custom_fields)) {
$custom_field_value = $ag_custom_fields[$custom_field['id_field']];
if (empty($custom_field_value)) {
$custom_field_value = "";
}
}
$row[1] = html_print_input_text ("ag_custom_fields[".$custom_field['id_field']."]", $custom_field_value, '', 100, 300, true);

View File

@ -31,7 +31,7 @@ if (! $id_report) {
$report = db_get_row ('treport', 'id_report', $id_report);
// Check ACL on the report to see if user has access to the report.
if (! check_acl ($config['id_user'], $report['id_group'], "RR")) {
if (empty($report) || ! check_acl ($config['id_user'], $report['id_group'], "RR")) {
db_pandora_audit("ACL Violation","Trying to access graph reader");
include ("general/noaccess.php");
exit;