* Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2017 Regis Houssin * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2021-2023 Anthony Berton * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France * Copyright (C) 2025 Marc de Lima Lucio * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/theme/md/style.css.php * \brief File for CSS style sheet Md (Material Design) */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations if (!defined('NOCSRFCHECK')) { define('NOCSRFCHECK', 1); } if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', 1); } if (!defined('NOLOGIN')) { define('NOLOGIN', 1); // File must be accessed by logon page so without login } //if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content if (!defined('NOREQUIREHTML')) { define('NOREQUIREHTML', 1); } if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } define('ISLOADEDBYSTEELSHEET', '1'); require __DIR__.'/theme_vars.inc.php'; if (defined('THEME_ONLY_CONSTANT')) { return; } // Types from theme_vars ' @phan-var-force string $badgeDanger @phan-var-force string $badgeWarning @phan-var-force string $butactionbg @phan-var-force string $colorbackbody @phan-var-force string $colorbackhmenu1 @phan-var-force string $colorbacklinebreak @phan-var-force string $colorbacklineimpair1 @phan-var-force string $colorbacklineimpair2 @phan-var-force string $colorbacklinepair1 @phan-var-force string $colorbacklinepair2 @phan-var-force string $colorbacklinepairchecked @phan-var-force string $colorbacklinepairhover @phan-var-force string $colorbacktabactive @phan-var-force string $colorbacktabcard1 @phan-var-force string $colorbacktitle1 @phan-var-force string $colorbackvmenu1 @phan-var-force string $colorblind_deuteranopes_textSuccess @phan-var-force string $colorblind_deuteranopes_textWarning @phan-var-force string $colortext @phan-var-force string $colortextlink @phan-var-force string $colortexttitle @phan-var-force string $colortexttitlelink @phan-var-force string $colortexttitlenotab @phan-var-force string $colortexttitlenotab2 @phan-var-force string $colortopbordertitle1 @phan-var-force string $fontsize @phan-var-force string $textDanger @phan-var-force string $textSuccess @phan-var-force string $textWarning @phan-var-force string $textbutaction @phan-var-force string $toolTipBgColor @phan-var-force string $toolTipFontColor '; session_cache_limiter('public'); require_once __DIR__.'/../../main.inc.php'; // __DIR__ allow this script to be included in custom themes require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; /** * @var Conf $conf * @var DoliDB $db * @var Translate $langs * @var User $user * * @var string $badgeDanger * @var string $badgeWarning * @var string $butactionbg * @var string $badgeStatus4 * @var string $colorbackbody * @var string $colorbackhmenu1 * @var string $colorbacklinebreak * @var string $colorbacklineimpair1 * @var string $colorbacklineimpair2 * @var string $colorbacklinepair1 * @var string $colorbacklinepair2 * @var string $colorbacklinepairchecked * @var string $colorbacklinepairhover * @var string $colorbacktabactive * @var string $colorbacktabcard1 * @var string $colorbacktitle1 * @var string $colorbackvmenu1 * @var string $colorblind_deuteranopes_textSuccess * @var string $colorblind_deuteranopes_textWarning * @var string $colortext * @var string $colortextlink * @var string $colortexttitle * @var string $colortexttitlelink * @var string $colortexttitlenotab * @var string $colortexttitlenotab2 * @var string $colortopbordertitle1 * @var string $fontsize * @var string $textDanger * @var string $textSuccess * @var string $textWarning * @var string $textbutaction * @var string $toolTipBgColor * @var string $toolTipFontColor */ // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) // and permission, so we can later calculate number of top menu ($nbtopmenuentries) according to user profile. if (empty($user->id) && !empty($_SESSION['dol_login'])) { $user->fetch(0, $_SESSION['dol_login'], '', 1); $user->loadRights(); //$user->loadPersonalConf(); // Reload menu now we have the good user (and we need the good menu to have ->showmenu('topnb') correct. // @phan-suppress-next-line PhanRedefinedClassReference $menumanager = new MenuManager($db, empty($user->socid) ? 0 : 1); // @phan-suppress-next-line PhanRedefinedClassReference $menumanager->loadMenu(); } // Define css type top_httphead('text/css'); // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access. if (empty($dolibarr_nocache)) { header('Cache-Control: max-age=10800, public, must-revalidate'); } else { header('Cache-Control: no-cache'); } if (GETPOST('theme', 'aZ09')) { $conf->theme = GETPOST('theme', 'aZ09'); // If theme was forced on URL } if (GETPOST('lang', 'aZ09')) { $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL } if (GETPOSTISSET('THEME_DARKMODEENABLED')) { $conf->global->THEME_DARKMODEENABLED = GETPOSTINT('THEME_DARKMODEENABLED'); // If darkmode was forced on URL } $langs->load("main", 0, 1); $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left'); $path = ''; // This value may be used in future for external module to overwrite theme $theme = 'md'; // Value of theme if (getDolGlobalString('MAIN_OVERWRITE_THEME_RES')) { $path = '/' . getDolGlobalString('MAIN_OVERWRITE_THEME_RES'); $theme = getDolGlobalString('MAIN_OVERWRITE_THEME_RES'); } // Define image path files and other constants $fontlist = 'roboto,arial,tahoma,verdana,helvetica'; //$fontlist='verdana,helvetica,arial,sans-serif'; if (getDolGlobalString('THEME_FONT_FAMILY')) { $fontlist = getDolGlobalString('THEME_FONT_FAMILY').', '.$fontlist; } $img_head = ''; $img_button = dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png', 1); $dol_hide_topmenu = $conf->dol_hide_topmenu; $dol_hide_leftmenu = $conf->dol_hide_leftmenu; $dol_optimize_smallscreen = $conf->dol_optimize_smallscreen; $dol_no_mouse_hover = $conf->dol_no_mouse_hover; //$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; //$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; //var_dump($user->conf->THEME_ELDY_RGB); $useboldtitle = getDolGlobalInt('THEME_ELDY_USEBOLDTITLE'); $borderwidth = 2; $userborderontable = getDolGlobalInt('THEME_ELDY_USEBORDERONTABLE'); // Case of option always editable if (!isset($conf->global->THEME_ELDY_BACKBODY)) { $conf->global->THEME_ELDY_BACKBODY = $colorbackbody; } if (!isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) { $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1; } if (!isset($conf->global->THEME_ELDY_VERMENU_BACK1)) { $conf->global->THEME_ELDY_VERMENU_BACK1 = $colorbackvmenu1; } if (!isset($conf->global->THEME_ELDY_BACKTITLE1)) { $conf->global->THEME_ELDY_BACKTITLE1 = $colorbacktitle1; } if (!isset($conf->global->THEME_ELDY_USE_HOVER)) { $conf->global->THEME_ELDY_USE_HOVER = $colorbacklinepairhover; } if (!isset($conf->global->THEME_ELDY_USE_CHECKED)) { $conf->global->THEME_ELDY_USE_CHECKED = $colorbacklinepairchecked; } if (!isset($conf->global->THEME_ELDY_LINEBREAK)) { $conf->global->THEME_ELDY_LINEBREAK = $colorbacklinebreak; } if (!isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) { $conf->global->THEME_ELDY_TEXTTITLENOTAB = $colortexttitlenotab; } if (!isset($conf->global->THEME_ELDY_TEXTLINK)) { $conf->global->THEME_ELDY_TEXTLINK = $colortextlink; } if (!isset($conf->global->THEME_ELDY_BTNACTION)) { $conf->global->THEME_ELDY_BTNACTION = $butactionbg; } if (!isset($conf->global->THEME_ELDY_TEXTBTNACTION)) { $conf->global->THEME_ELDY_TEXTBTNACTION = $textbutaction; } // Case of option editable only if option THEME_ELDY_ENABLE_PERSONALIZED is on if (!getDolGlobalString('THEME_ELDY_ENABLE_PERSONALIZED')) { // 90A4AE, 607D8B, 455A64, 37474F $conf->global->THEME_ELDY_BACKTABCARD1 = '255,255,255'; // card $conf->global->THEME_ELDY_BACKTABACTIVE = '234,234,234'; $conf->global->THEME_ELDY_TEXT = '0,0,0'; $conf->global->THEME_ELDY_FONT_SIZE1 = $fontsize; $conf->global->THEME_ELDY_FONT_SIZE2 = '0.7em'; } // Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on $colorbackhmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', $colorbackhmenu1) : getDolUserString('THEME_ELDY_TOPMENU_BACK1', $colorbackhmenu1); $colorbackvmenu1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_VERMENU_BACK1', $colorbackvmenu1) : getDolUserString('THEME_ELDY_VERMENU_BACK1', $colorbackvmenu1); $colortopbordertitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_TOPBORDER_TITLE1', $colortopbordertitle1) : getDolUserString('THEME_ELDY_TOPBORDER_TITLE1', $colortopbordertitle1); $colorbacktitle1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_BACKTITLE1', $colorbacktitle1) : getDolUserString('THEME_ELDY_BACKTITLE1', $colorbacktitle1); $colorbacktabcard1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_BACKTABCARD1', $colorbacktabcard1) : getDolUserString('THEME_ELDY_BACKTABCARD1', $colorbacktabcard1); $colorbacktabactive = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_BACKTABACTIVE', $colorbacktabactive) : getDolUserString('THEME_ELDY_BACKTABACTIVE', $colorbacktabactive); $colorbacklineimpair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_LINEIMPAIR1', $colorbacklineimpair1) : getDolUserString('THEME_ELDY_LINEIMPAIR1', $colorbacklineimpair1); $colorbacklineimpair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_LINEIMPAIR2', $colorbacklineimpair2) : getDolUserString('THEME_ELDY_LINEIMPAIR2', $colorbacklineimpair2); $colorbacklinepair1 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_LINEPAIR1', $colorbacklinepair1) : getDolUserString('THEME_ELDY_LINEPAIR1', $colorbacklinepair1); $colorbacklinepair2 = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_LINEPAIR2', $colorbacklinepair2) : getDolUserString('THEME_ELDY_LINEPAIR2', $colorbacklinepair2); $colorbacklinebreak = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_LINEBREAK', $colorbacklinebreak) : getDolUserString('THEME_ELDY_LINEBREAK', $colorbacklinebreak); $colorbackbody = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_BACKBODY', $colorbackbody) : getDolUserString('THEME_ELDY_BACKBODY', $colorbackbody); $colortexttitlenotab = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_TEXTTITLENOTAB', $colortexttitlenotab) : getDolUserString('THEME_ELDY_TEXTTITLENOTAB', $colortexttitlenotab); $colortexttitle = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_TEXTTITLE', $colortext) : getDolUserString('THEME_ELDY_TEXTTITLE', $colortexttitle); $colortexttitlelink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_TEXTTITLELINK', $colortexttitlelink) : getDolUserString('THEME_ELDY_TEXTTITLELINK', $colortexttitlelink); $colortext = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_TEXT', $colortext) : getDolUserString('THEME_ELDY_TEXT', $colortext); $colortextlink = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_TEXTLINK', $colortext) : getDolUserString('THEME_ELDY_TEXTLINK', $colortextlink); $colortextlinkHsla = colorHexToHsl($colortextlink, false, true); $butactionbg = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_BTNACTION', $butactionbg) : getDolUserString('THEME_ELDY_BTNACTION', $butactionbg); $textbutaction = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_TEXTBTNACTION', $textbutaction) : getDolUserString('THEME_ELDY_TEXTBTNACTION', $textbutaction); $fontsize = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_FONT_SIZE1', $fontsize) : getDolUserString('THEME_ELDY_FONT_SIZE1', $fontsize); $fontsizesmaller = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? getDolGlobalString('THEME_ELDY_FONT_SIZE2', $fontsize) : getDolUserString('THEME_ELDY_FONT_SIZE2', $fontsize); $heightrow = empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) ? (getDolGlobalString('THEME_ELDY_USECOMOACTROW') ? '300%' : '155%') : (getDolUserString('THEME_ELDY_USECOMOACTROW') ? '300%' : '155%'); // Hover color $colorbacklinepairhover = ((!isset($conf->global->THEME_ELDY_USE_HOVER) || getDolGlobalString('THEME_ELDY_USE_HOVER') === '255,255,255') ? '' : (getDolGlobalString('THEME_ELDY_USE_HOVER') === '1' ? 'edf4fb' : getDolGlobalString('THEME_ELDY_USE_HOVER'))); $colorbacklinepairchecked = ((!isset($conf->global->THEME_ELDY_USE_CHECKED) || getDolGlobalString('THEME_ELDY_USE_CHECKED') === '255,255,255') ? '' : (getDolGlobalString('THEME_ELDY_USE_CHECKED') === '1' ? 'edf4fb' : getDolGlobalString('THEME_ELDY_USE_CHECKED'))); if (!empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) { $colorbacklinepairhover = ((!isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '255,255,255') ? '' : (getDolUserString('THEME_ELDY_USE_HOVER') === '1' ? 'edf4fb' : getDolUserString('THEME_ELDY_USE_HOVER'))); $colorbacklinepairchecked = ((!isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '255,255,255') ? '' : (getDolUserString('THEME_ELDY_USE_CHECKED') === '1' ? 'edf4fb' : getDolUserString('THEME_ELDY_USE_CHECKED'))); } if (empty($colortopbordertitle1)) { $colortopbordertitle1 = $colorbackhmenu1; } // Set text color to black or white $colorbackhmenu1 = implode(',', colorStringToArray($colorbackhmenu1)); // Normalize value to 'x,y,z' $tmppart = explode(',', $colorbackhmenu1); $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortextbackhmenu = 'FFFFFF'; } else { $colortextbackhmenu = '000000'; } $colorbackvmenu1 = implode(',', colorStringToArray($colorbackvmenu1)); // Normalize value to 'x,y,z' $tmppart = explode(',', $colorbackvmenu1); $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortextbackvmenu = 'FFFFFF'; } else { $colortextbackvmenu = '222222'; } $colortopbordertitle1 = implode(',', colorStringToArray($colortopbordertitle1)); // Normalize value to 'x,y,z' $colorbacktitle1 = implode(',', colorStringToArray($colorbacktitle1)); // Normalize value to 'x,y,z' $tmppart = explode(',', $colorbacktitle1); if ($colortexttitle == '') { $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortexttitle = 'FFFFFF'; $colorshadowtitle = '888888'; } else { $colortexttitle = '101010'; $colorshadowtitle = 'FFFFFF'; } } else { $colorshadowtitle = '888888'; } $colorbacktabcard1 = implode(',', colorStringToArray($colorbacktabcard1)); // Normalize value to 'x,y,z' $tmppart = explode(',', $colorbacktabcard1); $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmppart[1] : 0) + (!empty($tmppart[2]) ? $tmppart[2] : 0); if ($tmpval <= 460) { $colortextbacktab = 'FFFFFF'; } else { $colortextbacktab = '111111'; } // Format color value to match expected format (may be 'FFFFFF' or '255,255,255') $colorbackhmenu1 = implode(',', colorStringToArray($colorbackhmenu1)); $colorbackvmenu1 = implode(',', colorStringToArray($colorbackvmenu1)); $colorbacktitle1 = implode(',', colorStringToArray($colorbacktitle1)); $colorbacktabcard1 = implode(',', colorStringToArray($colorbacktabcard1)); $colorbacktabactive = implode(',', colorStringToArray($colorbacktabactive)); $colorbacklineimpair1 = implode(',', colorStringToArray($colorbacklineimpair1)); $colorbacklineimpair2 = implode(',', colorStringToArray($colorbacklineimpair2)); $colorbacklinepair1 = implode(',', colorStringToArray($colorbacklinepair1)); $colorbacklinepair2 = implode(',', colorStringToArray($colorbacklinepair2)); if ($colorbacklinepairhover != '') { $colorbacklinepairhover = implode(',', colorStringToArray($colorbacklinepairhover)); } if ($colorbacklinepairchecked != '') { $colorbacklinepairchecked = implode(',', colorStringToArray($colorbacklinepairchecked)); } $colorbackbody = implode(',', colorStringToArray($colorbackbody)); $colortexttitlenotab = implode(',', colorStringToArray($colortexttitlenotab)); $colortexttitle = implode(',', colorStringToArray($colortexttitle)); $colortext = implode(',', colorStringToArray($colortext)); $colortextlink = implode(',', colorStringToArray($colortextlink)); // @phan-suppress-next-line PhanRedefinedClassReference $nbtopmenuentries = $menumanager->showmenu('topnb'); $nbtopmenuentriesreal = $nbtopmenuentries; if ($conf->browser->layout == 'phone') { $nbtopmenuentries = max($nbtopmenuentries, 10); } print '/*'."\n"; print 'colorbackbody='.$colorbackbody."\n"; print 'colorbackvmenu1='.$colorbackvmenu1."\n"; print 'colorbackhmenu1='.$colorbackhmenu1."\n"; print 'colorbacktitle1='.$colorbacktitle1."\n"; print 'colorbacklineimpair1='.$colorbacklineimpair1."\n"; print 'colorbacklineimpair2='.$colorbacklineimpair2."\n"; print 'colorbacklinepair1='.$colorbacklinepair1."\n"; print 'colorbacklinepair2='.$colorbacklinepair2."\n"; print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; print 'colorbacklinepairchecked='.$colorbacklinepairchecked."\n"; print 'colortexttitlenotab='.$colortexttitlenotab."\n"; print 'colortexttitle='.$colortexttitle."\n"; print 'colortext='.$colortext."\n"; print 'colortextlink='.$colortextlink."\n"; print 'colortexttitlelink='.$colortexttitlelink."\n"; print 'colortextbackhmenu='.$colortextbackhmenu."\n"; print 'colortextbackvmenu='.$colortextbackvmenu."\n"; print 'dol_hide_topmenu='.$dol_hide_topmenu."\n"; print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n"; print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n"; print 'dol_no_mouse_hover='.$dol_no_mouse_hover."\n"; print 'dol_screenwidth='.$_SESSION['dol_screenwidth']."\n"; print 'dol_screenheight='.$_SESSION['dol_screenheight']."\n"; print 'fontsize='.$fontsize."\n"; print 'nbtopmenuentries='.$nbtopmenuentries."\n"; print '*/'."\n"; $leftmenuwidth = 242; ?> /* IDE Hack