From 89bf35a8bf736dd1d61b0085ecd6d5dac8b2d496 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Nov 2019 21:54:41 +0100 Subject: [PATCH] Fix default value show must match the theme selected --- htdocs/core/lib/usergroups.lib.php | 46 +++++++++++++++++++----------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 5e842612b24..eeaa4d4d6ce 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -420,6 +420,10 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; + if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) { + include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + } + // Show logo if ($foruserprofile) { @@ -563,8 +567,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { - $default='5a6482'; - if ($conf->theme == 'md') $default='5a3278'; + $default=(empty($colorbackhmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackhmenu1))); print ''; print ''.$langs->trans("TopMenuBackgroundColor").''; @@ -612,8 +615,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { - $default='f0f0f0'; - if ($conf->theme == 'md') $default='ffffff'; + $default=(empty($colorbackvmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackvmenu1))); print ''; print ''.$langs->trans("LeftMenuBackgroundColor").''; @@ -641,6 +643,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colortexttitlenotab) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlenotab))); + print ''; print ''.$langs->trans("TextTitleColor").''; print ''; @@ -652,7 +656,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': 643c14) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print ''; @@ -666,6 +670,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colorbacktitle1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacktitle1))); + print ''; print ''.$langs->trans("BackgroundTableTitleColor").''; print ''; @@ -677,7 +683,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': f0f0f0) '; // $colorbacktitle1 in CSS + print '   ('.$langs->trans("Default").': '.$default.') '; // $colorbacktitle1 in CSS print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print ''; @@ -691,6 +697,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colortexttitle) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitle))); + print ''; print ''.$langs->trans("BackgroundTableTitleTextColor").''; print ''; @@ -702,7 +710,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': 000000) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print ''; @@ -716,8 +724,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { - $default='ffffff'; - if ($conf->theme == 'md') $default='ffffff'; + $default=(empty($colorbacklineimpair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklineimpair1))); print ''; print ''.$langs->trans("BackgroundTableLineOddColor").''; @@ -745,8 +752,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { - $default='f8f8f8'; - if ($conf->theme == 'md') $default='f8f8f8'; + $default=(empty($colorbacklinepair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepair1))); print ''; print ''.$langs->trans("BackgroundTableLineEvenColor").''; @@ -794,6 +800,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colortextlink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortextlink))); + print ''; print ''.$langs->trans("LinkColor").''; print ''; @@ -812,7 +820,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print $langs->trans("Default"); } } - print '   ('.$langs->trans("Default").': 000078) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print ''; @@ -834,6 +842,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) */ } else { + $default=(empty($colorbacklinepairhover) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairhover))); + print ''; print ''.$langs->trans("HighlightLinesColor").''; print ''; @@ -841,22 +851,22 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) //print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; if ($edit) { - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; + if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color=colorArrayToHex(colorStringToArray($colorbacklinepairhover)); else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', 'formcolor', 1).' '; } else { - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; + if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color=colorArrayToHex(colorStringToArray($colorbacklinepairhover)); else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); if ($color) { - if ($color != 'e6edf0') print ''; + if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) print ''; else print $langs->trans("Default"); } else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': e6edf0) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print ''; @@ -878,6 +888,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colorbacklinepairchecked) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairchecked))); + print ''; print ''.$langs->trans("HighlightLinesChecked").''; print ''; @@ -900,7 +912,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': e6edf0) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print '';