dolibarr 21.0.0-alpha
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
48require_once __DIR__.'/../../webportal.main.inc.php';
49dol_include_once('/webportal/class/webPortalTheme.class.php');
50
51// Define css type
52// top_httphead('text/css');
53header("Content-Type: text/css");
54header("X-Content-Type-Options: nosniff");
55header("X-Frame-Options: SAMEORIGIN");
56
57// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
58// if (empty($dolibarr_nocache)) {
59 header('Cache-Control: max-age=10800, public, must-revalidate');
60/* } else {
61 header('Cache-Control: no-cache');
62} */
63
64$webPortalTheme = new WebPortalTheme();
65
66?>
67[data-theme="custom"], :root{
68 --primary-color-hue: <?php print $webPortalTheme->primaryColorHsl['h']; ?>;
69 --primary-color-saturation: <?php print $webPortalTheme->primaryColorHsl['s']; ?>%;
70 --primary-color-lightness: <?php print $webPortalTheme->primaryColorHsl['l']; ?>%;
71 --banner-background: url(<?php print !empty($webPortalTheme->bannerBackground) ? $webPortalTheme->bannerBackground : '../img/banner.svg' ?>);
72}
73
74.login-page {
75 <?php
76 if (!empty($webPortalTheme->loginBackground)) {
77 print '--login-background: rgba(0, 0, 0, 0.4) url("'.$webPortalTheme->loginBackground.'");'."\n";
78 }
79
80 if (!empty($webPortalTheme->loginLogoUrl)) {
81 print '--login-logo: url("'.$webPortalTheme->loginLogoUrl.'"); /* for relative path, must be relative to the css file or use full url starting by http:// */'."\n";
82 }
83 ?>
84}
85<?php
86
87print '/* Here, the content of the common custom CSS defined into Home - Setup - Display - CSS'."*/\n";
88print 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 a Dolibarr global constant string value.