Networkmap

This commit is contained in:
Jose Gonzalez 2023-02-28 10:39:31 +01:00
parent ce5ccbec5d
commit 114e9a366f
3 changed files with 95 additions and 82 deletions

View File

@ -117,79 +117,91 @@ if ($not_found) {
$table = new StdClass();
$table->id = 'form_editor';
$table->width = '98%';
$table->class = 'databox_color';
$table->head = [];
$table->size = [];
$table->size[0] = '30%';
$table->width = '100%';
$table->class = 'databox filter-table-adv';
$table->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->style[0] = 'width: 50%';
$table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text(
'name',
$name,
'',
30,
100,
true
);
$table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
false,
'AR',
true,
'id_group',
$id_group,
'',
'',
0,
true
).'</div>';
$table->data[2][0] = __('Node radius');
$table->data[2][1] = html_print_input_text(
'node_radius',
$node_radius,
'',
2,
10,
true
$table->data[0][] = html_print_label_input_block(
__('Name'),
html_print_input_text(
'name',
$name,
'',
30,
100,
true
),
[ 'div_class' => 'w50p' ]
);
$table->data[3][0] = __('Description');
$table->data[3][1] = html_print_textarea('description', 7, 25, $description, '', true);
$table->data[1][] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
'AR',
true,
'id_group',
$id_group,
'',
'',
0,
true
),
[ 'div_class' => 'w50p' ]
);
$table->data[2][] = html_print_label_input_block(
__('Node radius'),
html_print_input_text(
'node_radius',
$node_radius,
'',
2,
10,
true
),
[ 'div_class' => 'w50p' ]
);
$table->data[3][] = html_print_label_input_block(
__('Description'),
html_print_textarea(
'description',
7,
25,
$description,
'',
true
)
);
echo '<form method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_table($table);
echo "<div style='width: ".$table->width."; text-align: right; margin-top:20px;'>";
if ($new_empty_networkmap) {
html_print_input_hidden('save_empty_networkmap', 1);
html_print_submit_button(
__('Save networkmap'),
'crt',
false,
'class="sub next"'
);
$titleButton = __('Save networkmap');
}
if ($edit_networkmap) {
html_print_input_hidden('id_networkmap', $id);
html_print_input_hidden('update_empty_networkmap', 1);
html_print_submit_button(
__('Update networkmap'),
'crt',
false,
'class="sub upd"'
);
$titleButton = __('Update networkmap');
}
html_print_action_buttons(
html_print_submit_button(
$titleButton,
'crt',
false,
['icon' => 'next'],
true
)
);
echo '</form>';
echo '</div>';
}

View File

@ -3047,17 +3047,6 @@ class NetworkMap
html_print_div(['id' => 'content_node_details-3-1'], true)
);
/*
$table->data[0][0] = '<strong>'.__('Agent').'</strong>';
$table->data[0][1] = '';
$table->data[1][0] = '<strong>'.__('Adresses').'</strong>';
$table->data[1][1] = '';
$table->data[2][0] = '<strong>'.__('OS type').'</strong>';
$table->data[2][1] = '';
$table->data[3][0] = '<strong>'.__('Group').'</strong>';
$table->data[3][1] = '';
*/
$output .= ui_toggle(
html_print_table($table, true),
__('Node Details'),
@ -3153,12 +3142,13 @@ class NetworkMap
)
);
$table->data['fictional_node_networkmap_link'][] = html_print_button(
$buttons = [];
$buttons[] = html_print_button(
__('Update fictional node'),
'',
'upd_fictional_node',
false,
'add_fictional_node();',
['mode' => 'link'],
'',
['icon' => 'next'],
true
);
/*
@ -3184,18 +3174,20 @@ class NetworkMap
);
*/
$buttons[] = html_print_button(
__('Update node'),
'upd_only_node',
false,
'update_node_name()',
['icon' => 'next'],
true
);
$nodeUpdateTable = html_print_table($table, true);
$nodeUpdateTable .= html_print_div(
[
'class' => 'action-buttons w100p float-right',
'content' => html_print_button(
__('Update node'),
'',
false,
'update_node_name()',
['icon' => 'next'],
true
),
'content' => implode('', $buttons),
],
true
);

View File

@ -839,6 +839,11 @@ function edit_node(data_node, dblClick) {
"onclick",
"update_fictional_node(" + node_selected.id_db + ");"
);
console.log("cimborrio");
$("#button-upd_fictional_node").attr(
"onclick",
"update_fictional_node(" + node_selected.id_db + ");"
);
$("#node_options-node_name-2 input").attr(
"onclick",
@ -934,18 +939,22 @@ function edit_node(data_node, dblClick) {
//Fictional node
$("#node_options-fictional_node_name").css("display", "");
$("input[name='edit_name_fictional_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok
$("#node_options-fictional_node_networkmap_link").css("display", "");
$("#node_options-fictional_node_networkmap_link-0").css("display", "");
$("#edit_networkmap_to_link").val(node_selected.networkmap_id);
$("#edit_networkmap_to_link").trigger("change");
$("#node_options-fictional_node_update_button").css("display", "");
$("#button-upd_fictional_node").css("display", "");
$("#node_options-node_name").css("display", "none");
$("#node_options-node_update_button").css("display", "none");
$("#button-upd_only_node").css("display", "none");
} else {
$("input[name='edit_name_node']").val(node_selected.text); // It doesn't eval the possible XSS so it's ok
$("#node_options-fictional_node_name").css("display", "none");
$("#node_options-fictional_node_networkmap_link").css("display", "none");
$("#node_options-fictional_node_update_button").css("display", "none");
$("#node_options-fictional_node_networkmap_link-0").css(
"display",
"none"
);
$("#node_options-node_name").css("display", "");
$("#button-upd_fictional_node").css("display", "none");
$("#button-upd_only_node").css("display", "");
}
//Clean