Fixed the networkmap enterprise when it is update.

This commit is contained in:
mdtrooper 2016-04-22 12:57:36 +02:00
parent 9347892a02
commit 74957c30a2
2 changed files with 23 additions and 1 deletions

View File

@ -133,7 +133,12 @@ if ($not_found) {
ui_print_error_message(__('Not found networkmap'));
}
else {
echo '<form method="post" action="index.php?sec=maps&amp;sec2=operation/maps/networkmap_list">';
if ($edit_networkmap && enterprise_installed()) {
echo '<form method="post" onsubmit="javascript: return alert_refresh_all_networkmap();" action="index.php?sec=maps&amp;sec2=operation/maps/networkmap_list">';
}
else {
echo '<form method="post" action="index.php?sec=maps&amp;sec2=operation/maps/networkmap_list">';
}
$table = null;
$table->id = 'form_editor';
@ -281,6 +286,9 @@ else {
'class="sub next"');
}
else if ($edit_networkmap) {
if (enterprise_installed()) {
ui_print_help_tip(__("Update the config of enterprise networkmap refresh all data and lost the changes."));
}
html_print_input_hidden ('id_networkmap', $id);
html_print_input_hidden ('update_networkmap', 1);
html_print_submit_button (__('Update networkmap'), 'crt', false,
@ -461,4 +469,8 @@ else {
$("#form_editor-source_ip_mask").show();
}
}
function alert_refresh_all_networkmap() {
return confirm("<?php echo __("Do you want refresh the map and lost the changes?");?>");
}
</script>

View File

@ -319,6 +319,16 @@ else if ($delete_networkmap || $duplicate_networkmap || $update_networkmap) {
$result_update = maps_update_map($id, $values);
}
if ($result_update) {
$nodes = db_get_all_rows_filter(
'titem', array('id_map' => $id));
foreach ($nodes as $node) {
db_process_sql_delete('trel_item', array('id_item' => $node['id']));
}
db_process_sql_delete('titem', array('id_map' => $id));
}
ui_print_result_message ($result_update,
__('Successfully updated'),
__('Could not be updated'));