diff --git a/pandora_console/extras/mr/64.sql b/pandora_console/extras/mr/64.sql new file mode 100644 index 0000000000..81253929b3 --- /dev/null +++ b/pandora_console/extras/mr/64.sql @@ -0,0 +1,16 @@ +START TRANSACTION; + +UPDATE `tnetwork_component` + SET module_enabled=1 +WHERE name='Cisco _nameOID_ power state'; + +ALTER TABLE `tlayout_data` +ADD COLUMN `recursive_group` TINYINT NOT NULL DEFAULT '0' AFTER `fill_color`; + +ALTER TABLE `tusuario` +ADD COLUMN `metaconsole_section` VARCHAR(255) NOT NULL DEFAULT 'Default' AFTER `data_section`; + +ALTER TABLE `tusuario` +ADD COLUMN `metaconsole_data_section` VARCHAR(255) NOT NULL DEFAULT '' AFTER `metaconsole_section`; + +COMMIT; diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 2f01df4a55..c05e486b81 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -73,6 +73,12 @@ if ($id !== $config['id_user']) { // ID given as parameter. $pure = get_parameter('pure', 0); $user_info = get_user_info($id); + +if (is_metaconsole() === true) { + $user_info['section'] = $user_info['metaconsole_section']; + $user_info['data_section'] = $user_info['metaconsole_data_section']; +} + $is_err = false; if (is_ajax() === true) { diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index 45c54306ce..8df367d263 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -608,42 +608,51 @@ $userManagementTable->data['fields_blocksize_eventfilter'][1] = html_print_selec false, false ); -if (is_metaconsole() === false) { - // Home screen table. - $homeScreenTable = new stdClass(); - $homeScreenTable->class = 'w100p full_section'; - $homeScreenTable->id = 'home_screen_table'; - $homeScreenTable->style = []; - $homeScreenTable->rowclass = []; - $homeScreenTable->data = []; - // Home screen. - $homeScreenTable->data['captions_homescreen'][0] = __('Home screen'); - $homeScreenTable->colspan['captions_homescreen'][0] = 2; - $homeScreenTable->rowclass['captions_homescreen'] = 'field_half_width'; - $homeScreenTable->rowclass['fields_homescreen'] = 'field_half_width flex'; - $homeScreenTable->data['fields_homescreen'][0] = html_print_select( - $homeScreenValues, - 'section', - io_safe_output($user_info['section']), - 'show_data_section();', - '', - -1, - true, - false, - false - ); - $homeScreenTable->data['fields_homescreen'][1] = html_print_div( - [ - 'class' => 'w100p', - 'content' => $customHomeScreenDataField, - ], - true - ); - $userManagementTable->rowclass['homescreen_table'] = 'w100p'; - $userManagementTable->data['homescreen_table'] = html_print_table($homeScreenTable, true); +// Home screen table. +$homeScreenTable = new stdClass(); +$homeScreenTable->class = 'w100p full_section'; +$homeScreenTable->id = 'home_screen_table'; +$homeScreenTable->style = []; +$homeScreenTable->rowclass = []; +$homeScreenTable->data = []; +// Home screen. +$homeScreenTable->data['captions_homescreen'][0] = __('Home screen'); +$homeScreenTable->colspan['captions_homescreen'][0] = 2; +$homeScreenTable->rowclass['captions_homescreen'] = 'field_half_width'; +$homeScreenTable->rowclass['fields_homescreen'] = 'field_half_width flex'; + +$selected_homescreen = $user_info['section']; +foreach ($homeScreenValues as $key => $value) { + if ($value === $selected_homescreen) { + $selected_homescreen = $key; + break; + } } +$homeScreenTable->data['fields_homescreen'][0] = html_print_select( + $homeScreenValues, + 'section', + $selected_homescreen, + 'show_data_section();', + '', + -1, + true, + false, + false +); +$homeScreenTable->data['fields_homescreen'][1] = html_print_div( + [ + 'class' => 'w100p', + 'content' => $customHomeScreenDataField, + ], + true +); + +$userManagementTable->rowclass['homescreen_table'] = 'w100p'; +$userManagementTable->data['homescreen_table'] = html_print_table($homeScreenTable, true); + + if (is_metaconsole() === true && users_is_admin() === true) { $userManagementTable->rowclass['search_custom1_looknfeel'] = 'field_half_width'; $userManagementTable->rowclass['search_custom2_looknfeel'] = 'field_half_width flex-column'; diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php index 9783c609b6..cd6f8f056f 100644 --- a/pandora_console/include/auth/mysql.php +++ b/pandora_console/include/auth/mysql.php @@ -801,13 +801,31 @@ function update_user(string $id_user, array $values) return false; } - if (is_metaconsole() === true) { - unset($values['id_skin']); - unset($values['section']); - unset($values['default_event_filter']); - $update_user_metaconsole = true; - } else { - $update_user_metaconsole = false; + if (isset($values['section']) === true) { + $homeScreenValues = [ + HOME_SCREEN_DEFAULT => __('Default'), + HOME_SCREEN_VISUAL_CONSOLE => __('Visual console'), + HOME_SCREEN_EVENT_LIST => __('Event list'), + HOME_SCREEN_GROUP_VIEW => __('Group view'), + HOME_SCREEN_TACTICAL_VIEW => __('Tactical view'), + HOME_SCREEN_ALERT_DETAIL => __('Alert detail'), + HOME_SCREEN_EXTERNAL_LINK => __('External link'), + HOME_SCREEN_OTHER => __('Other'), + HOME_SCREEN_DASHBOARD => __('Dashboard'), + ]; + + if (array_key_exists($values['section'], $homeScreenValues) === true) { + $values['section'] = $homeScreenValues[$values['section']]; + } + + if (is_metaconsole() === true) { + $values['metaconsole_section'] = $values['section']; + $values['metaconsole_data_section'] = $values['data_section']; + unset($values['id_skin']); + unset($values['section']); + unset($values['data_section']); + unset($values['default_event_filter']); + } } $output = db_process_sql_update('tusuario', $values, ['id_user' => $id_user]); @@ -847,10 +865,6 @@ function update_user(string $id_user, array $values) } } - if ($update_user_metaconsole === true) { - $output = 1; - } - return $output; }