Fix home screen external link pandora_enterprise#12413

This commit is contained in:
daniel 2023-11-07 11:11:08 +01:00
parent e516db1ef1
commit 7b7370659e
2 changed files with 48 additions and 90 deletions

View File

@ -33,8 +33,6 @@ check_login();
require_once $config['homedir'].'/vendor/autoload.php';
use PandoraFMS\Dashboard\Manager;
require_once $config['homedir'].'/include/functions_profile.php';
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_groups.php';
@ -1376,72 +1374,6 @@ if (is_metaconsole() === true) {
);
}
$values = [
-1 => __('Use global conf'),
1 => __('Yes'),
0 => __('No'),
];
$home_screen = '<div class="label_select"><p class="edit_user_labels">'.__('Home screen').ui_print_help_tip(
__('User can customize the home page. By default, will display \'Agent Detail\'. Example: Select \'Other\' and type index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 to show agent detail view'),
true
).'</p>';
$dashboards = Manager::getDashboards(
-1,
-1,
false,
false,
$id_usr
);
$dashboards_aux = [];
if ($dashboards === false) {
$dashboards = ['None' => 'None'];
} else {
foreach ($dashboards as $key => $dashboard) {
$dashboards_aux[$dashboard['id']] = $dashboard['name'];
}
}
$home_screen .= '<div id="show_db" style="display: none; width: 100%;">';
$home_screen .= html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true);
$home_screen .= '</div>';
$layouts = visual_map_get_user_layouts($config['id_user'], true);
$layouts_aux = [];
if ($layouts === false) {
$layouts_aux = ['None' => 'None'];
} else {
foreach ($layouts as $layout) {
$layouts_aux[$layout] = $layout;
}
}
$home_screen .= '<div id="show_vc" style="display: none; width: 100%;">';
$home_screen .= html_print_select(
$layouts_aux,
'visual_console',
$user_info['data_section'],
'',
'',
'',
true
);
$home_screen .= '</div>';
$home_screen .= html_print_input_text(
'data_section',
$user_info['data_section'],
'',
60,
255,
true,
false
);
$home_screen = '';
$size_pagination = '<div class="label_select_simple"><p class="edit_user_labels">'.__('Block size for pagination').'</p>';
$size_pagination .= html_print_input_text(
'block_size',
@ -2078,17 +2010,20 @@ if (is_metaconsole() === false) {
}
function show_data_section() {
var $section = $("#section").val();
var $allElements = $('div[id^="custom_home_screen_"]');
var $elementSelected = $('div[id="custom_home_screen_' + $section + '"]');
var section = $("#section").val();
if(section === 'other'){
section = 'external_link';
}
var allElements = $('div[id^="custom_home_screen_"]');
var elementSelected = $('div[id="custom_home_screen_' + section + '"]');
// Hide all elements.
$allElements.each(function() {
allElements.each(function() {
$(this).addClass('invisible');
$(this).children().addClass('invisible');
})
// Show only the selected.
$elementSelected.removeClass('invisible');
$elementSelected.children().removeClass('invisible');
elementSelected.removeClass('invisible');
elementSelected.children().removeClass('invisible');
}
function switch_ehorus_conf() {

View File

@ -48,13 +48,44 @@ $homeScreenValues = [
// Custom Home Screen controls.
$customHomeScreenAddition = [];
// Home screen. Dashboard.
$customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select($dashboards_aux, 'dashboard', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
$customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select(
$dashboards_aux,
'dashboard',
$user_info['data_section'],
'',
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
);
// Home screen. Visual consoles.
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%');
$customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select(
$layouts_aux,
'visual_console',
$user_info['data_section'],
'',
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%'
);
// Home screen. External link and Other.
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true);
$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true);
$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text(
'data_section',
$user_info['data_section'],
'',
60,
255,
true
);
$customHomeScreenDataField = '';
foreach ($customHomeScreenAddition as $key => $customField) {
$customHomeScreenDataField .= html_print_div(
@ -576,7 +607,7 @@ $userManagementTable->data['fields_autorefreshTime'][0] .= ui_print_input_placeh
true
);
// eHorus conf
// EHorus conf.
if (isset($config['ehorus_user_level_conf']) === true && (bool) $config['ehorus_user_level_conf'] === true) {
$userManagementTable->data['captions_ehorus_user_level_enabled'][1] = __('Pandora RC user access enabled');
$userManagementTable->data['fields_ehorus_user_level_enabled'][1] = html_print_checkbox_switch(
@ -791,7 +822,7 @@ $userManagementTable->data['fields_addSettings'][0] = html_print_textarea(
5,
65,
$user_info['comments'],
($view_mode ? 'readonly="readonly"' : ''),
($view_mode) ? 'readonly="readonly"' : '',
true,
''
);
@ -945,15 +976,7 @@ $(document).ready(function () {
$('#advanced-line1_looknfeel-1 > a').css('display', 'block');
})
var ehorus_user_level_enabled =
<?php
if (isset($user_info['ehorus_user_level_enabled']) === true) {
echo $user_info['ehorus_user_level_enabled'];
} else {
echo 0;
}
?>
;
var ehorus_user_level_enabled = '<?php echo (isset($user_info['ehorus_user_level_enabled']) === true) ? $user_info['ehorus_user_level_enabled'] : 0; ?>';
var chk_ehorus_user_level_enabled = ehorus_user_level_enabled;
if (ehorus_user_level_enabled == 0) {