From 9bbac06771758b2e3b9f77ab7a5066e2b21a28b1 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 13 Apr 2021 09:26:50 +0000 Subject: [PATCH] Ent 7161 cambiar opciones de skin en usuarios y grupos --- pandora_console/extras/mr/46.sql | 3 +++ .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 3 +++ .../godmode/groups/configure_group.php | 11 ++++---- pandora_console/include/functions_config.php | 26 +++++++++++++++++++ pandora_console/pandoradb_data.sql | 4 +-- 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/pandora_console/extras/mr/46.sql b/pandora_console/extras/mr/46.sql index 9b04f79114..f9ff2e9aac 100644 --- a/pandora_console/extras/mr/46.sql +++ b/pandora_console/extras/mr/46.sql @@ -4,4 +4,7 @@ ALTER TABLE `tagent_custom_fields` MODIFY COLUMN `combo_values` TEXT NOT NULL DE UPDATE `talert_commands` SET `fields_descriptions` = '[\"Event name\",\"Event type\",\"Source\",\"Agent name or _agent_\",\"Event severity\",\"ID extra\",\"Tags separated by commas\",\"Comments\",\"\",\"\"]' WHERE `name` = "Monitoring Event"; +UPDATE `tskin` SET `name` = 'Default theme' , `relative_path` = 'pandora.css' WHERE `id` = 1; +UPDATE `tskin` SET `name` = 'Black theme' , `relative_path` = 'Black theme' , `description` = 'Black theme' WHERE `id` = 2; + COMMIT; diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql index c8303640d3..880afa8baf 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql @@ -565,6 +565,9 @@ CREATE TABLE IF NOT EXISTS `tskin` ( PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +UPDATE `tskin` SET `name` = 'Default theme' , `relative_path` = 'pandora.css' WHERE `id` = 1; +UPDATE `tskin` SET `name` = 'Black theme' , `relative_path` = 'Black theme' , `description` = 'Black theme' WHERE `id` = 2; + -- --------------------------------------------------------------------- -- Table `tpolicy_queue` -- --------------------------------------------------------------------- diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 08e2c2e9f3..0d45f381e4 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -219,12 +219,11 @@ $table->data[$i][0] = __('Other').ui_print_help_tip(__('Information accessible t $table->data[$i][1] = html_print_textarea('other', 4, 40, $other, "class='min-height-0px'", true); $i++; -$isFunctionSkins = enterprise_include_once('include/functions_skins.php'); -if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) { - $table->data[9][0] = __('Skin'); - $table->data[9][1] = skins_print_select($config['id_user'], 'skin', $skin, '', __('None'), 0, true); -} - +// $isFunctionSkins = enterprise_include_once('include/functions_skins.php'); +// if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) { +// $table->data[10][0] = __('Skin'); +// $table->data[10][1] = skins_print_select($config['id_user'], 'skin', $skin, '', __('None'), 0, true); +// } if (defined('METACONSOLE')) { $sec = 'advanced'; } else { diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 322e630485..d2bed417b4 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -3358,6 +3358,32 @@ function config_user_set_custom_config() } } + if ((isset($userinfo['id_skin']) && $userinfo['id_skin'] !== 0)) { + if ((int) $userinfo['id_skin'] === 1) { + $config['style'] = 'pandora'; + } + + if ((int) $userinfo['id_skin'] === 2) { + $config['style'] = 'pandora_black'; + } + } + + $skin = get_parameter('skin', false); + $sec2_aux = get_parameter('sec2'); + + if ($sec2_aux != 'godmode/groups/group_list' && $skin !== false) { + $id_user_aux = get_parameter('id'); + if ($id_user_aux == $config['id_user']) { + if ((int) $skin === 1 || (int) $skin === 0) { + $config['style'] = 'pandora'; + } + + if ((int) $skin === 2) { + $config['style'] = 'pandora_black'; + } + } + } + if (defined('METACONSOLE')) { $config['metaconsole_access'] = $userinfo['metaconsole_access']; } diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index fce3eaf402..de448f7dd9 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -1199,8 +1199,8 @@ INSERT INTO `tupdate_settings` VALUES ('current_update', '412'), ('customer_key -- -- Dumping data for table `tskin` -- -INSERT INTO `tskin` VALUES (1,'skin default', 'skin_default', 'Default skin for Pandora FMS web console', 1); -INSERT INTO `tskin` VALUES (2,'Legacy', 'legacy', 'Skin of the visual style of Pandora FMS 4.x and previous versions', 1); +INSERT INTO `tskin` VALUES (1,'Default theme', 'pandora.css', 'Default skin for Pandora FMS web console', 0); +INSERT INTO `tskin` VALUES (2,'Black theme', 'pandora_black.css', 'Black theme', 0); -- -- Dumping data for table `tcollection`