New networkmaps in progress... (Added zoom and offset system to maps in dashboard)
This commit is contained in:
parent
5f95a1be60
commit
cdc469f974
|
@ -594,7 +594,7 @@ function networkmap_links_to_js_links($relations, $nodes_graph) {
|
|||
return $return;
|
||||
}
|
||||
|
||||
function networkmap_write_js_array($id, $nodes_and_relations = array()) {
|
||||
function networkmap_write_js_array($id, $nodes_and_relations = array(), $map_dash_details = array()) {
|
||||
global $config;
|
||||
|
||||
db_clean_cache();
|
||||
|
@ -616,6 +616,18 @@ function networkmap_write_js_array($id, $nodes_and_relations = array()) {
|
|||
echo "var url_background_grid = '" . ui_get_full_url(
|
||||
'images/background_grid.png') . "'\n";
|
||||
echo "var networkmap_id = " . $id . ";\n";
|
||||
|
||||
if (!empty($map_dash_details)) {
|
||||
echo "var x_offs = " . $map_dash_details['x_offs'] . ";\n";
|
||||
echo "var y_offs = " . $map_dash_details['y_offs'] . ";\n";
|
||||
echo "var z_dash = " . $map_dash_details['z_dash'] . ";\n";
|
||||
}
|
||||
else {
|
||||
echo "var x_offs = null;\n";
|
||||
echo "var y_offs = null;\n";
|
||||
echo "var z_dash = null;\n";
|
||||
}
|
||||
|
||||
echo "var networkmap_refresh_time = 1000 * " .
|
||||
$networkmap['source_period'] . ";\n";
|
||||
echo "var networkmap_center = [ " .
|
||||
|
@ -1211,7 +1223,7 @@ function migrate_older_open_maps($id) {
|
|||
return true;
|
||||
}
|
||||
|
||||
function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations = array(), $dashboard_mode = false) {
|
||||
function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations = array(), $dashboard_mode = false, $map_dash_details = array()) {
|
||||
global $config;
|
||||
$clean_relations = clean_duplicate_links($nodes_and_relations['relations']);
|
||||
|
||||
|
@ -1293,7 +1305,7 @@ function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations =
|
|||
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
networkmap_write_js_array($id, $nodes_and_relations);
|
||||
networkmap_write_js_array($id, $nodes_and_relations, $map_dash_details);
|
||||
?>
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// document ready
|
||||
|
|
|
@ -2203,10 +2203,14 @@ function init_graph(parameter_object) {
|
|||
.linkDistance(0)
|
||||
.size([width_svg, height_svg]);
|
||||
|
||||
if (graph.nodes.length > 100) {
|
||||
scale = 0.05;
|
||||
translation[0] = 200;
|
||||
translation[1] = 400;
|
||||
if (x_offs != null) {
|
||||
translation[0] = x_offs;
|
||||
}
|
||||
if (y_offs != null) {
|
||||
translation[1] = y_offs;
|
||||
}
|
||||
if (z_dash != null) {
|
||||
scale = z_dash;
|
||||
}
|
||||
|
||||
window.zoom_obj = d3.behavior.zoom();
|
||||
|
|
|
@ -681,12 +681,19 @@ if (is_ajax ()) {
|
|||
//--------------END AJAX------------------------------------------------
|
||||
$id = (int) get_parameter('id_networkmap', 0);
|
||||
$dash_mode = 0;
|
||||
$map_dash_details = array();
|
||||
|
||||
if (enterprise_installed()) {
|
||||
include_once("enterprise/dashboard/widgets/network_map.php");
|
||||
if ($id_networkmap) {
|
||||
$id = $id_networkmap;
|
||||
$dash_mode = $dashboard_mode;
|
||||
$x_offs = $x_offset;
|
||||
$y_offs = $y_offset;
|
||||
$z_dash = $zoom_dash;
|
||||
$map_dash_details['x_offs'] = $x_offs;
|
||||
$map_dash_details['y_offs'] = $y_offs;
|
||||
$map_dash_details['z_dash'] = $z_dash;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -744,11 +751,13 @@ else {
|
|||
}
|
||||
}
|
||||
|
||||
ui_print_page_header(sprintf(__('Networkmap - %s'),
|
||||
io_safe_output($networkmap['name'])), "images/bricks.png",
|
||||
false, "network_map_enterprise", false, $buttons);
|
||||
if (!$dash_mode) {
|
||||
ui_print_page_header(sprintf(__('Networkmap - %s'),
|
||||
io_safe_output($networkmap['name'])), "images/bricks.png",
|
||||
false, "network_map_enterprise", false, $buttons);
|
||||
}
|
||||
|
||||
$nodes_and_relations = networkmap_process_networkmap($id);
|
||||
show_networkmap($id, $user_readonly, $nodes_and_relations, $dash_mode);
|
||||
show_networkmap($id, $user_readonly, $nodes_and_relations, $dash_mode, $map_dash_details);
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue