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

View File

@ -3047,17 +3047,6 @@ class NetworkMap
html_print_div(['id' => 'content_node_details-3-1'], true) 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( $output .= ui_toggle(
html_print_table($table, true), html_print_table($table, true),
__('Node Details'), __('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'), __('Update fictional node'),
'', 'upd_fictional_node',
false, false,
'add_fictional_node();', '',
['mode' => 'link'], ['icon' => 'next'],
true 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_table($table, true);
$nodeUpdateTable .= html_print_div( $nodeUpdateTable .= html_print_div(
[ [
'class' => 'action-buttons w100p float-right', 'class' => 'action-buttons w100p float-right',
'content' => html_print_button( 'content' => implode('', $buttons),
__('Update node'),
'',
false,
'update_node_name()',
['icon' => 'next'],
true
),
], ],
true true
); );

View File

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