From 25a505534ba29fd1c5f2326fb0cfd18e3e1eed9b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 15 Jan 2012 17:40:44 +0100 Subject: [PATCH] New: A page can force reload of css style sheet --- ChangeLog | 1 + htdocs/core/class/html.formother.class.php | 24 +++++++++++----------- htdocs/main.inc.php | 12 ++++++----- htdocs/theme/eldy/style.css.php | 13 +++++++++--- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 591dd081901..44f43536190 100644 --- a/ChangeLog +++ b/ChangeLog @@ -51,6 +51,7 @@ For developers: - New: Can define different requests according to database type into migration files. - New: Add "canvas" feature to overwrite page of thirdparty, contact, product with yours. - New: Removed artichow deprecated libraries. +- New: A page can force reload of css style sheet - Qual: Add a lot of more PHPUnit tests. - Qual: Data structure for supplier prices is simpler. - Qual: Removed no more used external libraries. diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index dce3e4fcb62..65d6f098aa3 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -57,7 +57,7 @@ class FormOther /** * Return HTML select list of export models - * + * * @param string $selected Id modele pre-selectionne * @param string $htmlname Nom de la zone select * @param string $type Type des modeles recherches @@ -106,7 +106,7 @@ class FormOther /** * Return list of export models - * + * * @param string $selected Id modele pre-selectionne * @param string $htmlname Nom de la zone select * @param string $type Type des modeles recherches @@ -155,7 +155,7 @@ class FormOther /** * Retourne la liste des ecotaxes avec tooltip sur le libelle - * + * * @param string $selected code ecotaxes pre-selectionne * @param string $htmlname nom de la liste deroulante * @return void @@ -209,7 +209,7 @@ class FormOther /** * Return a HTML select list to select a percent - * + * * @param selected pourcentage pre-selectionne * @param htmlname nom de la liste deroulante * @param increment increment value @@ -242,7 +242,7 @@ class FormOther /** * Return select list for categories (to use in form search selectors) - * + * * @param type Type of categories (0=product, 1=suppliers, 2=customers, 3=members) * @param selected Preselected value * @param htmlname Name of combo list @@ -278,7 +278,7 @@ class FormOther /** * Return select list for categories (to use in form search selectors) - * + * * @param selected Preselected value * @param htmlname Name of combo list * @param user Object user @@ -419,7 +419,7 @@ class FormOther title: \''.dol_escape_js($langs->trans("SelectAColor")).'\', newColor: \''.dol_escape_js($langs->trans("New")).'\', currentColor: \''.dol_escape_js($langs->trans("Current")).'\', - ok: \''.dol_escape_js($langs->trans("Change")).'\', + ok: \''.dol_escape_js($langs->trans("Save")).'\', cancel: \''.dol_escape_js($langs->trans("Cancel")).'\' } } @@ -493,7 +493,7 @@ class FormOther /** * Return HTML combo list of week - * + * * @param string $selected Preselected value * @param string $htmlname Nom de la zone select * @param int $useempty Affiche valeur vide dans liste @@ -534,7 +534,7 @@ class FormOther /** * Return HTML combo list of month - * + * * @param string $selected Preselected value * @param string $htmlname Nom de la zone select * @param int $useempty Affiche valeur vide dans liste @@ -569,7 +569,7 @@ class FormOther /** * Return HTML combo list of years - * + * * @param string $selected Preselected value (''=current year, -1=none, year otherwise) * @param string $htmlname Name of HTML select object * @param int $useempty Affiche valeur vide dans liste @@ -584,7 +584,7 @@ class FormOther /** * Return HTML combo list of years - * + * * @param string $selected Preselected value (''=current year, -1=none, year otherwise) * @param string $htmlname Name of HTML select object * @param int $useempty Affiche valeur vide dans liste @@ -635,7 +635,7 @@ class FormOther /** * Write all lines of a project (if parent = 0) - * + * * @param int &$inc Cursor counter * @param int $parent Id parent * @param Object $lines Line object diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 28006c544b0..0762a75cb3f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -864,16 +864,18 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs print '<!-- Includes for Dolibarr, modules or specific pages-->'."\n"; // Output style sheets (optioncss='print' or '') $themepath=dol_buildpath((empty($conf->global->MAIN_FORCETHEMEDIR)?'':$conf->global->MAIN_FORCETHEMEDIR).$conf->css,1); - //print 'themepath='.$themepath;exit; - print '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.'?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):'').'">'."\n"; + $themeparam='?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):''); + if (! empty($_SESSION['dol_resetcache'])) $themeparam.='&dol_resetcache='.$_SESSION['dol_resetcache']; + //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; + print '<link rel="stylesheet" type="text/css" title="default" href="'.$themepath.$themeparam.'">'."\n"; // CSS forced by modules (relative url starting with /) if (is_array($conf->css_modules)) { foreach($conf->css_modules as $cssfile) { // cssfile is an absolute path print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1); - // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used. - if (!preg_match('/\.css$/i',$cssfile)) print '?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):''); + // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used. + if (!preg_match('/\.css$/i',$cssfile)) print $themeparam; print '">'."\n"; } } @@ -884,7 +886,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs { print '<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile,1); // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used. - if (!preg_match('/\.css$/i',$cssfile)) print '?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss')?'&optioncss='.GETPOST('optioncss','alpha',1):''); + if (!preg_match('/\.css$/i',$cssfile)) print $themeparam; print '">'."\n"; } } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 717b90bdf1e..f1625216123 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -68,9 +68,11 @@ $img_button=dol_buildpath($path.'/theme/eldy/img/button_bg.png',1); // Example: Pink: $colred=230;$colgreen=210;$colblue=230; // Example: Green: $colred=210;$colgreen=230;$colblue=210; // Example: Ocean: $colred=220;$colgreen=220;$colblue=240; -$colred=235;$colgreen=235;$colblue=235; //$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; //$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; +$colred =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,0,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,0,2))); +$colgreen=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,2,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,2,2))); +$colblue =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,4,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,4,2))); // Colors $isred=max(0,(2*$colred-$colgreen-$colblue)/2); // 0 - 255 @@ -90,6 +92,7 @@ $colorbacklineimpair2=(250+round($isred/3)).','.(250+round($isgreen/3)).','.(250 $colorbacklinepair1='255,255,255'; // line pair $colorbacklinepair2='255,255,255'; // line pair $colorbackbody='#ffffff url('.$img_head.') 0 0 no-repeat;'; +$colortext='40,40,40'; // Eldy colors if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) @@ -109,6 +112,7 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) $conf->global->THEME_ELDY_LINEPAIR1='255,255,255'; $conf->global->THEME_ELDY_LINEPAIR2='255,255,255'; $conf->global->THEME_ELDY_BACKBODY='#ffffff url('.$img_head.') 0 0 no-repeat;'; + $conf->global->THEME_ELDY_TEXT='48,102,102'; } $colorback1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorback1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorback1:$user->conf->THEME_ELDY_TOPMENU_BACK1); @@ -124,9 +128,11 @@ $colorbacklineimpair1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty( $colorbacklineimpair2=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR2) ?$colorbacklineimpair2:$conf->global->THEME_ELDY_LINEIMPAIR2):(empty($user->conf->THEME_ELDY_LINEIMPAIR2)?$colorbacklineimpair2:$user->conf->THEME_ELDY_LINEIMPAIR2); $colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR1) ?$colorbacklinepair1:$conf->global->THEME_ELDY_LINEPAIR1) :(empty($user->conf->THEME_ELDY_LINEPAIR1)?$colorbacklinepair1:$user->conf->THEME_ELDY_LINEPAIR1); $colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2); -$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY); +$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY); +$colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT); print '/*'."\n"; +print 'colred='.$colred.' colgreen='.$colgreen.' colblue='.$colblue."\n"; print 'isred='.$isred.' isgreen='.$isgreen.' isblue='.$isblue."\n"; print 'colorbacklineimpair1='.$colorbacklineimpair1."\n"; print 'colorbacklineimpair2='.$colorbacklineimpair2."\n"; @@ -1680,8 +1686,9 @@ border: 0px; div.titre { font-family: <?php print $fontlist ?>; font-weight: bold; - color: #336666; + color: rgb(<?php print $colortext; ?>); text-decoration: none; + text-shadow: 1px 2px 3px #AFAFAF; } -- GitLab