Network maps improve

This commit is contained in:
Jose Gonzalez 2023-02-27 16:37:00 +01:00
parent 526bff976c
commit 5df442e83e
6 changed files with 504 additions and 346 deletions

View File

@ -3022,17 +3022,41 @@ class NetworkMap
$table = new StdClass();
$table->id = 'node_details';
$table->class = 'filter-table-adv';
$table->width = '100%';
$table->data = [];
$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] = '';
$table->data[0][] = html_print_label_input_block(
__('Agent'),
html_print_div(['id' => 'content_node_details-0-1'], true)
);
$table->data[0][] = html_print_label_input_block(
__('Adresses'),
html_print_div(['id' => 'content_node_details-1-1'], true)
);
$table->data[1][] = html_print_label_input_block(
__('OS type'),
html_print_div(['id' => 'content_node_details-2-1'], true)
);
$table->data[1][] = html_print_label_input_block(
__('Group'),
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),
@ -3071,52 +3095,75 @@ class NetworkMap
$table = new StdClass();
$table->id = 'node_options';
$table->class = 'filter-table-adv';
$table->width = '100%';
$table->data = [];
$table->data[0][0] = __('Shape');
$table->data[0][1] = html_print_select(
[
'circle' => __('Circle'),
'square' => __('Square'),
'rhombus' => __('Rhombus'),
],
'shape',
'',
'javascript:',
'',
0,
true
).'&nbsp;<span id="shape_icon_in_progress" class="invisible">'.html_print_image('images/spinner.gif', true).'</span><span id="shape_icon_correct" class="invisible">'.html_print_image('images/success.png', true, ['width' => '18px']).'</span><span id="shape_icon_fail" class="invisible">'.html_print_image('images/icono-bad.png', true, ['width' => '18px']).'</span>';
$table->data['node_name'][0] = __('Name');
$table->data['node_name'][1] = html_print_input_text(
'edit_name_node',
'',
__('name node'),
'20',
'50',
true
);
$table->data['node_name'][2] = html_print_button(
__('Update node'),
'',
false,
'',
'class="sub next"',
true
$table->data[0][] = html_print_label_input_block(
__('Shape'),
html_print_select(
[
'circle' => __('Circle'),
'square' => __('Square'),
'rhombus' => __('Rhombus'),
],
'shape',
'',
'javascript:',
'',
0,
true
)
);
$table->data['fictional_node_name'][0] = __('Name');
$table->data['fictional_node_name'][1] = html_print_input_text(
'edit_name_fictional_node',
$table->data['node_name'][] = html_print_label_input_block(
__('Name'),
html_print_input_text(
'edit_name_node',
'',
__('name node'),
'20',
'50',
true
)
);
$table->data['fictional_node_name'][] = html_print_label_input_block(
__('Name'),
html_print_input_text(
'edit_name_fictional_node',
'',
__('name fictional node'),
'20',
'50',
true
)
);
$table->data['fictional_node_networkmap_link'][] = html_print_label_input_block(
__('Networkmap to link'),
html_print_select(
$list_networkmaps,
'edit_networkmap_to_link',
'',
'',
'',
0,
true
)
);
$table->data['fictional_node_networkmap_link'][] = html_print_button(
__('Update fictional node'),
'',
__('name fictional node'),
'20',
'50',
false,
'add_fictional_node();',
['mode' => 'link'],
true
);
$table->data['fictional_node_networkmap_link'][0] = __('Networkmap to link');
$table->data['fictional_node_networkmap_link'][1] = html_print_select(
/*
$table->data['fictional_node_networkmap_link'][0] = __('Networkmap to link');
$table->data['fictional_node_networkmap_link'][1] = html_print_select(
$list_networkmaps,
'edit_networkmap_to_link',
'',
@ -3124,19 +3171,37 @@ class NetworkMap
'',
0,
true
);
$table->data['fictional_node_update_button'][0] = '';
$table->data['fictional_node_update_button'][1] = html_print_button(
);
$table->data['fictional_node_update_button'][0] = '';
$table->data['fictional_node_update_button'][1] = html_print_button(
__('Update fictional node'),
'',
false,
'add_fictional_node();',
'class="sub next"',
['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
),
],
true
);
$output .= ui_toggle(
html_print_table($table, true),
$nodeUpdateTable,
__('Node options'),
__('Node options'),
'',
@ -3210,9 +3275,9 @@ class NetworkMap
$table->data['template_row']['node_target'] = '';
$table->data['template_row']['edit'] = '';
$table->data['template_row']['edit'] .= '<span class="edit_icon_correct" style="display: none">'.html_print_image('images/dot_green.png', true).'</span><span class="edit_icon_fail" style="display: none" >'.html_print_image('images/dot_red.png', true).'</span><span class="edit_icon_progress" style="display: none">'.html_print_image('images/spinner.gif', true).'</span>';
$table->data['template_row']['edit'] .= '<span class="edit_icon_correct" style="display: none">'.html_print_image('images/pixel_green.png', true, ['class' => 'main_menu_icon']).'</span><span class="edit_icon_fail" style="display: none" >'.html_print_image('images/dot_red.png', true).'</span><span class="edit_icon_progress" style="display: none">'.html_print_image('images/spinner.gif', true).'</span>';
// <span class="edit_icon"><a class="edit_icon_link" title="'.__('Update').'" href="#">'.html_print_image('images/config.png', true, ['class' => 'invert_filter']).'</a></span>';
$table->data['template_row']['edit'] .= '<a class="delete_icon" href="#">'.html_print_image('images/delete.png', true, ['class' => 'invert_filter']).'</a>';
$table->data['template_row']['edit'] .= '<a class="delete_icon" href="#">'.html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter', 'style' => 'padding: 10px']).'</a>';
$table->colspan['no_relations']['0'] = 5;
$table->cellstyle['no_relations']['0'] = 'text-align: center;';
@ -3434,7 +3499,7 @@ class NetworkMap
'',
false,
'add_fictional_node();',
'class="sub"',
['type' => 'link'],
true
);
$add_agent_node_html = html_print_table($table, true);
@ -3691,7 +3756,7 @@ class NetworkMap
$output .= '<div id="hide_labels_'.$networkmap['id'].'"';
$output .= ' class="absolute right_10px top_10px">';
$output .= '<a title="'.__('Hide Labels').'" href="javascript: hide_labels();">';
$output .= html_print_image('/images/icono_borrar.png', true, ['id' => 'image_hide_show_labels']);
$output .= html_print_image('/images/disable.svg', true, ['id' => 'image_hide_show_labels', 'class' => 'main_menu_icon invert_filter']);
$output .= '</a></div>';
$output .= '<div id="holding_spinner_'.$networkmap['id'].'" ';

View File

@ -846,9 +846,9 @@ function edit_node(data_node, dblClick) {
);
if (node_selected.type === "3") {
$("#node_details-0-0").html("<strong>Link to map</strong>");
$("#node_details-0-0").html("Link to map");
if (node_selected.networkmap_id > 0) {
$("#node_details-0-1").html(
$("#node_details-0-1 div").html(
'<a href="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap=' +
node_selected.networkmap_id +
'">' +
@ -858,7 +858,7 @@ function edit_node(data_node, dblClick) {
"</a>"
);
} else {
$("#node_details-0-1").html(
$("#node_details-0-1 div").html(
$(
`#edit_networkmap_to_link option[value='${node_selected.networkmap_id}']`
).text()
@ -869,7 +869,7 @@ function edit_node(data_node, dblClick) {
$("#node_details-2").hide();
$("#node_details-3").hide();
} else {
$("#node_details-0-0").html("<strong>Agent</strong>");
//$("#node_details-0-0").html("Agent");
$("#node_details-1").show();
$("#node_details-2").show();
$("#node_details-3").show();
@ -885,7 +885,7 @@ function edit_node(data_node, dblClick) {
type: "POST",
url: window.base_url_homedir + "/ajax.php",
success: function(data) {
$("#node_details-0-1").html(
$("#content_node_details-0-1").html(
'<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' +
node_selected["id_agent"] +
'">' +
@ -903,9 +903,9 @@ function edit_node(data_node, dblClick) {
addresses += address + "<br>";
}
}
$("#node_details-1-1").html(addresses);
$("#node_details-2-1").html(data["os"]);
$("#node_details-3-1").html(data["group"]);
$("#content_node_details-1-1").html(addresses);
$("#content_node_details-2-1").html(data["os"]);
$("#content_node_details-3-1").html(data["group"]);
$("[aria-describedby=dialog_node_edit]").css({ top: "200px" });
$("#foot").css({
@ -1184,9 +1184,15 @@ function load_interfaces(selected_links) {
$("#relations_table")
.parent()
.append(
`<div class='action-buttons w100p'>
<input id='update_relations_button' class='sub upd' type='button' value='update relations'>
</div>`
`
<div class='action-buttons w100p'>
<button id="update_relations_button" type="button" class="buttonButton" value="Update relations">
<span id="span-button-unnamed" class="font_11">
Update relations
</span>
<div style="" class="subIcon next "></div>
</button>
`
);
$("#update_relations_button").click(function() {
@ -1341,7 +1347,7 @@ function hide_labels_function() {
$("#hide_labels_" + networkmap_id + " > a").attr("title", "Show Labels");
$("#hide_labels_" + networkmap_id + " > a > img").attr(
"src",
window.location.origin + "/pandora_console/images/icono_pintar.png"
window.location.origin + "/pandora_console/images/enable.svg"
);
d3.selectAll(".node_text").style("display", "none");
@ -1354,7 +1360,7 @@ function show_labels_function() {
$("#hide_labels_" + networkmap_id + " > a").attr("title", "Hide Labels");
$("#hide_labels_" + networkmap_id + " > a > img").attr(
"src",
window.location.origin + "/pandora_console/images//icono_borrar.png"
window.location.origin + "/pandora_console/images/disable.svg"
);
d3.selectAll(".node_text").style("display", "");

View File

@ -8066,6 +8066,7 @@ div.graph div.legend table {
.networkconsole {
width: 100%;
height: 100%;
min-height: 460px;
position: relative;
overflow: hidden;
background-color: #fafafa;
@ -9870,6 +9871,11 @@ div#err_msg_centralised {
font-style: italic;
}
.div-4-col {
flex: 25%;
display: flex;
flex-direction: column;
}
.div-col {
width: 33%;
display: flex;
@ -11262,7 +11268,11 @@ form#satellite_conf_edit > fieldset.full-column {
.input_sub_placeholder {
font-size: 8pt;
color: #8a96a6;
/*font-family: "lato";*/
}
.input_sub_placeholder_warning {
color: #ffb900;
font-style: italic;
}
#principal_action_buttons input,

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -204,15 +204,15 @@ if ($edit_networkmap) {
}
$button = [];
if ($edit_networkmap) {
if ($edit_networkmap === true) {
$button['map'] = [
'active' => false,
'text' => '<a href="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=view&id_networkmap='.$id.'">'.html_print_image(
'images/op_network.png',
'images/network@svg.svg',
true,
[
'title' => __('View map'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
];
@ -292,177 +292,6 @@ 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->style = [];
$table->style[0] = 'font-weight: bold; width: 150px;';
$table->data = [];
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text(
'name',
$name,
'',
30,
100,
true
);
$return_all_group = false;
if (users_can_manage_group_all('AR') === true) {
$return_all_group = true;
}
$table->data[1][0] = __('Group');
$table->data[1][1] = '<div class="w250px">'.html_print_select_groups(
// Id_user.
$config['id_user'],
// Privilege.
'AR',
// ReturnAllGroup.
$return_all_group,
// Name.
'id_group_map',
// Selected.
$id_group_map,
// Script.
'',
// Nothing.
'',
// Nothing_value.
'',
// Return.
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[3][1] = html_print_input_text(
'description',
$description,
'',
100,
100,
true
);
$table->data[4][0] = __('Position X');
$table->data[4][1] = html_print_input_text('pos_x', $offset_x, '', 2, 10, true);
$table->data[5][0] = __('Position Y');
$table->data[5][1] = html_print_input_text('pos_y', $offset_y, '', 2, 10, true);
$table->data[6][0] = __('Zoom scale');
if ($scale_z == '') {
$scale_z = 0.5;
}
$table->data[6][1] = html_print_input_text('scale_z', $scale_z, '', 2, 10, true).ui_print_help_tip(__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true);
$table->data['source'][0] = __('Source');
$table->data['source'][1] = html_print_select(
[
'group' => __('Group'),
'recon_task' => __('Discovery task'),
'ip_mask' => __('CIDR IP mask'),
],
'source',
$source,
'',
'',
0,
true,
false,
false,
'',
$disabled_source
);
$table->data['source_data_recon_task'][0] = __('Source from recon task');
$table->data['source_data_recon_task'][0] .= ui_print_help_tip(
__('It is setted any recon task, the nodes get from the recontask IP mask instead from the group.'),
true
);
$table->data['source_data_recon_task'][1] = html_print_select(
$list_recon_tasks,
'recon_task_id',
$recon_task_id,
'',
__('None'),
0,
true,
false,
true,
'',
$disabled_source
);
$table->data['source_data_recon_task'][1] .= ui_print_help_tip(
__('Show only the task with the recon script "SNMP L2 Recon".'),
true
);
$table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask');
$table->data['source_data_ip_mask'][1] = html_print_textarea(
'ip_mask',
3,
5,
$ip_mask,
'style="width: 238px"',
true,
'',
$disabled_source
);
$table->data['source_data_group'][0] = __('Source group');
$table->data['source_data_group'][1] = '<div class="w250px">'.html_print_select_groups(
$config['id_user'],
'AR',
true,
'id_group[]',
explode(',', $id_group),
'',
'',
'',
true,
true
).'</div>';
$table->data['source_data_group'][1] .= html_print_image(
'images/error.png',
true,
[
'id' => 'group_change_warning',
'title' => __('Source id group changed. All elements in networkmap will be lost.'),
'style' => 'display : none',
]
);
$table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:');
$table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox(
'dont_show_subgroups',
'1',
$dont_show_subgroups,
true,
$disabled_source
);
$methods = [
'twopi' => 'radial',
'dot' => 'flat',
@ -472,79 +301,312 @@ if ($not_found) {
'radial_dinamic' => 'radial dynamic',
];
$table->data[7][0] = __('Method generation networkmap');
$table->data[7][1] = html_print_select(
$methods,
'method',
$method,
'',
'',
'neato',
true,
false,
true,
'',
$disabled_generation_method_select
);
$itemClass = '';
if ($disabled_source) {
if ($disabled_source === true) {
$itemClass = 'disabled';
}
$table->data['nodesep'][0] = __('Node separation');
$table->data['nodesep'][1] = html_print_input_text('node_sep', $node_sep, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Separation between nodes. By default 0.25'), true);
$return_all_group = false;
$table->data['ranksep'][0] = __('Rank separation');
$table->data['ranksep'][1] = html_print_input_text('rank_sep', $rank_sep, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only flat and radial. Separation between arrows. By default 0.5 in flat and 1.0 in radial'), true);
if (users_can_manage_group_all('AR') === true) {
$return_all_group = true;
}
$table->data['mindist'][0] = __('Min nodes dist');
$table->data['mindist'][1] = html_print_input_text('mindist', $mindist, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only circular. Minimum separation between all nodes. By default 1.0'), true);
if (empty($scale_z) === true) {
$scale_z = 0.5;
}
$table->data['kval'][0] = __('Default ideal node separation');
$table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true);
$table = new stdClass();
$table->id = 'form_editor';
$table->width = '100%';
$table->class = 'databox filter-table-adv max_floating_element_size';
$table->head = [];
$table->size = [];
$table->style = [];
$table->style[0] = 'width: 50%';
$table->style[1] = 'width: 50%';
$table->colspan[1][0] = 2;
$table->data = [];
$table->data['refresh'][0] = __('Refresh');
$table->data['refresh'][1] = html_print_extended_select_for_time(
'refresh_time',
$refresh_time,
'',
'',
'0',
false,
true,
false,
false
$table->data[0][] = html_print_label_input_block(
__('Name'),
html_print_input_text(
'name',
$name,
'',
30,
100,
true
)
);
$table->data[0][] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
// Id_user.
$config['id_user'],
// Privilege.
'AR',
// ReturnAllGroup.
$return_all_group,
// Name.
'id_group_map',
// Selected.
$id_group_map,
// Script.
'',
// Nothing.
'',
// Nothing_value.
'',
// Return.
true
)
);
$table->data[1][] = html_print_label_input_block(
__('Description'),
html_print_input_text(
'description',
$description,
'',
100,
100,
true
)
);
$divLittleFields = [];
$divLittleFields[] = html_print_label_input_block(
__('Position X'),
html_print_input_text('pos_x', $offset_x, '', 10, 10, true, false, false, '', 'w50p'),
[ 'div_class' => 'div-4-col' ]
);
$divLittleFields[] = html_print_label_input_block(
__('Position Y'),
html_print_input_text('pos_y', $offset_y, '', 10, 10, true, false, false, '', 'w50p'),
[ 'div_class' => 'div-4-col' ]
);
$divLittleFields[] = html_print_label_input_block(
__('Zoom scale'),
html_print_input_text('scale_z', $scale_z, '', 10, 10, true, false, false, '', 'w50p').ui_print_input_placeholder(__('Introduce zoom level. 1 = Highest resolution. Figures may include decimals'), true),
[ 'div_class' => 'div-4-col' ]
);
$divLittleFields[] = html_print_label_input_block(
__('Node radius'),
html_print_input_text(
'node_radius',
$node_radius,
'',
10,
10,
true,
false,
false,
'',
'w50p'
),
[ 'div_class' => 'div-4-col' ]
);
$table->colspan[2][0] = 2;
$table->data[2][0] = html_print_div(
[
'style' => 'flex-direction: row;',
'content' => implode('', $divLittleFields),
],
true
);
$table->data['source'][] = html_print_label_input_block(
__('Source'),
html_print_select(
[
'group' => __('Group'),
'recon_task' => __('Discovery task'),
'ip_mask' => __('CIDR IP mask'),
],
'source',
$source,
'',
'',
0,
true,
false,
false,
'',
$disabled_source
)
);
$table->data['source_data_group'][] = html_print_label_input_block(
__('Source group'),
html_print_select_groups(
$config['id_user'],
'AR',
true,
'id_group[]',
explode(',', $id_group),
'',
'',
'',
true,
true
).ui_print_input_placeholder(
__('Source id group changed. All elements in networkmap will be lost.'),
true,
[
'class' => 'input_sub_placeholder input_sub_placeholder_warning',
'style' => 'display: none',
'id' => 'group_change_warning',
]
)
);
$table->data['source_data_group'][] = html_print_label_input_block(
__('Don\'t show subgroups:'),
html_print_checkbox(
'dont_show_subgroups',
'1',
$dont_show_subgroups,
true,
$disabled_source
)
);
$table->data['source_data_recon_task'][] = html_print_label_input_block(
__('Source from recon task'),
html_print_select(
$list_recon_tasks,
'recon_task_id',
$recon_task_id,
'',
__('None'),
0,
true,
false,
true,
'',
$disabled_source
).ui_print_input_placeholder(
__('It is setted any recon task, the nodes get from the recontask IP mask instead from the group.'),
true
)
);
$table->data['source_data_ip_mask'][] = html_print_label_input_block(
__('Source from CIDR IP mask'),
html_print_textarea(
'ip_mask',
3,
5,
$ip_mask,
'style="width: 100%"',
true,
'',
$disabled_source
)
);
$table->data[7][] = html_print_label_input_block(
__('Method generation networkmap'),
html_print_select(
$methods,
'method',
$method,
'',
'',
'neato',
true,
false,
true,
'',
$disabled_generation_method_select
)
);
$table->data['nodesep'][] = html_print_label_input_block(
__('Node separation'),
html_print_input_text('node_sep', $node_sep, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_input_placeholder(__('Separation between nodes. By default 0.25'), true)
);
$table->data['ranksep'][] = html_print_label_input_block(
__('Rank separation'),
html_print_input_text('rank_sep', $rank_sep, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_input_placeholder(__('Only flat and radial. Separation between arrows. By default 0.5 in flat and 1.0 in radial'), true)
);
$table->data['mindist'][] = html_print_label_input_block(
__('Min nodes dist'),
html_print_input_text('mindist', $mindist, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_input_placeholder(__('Only circular. Minimum separation between all nodes. By default 1.0'), true)
);
$table->data['kval'][] = html_print_label_input_block(
__('Default ideal node separation'),
html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_input_placeholder(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true)
);
$table->data['refresh'][] = html_print_label_input_block(
__('Refresh'),
html_print_extended_select_for_time(
'refresh_time',
$refresh_time,
'',
'',
'0',
false,
true,
false,
false
)
);
echo '<form id="networkmap_options_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_networkmap) {
$actionButtons = [];
if ($new_networkmap === true) {
html_print_input_hidden('save_networkmap', 1);
html_print_submit_button(
$actionButtons[] = html_print_submit_button(
__('Save networkmap'),
'crt',
false,
'class="sub next" onclick="if (typeof(sent) == \'undefined\') {sent = 1; return true;} else {return false;}"'
[
'onClick' => 'if (typeof(sent) == \'undefined\') {sent = 1; return true;} else {return false;}',
'icon' => 'next',
],
true
);
}
if ($edit_networkmap) {
if ($edit_networkmap === true) {
html_print_input_hidden('id_networkmap', $id);
html_print_input_hidden('update_networkmap', 1);
html_print_submit_button(
$actionButtons[] = html_print_submit_button(
__('Update networkmap'),
'crt',
false,
'class="sub upd"'
[ 'icon' => 'update'],
true
);
}
$actionButtons[] = html_print_go_back_button(
'index.php?sec=networkmapconsole&sec2=operation/agentes/pandora_networkmap',
['button_class' => ''],
true
);
html_print_action_buttons(
$actionButtons
);
echo '</form>';
echo '</div>';
}
?>
<script type="text/javascript">

View File

@ -685,29 +685,22 @@ switch ($tab) {
$table->class = 'info_table';
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->headstyle['copy'] = 'text-align: center;';
$table->headstyle['edit'] = 'text-align: center;';
$table->headstyle['actions'] = 'text-align: right;';
$table->style = [];
$table->style['name'] = '';
$table->style['nodes'] = 'text-align: center;';
$table->style['nodes'] = 'text-align: left;';
$table->style['groups'] = 'text-align: left;';
if ($networkmaps_write === true || $networkmaps_manage === true) {
$table->style['copy'] = 'text-align: center;';
$table->style['edit'] = 'text-align: center;';
$table->style['delete'] = 'text-align: center;';
$table->style['actions'] = 'text-align: right;';
}
$table->size = [];
$table->size['name'] = '60%';
$table->size['nodes'] = '30px';
$table->size['name'] = '40%';
$table->size['nodes'] = '15%';
$table->size['groups'] = '400px';
if ($networkmaps_write === true || $networkmaps_manage === true) {
$table->size['copy'] = '30px';
$table->size['edit'] = '30px';
$table->size['delete'] = '30px';
$table->size['actions'] = '10%';
}
$table->head = [];
@ -716,9 +709,7 @@ switch ($tab) {
$table->head['groups'] = __('Groups');
if ($networkmaps_write === true || $networkmaps_manage === true) {
$table->head['copy'] = __('Copy');
$table->head['edit'] = __('Edit');
$table->head['delete'] = __('Delete');
$table->head['actions'] = __('Actions');
}
$id_groups = array_keys(users_get_groups());
@ -796,27 +787,52 @@ switch ($tab) {
$data['groups'] = ui_print_group_icon($network_map['id_group_map'], true);
$data['copy'] = '';
$data['edit'] = '';
$data['delete'] = '';
$data['actions'] = '';
if ($networkmap_write || $networkmap_manage) {
$table->cellclass[] = [
'copy' => 'table_action_buttons',
'edit' => 'table_action_buttons',
'delete' => 'table_action_buttons',
];
$data['copy'] = '<a href="index.php?'.'sec=network&'.'sec2=operation/agentes/pandora_networkmap&amp;'.'copy_networkmap=1&'.'id_networkmap='.$network_map['id'].'" alt="'.__('Copy').'">'.html_print_image('images/copy.png', true, ['class' => 'invert_filter']).'</a>';
$data['edit'] = '<a href="index.php?'.'sec=network&'.'sec2=operation/agentes/pandora_networkmap&'.'tab=edit&'.'edit_networkmap=1&'.'id_networkmap='.$network_map['id'].'" alt="'.__('Config').'">'.html_print_image('images/config.png', true, ['class' => 'invert_filter']).'</a>';
$data['delete'] = '<a href="index.php?'.'sec=network&'.'sec2=operation/agentes/pandora_networkmap&'.'delete=1&'.'id_networkmap='.$network_map['id'].'" alt="'.__('Delete').'" onclick="javascript: if (!confirm(\''.__('Are you sure?').'\')) return false;">'.html_print_image('images/cross.png', true, ['class' => 'invert_filter']).'</a>';
$tableActionButtons = [];
$tableActionButtons[] = html_print_anchor(
[
'title' => __('Copy'),
'href' => 'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&amp;copy_networkmap=1&id_networkmap='.$network_map['id'],
'content' => html_print_image('images/copy.svg', true, ['class' => 'main_menu_icon invert_filter']),
],
true
);
$tableActionButtons[] = html_print_anchor(
[
'title' => __('Edit'),
'href' => 'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=edit&edit_networkmap=1&id_networkmap='.$network_map['id'],
'content' => html_print_image('images/edit.svg', true, ['class' => 'main_menu_icon invert_filter']),
],
true
);
$tableActionButtons[] = html_print_anchor(
[
'title' => __('Delete'),
'href' => 'index.php?sec=network&sec2=operation/agentes/pandora_networkmap&delete=1&id_networkmap='.$network_map['id'],
'content' => html_print_image('images/delete.svg', true, ['class' => 'main_menu_icon invert_filter']),
],
true
);
$data['actions'] = html_print_div(
[
'class' => 'table_action_buttons',
'content' => implode('', $tableActionButtons),
],
true
);
}
$table->data[] = $data;
}
ui_pagination($count_maps, false, $offset);
html_print_table($table);
ui_pagination($count_maps, false, 0, 0, false, 'offset', true, 'pagination-bottom');
$tablePagination = ui_pagination($count_maps, false, 0, 0, true, 'offset', false);
} else {
ui_print_info_message(['no_close' => true, 'message' => __('There are no maps defined.') ]);
}
@ -829,20 +845,12 @@ switch ($tab) {
echo '<form id="empty_networkmap" method="post" action="index.php?sec=network&amp;sec2=operation/agentes/pandora_networkmap">';
html_print_input_hidden('new_empty_networkmap', 1);
echo '</form>';
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(__('Create network map'), 'crt', false, [ 'icon' => 'next', 'form' => 'new_networkmap' ], true).html_print_submit_button(__('Create empty network map'), 'crt', false, [ 'icon' => 'next', 'form' => 'empty_networkmap' ], true),
],
false
);
/*
echo "<div style='width: ".$table->width."; margin-top: 5px;' class='action-buttons'>";
html_print_submit_button(__('Create network map'), 'crt', false, 'class="sub next"');
html_print_submit_button(__('Create empty network map'), 'crt', false, 'class="sub next"');
echo '</div>';
*/
}
html_print_action_buttons(
html_print_submit_button(__('Create network map'), 'crt', false, [ 'icon' => 'next', 'form' => 'new_networkmap' ], true).html_print_submit_button(__('Create empty network map'), 'crt', false, [ 'icon' => 'next', 'form' => 'empty_networkmap' ], true),
[ 'right_content' => $tablePagination ],
);
break;
}

View File

@ -14,7 +14,7 @@
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
*
* ============================================================================
* Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
* Copyright (c) 2005-2023 Artica Soluciones Tecnologicas
* Please see http://pandorafms.org for full contribution list
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -124,7 +124,7 @@ if (is_ajax() === true) {
$table = new StdClass();
$table->id = 'form_editor';
$table->width = '98%';
$table->width = '100%';
$table->class = 'databox_color';
$table->head = [];
$table->size = [];
@ -1264,7 +1264,7 @@ if (is_ajax() === true) {
$id_group = agents_get_agent_group($id_agent);
$return['group'] = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
$id_os = agents_get_os($id_agent);
$return['os'] = ui_print_os_icon($id_os, true, true);
$return['os'] = html_print_div([ 'class' => 'flex main_menu_icon invert_filter', 'content' => ui_print_os_icon($id_os, true, true)], true);
echo json_encode($return);
@ -1526,7 +1526,7 @@ if (is_ajax() === true) {
$id_group = agents_get_agent_group($id_agent);
$return['group'] = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group);
$id_os = agents_get_os($id_agent);
$return['os'] = ui_print_os_icon($id_os, true, true);
$return['os'] = html_print_div([ 'class' => 'flex main_menu_icon invert_filter', 'content' => ui_print_os_icon($id_os, true, true)], true);
echo json_encode($return);
@ -2341,11 +2341,11 @@ if ($networkmap === false) {
$buttons['screen'] = [
'active' => false,
'text' => '<a href="index.php?sec=networkmapconsole&amp;sec2=operation/agentes/pandora_networkmap&amp;tab=view&amp;id_networkmap='.$id.'">'.html_print_image(
'images/normal_screen.png',
'images/exit_fullscreen@svg.svg',
true,
[
'title' => __('Normal screen'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
];
@ -2358,33 +2358,33 @@ if ($networkmap === false) {
$buttons['screen'] = [
'active' => false,
'text' => '<a href="index.php?sec=networkmapconsole&amp;sec2=operation/agentes/pandora_networkmap&amp;pure=1&amp;tab=view&amp;id_networkmap='.$id.'">'.html_print_image(
'images/full_screen.png',
'images/fullscreen@svg.svg',
true,
[
'title' => __('Full screen'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
];
$buttons['list'] = [
'active' => false,
'text' => '<a href="index.php?sec=networkmapconsole&amp;sec2=operation/agentes/pandora_networkmap">'.html_print_image(
'images/list.png',
'images/file-collection@svg.svg',
true,
[
'title' => __('List of networkmap'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
];
$buttons['option'] = [
'active' => false,
'text' => '<a href="index.php?sec=network&sec2=operation/agentes/pandora_networkmap&tab=edit&edit_networkmap=1&id_networkmap='.$id.'">'.html_print_image(
'images/setup.png',
'images/edit.svg',
true,
[
'title' => __('Options'),
'class' => 'invert_filter',
'class' => 'main_menu_icon invert_filter',
]
).'</a>',
];
@ -2396,16 +2396,23 @@ if ($networkmap === false) {
}
if (!$dash_mode) {
ui_print_page_header(
ui_print_standard_header(
$networkmap['name'],
'images/bricks.png',
false,
'network_map_enterprise_view',
false,
$buttons,
false,
'',
$config['item_title_size_text']
[
[
'link' => '',
'label' => __('Topology maps'),
],
[
'link' => '',
'label' => __('Network maps'),
],
]
);
}