dolibarr 20.0.5
custom.css.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2023-2024 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2023-2024 Lionel Vessiller <lvessiller@easya.solutions>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26if (!defined('NOREQUIRESOC')) {
27 define('NOREQUIRESOC', '1');
28}
29
30if (!defined('NOCSRFCHECK')) {
31 define('NOCSRFCHECK', 1);
32}
33if (!defined('NOTOKENRENEWAL')) {
34 define('NOTOKENRENEWAL', 1);
35}
36if (!defined('NOLOGIN')) {
37 define('NOLOGIN', 1); // File must be accessed by logon page so without login.
38}
39if (!defined('NOREQUIREHTML')) {
40 define('NOREQUIREHTML', 1);
41}
42if (!defined('NOREQUIREAJAX')) {
43 define('NOREQUIREAJAX', '1');
44}
45
46session_cache_limiter('public');
47
48if (!defined('MAIN_INC_REL_DIR')) {
49 define('MAIN_INC_REL_DIR', '../../');
50}
51require_once __DIR__.'/../../webportal.main.inc.php';
52dol_include_once('/webportal/class/webPortalTheme.class.php');
53
54// Define css type
55// top_httphead('text/css');
56header("Content-Type: text/css");
57header("X-Content-Type-Options: nosniff");
58header("X-Frame-Options: SAMEORIGIN");
59
60// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
61// if (empty($dolibarr_nocache)) {
62 header('Cache-Control: max-age=10800, public, must-revalidate');
63/* } else {
64 header('Cache-Control: no-cache');
65} */
66
67$webPortalTheme = new WebPortalTheme();
68
69?>
70[data-theme="custom"], :root{
71 --primary-color-hue: <?php print $webPortalTheme->primaryColorHsl['h']; ?>;
72 --primary-color-saturation: <?php print $webPortalTheme->primaryColorHsl['s']; ?>%;
73 --primary-color-lightness: <?php print $webPortalTheme->primaryColorHsl['l']; ?>%;
74 --banner-background: url(<?php print !empty($webPortalTheme->bannerBackground) ? $webPortalTheme->bannerBackground : '../img/banner.svg' ?>);
75}
76
77.login-page {
78 <?php
79 if (!empty($webPortalTheme->loginBackground)) {
80 print '--login-background: rgba(0, 0, 0, 0.4) url("'.$webPortalTheme->loginBackground.'");'."\n";
81 }
82
83 if (!empty($webPortalTheme->loginLogoUrl)) {
84 print '--login-logo: url("'.$webPortalTheme->loginLogoUrl.'"); /* for relative path, must be relative to the css file or use full url starting by http:// */'."\n";
85 }
86 ?>
87}
88<?php
89
90print '/* Here, the content of the common custom CSS defined into Home - Setup - Display - CSS'."*/\n";
91print getDolGlobalString('WEBPORTAL_CUSTOM_CSS');
Class WebPortalTheme.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.