Working in the code of new networkmap.
This commit is contained in:
parent
64e3488ea5
commit
df25018631
|
@ -148,14 +148,17 @@ class Networkmap extends Map {
|
|||
break;
|
||||
}
|
||||
|
||||
$cmd = "$graphviz_command -Tplain -o " . $filename_plain . " " .
|
||||
$cmd = "$graphviz_command " .
|
||||
"-Tpng -o /tmp/caca.png -Tplain -o " . $filename_plain . " " .
|
||||
$filename_dot;
|
||||
|
||||
system ($cmd);
|
||||
|
||||
unlink($filename_dot);
|
||||
|
||||
html_debug($cmd);
|
||||
html_debug($filename_plain);
|
||||
html_debug(file_get_contents($filename_plain), true);
|
||||
|
||||
$nodes = networkmap_enterprise_loadfile($this->id,
|
||||
$filename_plain,
|
||||
|
@ -165,6 +168,16 @@ class Networkmap extends Map {
|
|||
//~ html_debug_print($nodes);
|
||||
//~ html_debug_print($relation_nodes);
|
||||
|
||||
// debug image
|
||||
// Read image path, convert to base64 encoding
|
||||
$imgData = base64_encode(file_get_contents("/tmp/caca.png"));
|
||||
|
||||
// Format the image SRC: data:{mime};base64,{data};
|
||||
$src = 'data: '.mime_content_type("/tmp/caca.png").';base64,'.$imgData;
|
||||
|
||||
// Echo out a sample image
|
||||
echo '<img src="'.$src.'">';
|
||||
|
||||
// ----- END DEPRECATED CODE--------------------------------
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,10 @@ function migration_open_networkmaps() {
|
|||
foreach ($old_networkmaps_open as $old_netw_open) {
|
||||
$new_networkmap = array();
|
||||
|
||||
$new_networkmap['name'] = $old_netw_open['name'];
|
||||
$new_networkmap['name'] =
|
||||
io_safe_output($old_netw_open['name']);
|
||||
$new_networkmap['id_user'] = $old_netw_open['id_user'];
|
||||
$new_networkmap['id_group'] = $old_netw_open['store_group'];
|
||||
|
||||
switch ($old_netw_open['type']) {
|
||||
case 'radial_dynamic':
|
||||
|
@ -53,6 +55,13 @@ function migration_open_networkmaps() {
|
|||
break;
|
||||
}
|
||||
|
||||
switch ($new_networkmap['subtype']) {
|
||||
case MAP_SUBTYPE_TOPOLOGY:
|
||||
$new_networkmap['source'] = MAP_SOURCE_GROUP;
|
||||
$new_networkmap['source_data'] = $old_netw_open['id_group'];
|
||||
break;
|
||||
}
|
||||
|
||||
switch ($old_netw_open['layout']) {
|
||||
case 'radial':
|
||||
$new_networkmap['generation_method'] = MAP_GENERATION_RADIAL;
|
||||
|
|
|
@ -129,6 +129,7 @@ else {
|
|||
$filter = $filter . '.exe';
|
||||
}
|
||||
$cmd = escapeshellarg($graphviz_path . $filter) .
|
||||
" -Tplain -o /tmp/caca.txt " .
|
||||
" -Tcmapx " . escapeshellarg("-o$filename_map") .
|
||||
" -Tpng ". escapeshellarg("-o$filename_img") .
|
||||
" " . escapeshellarg($filename_dot);
|
||||
|
@ -136,7 +137,11 @@ else {
|
|||
$result = system ($cmd);
|
||||
fclose ($fh);
|
||||
unlink ($filename_dot);
|
||||
//~ html_debug_print($cmd);
|
||||
html_debug_print($cmd);
|
||||
|
||||
|
||||
|
||||
html_debug(file_get_contents("/tmp/caca.txt"), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,10 +71,33 @@ if ($migrate_open_networkmaps)
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$delete_networkmap = (bool)get_parameter('delete_networkmap', 0);
|
||||
$multiple_delete = (bool)get_parameter('multiple_delete', 0);
|
||||
$duplicate_networkmap = (bool)get_parameter('duplicate_networkmap', 0);
|
||||
$update_networkmap = (bool)get_parameter('update_networkmap', 0);
|
||||
$save_networkmap = (bool)get_parameter('save_networkmap', 0);
|
||||
|
||||
if ($multiple_delete) {
|
||||
$ids_multiple_delete = json_decode(
|
||||
io_safe_output(
|
||||
get_parameter('ids_multiple_delete',
|
||||
json_encode(array())
|
||||
)
|
||||
),
|
||||
true);
|
||||
|
||||
$total = count($ids_multiple_delete);
|
||||
$count = 0;
|
||||
foreach ($ids_multiple_delete as $id) {
|
||||
if (maps_delete_map($id)) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
ui_print_result_message (($total > 0 && $total == $count),
|
||||
__('Successfully deleted'),
|
||||
__('Could not be deleted'));
|
||||
}
|
||||
|
||||
if ($save_networkmap) {
|
||||
$id_group = (int) get_parameter('id_group', 0);
|
||||
|
||||
|
@ -254,6 +277,7 @@ else if ($delete_networkmap || $duplicate_networkmap || $update_networkmap) {
|
|||
|
||||
//+++++++++++++++TABLE AND EDIT/CREATION BUTTONS++++++++++++++++++++++
|
||||
$table = new stdClass();
|
||||
$table->id = "list_networkmaps";
|
||||
$table->width = "100%";
|
||||
$table->class = "databox data";
|
||||
|
||||
|
@ -282,7 +306,8 @@ if (enterprise_installed()) {
|
|||
$table->head['group'] = __('Group');
|
||||
$table->head['copy'] = __('Copy');
|
||||
$table->head['edit'] = __('Edit');
|
||||
$table->head['delete'] = __('Delete');
|
||||
$table->head['delete'] = __('Delete') .
|
||||
html_print_checkbox('delete_all', 0, false, true, false, 'checkbox_delete_all();');
|
||||
|
||||
$networkmaps = maps_get_maps(array('type' => MAP_TYPE_NETWORKMAP));
|
||||
|
||||
|
@ -341,19 +366,56 @@ else {
|
|||
'delete_networkmap=1&id_networkmap=' . $networkmap['id'] . '" alt="' . __('Delete') .
|
||||
'" onclick="javascript: if (!confirm(\'' . __('Are you sure?') . '\')) return false;">' .
|
||||
html_print_image('images/cross.png', true) . '</a>';
|
||||
$data['delete'] .=
|
||||
html_print_checkbox("delete_id[" . $networkmap['id'] . "]",
|
||||
1, false, true);
|
||||
|
||||
|
||||
$table->data[] = $data;
|
||||
}
|
||||
html_print_table($table);
|
||||
}
|
||||
echo '<form id="multiple_delete" method="post" style="float:right;" action="index.php?sec=network&sec2=operation/maps/networkmap_list">';
|
||||
html_print_input_hidden ('multiple_delete', 1);
|
||||
html_print_input_hidden ('ids_multiple_delete', "");
|
||||
html_print_button(__('Delete'), 'del', false, 'submit_multiple_delete();', 'class="sub delete"');
|
||||
echo '</form>';
|
||||
|
||||
echo '<form method="post" style="float:right;" action="index.php?sec=maps&sec2=operation/maps/networkmap_editor">';
|
||||
echo '<form method="post" style="float:right; margin-right: 10px;" action="index.php?sec=maps&sec2=operation/maps/networkmap_editor">';
|
||||
html_print_input_hidden ('create_networkmap', 1);
|
||||
html_print_submit_button (__('Create'), "crt", false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function submit_multiple_delete() {
|
||||
var ids_multiple_delete = [];
|
||||
$.each(
|
||||
$("#list_networkmaps tbody input[type='checkbox']:checked"),
|
||||
function(i,e) {
|
||||
ids_multiple_delete.push(
|
||||
$(e).attr("name").match(/\[(.*)\]/)[1]);
|
||||
}
|
||||
);
|
||||
|
||||
$("input[name='ids_multiple_delete']").val(
|
||||
JSON.stringify(ids_multiple_delete));
|
||||
|
||||
if (confirm('<?php echo __('Are you sure?');?>'))
|
||||
$("#multiple_delete").submit();
|
||||
}
|
||||
|
||||
function checkbox_delete_all() {
|
||||
if ($("input[name='delete_all']").prop("checked")) {
|
||||
$("#list_networkmaps tbody input[type='checkbox']")
|
||||
.prop("checked", true);
|
||||
}
|
||||
else {
|
||||
$("#list_networkmaps tbody input[type='checkbox']")
|
||||
.prop("checked", false);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue