From 401dc12b939c1e9c1ac4903db6dab1ae5f1bd358 Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 7 Aug 2019 12:15:55 +0200 Subject: [PATCH] Add color blind option in body for css impact --- htdocs/core/class/dolgraph.class.php | 2 +- htdocs/main.inc.php | 7 +++++++ htdocs/theme/eldy/theme_vars.inc.php | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 6bc20742821..5c45eb5836d 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -96,7 +96,7 @@ class DolGraph */ public function __construct($library = 'jflot') { - global $conf, $user; + global $conf; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor; // To use old feature diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7b983ca05eb..e1a1f333d1d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -902,6 +902,9 @@ elseif (! empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER=$user->conf->MAIN_OPTIMIZEFORTEXTBROWSER; } +// set MAIN_OPTIMIZEFORCOLORBLIND +$conf->global->MAIN_OPTIMIZEFORCOLORBLIND=$user->conf->MAIN_OPTIMIZEFORCOLORBLIND; + // Set terminal output option according to conf->browser. if (GETPOST('dol_hide_leftmenu', 'int') || ! empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu=1; if (GETPOST('dol_hide_topmenu', 'int') || ! empty($_SESSION['dol_hide_topmenu'])) $conf->dol_hide_topmenu=1; @@ -1087,6 +1090,10 @@ if (! function_exists("llxHeader")) if ($mainmenu != 'website') $tmpcsstouse=$morecssonbody; // We do not use sidebar-collpase by default to have menuhider open by default. } + if(!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)){ + $tmpcsstouse.= ' colorblind-'.strip_tags($conf->global->MAIN_OPTIMIZEFORCOLORBLIND); + } + print '' . "\n"; // top menu and left menu area diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index 1fc1acb32bc..a1ff5120c27 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -30,10 +30,10 @@ * if (is_readable($var_file)) include $var_file; */ -global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet, $user; +global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $theme_bordercolor = array(235,235,224); $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250,190,30), array(221, 75, 57), array(0,166,90), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); -if(!empty($user) && !empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by graph +if(!empty($conf->global->MAIN_OPTIMIZEFORCOLORBLIND)) // user is loaded by dolgraph.class.php { // for now we use the same configuration for all types of color blind $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(120,120,120), array(253, 205, 102), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150));