From 3c91b8c8900829ea1c0be6111c46be290d79d29c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Sep 2015 12:11:57 +0200 Subject: [PATCH] Force to select "use personalized value" to select a personalized screen option. --- htdocs/core/lib/usergroups.lib.php | 142 +++++++++++++++++++---------- htdocs/user/param_ihm.php | 68 +++++++++++--- 2 files changed, 150 insertions(+), 60 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 5dc17962e14..f5f8df18ba1 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -277,6 +277,10 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME; else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:''); + $hoverdisabled=''; + if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'); + else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):''); + $colspan=2; if ($foruserprofile) $colspan=4; @@ -295,7 +299,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print ''; print ''.$langs->trans("DefaultSkin").''; print ''.$conf->global->MAIN_THEME.''; - print ' '.$langs->trans("UsePersonalValue").''; + print ' '.$langs->trans("UsePersonalValue").''; print ' '; print ''; } @@ -359,11 +363,11 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '
'; if ($subdir == $selected_theme) { - print ' '.$subdir.''; + print ' '.$subdir.''; } else { - print ' '.$subdir; + print ' '.$subdir; } print ''; @@ -378,57 +382,101 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print ''; - if (! $foruserprofile) + // Use Hover + $var=!$var; + if ($foruserprofile) + { + /* Must first change option to choose color of highlight insteado of yes or no. + print ''; + print ''.$langs->trans("HighlightLinesOnMouseHover").''; + print 'global->THEME_ELDY_USE_HOVER?" checked":"").'>'; + print ' '.$langs->trans("UsePersonalValue").''; + print ''; + print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print ''; + print ''; + */ + } + else + { + print ''; + print ''.$langs->trans("HighlightLinesOnMouseHover").''; + print ''; + print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print ''; + print ''; + } + + // TopMenuBackgroundColor + if ($foruserprofile) + { + /*$var=!$var; + print ''; + print ''.$langs->trans("TopMenuBackgroundColor").''; + print ''.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).''; + print 'conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); + print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo + print '> '.$langs->trans("UsePersonalValue").''; + print ''; + if ($edit) + { + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; + } + else + { + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); + if ($color) print ''; + else print ''; + } + if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print '';*/ + } + else { $var=!$var; print ''; - print ''.$langs->trans("HighlightLinesOnMouseHover").''; - $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0'); - print ''; - print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print ''.$langs->trans("TopMenuBackgroundColor").''; + print ''; + if ($edit) + { + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; + } + else + { + $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); + if ($color) print ''; + else print $langs->trans("Default"); + } + print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print ''; + } + + // BackgroundTableTitleColor + if ($foruserprofile) + { + + + } + else + { + $var=!$var; + print ''; + print ''.$langs->trans("BackgroundTableTitleColor").''; + print ''; + if ($edit) + { + print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' '; + } + else + { + print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); + } + print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; print ''; - print ''; - - //if ($conf->theme == 'eldy') - //{ - // TopMenuBackgroundColor - $var=!$var; - print ''; - print ''.$langs->trans("TopMenuBackgroundColor").''; - print ''; - if ($edit) - { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' '; - } - else - { - $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''); - if ($color) print ''; - else print $langs->trans("Default"); - } - print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; - print ''; - - // BackgroundTableTitleColor - $var=!$var; - print ''; - print ''.$langs->trans("BackgroundTableTitleColor").''; - print ''; - if ($edit) - { - print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' '; - } - else - { - print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); - } - print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; - print ''; - //} print ''; } - + print ''; } diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 5355a0f74fc..9e67a1015c7 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -93,7 +93,18 @@ if ($action == 'update' && ($caneditfield || ! empty($user->admin))) if ($_POST["check_MAIN_THEME"]=="on") $tabparam["MAIN_THEME"]=$_POST["main_theme"]; else $tabparam["MAIN_THEME"]=''; - $tabparam["MAIN_SEARCHFORM_CONTACT"]=$_POST["main_searchform_contact"]; + $val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())))); + if ($val == '') $tabparam['THEME_ELDY_TOPMENU_BACK1']=''; + else $tabparam['THEME_ELDY_TOPMENU_BACK1']=join(',',colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())); + + $val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())))); + if ($val == '') $tabparam['THEME_ELDY_BACKTITLE1']=''; + else $tabparam['THEME_ELDY_BACKTITLE1']=join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())); + + if (GETPOST('check_THEME_ELDY_USE_HOVER') == 'on') $tabparam["THEME_ELDY_USE_HOVER"]=1; + else $tabparam["THEME_ELDY_USE_HOVER"]=0; + + $tabparam["MAIN_SEARCHFORM_CONTACT"]=$_POST["main_searchform_contact"]; $tabparam["MAIN_SEARCHFORM_SOCIETE"]=$_POST["main_searchform_societe"]; $tabparam["MAIN_SEARCHFORM_PRODUITSERVICE"]=$_POST["main_searchform_produitservice"]; @@ -152,17 +163,48 @@ print '
'; if ($action == 'edit') { - print ''; + if (! empty($conf->use_javascript_ajax)) + {/* + print '';*/ + } + if (! empty($conf->use_javascript_ajax)) + { + print ''; + } + clearstatcache(); $var=true; @@ -197,7 +239,7 @@ if ($action == 'edit') print '
'; // Theme - show_theme($object,(($user->admin || empty($dolibarr_main_demo))?1:0),true); + show_theme($object, (($user->admin || empty($dolibarr_main_demo))?1:0), true); dol_fiche_end();