From f10a661cd66c1a9ad76cde44bdf9d519e3651fe7 Mon Sep 17 00:00:00 2001 From: danielmaya Date: Tue, 23 Oct 2018 12:36:20 +0200 Subject: [PATCH] Fixed group and set_center --- .../include/javascript/functions_pandora_networkmap.js | 9 +++++---- .../operation/agentes/pandora_networkmap.editor.php | 5 ++--- .../operation/agentes/pandora_networkmap.view.php | 9 ++++++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/javascript/functions_pandora_networkmap.js b/pandora_console/include/javascript/functions_pandora_networkmap.js index 83418f97c1..3a8f29d6c0 100644 --- a/pandora_console/include/javascript/functions_pandora_networkmap.js +++ b/pandora_console/include/javascript/functions_pandora_networkmap.js @@ -87,15 +87,16 @@ function inner_minimap_box(param_x, param_y) { return false; } -function set_center(id) { - pos_x = (width_svg / 2) - translation[0]; - pos_y = (height_svg / 2) - translation[1]; +function set_center(id, event) { + pos_x = (width_svg / 2) - (translation[0] / scale); + pos_y = (height_svg / 2) - (translation[1] / scale); var params = []; params.push("set_center=1"); params.push("id=" + id); params.push("x=" + pos_x); params.push("y=" + pos_y); + params.push("scale=" + scale); params.push("page=operation/agentes/pandora_networkmap.view"); jQuery.ajax({ data: params.join("&"), @@ -2720,7 +2721,7 @@ function init_graph(parameter_object) { } window.scale_minimap = 4.2; window.translation = [0, 0]; - window.scale = 0.5; + window.scale = (typeof (z_dash) != "undefined") ? z_dash : 0.5; window.node_radius = 40; if (typeof (parameter_object.node_radius) != "undefined") { window.node_radius = parameter_object.node_radius; diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index a5c5acc1ec..6163c47f8f 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -221,11 +221,10 @@ else { $table->data[0][0] = __('Name'); $table->data[0][1] = html_print_input_text ('name', $name, '', 30, 100,true); - $table->data[1][0] = __('Group'); - + $table->data[1][0] = __('Group'); $table->data[1][1] = html_print_select_groups($config['id_user'], "AR", - true, 'id_group', $idGroup, '', '', '', true); + true, 'id_group', $id_group, '', '', '', true); $table->data[2][0] = __('Node radius'); $table->data[2][1] = html_print_input_text ('node_radius', $node_radius, '', 2, diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 738f9ed5df..d1916ea741 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -511,9 +511,16 @@ if (is_ajax ()) { $id = (int)get_parameter('id', 0); $x = (int)get_parameter('x', 0); $y = (int)get_parameter('y', 0); + $scale = (float)get_parameter('scale', 0); $networkmap = db_get_row('tmap', 'id', $id); + $array_filter = json_decode($networkmap['filter']); + if (isset($array_filter->z_dash)) { + $array_filter->z_dash = number_format($scale,2); + } + $filter = json_encode($array_filter); + // ACL for the network map // $networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR"); $networkmap_write = check_acl ($config['id_user'], $networkmap['id_group'], "MW"); @@ -529,7 +536,7 @@ if (is_ajax ()) { $networkmap['center_x'] = $x; $networkmap['center_y'] = $y; db_process_sql_update('tmap', - array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y']), + array('center_x' => $networkmap['center_x'], 'center_y' => $networkmap['center_y'], 'filter' => $filter), array('id' => $id)); $return = array();