Merge branch 'ent-9662-second-round' of brutus.artica.es:artica/pandorafms into ent-9662-second-round

This commit is contained in:
Pablo Aragon 2023-03-09 15:15:06 +01:00
commit cbc05f7ea0
20 changed files with 335 additions and 393 deletions

View File

@ -471,10 +471,6 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
</div> <!-- Closes #table_header_inner --> </div> <!-- Closes #table_header_inner -->
</div> <!-- Closes #table_header --> </div> <!-- Closes #table_header -->
<!-- Notifications content wrapper-->
<div id='notification-content' class='invisible'/></div>
<!-- Old style div wrapper --> <!-- Old style div wrapper -->
<div id="alert_messages" class="invisible"></div> <div id="alert_messages" class="invisible"></div>

View File

@ -98,6 +98,7 @@ echo '</div>';
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
menuActionButtonResizing();
const menuTypeClass = '<?php echo $menuTypeClass; ?>'; const menuTypeClass = '<?php echo $menuTypeClass; ?>';
if (menuTypeClass === 'classic' && menuTypeClass !== localStorage.getItem('menuType')) { if (menuTypeClass === 'classic' && menuTypeClass !== localStorage.getItem('menuType')) {
localStorage.setItem('menuType', 'classic'); localStorage.setItem('menuType', 'classic');

View File

@ -34,7 +34,6 @@ $url = sprintf(
$url_id_agente $url_id_agente
); );
enterprise_include('godmode/agentes/module_manager.php');
$isFunctionPolicies = enterprise_include_once('include/functions_policies.php'); $isFunctionPolicies = enterprise_include_once('include/functions_policies.php');
require_once $config['homedir'].'/include/functions_modules.php'; require_once $config['homedir'].'/include/functions_modules.php';
require_once $config['homedir'].'/include/functions_agents.php'; require_once $config['homedir'].'/include/functions_agents.php';
@ -51,196 +50,10 @@ if (isset($policy_page) === false) {
$checked = (bool) get_parameter('checked'); $checked = (bool) get_parameter('checked');
$sec2 = (string) get_parameter('sec2'); $sec2 = (string) get_parameter('sec2');
// Table for filter bar.
$filterTable = new stdClass();
$filterTable->class = 'fixed_filter_bar';
$filterTable->data = [];
$filterTable->cellstyle[0][0] = 'width:0';
$filterTable->data[0][0] = __('Search');
$filterTable->data[1][0] .= html_print_input_text(
'search_string',
$search_string,
'',
30,
255,
true,
false,
false,
'',
''
);
$filterTable->data[0][0] .= html_print_input_hidden('search', 1, true);
if ((bool) $policy_page === false) {
$filterTable->data[0][1] = __('Show in hierachy mode');
$filterTable->data[1][1] = html_print_checkbox_switch(
'status_hierachy_mode',
'',
((string) $checked === 'true'),
true,
false,
'onChange=change_mod_filter();'
);
}
$filterTable->data[1][2] = html_print_submit_button(
__('Filter'),
'filter',
false,
[
'icon' => 'search',
'class' => 'float-right',
'mode' => 'secondary mini',
],
true
);
// Print filter table.
echo '<form id="create_module_type" method="post" action="'.$url.'">';
html_print_table($filterTable);
echo '</form>';
// Check if there is at least one server of each type available to assign that
// kind of modules. If not, do not show server type in combo.
$network_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = '.SERVER_TYPE_NETWORK
);
// POSTGRESQL AND ORACLE COMPATIBLE.
$wmi_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = '.SERVER_TYPE_WMI
);
// POSTGRESQL AND ORACLE COMPATIBLE.
$plugin_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = '.SERVER_TYPE_PLUGIN
);
// POSTGRESQL AND ORACLE COMPATIBLE.
$prediction_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = '.SERVER_TYPE_PREDICTION
);
// POSTGRESQL AND ORACLE COMPATIBLE.
$web_available = db_get_sql(
'SELECT count(*)
FROM tserver
WHERE server_type = '.SERVER_TYPE_WEB
);
// POSTGRESQL AND ORACLE COMPATIBLE.
// Development mode to use all servers.
if ($develop_bypass || is_metaconsole()) {
$network_available = 1;
$wmi_available = 1;
$plugin_available = 1;
// FIXME when prediction predictions server modules can be configured.
// on metaconsole.
$prediction_available = (is_metaconsole() === true) ? 0 : 1;
}
$modules = [];
$modules['dataserver'] = __('Create a new data server module');
if ($network_available) {
$modules['networkserver'] = __('Create a new network server module');
}
if ($plugin_available) {
$modules['pluginserver'] = __('Create a new plugin server module');
}
if ($wmi_available) {
$modules['wmiserver'] = __('Create a new WMI server module');
}
if ($prediction_available) {
$modules['predictionserver'] = __('Create a new prediction server module');
}
if (is_metaconsole() === true || $web_available >= '1') {
$modules['webserver'] = __('Create a new web Server module');
}
if (enterprise_installed() === true) {
set_enterprise_module_types($modules);
}
if (strstr($sec2, 'enterprise/godmode/policies/policies') !== false) {
// It is unset because the policies haven't a table tmodule_synth and the
// some part of code to apply this kind of modules in policy agents.
// But in the future maybe will be good to make this feature, but remember
// the modules to show in syntetic module policy form must be the policy
// modules from the same policy.
unset($modules['predictionserver']);
if (enterprise_installed() === true) {
unset($modules['webux']);
}
}
if (($policy_page === true) || (isset($agent) === true)) {
if ($policy_page === true) {
$show_creation = is_management_allowed();
} else {
if (isset($all_groups) === false) {
$all_groups = agents_get_all_groups_agent(
$agent['id_agente'],
$agent['id_grupo']
);
}
$show_creation = check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === true;
}
} else {
$show_creation = false;
}
if ($show_creation === true) {
// Create module/type combo.
$tableCreateModule = new stdClass();
$tableCreateModule->id = 'create';
$tableCreateModule->class = 'create_module_dialog';
$tableCreateModule->width = '100%';
$tableCreateModule->data = [];
$tableCreateModule->style = [];
$tableCreateModule->data['caption_type'] = html_print_input_hidden('edit_module', 1);
$tableCreateModule->data['caption_type'] .= __('Type');
$tableCreateModule->data['type'] = html_print_select(
$modules,
'moduletype',
'',
'',
'',
'',
true,
false,
false,
'',
false,
'width:380px;'
);
// Link for get more modules.
if ((bool) $config['disable_help'] === false) {
$tableCreateModule->data['get_more_modules'] = html_print_anchor(
[
'href' => 'https://pandorafms.com/Library/Library/',
'target' => '_blank',
'class' => 'color-black-grey',
'content' => __('Get more modules on Monitoring Library'),
],
true
);
}
}
if (isset($id_agente) === false) { if (isset($id_agente) === false) {
return; return;
} }
$module_action = (string) get_parameter('module_action'); $module_action = (string) get_parameter('module_action');
if ($module_action === 'delete') { if ($module_action === 'delete') {
@ -1256,43 +1069,58 @@ if ((bool) check_acl_one_of_groups($config['id_user'], $all_groups, 'AW') === tr
[ 'type' => 'data_table' ] [ 'type' => 'data_table' ]
); );
echo '</form>'; echo '</form>';
$modalCreateModule = '<form name="create_module_form" method="post">';
$modalCreateModule .= html_print_table($tableCreateModule, true);
$modalCreateModule .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create'),
'create_module',
false,
[
'icon' => 'next',
'mode' => 'mini secondary',
],
true
),
],
true
);
$modalCreateModule .= '</form>';
html_print_div(
[
'id' => 'modal',
'style' => 'display: none',
'content' => $modalCreateModule,
]
);
} }
$modalCreateModule = '<form name="create_module_form" method="post">';
$input_type = html_print_input_hidden('edit_module', 1, true);
$input_type .= html_print_select(
policies_type_modules_availables($sec2),
'moduletype',
'',
'',
'',
'',
true,
false,
false,
'',
false,
'max-width:300px;'
);
$modalCreateModule .= $input_type;
$modalCreateModule .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create'),
'create_module',
false,
[
'icon' => 'next',
'mode' => 'mini secondary',
],
true
),
],
true
);
$modalCreateModule .= '</form>';
html_print_div(
[
'id' => 'modal',
'style' => 'display: none',
'content' => $modalCreateModule,
]
);
?> ?>
<script type="text/javascript"> <script type="text/javascript">
function create_module_dialog(){ function create_module_dialog(){
$('#modal') console.log('Entra');
.dialog({ $('#modal').dialog({
title: '<?php echo __('Create Module'); ?>', title: '<?php echo __('Create Module'); ?>',
resizable: true, resizable: true,
draggable: true, draggable: true,

View File

@ -444,7 +444,7 @@ $tableBasicThresholds->data = [];
$tableBasicThresholds->rowclass['caption_warning_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['caption_warning_threshold'] = 'field_half_width pdd_t_10px';
$tableBasicThresholds->rowclass['warning_threshold'] = 'field_half_width'; $tableBasicThresholds->rowclass['warning_threshold'] = 'field_half_width';
$tableBasicThresholds->data['caption_warning_threshold'][0] .= __('Warning threshold').'&nbsp;'; $tableBasicThresholds->data['caption_warning_threshold'][0] .= __('Warning threshold').'&nbsp;';
if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === false)) { if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) {
$tableBasicThresholds->data['caption_warning_threshold'][0] .= '<span class="font_11" id="caption_minmax_warning">('.__('Min / Max').')</span>'; $tableBasicThresholds->data['caption_warning_threshold'][0] .= '<span class="font_11" id="caption_minmax_warning">('.__('Min / Max').')</span>';
$tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text( $tableBasicThresholds->data['warning_threshold'][0] .= html_print_input_text(
'min_warning', 'min_warning',
@ -482,7 +482,7 @@ if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeM
); );
} }
if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === true)) { if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) {
$basicThresholdsIntervalWarning = []; $basicThresholdsIntervalWarning = [];
$basicThresholdsIntervalWarning[] = '<span>'.__('Inverse interval').'</span>'; $basicThresholdsIntervalWarning[] = '<span>'.__('Inverse interval').'</span>';
$basicThresholdsIntervalWarning[] = html_print_checkbox_switch( $basicThresholdsIntervalWarning[] = html_print_checkbox_switch(
@ -531,7 +531,7 @@ $tableBasicThresholds->data['switch_warning_threshold'][0] .= html_print_div(
$tableBasicThresholds->rowclass['caption_critical_threshold'] = 'field_half_width pdd_t_10px'; $tableBasicThresholds->rowclass['caption_critical_threshold'] = 'field_half_width pdd_t_10px';
$tableBasicThresholds->rowclass['critical_threshold'] = 'field_half_width'; $tableBasicThresholds->rowclass['critical_threshold'] = 'field_half_width';
$tableBasicThresholds->data['caption_critical_threshold'][0] .= __('Critical threshold').'&nbsp;'; $tableBasicThresholds->data['caption_critical_threshold'][0] .= __('Critical threshold').'&nbsp;';
if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === false)) { if ($edit_module === false && (isset($stringTypeModule) === false || $stringTypeModule === false)) {
$tableBasicThresholds->data['caption_critical_threshold'][0] .= '<span class="font_11" id="caption_minmax_critical">('.__('Min / Max').')</span>'; $tableBasicThresholds->data['caption_critical_threshold'][0] .= '<span class="font_11" id="caption_minmax_critical">('.__('Min / Max').')</span>';
$tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text( $tableBasicThresholds->data['critical_threshold'][0] .= html_print_input_text(
'min_critical', 'min_critical',
@ -569,7 +569,7 @@ if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeM
); );
} }
if ($edit_module === false || (isset($stringTypeModule) === true && $stringTypeModule === true)) { if ($edit_module === false && isset($stringTypeModule) === true && $stringTypeModule === true) {
$basicThresholdsIntervalCritical = []; $basicThresholdsIntervalCritical = [];
$basicThresholdsIntervalCritical[] = '<span>'.__('Inverse interval').'</span>'; $basicThresholdsIntervalCritical[] = '<span>'.__('Inverse interval').'</span>';
$basicThresholdsIntervalCritical[] = html_print_checkbox_switch( $basicThresholdsIntervalCritical[] = html_print_checkbox_switch(

View File

@ -243,11 +243,7 @@ $submitButtons .= html_print_submit_button(
); );
html_print_action_buttons( html_print_action_buttons(
$submitButtons, $submitButtons
[
'type' => 'form_action',
'id' => 'list-events-filters',
]
); );
?> ?>

View File

@ -293,6 +293,7 @@ $table->head[3] = __('Interpreter');
if ($management_allowed === true) { if ($management_allowed === true) {
$table->head[4] = __('Action').html_print_checkbox('all_delete', 0, false, true, false); $table->head[4] = __('Action').html_print_checkbox('all_delete', 0, false, true, false);
$table->size[4] = '80px';
} }
$result = inventory_get_modules_list($offset); $result = inventory_get_modules_list($offset);
@ -414,30 +415,14 @@ if (is_metaconsole() === true) {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
$( document ).ready(function() { $( document ).ready(function() {
$('[id^=checkbox-delete_multiple]').change(function(){
if($(this).parent().parent().hasClass('checkselected')){
$(this).parent().parent().removeClass('checkselected');
}
else{
$(this).parent().parent().addClass('checkselected');
}
});
$('[id^=checkbox-all_delete]').change(function() { $('[id^=checkbox-all_delete]').change(function() {
if ($("#checkbox-all_delete").prop("checked")) { if ($("input[name=all_delete]").prop("checked")) {
$('[id^=checkbox-delete_multiple]').parent().parent().addClass('checkselected'); $(".custom_checkbox_input").prop("checked", true);
$(".check_delete").prop("checked", true);
} }
else { else {
$('[id^=checkbox-delete_multiple]').parent().parent().removeClass('checkselected'); $(".custom_checkbox_input").prop("checked", false);
$(".check_delete").prop("checked", false);
} }
}); });
}); });
</script> </script>

View File

@ -2633,7 +2633,8 @@ $class = 'databox filters';
'render_definition', 'render_definition',
3, 3,
25, 25,
$render_definition $render_definition,
'style=width:100%'
); );
?> ?>
</td> </td>

View File

@ -47,6 +47,7 @@ if (json_last_error() === JSON_ERROR_NONE) {
$data = $data_decoded['data']; $data = $data_decoded['data'];
$session_id = $data_decoded['session_id']; $session_id = $data_decoded['session_id'];
$type_graph_pdf = $data_decoded['type_graph_pdf']; $type_graph_pdf = $data_decoded['type_graph_pdf'];
$id_user = $data_decoded['id_user'];
$data_combined = []; $data_combined = [];
if (isset($data_decoded['data_combined']) === true) { if (isset($data_decoded['data_combined']) === true) {
@ -62,6 +63,10 @@ if (json_last_error() === JSON_ERROR_NONE) {
// Initialize session. // Initialize session.
global $config; global $config;
// Care whit this!!! check_login not working if you remove this.
$config['id_user'] = $id_user;
$_SESSION['id_usuario'] = $id_user;
// Try to initialize session using existing php session id. // Try to initialize session using existing php session id.
$user = new PandoraFMS\User(['phpsessionid' => $session_id]); $user = new PandoraFMS\User(['phpsessionid' => $session_id]);
if (check_login(false) === false) { if (check_login(false) === false) {
@ -82,6 +87,7 @@ if (check_login(false) === false) {
</head> </head>
<body> <body>
<h1>Access is not granted</h1> <h1>Access is not granted</h1>
<div id="container-chart-generator-item" style="display:none; margin:0px;">
</body> </body>
</html> </html>

View File

@ -544,7 +544,7 @@ class HTML
'container_class' => $input['toggle_container_class'], 'container_class' => $input['toggle_container_class'],
'img_a' => $input['toggle_img_a'], 'img_a' => $input['toggle_img_a'],
'img_b' => $input['toggle_img_b'], 'img_b' => $input['toggle_img_b'],
'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : true), 'clean' => (isset($input['toggle_clean']) ? $input['toggle_clean'] : false),
] ]
); );
} else { } else {

View File

@ -4264,12 +4264,14 @@ function generator_chart_to_pdf(
'type_graph_pdf' => $type_graph_pdf, 'type_graph_pdf' => $type_graph_pdf,
'data_module_list' => $module_list, 'data_module_list' => $module_list,
'data_combined' => $params_combined, 'data_combined' => $params_combined,
'id_user' => $config['id_user'],
]; ];
} else { } else {
$data = [ $data = [
'data' => $params, 'data' => $params,
'session_id' => $session_id, 'session_id' => $session_id,
'type_graph_pdf' => $type_graph_pdf, 'type_graph_pdf' => $type_graph_pdf,
'id_user' => $config['id_user'],
]; ];
} }

View File

@ -5235,9 +5235,13 @@ function html_print_switch($attributes=[])
* *
* @return string With HTML code. * @return string With HTML code.
*/ */
function html_print_link_with_params($text, $params=[], $type='text', $style='') function html_print_link_with_params($text, $params=[], $type='text', $style='', $formStyle='')
{ {
$html = '<form method=post>'; if (empty($formStyle) === false) {
$formStyle = ' style="'.$formStyle.'"';
}
$html = '<form method="POST"'.$formStyle.'>';
switch ($type) { switch ($type) {
case 'image': case 'image':
$html .= html_print_input_image($text, $text, $text, $style, true); $html .= html_print_input_image($text, $text, $text, $style, true);
@ -5245,7 +5249,7 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='')
case 'text': case 'text':
default: default:
if (!empty($style)) { if (empty($style) === false) {
$style = ' style="'.$style.'"'; $style = ' style="'.$style.'"';
} }
@ -5253,7 +5257,10 @@ function html_print_link_with_params($text, $params=[], $type='text', $style='')
$text, $text,
$text, $text,
false, false,
'class="button-as-link"'.$style, [
'mode' => 'link',
'style' => $style,
],
true true
); );
break; break;
@ -5587,7 +5594,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
); );
case 'submit': case 'submit':
$width = (isset($data['width']) === true) ? 'width: '.$data['width'] : 'width: 100%'; $width = (isset($data['width']) === true) ? 'width: '.$data['width'] : '';
$output .= '<'.$wrapper.' class="action-buttons" style="'.$width.'">'.html_print_submit_button( $output .= '<'.$wrapper.' class="action-buttons" style="'.$width.'">'.html_print_submit_button(
((isset($data['label']) === true) ? $data['label'] : 'OK'), ((isset($data['label']) === true) ? $data['label'] : 'OK'),
((isset($data['name']) === true) ? $data['name'] : ''), ((isset($data['name']) === true) ? $data['name'] : ''),

View File

@ -3918,10 +3918,15 @@ function ui_print_datatable(array $parameters)
ordering: '.$ordering.', ordering: '.$ordering.',
initComplete: function(settings, json) { initComplete: function(settings, json) {
// Move elements to table_action_buttons bar. // Move elements to table_action_buttons bar.
$(".action_buttons_right_content").append($("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers")); $(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").append($("#'.$table_id.'_wrapper > .dataTables_length")); $(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").append($("#'.$table_id.'_wrapper > .dt-buttons")); $(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".action_buttons_right_content").append($("#'.$table_id.'_wrapper > .dataTables_filter")); $(".action_buttons_right_content").html("<div class=\"pagination-child-div\"></div>");
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_paginate.paging_simple_numbers"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_length"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dt-buttons"));
$(".pagination-child-div").append($("#'.$table_id.'_wrapper > .dataTables_filter"));
}, },
columns: ['; columns: [';
@ -4519,8 +4524,8 @@ function ui_print_toggle($data)
(isset($data['toggle_class']) === true) ? $data['toggle_class'] : '', (isset($data['toggle_class']) === true) ? $data['toggle_class'] : '',
(isset($data['container_class']) === true) ? $data['container_class'] : 'white-box-content', (isset($data['container_class']) === true) ? $data['container_class'] : 'white-box-content',
(isset($data['main_class']) === true) ? $data['main_class'] : 'box-flat white_table_graph', (isset($data['main_class']) === true) ? $data['main_class'] : 'box-flat white_table_graph',
(isset($data['img_a']) === true) ? $data['img_a'] : 'images/arrow_down_green.png', (isset($data['img_a']) === true) ? $data['img_a'] : 'images/arrow@svg.svg',
(isset($data['img_b']) === true) ? $data['img_b'] : 'images/arrow_right_green.png', (isset($data['img_b']) === true) ? $data['img_b'] : 'images/arrow@svg.svg',
(isset($data['clean']) === true) ? $data['clean'] : false, (isset($data['clean']) === true) ? $data['clean'] : false,
(isset($data['reverseImg']) === true) ? $data['reverseImg'] : false, (isset($data['reverseImg']) === true) ? $data['reverseImg'] : false,
(isset($data['switch']) === true) ? $data['switch'] : false, (isset($data['switch']) === true) ? $data['switch'] : false,

View File

@ -2402,8 +2402,8 @@ function topFunction() {
} }
function menuActionButtonResizing() { function menuActionButtonResizing() {
$(".action_buttons_right_content").attr( $("#principal_action_buttons").attr(
"style", "style",
"left: " + $("#menu_full").width() + "px;" "width: calc(100% - " + $("#menu_full").width() + "px);"
); );
} }

View File

@ -54,10 +54,10 @@ class User extends Entity implements PublicLogin
/** /**
* Initializes a user object. * Initializes a user object.
* *
* @param string|null $id_user User id. * @param mixed $id_user User id.
* - Username * - Username
*/ */
public function __construct(?string $id_user) public function __construct($id_user)
{ {
$this->table = 'tusuario'; $this->table = 'tusuario';

View File

@ -297,6 +297,7 @@ td input[type="checkbox"] {
padding: 10px; padding: 10px;
margin-top: 2px; margin-top: 2px;
display: table-cell; display: table-cell;
height: 15px;
} }
input[type="image"] { input[type="image"] {
@ -1052,6 +1053,10 @@ select:-internal-list-box {
border-radius: 8px; border-radius: 8px;
} }
.box-flat .action-buttons {
flex-direction: row-reverse;
}
.align-top td { .align-top td {
vertical-align: top; vertical-align: top;
} }
@ -2101,20 +2106,20 @@ table.rounded_cells td {
.action-buttons { .action-buttons {
display: flex; display: flex;
flex-direction: row-reverse;
align-items: center; align-items: center;
} }
.action-buttons > *:not(#backgroundMaskId) {
z-index: 5;
}
#principal_action_buttons { #principal_action_buttons {
z-index: 6; z-index: 6;
background: #ffffff;
display: flex;
flex-direction: row-reverse;
justify-content: space-between;
} }
.action-buttons > button { #principal_action_buttons.action-buttons > button {
margin-left: 16px; margin-left: 16px;
flex: none;
} }
.action-buttons-right-forced { .action-buttons-right-forced {
@ -4816,7 +4821,7 @@ div#dialog_messages table th:last-child {
z-index: 900000; z-index: 900000;
position: absolute; position: absolute;
width: 550px; width: 550px;
margin-top: -5px; margin-top: 55px;
border-radius: 5px; border-radius: 5px;
} }
@ -10956,24 +10961,28 @@ tr.bring_next_field {
position: fixed; position: fixed;
padding: 0; padding: 0;
bottom: 0; bottom: 0;
z-index: 1; right: 0;
width: -webkit-fill-available;
width: -moz-available; width: -moz-available;
padding-right: 10px; height: auto;
left: 0;
height: 62px;
} }
.action_buttons_right_content { .action_buttons_right_content {
position: fixed; flex: 1;
z-index: 10000; height: auto;
left: 250px;
display: flex; display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center; align-items: center;
margin-left: 20px;
} }
.action_buttons_right_content div { #principal_action_buttons > form:first-child,
.action_buttons_right_content > div {
height: 62px;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-right: 1em;
margin-left: 1em; margin-left: 1em;
} }
@ -10989,14 +10998,14 @@ tr.bring_next_field {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
height: 62px; height: auto;
border-top: 1px solid #e5e9ed; border-top: 1px solid #e5e9ed;
background-color: #fff; background-color: #fff;
} }
/*
.fixed_action_buttons_size > .action_buttons_background_mask { .fixed_action_buttons_size > .action_buttons_background_mask {
left: -95px !important; left: -95px !important;
} }*/
.external_tools_title { .external_tools_title {
padding: 0 10px; padding: 0 10px;

View File

@ -13,6 +13,10 @@ ul.wizard li {
padding-top: 10px; padding-top: 10px;
} }
#principal_action_buttons ul.wizard li {
padding: 0px;
}
ul.wizard.inline li { ul.wizard.inline li {
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@ -1169,6 +1169,10 @@ if ($config['pure'] == 0) {
$menuTypeClass = ($menuCollapsed === true) ? 'collapsed' : 'classic'; $menuTypeClass = ($menuCollapsed === true) ? 'collapsed' : 'classic';
// Container. // Container.
echo '<div id="container">'; echo '<div id="container">';
// Notifications content wrapper
echo '<div id="notification-content" class="invisible"/></div>';
// Header. // Header.
echo '<div id="head">'; echo '<div id="head">';
include 'general/header.php'; include 'general/header.php';
@ -1515,7 +1519,6 @@ require 'include/php_to_js_values.php';
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
// Handle the scroll. // Handle the scroll.
$(document).ready(scrollFunction()); $(document).ready(scrollFunction());
$(document).ready(menuActionButtonResizing());
// When there are less than 5 rows, all rows must be white // When there are less than 5 rows, all rows must be white
var theme = "<?php echo $config['style']; ?>"; var theme = "<?php echo $config['style']; ?>";
if (theme === 'pandora') { if (theme === 'pandora') {

View File

@ -1448,7 +1448,7 @@ $url_timestamp_down .= '&sort_field=timestamp&sort=down';
if (empty($result) === false) { if (empty($result) === false) {
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
html_print_action_buttons( html_print_action_buttons(
html_print_div(['style' => 'float:left; height: 55px;', 'class' => 'mrgn_top_15px'], true), '',
[ [
'type' => 'form_action', 'type' => 'form_action',
'right_content' => $tablePagination, 'right_content' => $tablePagination,
@ -2229,7 +2229,7 @@ if (empty($result) === false) {
if (is_metaconsole() !== true) { if (is_metaconsole() !== true) {
html_print_action_buttons( html_print_action_buttons(
html_print_div(['style' => 'float:left; height: 55px;'], true), '',
[ [
'type' => 'form_action', 'type' => 'form_action',
'right_content' => $tablePagination, 'right_content' => $tablePagination,

View File

@ -34,7 +34,24 @@ if (! check_acl($config['id_user'], 0, 'AR')) {
$action = get_parameter('action', 'listeners'); $action = get_parameter('action', 'listeners');
ui_print_page_header(__('Netflow explorer')); ui_print_standard_header(
__('Netflow explorer'),
'',
false,
'',
false,
[],
[
[
'link' => '',
'label' => __('Monitoring'),
],
[
'link' => '',
'label' => __('Network'),
],
]
);
if (netflow_print_check_version_error()) { if (netflow_print_check_version_error()) {
include $config['homedir'].'/operation/network/network_report.php'; include $config['homedir'].'/operation/network/network_report.php';

View File

@ -62,95 +62,172 @@ $style_period = ($is_period) ? '' : 'display: none;';
// Build the table. // Build the table.
$table = new stdClass(); $table = new stdClass();
$table->class = 'databox filters'; $table->class = 'filter-table-adv';
$table->styleTable = 'width: 100%'; $table->width = '100%';
$table->data['0']['0'] = __('Data to show').'&nbsp;&nbsp;'; $table->data = [];
$table->data['0']['0'] .= html_print_select(
network_get_report_actions(false), $table->data[0][] = html_print_label_input_block(
'action', __('Data to show'),
$action, html_print_select(
'', network_get_report_actions(false),
'', 'action',
0, $action,
true '',
'',
0,
true
)
); );
$table->data['0']['1'] = __('Number of result to show').'&nbsp;&nbsp;'; $table->data[0][] = html_print_label_input_block(
$table->data['0']['1'] .= html_print_select( __('Number of result to show'),
[ html_print_select(
'5' => 5, [
'10' => 10, '5' => 5,
'15' => 15, '10' => 10,
'20' => 20, '15' => 15,
'25' => 25, '20' => 20,
'50' => 50, '25' => 25,
'100' => 100, '50' => 50,
'250' => 250, '100' => 100,
], '250' => 250,
'top', ],
$top, 'top',
'', $top,
'', '',
0, '',
true 0,
true
)
); );
$table->data['0']['2'] = ''; $table->data[1][] = html_print_label_input_block(
__('Start date'),
$table->data['1']['0'] = '<div class="flex">'; html_print_div(
$table->data['1']['0'] .= '<div id="end_date_container" style="'.$style_end.'">'; [
$table->data['1']['0'] .= __('Start date').'&nbsp;&nbsp;'; 'id' => 'end_date_container',
$table->data['1']['0'] .= html_print_input_text('date_lower', $date_lower, '', 10, 7, true); 'content' => html_print_input_text(
$table->data['1']['0'] .= '&nbsp;&nbsp;'; 'date_lower',
$table->data['1']['0'] .= html_print_input_text('time_lower', $time_lower, '', 7, 8, true); $date_lower,
$table->data['1']['0'] .= '</div>'; '',
10,
$table->data['1']['0'] .= '<div id="period_container" style="'.$style_period.'">'; 10,
$table->data['1']['0'] .= __('Time Period').'&nbsp;&nbsp;'; true
$table->data['1']['0'] .= html_print_extended_select_for_time('period', $period, '', '', 0, false, true); ).html_print_input_text(
$table->data['1']['0'] .= '</div>'; 'time_lower',
$table->data['1']['0'] .= html_print_checkbox( $time_lower,
'is_period', '',
1, 7,
($is_period === true) ? 1 : 0, 8,
true, true
false, ),
'network_report_click_period(event)' ],
true
).html_print_div(
[
'id' => 'period_container',
'style' => 'display: none;',
'content' => html_print_label_input_block(
'',
html_print_extended_select_for_time(
'period',
$period,
'',
'',
0,
false,
true
),
),
],
true
)
); );
$table->data['1']['0'] .= ui_print_help_tip(
__('Select this checkbox to write interval instead a date.'),
true
);
$table->data['1']['0'] .= '</div>';
$table->data['1']['1'] = __('End date').'&nbsp;&nbsp;'; $table->data[1][] = html_print_label_input_block(
$table->data['1']['1'] .= html_print_input_text('date_greater', $date_greater, '', 10, 7, true); __('End date'),
$table->data['1']['1'] .= '&nbsp;&nbsp;'; html_print_div(
$table->data['1']['1'] .= html_print_input_text('time_greater', $time_greater, '', 7, 8, true); [
'id' => '',
$table->data['1']['2'] = html_print_submit_button( 'class' => '',
__('Update'), 'content' => html_print_input_text(
'update', 'date_greater',
false, $date_greater,
'class="sub upd"', '',
true 10,
10,
true
).html_print_input_text(
'time_greater',
$time_greater,
'',
7,
8,
true
),
],
true
)
); );
$table->data['1']['2'] .= '&nbsp;&nbsp;';
$table->data['1']['2'] .= html_print_submit_button( $table->data[2][] = html_print_label_input_block(
__('Export to CSV'), __('Defined period'),
'export_csv', html_print_checkbox_switch(
false, 'is_period',
'class="sub next" onclick="blockResumit($(this))"', 1,
true ($is_period === true) ? 1 : 0,
true,
false,
'network_report_click_period(event)'
)
); );
echo '<form method="post">'; echo '<form method="post">';
html_print_input_hidden('order_by', $order_by); html_print_input_hidden('order_by', $order_by);
if (!empty($main_value)) { if (empty($main_value) === false) {
html_print_input_hidden('main_value', $main_value); html_print_input_hidden('main_value', $main_value);
} }
html_print_table($table); $outputTable = html_print_table($table, true);
$outputTable .= html_print_div(
[
'class' => 'action-buttons-right-forced',
'content' => html_print_submit_button(
__('Filter'),
'update',
false,
[
'icon' => 'search',
'mode' => 'mini',
],
true
),
],
true
);
ui_toggle(
$outputTable,
'<span class="subsection_header_title">'.__('Filters').'</span>',
__('Filters'),
'',
true,
false,
'',
'white-box-content',
'box-flat white_table_graph fixed_filter_bar'
);
html_print_action_buttons(
html_print_submit_button(
__('Export to CSV'),
'export_csv',
false,
[
'icon' => 'load',
'onclick' => 'blockResumit($(this))',
],
true
)
);
echo '</form>'; echo '</form>';
// Print the data. // Print the data.
@ -178,7 +255,8 @@ $hidden_main_link = [
unset($table); unset($table);
$table = new stdClass(); $table = new stdClass();
$table->styleTable = 'width: 60%'; $table->id = '';
$table->width = '100%';
// Print the header. // Print the header.
$table->head = []; $table->head = [];
$table->head['main'] = __('IP'); $table->head['main'] = __('IP');
@ -252,20 +330,6 @@ if (get_parameter('export_csv')) {
exit; exit;
} }
// Print the filter remove link.
if (!empty($main_value)) {
echo html_print_link_with_params(
in_array($action, ['udp', 'tcp']) ? __('Filtered by port %s. Click here to remove the filter.', $main_value) : __('Filtered by IP %s. Click here to remove the filter.', $main_value),
array_merge(
$hidden_main_link,
[
'main_value' => $main_value,
'remove_filter' => 1,
]
)
);
}
// Print the data and build the chart. // Print the data and build the chart.
$table->data = []; $table->data = [];
$chart_data = []; $chart_data = [];
@ -277,7 +341,7 @@ foreach ($data as $item) {
$row['main'] .= $item['host']; $row['main'] .= $item['host'];
if (!$hide_filter) { if (!$hide_filter) {
$row['main'] .= html_print_link_with_params( $row['main'] .= html_print_link_with_params(
'images/filter.png', 'images/filters@svg.svg',
array_merge($hidden_main_link, ['main_value' => $item['host']]), array_merge($hidden_main_link, ['main_value' => $item['host']]),
'image' 'image'
); );
@ -316,9 +380,7 @@ foreach ($data as $item) {
if (empty($data)) { if (empty($data)) {
ui_print_info_message(__('No data found')); ui_print_info_message(__('No data found'));
} else { } else {
echo '<div class="flex mrgn_top_10px">'; // Pie graph options.
html_print_table($table);
$options = [ $options = [
'height' => 230, 'height' => 230,
'legend' => [ 'legend' => [
@ -328,15 +390,35 @@ if (empty($data)) {
], ],
'labels' => $labels, 'labels' => $labels,
]; ];
// Pie graph.
// Print the graph. html_print_div(
echo '<div class="mrgn_top_50px w40p">'; [
echo pie_graph( 'class' => 'databox netflow-pie-graph-container padding-2 white_box',
$chart_data, 'content' => pie_graph(
$options $chart_data,
$options
),
]
); );
echo '</div>'; // Print the filter remove link.
echo '</div>'; if (empty($main_value) === false) {
echo html_print_link_with_params(
in_array($action, ['udp', 'tcp']) ? __('Filtered by port %s. Click here to remove the filter.', $main_value) : __('Filtered by IP %s. Click here to remove the filter.', $main_value),
array_merge(
$hidden_main_link,
[
'main_value' => $main_value,
'remove_filter' => 1,
]
),
'text',
'',
'width: 100%; display: flex; justify-content: center;'
);
}
// Print results.
html_print_table($table);
} }
?> ?>