Adapt views

This commit is contained in:
jose.gonzalez@pandorafms.com 2022-10-25 11:46:28 +02:00
parent 15f2a6ae88
commit 70d0e38382
5 changed files with 297 additions and 57 deletions

View File

@ -130,6 +130,7 @@ $table_styles = new stdClass();
$table_styles->width = '100%';
$table_styles->class = 'databox filters';
$table_styles->style[0] = 'font-weight: bold;';
$table_styles->style[1] = 'display: flex; align-items: center;';
$table_styles->size[0] = '50%';
$table_styles->data = [];
@ -146,7 +147,6 @@ $table_styles->data[$row][1] = html_print_select(
);
$row++;
$table_styles->data[$row][0] = __('Status icon set');
$iconsets['default'] = __('Colors');
$iconsets['faces'] = __('Faces');
@ -236,7 +236,18 @@ $table_styles->data[$row][1] = html_print_select(
false,
'width:240px'
);
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'login_background_preview', false, '', 'class="sub camera logo_preview"', true);
$table_styles->data[$row][1] .= html_print_button(
__('View'),
'login_background_preview',
false,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true
);
$row++;
@ -290,16 +301,44 @@ function logo_custom_enterprise($name, $logo)
$table_styles->data[$row][0] = __('Custom logo (menu)');
$table_styles->data[$row][1] = logo_custom_enterprise('custom_logo', $config['custom_logo']);
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'custom_logo_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$table_styles->data[$row][1] .= ' '.html_print_button(
__('View'),
'custom_logo_preview',
$open,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true,
false,
$open,
'visualmodal'
);
$row++;
$table_styles->data[$row][0] = __('Custom logo collapsed (menu)');
$table_styles->data[$row][1] = logo_custom_enterprise('custom_logo_collapsed', $config['custom_logo_collapsed']);
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'custom_logo_collapsed_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$table_styles->data[$row][1] .= ' '.html_print_button(
__('View'),
'custom_logo_collapsed_preview',
$open,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true,
false,
$open,
'visualmodal'
);
$row++;
$table_styles->data[$row][0] = __('Custom logo (header white background)');
if (enterprise_installed()) {
if (enterprise_installed() === true) {
$ent_files = list_files('enterprise/images/custom_logo', 'png', 1, 0);
$open_files = list_files('images/custom_logo', 'png', 1, 0);
@ -334,7 +373,21 @@ if (enterprise_installed()) {
);
}
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'custom_logo_white_bg_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$table_styles->data[$row][1] .= ' '.html_print_button(
__('View'),
'custom_logo_white_bg_preview',
$open,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true,
false,
$open,
'visualmodal'
);
$row++;
$table_styles->data[$row][0] = __('Custom logo (login)');
@ -371,11 +424,25 @@ if (enterprise_installed()) {
);
}
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'custom_logo_login_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$table_styles->data[$row][1] .= ' '.html_print_button(
__('View'),
'custom_logo_login_preview',
$open,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true,
false,
$open,
'visualmodal'
);
$row++;
// Splash login
if (enterprise_installed()) {
// Splash login.
if (enterprise_installed() === true) {
$table_styles->data[$row][0] = __('Custom Splash (login)');
$table_styles->data[$row][1] = html_print_select(
@ -393,11 +460,25 @@ if (enterprise_installed()) {
'width:240px'
);
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'custom_splash_login_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$table_styles->data[$row][1] .= ' '.html_print_button(
__('View'),
'custom_splash_login_preview',
$open,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true,
false,
$open,
'visualmodal'
);
$row++;
}
if (enterprise_installed()) {
if (enterprise_installed() === true) {
// Get all the custom logos.
$files = list_files('enterprise/images/custom_general_logos', 'png', 1, 0);
@ -418,7 +499,21 @@ if (enterprise_installed()) {
false,
'width:240px'
);
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'custom_docs_logo_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$table_styles->data[$row][1] .= ' '.html_print_button(
__('View'),
'custom_docs_logo_preview',
$open,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true,
false,
$open,
'visualmodal'
);
$row++;
// Custom support icon.
@ -437,7 +532,21 @@ if (enterprise_installed()) {
false,
'width:240px'
);
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'custom_support_logo_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$table_styles->data[$row][1] .= ' '.html_print_button(
__('View'),
'custom_support_logo_preview',
$open,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true,
false,
$open,
'visualmodal'
);
$row++;
// Custom center networkmap icon.
@ -456,7 +565,21 @@ if (enterprise_installed()) {
false,
'width:240px'
);
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'custom_network_center_logo_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$table_styles->data[$row][1] .= ' '.html_print_button(
__('View'),
'custom_network_center_logo_preview',
$open,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true,
false,
$open,
'visualmodal'
);
$row++;
// Custom center mobile console icon.
@ -475,7 +598,21 @@ if (enterprise_installed()) {
false,
'width:240px'
);
$table_styles->data[$row][1] .= ' '.html_print_button(__('View'), 'custom_mobile_console_logo_preview', $open, '', 'class="sub camera logo_preview"', true, false, $open, 'visualmodal');
$table_styles->data[$row][1] .= ' '.html_print_button(
__('View'),
'custom_mobile_console_logo_preview',
$open,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true,
false,
$open,
'visualmodal'
);
$row++;
}
@ -489,45 +626,45 @@ $table_styles->data[$row][0] = __('Subtitle (header)');
$table_styles->data[$row][1] = html_print_input_text('custom_subtitle_header', $config['custom_subtitle_header'], '', 50, 40, true);
$row++;
// login title1
if (enterprise_installed()) {
// Login title1.
if (enterprise_installed() === true) {
$table_styles->data[$row][0] = __('Title 1 (login)');
$table_styles->data[$row][1] = html_print_input_text('custom_title1_login', $config['custom_title1_login'], '', 50, 50, true);
$row++;
}
// login text2
if (enterprise_installed()) {
// Login text2.
if (enterprise_installed() === true) {
$table_styles->data[$row][0] = __('Title 2 (login)');
$table_styles->data[$row][1] = html_print_input_text('custom_title2_login', $config['custom_title2_login'], '', 50, 50, true);
$row++;
}
if (enterprise_installed()) {
if (enterprise_installed() === true) {
$table_styles->data[$row][0] = __('Docs URL (login)');
$table_styles->data[$row][1] = html_print_input_text('custom_docs_url', $config['custom_docs_url'], '', 50, 50, true);
$row++;
}
if (enterprise_installed()) {
if (enterprise_installed() === true) {
$table_styles->data[$row][0] = __('Support URL (login)');
$table_styles->data[$row][1] = html_print_input_text('custom_support_url', $config['custom_support_url'], '', 50, 50, true);
$row++;
}
if (enterprise_installed()) {
if (enterprise_installed() === true) {
$table_styles->data[$row][0] = __('Product name');
$table_styles->data[$row][1] = html_print_input_text('rb_product_name', get_product_name(), '', 30, 255, true);
$row++;
}
if (enterprise_installed()) {
if (enterprise_installed() === true) {
$table_styles->data[$row][0] = __('Copyright notice');
$table_styles->data[$row][1] = html_print_input_text('rb_copyright_notice', get_copyright_notice(), '', 30, 255, true);
$row++;
}
if (enterprise_installed()) {
if (enterprise_installed() === true) {
$table_styles->data[$row][0] = __('Disable logo in graphs');
$table_styles->data[$row][1] = html_print_checkbox_switch(
'fixed_graph',
@ -563,7 +700,7 @@ $table_styles->data[$row][1] = html_print_checkbox_switch(
$row++;
// For 5.1 Autohidden menu feature
// For 5.1 Autohidden menu feature.
$table_styles->data['autohidden'][0] = __('Automatically hide submenu');
$table_styles->data['autohidden'][1] = html_print_checkbox_switch(
'autohidden_menu',
@ -589,6 +726,7 @@ $table_gis = new stdClass();
$table_gis->width = '100%';
$table_gis->class = 'databox filters';
$table_gis->style[0] = 'font-weight: bold;';
$table_gis->style[1] = 'display: flex; align-items: center;';
$table_gis->size[0] = '50%';
$table_gis->data = [];
@ -617,7 +755,18 @@ $table_gis->data[$row][1] = html_print_select(
'',
true
);
$table_gis->data[$row][1] .= ' '.html_print_button(__('View'), 'gis_icon_preview', false, '', 'class="sub camera logo_preview"', true);
$table_gis->data[$row][1] .= ' '.html_print_button(
__('View'),
'gis_icon_preview',
false,
'',
[
'icon' => 'camera',
'mode' => 'link',
'class' => 'logo_preview',
],
true
);
$row++;
// ----------------------------------------------------------------------
@ -1323,15 +1472,15 @@ $table_other->data[$row][1] = '<em>'.__('Example').'</em> '.date($config['date_f
$table_other->data[$row][1] .= html_print_input_text('date_format', $config['date_format'], '', 30, 100, true);
$row++;
if ($config['prominent_time'] == 'comparation') {
if ($config['prominent_time'] === 'comparation') {
$timestamp = false;
$comparation = true;
$compact = false;
} else if ($config['prominent_time'] == 'timestamp') {
} else if ($config['prominent_time'] === 'timestamp') {
$timestamp = true;
$comparation = false;
$compact = false;
} else if ($config['prominent_time'] == 'compact') {
} else if ($config['prominent_time'] === 'compact') {
$timestamp = false;
$comparation = false;
$compact = true;
@ -1363,7 +1512,10 @@ $table_other->data[$row][3] = html_print_button(
'custom_value_add_btn',
false,
'',
'class="sub next"',
[
'icon' => 'next',
'mode' => 'secondary mini',
],
true
);
@ -1386,10 +1538,13 @@ $table_other->data[$row][3] = html_print_button(
'custom_values_del_btn',
empty($count_custom_postprocess),
'',
'class="sub cancel"',
[
'icon' => 'cancel',
'mode' => 'secondary mini',
],
true
);
// This hidden field will be filled from jQuery before submit
// This hidden field will be filled from jQuery before submit.
$table_other->data[$row][1] .= html_print_input_hidden(
'custom_value_to_delete',
'',
@ -1414,17 +1569,37 @@ $units = [
$table_other->data[$row][1] = __('Value').': ';
$table_other->data[$row][1] .= html_print_input_text('interval_value', '', '', 5, 5, true);
$table_other->data[$row][2] = html_print_select($units, 'interval_unit', 1, '', '', '', true, false, false);
$table_other->data[$row][3] = html_print_button(__('Add'), 'interval_add_btn', false, '', 'class="sub next"', true);
$table_other->data[$row][3] = html_print_button(
__('Add'),
'interval_add_btn',
false,
'',
[
'icon' => 'next',
'mode' => 'secondary mini',
],
true
);
$row++;
$table_other->data[$row][0] = '';
$table_other->data[$row][1] = __('Delete interval').': ';
$table_other->data[$row][2] = html_print_select(get_periods(false, false), 'intervals', '', '', '', '', true);
$table_other->data[$row][3] = html_print_button(__('Delete'), 'interval_del_btn', empty($config['interval_values']), '', 'class="sub cancel"', true);
$table_other->data[$row][3] = html_print_button(
__('Delete'),
'interval_del_btn',
empty($config['interval_values']),
'',
[
'icon' => 'cancel',
'mode' => 'secondary mini',
],
true
);
$table_other->data[$row][1] .= html_print_input_hidden('interval_values', $config['interval_values'], true);
// This hidden field will be filled from jQuery before submit
// This hidden field will be filled from jQuery before submit.
$table_other->data[$row][1] .= html_print_input_hidden('interval_to_delete', '', true);
$table_other->data[$row][3] .= '<br><br>';
// ----------------------------------------------------------------------
@ -1434,7 +1609,17 @@ $table_other->data[$row][0] = __('Module units');
$table_other->data[$row][1] = __('Value').': ';
$table_other->data[$row][1] .= html_print_input_text('custom_module_unit', '', '', 15, 50, true);
$table_other->data[$row][2] = '';
$table_other->data[$row][3] = html_print_button(__('Add'), 'module_unit_add_btn', false, '', 'class="sub next"', true);
$table_other->data[$row][3] = html_print_button(
__('Add'),
'module_unit_add_btn',
false,
'',
[
'icon' => 'next',
'mode' => 'secondary mini',
],
true
);
$row++;
$table_other->data[$row][0] = '';
@ -1445,7 +1630,10 @@ $table_other->data[$row][3] = html_print_button(
'custom_module_unit_del_btn',
empty($count_custom_postprocess),
'',
'class="sub cancel"',
[
'icon' => 'cancel',
'mode' => 'secondary mini',
],
true
);

View File

@ -1508,14 +1508,20 @@ if ($config['admin_can_add_user']) {
__('Create'),
'crtbutton',
false,
'class="sub wand" form="user_profile_form"'
[
'icon' => 'wand',
'form' => 'user_profile_form',
]
);
} else {
html_print_submit_button(
__('Update'),
'uptbutton',
false,
'class="sub upd" form="user_profile_form"'
[
'icon' => 'update',
'form' => 'user_profile_form',
]
);
}
}

View File

@ -3325,7 +3325,10 @@ function events_page_responses($event)
'owner_button',
false,
'event_change_owner('.$event['id_evento'].', '.$event['server_id'].');',
'class="sub next w70p"',
[
'icon' => 'next',
'mode' => 'mini secondary',
],
true
);
@ -3404,7 +3407,10 @@ function events_page_responses($event)
'status_button',
false,
'event_change_status(\''.$event['similar_ids'].'\','.$event['server_id'].');',
'class="sub next w70p"',
[
'icon' => 'next',
'mode' => 'mini secondary',
],
true
);
}
@ -3432,7 +3438,10 @@ function events_page_responses($event)
'comment_button',
false,
'$(\'#link_comments\').trigger(\'click\');',
'class="sub next w70p"',
[
'icon' => 'next',
'mode' => 'mini secondary',
],
true
);
@ -3456,7 +3465,10 @@ function events_page_responses($event)
'delete_button',
false,
'if(!confirm(\''.__('Are you sure?').'\')) { return false; } this.form.submit();',
'class="sub cancel w70p"',
[
'icon' => 'cancel',
'mode' => 'mini secondary',
],
true
);
$data[2] .= html_print_input_hidden('delete', 1, true);
@ -3511,7 +3523,10 @@ function events_page_responses($event)
'custom_response_button',
false,
'execute_response('.$event['id_evento'].','.$server_id.',0)',
"class='sub next w70p'",
[
'icon' => 'next',
'mode' => 'mini secondary',
],
true
);
}
@ -4190,7 +4205,10 @@ function events_page_details($event, $server_id=0)
'custom_button',
false,
'$(\'#link_custom_fields\').trigger(\'click\');',
'class="sub next"',
[
'icon' => 'next',
'mode' => 'mini secondary',
],
true
);
$table_details->data[] = $data;
@ -5042,7 +5060,10 @@ function events_page_comments($event, $ajax=false, $groupedComments=[])
'comment_button',
false,
'event_comment(\''.base64_encode(json_encode($event)).'\');',
'class="sub next"',
[
'icon' => 'next',
'mode' => 'mini secondary',
],
true
);
$comments_form .= '</div><br></div>';
@ -5638,7 +5659,10 @@ function get_row_response_action(
'btn_str',
false,
'perform_response(\''.base64_encode(json_encode($event_response)).'\','.$response_id.',\''.trim($index).'\')',
"class='sub next'",
[
'icon' => 'next',
'mode' => 'mini secondary',
],
true
);
$output .= '</div>';

View File

@ -3381,24 +3381,46 @@ function ui_print_datatable(array $parameters)
}
$filter .= '<li>';
// Search button.
$filter .= '<input type="submit" class="'.$search_button_class.'" ';
$filter .= ' id="'.$form_id.'_search_bt" value="'.__('Filter').'"/>';
// Extra buttons.
if (isset($parameters['form']['extra_buttons']) === true
&& is_array($parameters['form']['extra_buttons']) === true
) {
foreach ($parameters['form']['extra_buttons'] as $button) {
$filter .= '<button id="'.$button['id'].'" ';
$filter .= ' class="'.$button['class'].'" ';
$filter .= ' style="'.($button['style'] ?? '').'" ';
$filter .= ' onclick="'.$button['onclick'].'" >';
$filter .= $button['text'];
$filter .= '</button>';
$filter .= html_print_button(
$button['text'],
$button['id'],
false,
$button['onclick'],
[
'style' => ($button['style'] ?? ''),
'mode' => 'mini secondary',
'class' => $button['class'],
],
true
);
}
}
// Search button.
$filter .= html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Filter'),
$form_id.'_search_bt',
false,
[
'icon' => 'search',
'mode' => 'mini',
'class' => $search_button_class,
],
true
),
],
true
);
$filter .= '</li>';
$filter .= '</ul><div id="both"></div></form>';

View File

@ -270,7 +270,7 @@ $chart_data = [];
$hide_filter = !empty($main_value) && ($action === 'udp' || $action === 'tcp');
foreach ($data as $item) {
$row = [];
$row['main'] = '<div class="div-v-centered">';
$row['main'] = '<div class="flex_center">';
$row['main'] .= $item['host'];
if (!$hide_filter) {
$row['main'] .= html_print_link_with_params(