mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
New networkmaps in progress... (Added new migration system and new design elements to js)
This commit is contained in:
parent
63b280e5d3
commit
eb9390cad6
@ -1468,7 +1468,7 @@ function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom,
|
|||||||
|
|
||||||
$head .= "ratio=fill;";
|
$head .= "ratio=fill;";
|
||||||
$head .= "root=0;";
|
$head .= "root=0;";
|
||||||
$head .= "nodesep=\"0.5\";";
|
$head .= "nodesep=\"0.02\";";
|
||||||
$head .= "size=\"$size\";";
|
$head .= "size=\"$size\";";
|
||||||
|
|
||||||
$head .= "\n";
|
$head .= "\n";
|
||||||
|
@ -1152,12 +1152,25 @@ function is_in_rel_array ($relations, $relation) {
|
|||||||
return $is_in_array;
|
return $is_in_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrate_older_open_maps() {
|
function map_migrated($id) {
|
||||||
|
$new_maps = db_get_all_rows_sql("SELECT filter FROM tmap");
|
||||||
|
$new_map_filter = json_decode($new_maps, true);
|
||||||
|
|
||||||
|
foreach ($new_map_filter as $filter) {
|
||||||
|
if ((isset($filter['id_migrate_map'])) && ($filter['id_migrate_map'] == $id)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function migrate_older_open_maps($id) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$older_networkmaps = db_get_all_rows_sql("SELECT * FROM tnetwork_map");
|
$old_networkmap = db_get_row_filter('tnetwork_map',
|
||||||
|
array('id_networkmap' => $id));
|
||||||
|
|
||||||
foreach ($older_networkmaps as $old_networkmap) {
|
|
||||||
$map_values = array();
|
$map_values = array();
|
||||||
$map_values['id_group'] = $old_networkmap['id_group'];
|
$map_values['id_group'] = $old_networkmap['id_group'];
|
||||||
$map_values['id_user'] = $old_networkmap['id_user'];
|
$map_values['id_user'] = $old_networkmap['id_user'];
|
||||||
@ -1168,6 +1181,7 @@ function migrate_older_open_maps() {
|
|||||||
$new_map_filter = array();
|
$new_map_filter = array();
|
||||||
$new_map_filter['dont_show_subgroups'] = $old_networkmap['dont_show_subgroups'];
|
$new_map_filter['dont_show_subgroups'] = $old_networkmap['dont_show_subgroups'];
|
||||||
$new_map_filter['node_radius'] = 40;
|
$new_map_filter['node_radius'] = 40;
|
||||||
|
$new_map_filter['id_migrate_map'] = $id;
|
||||||
$map_values['filter'] = json_encode($new_map_filter);
|
$map_values['filter'] = json_encode($new_map_filter);
|
||||||
|
|
||||||
$map_values['description'] = "Mapa open migrado";
|
$map_values['description'] = "Mapa open migrado";
|
||||||
@ -1193,7 +1207,7 @@ function migrate_older_open_maps() {
|
|||||||
if (!$id_new_map) {
|
if (!$id_new_map) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1050,12 +1050,17 @@ function set_positions_graph() {
|
|||||||
return d.y - (d.image_height / 2);
|
return d.y - (d.image_height / 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var position_text = 40;
|
||||||
|
if (node_radius > 100) {
|
||||||
|
position_text = 60;
|
||||||
|
}
|
||||||
|
|
||||||
node.selectAll(".node_text")
|
node.selectAll(".node_text")
|
||||||
.attr("x", function(d) {
|
.attr("x", function(d) {
|
||||||
return d.x;
|
return d.x;
|
||||||
})
|
})
|
||||||
.attr("y", function(d) {
|
.attr("y", function(d) {
|
||||||
return d.y + node_radius + 24;
|
return d.y + node_radius + position_text;
|
||||||
});
|
});
|
||||||
|
|
||||||
draw_minimap();
|
draw_minimap();
|
||||||
@ -2662,9 +2667,14 @@ function draw_elements_graph() {
|
|||||||
node_temp.append("title")
|
node_temp.append("title")
|
||||||
.text(function(d) {return d.text; });
|
.text(function(d) {return d.text; });
|
||||||
|
|
||||||
|
var font_size = "32px";
|
||||||
|
if (node_radius > 100) {
|
||||||
|
font_size = "64px";
|
||||||
|
}
|
||||||
|
|
||||||
node_temp.append("text")
|
node_temp.append("text")
|
||||||
.attr("class", "node_text")
|
.attr("class", "node_text")
|
||||||
.attr("style", "font-size: 32px; font-style:normal; font-weight:normal; line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Verdana")
|
.attr("style", "font-style:normal; font-weight:normal; line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;")
|
||||||
.attr("x", function(d) {
|
.attr("x", function(d) {
|
||||||
return d.x;
|
return d.x;
|
||||||
})
|
})
|
||||||
@ -2672,7 +2682,7 @@ function draw_elements_graph() {
|
|||||||
return d.y + node_radius + 12;
|
return d.y + node_radius + 12;
|
||||||
})
|
})
|
||||||
.append("tspan")
|
.append("tspan")
|
||||||
.attr("style", "text-align:center; text-anchor:middle; fill:#000000")
|
.attr("style", "font-size: " + font_size + " !important; font-family:Verdana; text-align:center; text-anchor:middle; fill:#000000")
|
||||||
.text(function(d) {
|
.text(function(d) {
|
||||||
return d.text;
|
return d.text;
|
||||||
})
|
})
|
||||||
|
@ -37,7 +37,6 @@ $update_networkmap = (bool) get_parameter('update_networkmap', false);
|
|||||||
$copy_networkmap = (bool) get_parameter('copy_networkmap', false);
|
$copy_networkmap = (bool) get_parameter('copy_networkmap', false);
|
||||||
$delete = (bool) get_parameter('delete', false);
|
$delete = (bool) get_parameter('delete', false);
|
||||||
$tab = (string) get_parameter('tab', 'list');
|
$tab = (string) get_parameter('tab', 'list');
|
||||||
$migrate_networkmap = (string) get_parameter('migrate_networkmap', false);
|
|
||||||
|
|
||||||
$result_txt = '';
|
$result_txt = '';
|
||||||
// The networkmap doesn't exist yet
|
// The networkmap doesn't exist yet
|
||||||
@ -271,19 +270,6 @@ else if ($update_networkmap || $copy_networkmap || $delete) {
|
|||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($migrate_networkmap) {
|
|
||||||
$result = migrate_older_open_maps();
|
|
||||||
|
|
||||||
if (enterprise_installed()) {
|
|
||||||
enterprise_include_once ('include/functions_pandora_networkmap.php');
|
|
||||||
|
|
||||||
$result = migrate_older_networkmap_enterprise();
|
|
||||||
}
|
|
||||||
|
|
||||||
$result_txt = ui_print_result_message($result,
|
|
||||||
__('Succesfully migrated (New map, I AM YOUR FATHER)'), __('Could not be migrated'), '',
|
|
||||||
true);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($tab) {
|
switch ($tab) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
@ -293,6 +279,38 @@ switch ($tab) {
|
|||||||
require('pandora_networkmap.view.php');
|
require('pandora_networkmap.view.php');
|
||||||
break;
|
break;
|
||||||
case 'list':
|
case 'list':
|
||||||
|
$old_networkmaps_enterprise = array();
|
||||||
|
$old_networkmaps_open = array();
|
||||||
|
|
||||||
|
if (enterprise_installed()) {
|
||||||
|
$old_networkmaps_enterprise = db_get_all_rows_sql("SELECT id FROM tnetworkmap_enterprise");
|
||||||
|
}
|
||||||
|
$old_networkmaps_open = db_get_all_rows_sql("SELECT id_networkmap FROM tnetwork_map");
|
||||||
|
|
||||||
|
foreach ($old_networkmaps_enterprise as $old_map_ent) {
|
||||||
|
if (!map_migrated($old_map_ent['id'])) {
|
||||||
|
if (enterprise_installed()) {
|
||||||
|
enterprise_include_once ('include/functions_pandora_networkmap.php');
|
||||||
|
|
||||||
|
$return = migrate_older_networkmap_enterprise($old_map_ent['id']);
|
||||||
|
|
||||||
|
if (!$return) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($old_networkmaps_enterprise as $old_map_ent) {
|
||||||
|
if (!map_migrated($old_map_ent['id'])) {
|
||||||
|
$return = migrate_older_open_maps($old_map_ent['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$return) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ui_print_page_header(__('Networkmap'),
|
ui_print_page_header(__('Networkmap'),
|
||||||
"images/op_network.png", false, "network_map_enterprise",
|
"images/op_network.png", false, "network_map_enterprise",
|
||||||
false);
|
false);
|
||||||
@ -376,7 +394,6 @@ switch ($tab) {
|
|||||||
$network_map['name'] . '</a>';
|
$network_map['name'] . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($network_map['id_group'] > 0) {
|
if ($network_map['id_group'] > 0) {
|
||||||
$nodes = db_get_all_rows_sql("SELECT style FROM titem WHERE id_map = " . $network_map['id'] . " AND deleted = 0");
|
$nodes = db_get_all_rows_sql("SELECT style FROM titem WHERE id_map = " . $network_map['id'] . " AND deleted = 0");
|
||||||
$count = 0;
|
$count = 0;
|
||||||
@ -394,7 +411,6 @@ switch ($tab) {
|
|||||||
WHERE id_map = ' . $network_map['id'] . ' AND deleted = 0');
|
WHERE id_map = ' . $network_map['id'] . ' AND deleted = 0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (empty($count))
|
if (empty($count))
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
@ -445,13 +461,6 @@ switch ($tab) {
|
|||||||
html_print_submit_button (__('Create networkmap'), 'crt', false, 'class="sub next" style="float: right;"');
|
html_print_submit_button (__('Create networkmap'), 'crt', false, 'class="sub next" style="float: right;"');
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
echo "<div style='width: " . $table->width . "; margin-top: 5px;'>";
|
|
||||||
echo '<form method="post" action="index.php?sec=network&sec2=operation/agentes/pandora_networkmap">';
|
|
||||||
html_print_input_hidden ('migrate_networkmap', 1);
|
|
||||||
html_print_submit_button (__('Migrate older networkmaps'), 'crt', false, 'class="sub next" style="float: left;"');
|
|
||||||
echo "</form>";
|
|
||||||
echo "</div>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user