Fixed group and set_center

This commit is contained in:
danielmaya 2018-10-23 12:36:20 +02:00
parent 9a77256198
commit f10a661cd6
3 changed files with 15 additions and 8 deletions

View File

@ -87,15 +87,16 @@ function inner_minimap_box(param_x, param_y) {
return false; return false;
} }
function set_center(id) { function set_center(id, event) {
pos_x = (width_svg / 2) - translation[0]; pos_x = (width_svg / 2) - (translation[0] / scale);
pos_y = (height_svg / 2) - translation[1]; pos_y = (height_svg / 2) - (translation[1] / scale);
var params = []; var params = [];
params.push("set_center=1"); params.push("set_center=1");
params.push("id=" + id); params.push("id=" + id);
params.push("x=" + pos_x); params.push("x=" + pos_x);
params.push("y=" + pos_y); params.push("y=" + pos_y);
params.push("scale=" + scale);
params.push("page=operation/agentes/pandora_networkmap.view"); params.push("page=operation/agentes/pandora_networkmap.view");
jQuery.ajax({ jQuery.ajax({
data: params.join("&"), data: params.join("&"),
@ -2720,7 +2721,7 @@ function init_graph(parameter_object) {
} }
window.scale_minimap = 4.2; window.scale_minimap = 4.2;
window.translation = [0, 0]; window.translation = [0, 0];
window.scale = 0.5; window.scale = (typeof (z_dash) != "undefined") ? z_dash : 0.5;
window.node_radius = 40; window.node_radius = 40;
if (typeof (parameter_object.node_radius) != "undefined") { if (typeof (parameter_object.node_radius) != "undefined") {
window.node_radius = parameter_object.node_radius; window.node_radius = parameter_object.node_radius;

View File

@ -221,11 +221,10 @@ else {
$table->data[0][0] = __('Name'); $table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text ('name', $name, '', 30, $table->data[0][1] = html_print_input_text ('name', $name, '', 30,
100,true); 100,true);
$table->data[1][0] = __('Group');
$table->data[1][0] = __('Group');
$table->data[1][1] = html_print_select_groups($config['id_user'], "AR", $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][0] = __('Node radius');
$table->data[2][1] = html_print_input_text ('node_radius', $node_radius, '', 2, $table->data[2][1] = html_print_input_text ('node_radius', $node_radius, '', 2,

View File

@ -511,9 +511,16 @@ if (is_ajax ()) {
$id = (int)get_parameter('id', 0); $id = (int)get_parameter('id', 0);
$x = (int)get_parameter('x', 0); $x = (int)get_parameter('x', 0);
$y = (int)get_parameter('y', 0); $y = (int)get_parameter('y', 0);
$scale = (float)get_parameter('scale', 0);
$networkmap = db_get_row('tmap', 'id', $id); $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 // ACL for the network map
// $networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR"); // $networkmap_read = check_acl ($config['id_user'], $networkmap['id_group'], "MR");
$networkmap_write = check_acl ($config['id_user'], $networkmap['id_group'], "MW"); $networkmap_write = check_acl ($config['id_user'], $networkmap['id_group'], "MW");
@ -529,7 +536,7 @@ if (is_ajax ()) {
$networkmap['center_x'] = $x; $networkmap['center_x'] = $x;
$networkmap['center_y'] = $y; $networkmap['center_y'] = $y;
db_process_sql_update('tmap', 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)); array('id' => $id));
$return = array(); $return = array();