mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
New networkmaps in progress... (Added dblclick function)
This commit is contained in:
parent
209b76a642
commit
e501734b47
@ -119,6 +119,7 @@ function networkmap_process_networkmap($id = 0) {
|
|||||||
$old_mode);
|
$old_mode);
|
||||||
|
|
||||||
$filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter;
|
$filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter;
|
||||||
|
|
||||||
if ($simple) {
|
if ($simple) {
|
||||||
$filename_dot .= "_simple";
|
$filename_dot .= "_simple";
|
||||||
}
|
}
|
||||||
@ -133,14 +134,12 @@ function networkmap_process_networkmap($id = 0) {
|
|||||||
|
|
||||||
$cmd = "$filter -Tplain -o " . $filename_plain . " " .
|
$cmd = "$filter -Tplain -o " . $filename_plain . " " .
|
||||||
$filename_dot;
|
$filename_dot;
|
||||||
|
|
||||||
system ($cmd);
|
system ($cmd);
|
||||||
|
|
||||||
unlink($filename_dot);
|
|
||||||
|
|
||||||
$nodes = networkmap_loadfile($id, $filename_plain,
|
$nodes = networkmap_loadfile($id, $filename_plain,
|
||||||
$relation_nodes, $graph);
|
$relation_nodes, $graph);
|
||||||
|
|
||||||
//Set the position of modules
|
//Set the position of modules
|
||||||
foreach ($nodes as $key => $node) {
|
foreach ($nodes as $key => $node) {
|
||||||
if ($node['type'] == 'module') {
|
if ($node['type'] == 'module') {
|
||||||
@ -159,7 +158,7 @@ function networkmap_process_networkmap($id = 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink($filename_plain);
|
|
||||||
|
|
||||||
$nodes_and_relations['nodes'] = array();
|
$nodes_and_relations['nodes'] = array();
|
||||||
$index = 0;
|
$index = 0;
|
||||||
@ -243,6 +242,9 @@ function networkmap_process_networkmap($id = 0) {
|
|||||||
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']),
|
||||||
array('id' => $id));
|
array('id' => $id));
|
||||||
|
|
||||||
|
unlink($filename_plain);
|
||||||
|
unlink($filename_dot);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $nodes_and_relations;
|
return $nodes_and_relations;
|
||||||
@ -1240,7 +1242,7 @@ function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations =
|
|||||||
}
|
}
|
||||||
|
|
||||||
.node_selected {
|
.node_selected {
|
||||||
stroke:#717171;
|
stroke:#343434;
|
||||||
stroke-width:5;
|
stroke-width:5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ function update_link(row_index, id_link) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function edit_node(data) {
|
function edit_node(data, dblClick) {
|
||||||
if (enterprise_installed) {
|
if (enterprise_installed) {
|
||||||
var flag_edit_node = true;
|
var flag_edit_node = true;
|
||||||
var edit_node = null
|
var edit_node = null
|
||||||
@ -484,10 +484,14 @@ function edit_node(data) {
|
|||||||
else if (selection[0].length > 1) {
|
else if (selection[0].length > 1) {
|
||||||
edit_node = selection[0].pop();
|
edit_node = selection[0].pop();
|
||||||
}
|
}
|
||||||
|
else if (dblClick){
|
||||||
|
edit_node = d3.select("#id_node_" + data['id']);
|
||||||
|
edit_node = edit_node[0][0];
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
flag_edit_node = false;
|
flag_edit_node = false;
|
||||||
}
|
}
|
||||||
|
console.log(edit_node);
|
||||||
if (flag_edit_node) {
|
if (flag_edit_node) {
|
||||||
d3.selectAll('.node_selected')
|
d3.selectAll('.node_selected')
|
||||||
.classed("node_selected", false);
|
.classed("node_selected", false);
|
||||||
@ -961,7 +965,6 @@ function zoom(manual) {
|
|||||||
manual = false;
|
manual = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (manual) {
|
if (manual) {
|
||||||
layer_graph.attr("transform",
|
layer_graph.attr("transform",
|
||||||
"translate(" + translation + ")scale(" + scale + ")");
|
"translate(" + translation + ")scale(" + scale + ")");
|
||||||
@ -1047,7 +1050,7 @@ function set_positions_graph() {
|
|||||||
return d.x;
|
return d.x;
|
||||||
})
|
})
|
||||||
.attr("y", function(d) {
|
.attr("y", function(d) {
|
||||||
return d.y + node_radius + 30;
|
return d.y + node_radius + 24;
|
||||||
});
|
});
|
||||||
|
|
||||||
draw_minimap();
|
draw_minimap();
|
||||||
@ -1283,7 +1286,7 @@ function show_menu(item, data) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"callback": function(key, options) {
|
"callback": function(key, options) {
|
||||||
edit_node(data);
|
edit_node(data, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
items_list["children"] = {
|
items_list["children"] = {
|
||||||
@ -2492,6 +2495,9 @@ function draw_elements_graph() {
|
|||||||
.on("mouseover", myMouseoverCircleFunction)
|
.on("mouseover", myMouseoverCircleFunction)
|
||||||
.on("mouseout", myMouseoutCircleFunction)
|
.on("mouseout", myMouseoutCircleFunction)
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
|
.on("dblclick", function(d) {
|
||||||
|
edit_node(d, true);
|
||||||
|
})
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
node_temp.append("image")
|
node_temp.append("image")
|
||||||
@ -2518,7 +2524,9 @@ function draw_elements_graph() {
|
|||||||
.classed('dragable_node', true) //own dragable
|
.classed('dragable_node', true) //own dragable
|
||||||
.on("mouseover", myMouseoverCircleFunction)
|
.on("mouseover", myMouseoverCircleFunction)
|
||||||
.on("mouseout", myMouseoutCircleFunction)
|
.on("mouseout", myMouseoutCircleFunction)
|
||||||
.on("click", selected_node)
|
.on("dblclick", function(d) {
|
||||||
|
edit_node(d, true);
|
||||||
|
})
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
//Shape square
|
//Shape square
|
||||||
@ -2540,6 +2548,9 @@ function draw_elements_graph() {
|
|||||||
.on("mouseover", myMouseoverSquareFunction)
|
.on("mouseover", myMouseoverSquareFunction)
|
||||||
.on("mouseout", myMouseoutSquareFunction)
|
.on("mouseout", myMouseoutSquareFunction)
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
|
.on("dblclick", function(d) {
|
||||||
|
edit_node(d, true);
|
||||||
|
})
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
node_temp.filter(function(d) {
|
node_temp.filter(function(d) {
|
||||||
@ -2571,6 +2582,9 @@ function draw_elements_graph() {
|
|||||||
.on("mouseover", myMouseoverSquareFunction)
|
.on("mouseover", myMouseoverSquareFunction)
|
||||||
.on("mouseout", myMouseoutSquareFunction)
|
.on("mouseout", myMouseoutSquareFunction)
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
|
.on("dblclick", function(d) {
|
||||||
|
edit_node(d, true);
|
||||||
|
})
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
//Shape rhombus
|
//Shape rhombus
|
||||||
@ -2594,6 +2608,9 @@ function draw_elements_graph() {
|
|||||||
.on("mouseover", myMouseoverRhombusFunction)
|
.on("mouseover", myMouseoverRhombusFunction)
|
||||||
.on("mouseout", myMouseoutRhombusFunction)
|
.on("mouseout", myMouseoutRhombusFunction)
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
|
.on("dblclick", function(d) {
|
||||||
|
edit_node(d, true);
|
||||||
|
})
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
node_temp.filter(function(d) {
|
node_temp.filter(function(d) {
|
||||||
@ -2625,6 +2642,9 @@ function draw_elements_graph() {
|
|||||||
.on("mouseover", myMouseoverRhombusFunction)
|
.on("mouseover", myMouseoverRhombusFunction)
|
||||||
.on("mouseout", myMouseoutRhombusFunction)
|
.on("mouseout", myMouseoutRhombusFunction)
|
||||||
.on("click", selected_node)
|
.on("click", selected_node)
|
||||||
|
.on("dblclick", function(d) {
|
||||||
|
edit_node(d, true);
|
||||||
|
})
|
||||||
.on("contextmenu", function(d) { show_menu("node", d);});
|
.on("contextmenu", function(d) { show_menu("node", d);});
|
||||||
|
|
||||||
node_temp.append("title")
|
node_temp.append("title")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user