From 2b191b6ef8c7b366702d61e94c7ff240136d3114 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Tue, 22 Apr 2014 23:49:33 +0200 Subject: [PATCH] Uniformization and simplification of code. --- htdocs/theme/amarok/style.css.php | 26 ++++++++++---------------- htdocs/theme/auguria/style.css.php | 24 +++++++++++++----------- htdocs/theme/bureau2crea/style.css.php | 19 +++++++++++-------- htdocs/theme/cameleo/style.css.php | 24 ++++++++++++++---------- htdocs/theme/eldy/style.css.php | 16 +++++----------- 5 files changed, 53 insertions(+), 56 deletions(-) diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 13fbe768d5d..ca47f144cdb 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -1,9 +1,9 @@ <?php -/* Copyright (C) 2012 Nicolas Péré <nicolas@amarok2.net> - * Copyright (C) 2012 Xavier Peyronnet <xavier.peyronnet@free.fr> - * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> - * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> - * Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2012 Nicolas Péré <nicolas@amarok2.net> + * Copyright (C) 2012 Xavier Peyronnet <xavier.peyronnet@free.fr> + * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> + * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net> * * 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 @@ -44,10 +44,10 @@ require_once '../../main.inc.php'; // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); + // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// 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=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); @@ -59,16 +59,13 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $path=''; // This value may be used in future for external module to overwrite theme $theme='amarok'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } -// Define image path files +// Define image path files and other constants $fontlist='helvetica,arial,tahoma,verdana'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; -//'/theme/auguria/img/menus/trtitle.png'; $img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); $dol_hide_topmenu=$conf->dol_hide_topmenu; @@ -112,8 +109,8 @@ $colorbacklinepair2='255,255,255'; // line pair $colorbacklinepairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); $colorbackbody='#f5f5f5'; $colortext='40,40,40'; -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'14'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'14'; +$fontsize='12'; +$fontsizesmaller='11'; $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); $colorback2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK2)?$colorback2:$conf->global->THEME_ELDY_TOPMENU_BACK2) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK2)?$colorback2:$user->conf->THEME_ELDY_TOPMENU_BACK2); @@ -575,8 +572,6 @@ div.login_block table { div.login { white-space:nowrap; - /* padding: <?php echo ($conf->dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px; */ - /* margin:0px 0px 0px 8px; */ font-weight:bold; float: right; } @@ -591,7 +586,6 @@ div.login { } img.login, img.printer, img.entity { - /* padding: <?php echo ($conf->dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px; */ margin:2px 0px 0px 0px; text-decoration:none; color: white; diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 7e10b40d706..e363537ad01 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> @@ -38,10 +38,13 @@ session_cache_limiter(FALSE); require_once '../../main.inc.php'; +// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) +if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); + + // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// 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=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); @@ -53,28 +56,26 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $path=''; // This value may be used in future for external module to overwrite theme $theme='auguria'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } -// Define image path files +// Define image path files and other constants $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; - +$img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); +$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); +$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; $dol_use_jmobile=$conf->dol_use_jmobile; -$img_liste_titre=dol_buildpath($path.'/theme/'.$theme.'/img/menus/trtitle.png',1); -$img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); -$img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); - $colorbacklineimpairhover='210,214,217'; $colorbacklinepairhover='210,214,217'; +$fontsize='12'; +$fontsizesmaller='11'; // No hover by default, we keep only if we set var THEME_ELDY_USE_HOVER if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($user->conf->THEME_ELDY_USE_HOVER)) @@ -96,6 +97,7 @@ print 'colorbacklineimpairhover='.$colorbacklineimpairhover."\n"; print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; print '*/'."\n"; +if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11; ?> /* ============================================================================== */ diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php index 3fa8b980fe4..c67d3f90d85 100644 --- a/htdocs/theme/bureau2crea/style.css.php +++ b/htdocs/theme/bureau2crea/style.css.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> @@ -43,10 +43,13 @@ session_cache_limiter(FALSE); require_once '../../main.inc.php'; +// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) +if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); + + // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// 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=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); @@ -58,18 +61,14 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $path=''; // This value may be used in future for external module to overwrite theme $theme='bureau2crea'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } -// Define image path files +// Define image path files and other constants $fontlist='arial, sans-serif, verdana, helvetica'; -//$fontlist='Verdana,Helvetica,Arial,sans-serif'; - $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; $dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; @@ -77,6 +76,10 @@ $dol_no_mouse_hover=$conf->dol_no_mouse_hover; $dol_use_jmobile=$conf->dol_use_jmobile; $colorshadowtitle='000'; +$fontsize='12'; +$fontsizesmaller='11'; + +if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11; ?> /* ============================================================================== */ diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index dc7ccd58e59..ac72ab2f3f5 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2011 Herve Prot <herve.prot@symeos.com> @@ -20,7 +20,7 @@ */ /** - * \file htdocs/theme/eldy/style.css.php + * \file htdocs/theme/cameleo/style.css.php * \brief Fichier de style CSS du theme Cameleo */ @@ -39,27 +39,27 @@ session_cache_limiter(FALSE); require_once '../../main.inc.php'; +// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) +if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']); + + // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// 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=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); // On the fly GZIP compression for all pages (if browser support it). Must set the bit 3 of constant to 1. if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x04)) { ob_start("ob_gzhandler"); } -if (! empty($_GET["lang"])) $langs->setDefaultLang($_GET["lang"]); // If language was forced on URL -if (! empty($_GET["theme"])) $conf->theme=$_GET["theme"]; // If theme was forced on URL +if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); // If language was forced on URL +if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on URL $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; +// Define image path files and other constants $fontlist='arial,tahoma,verdana,helvetica'; -//$fontlist='Verdana,Helvetica,Arial,sans-serif'; - $dol_hide_topmenu=$conf->dol_hide_topmenu; $dol_hide_leftmenu=$conf->dol_hide_leftmenu; $dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; @@ -71,6 +71,10 @@ $theme='cameleo'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } $colorshadowtitle='000'; +$fontsize='12'; +$fontsizesmaller='11'; + +if (! empty($conf->dol_optimize_smallscreen)) $fontsize=11; ?> /* ============================================================================== */ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c6cf6b29e6c..b58030ac654 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> @@ -45,8 +45,7 @@ if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSI // Define css type header('Content-type: text/css'); -// Important: Following code is to avoid page request by browser and PHP CPU at -// each Dolibarr page access. +// 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=3600, public, must-revalidate'); else header('Cache-Control: no-cache'); @@ -58,14 +57,12 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on $langs->load("main",0,1); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'12'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'11'; $path=''; // This value may be used in future for external module to overwrite theme $theme='eldy'; // Value of theme if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme=$conf->global->MAIN_OVERWRITE_THEME_RES; } -// Define image path files +// Define image path files and other constants $fontlist='arial,tahoma,verdana,helvetica'; //$fontlist='Verdana,Helvetica,Arial,sans-serif'; $img_head=dol_buildpath($path.'/theme/'.$theme.'/img/headbg2.jpg',1); $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); @@ -108,11 +105,10 @@ $colorbacklineimpairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+roun $colorbacklinepair1='255,255,255'; // line pair $colorbacklinepair2='255,255,255'; // line pair $colorbacklinepairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); -//$colorbackbody='#ffffff url('.$img_head.') 0 0 no-repeat;'; $colorbackbody='#fcfcfc'; $colortext='40,40,40'; -$fontsize=empty($conf->dol_optimize_smallscreen)?'12':'14'; -$fontsizesmaller=empty($conf->dol_optimize_smallscreen)?'11':'14'; +$fontsize='12'; +$fontsizesmaller='11'; // Eldy colors if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) @@ -887,8 +883,6 @@ div.login_block table { } div.login { white-space:nowrap; - /* padding: <?php echo ($conf->dol_optimize_smallscreen?'0':'8')?>px 0px 0px 0px; */ - /* margin: 0px 0px 0px 8px; */ font-weight: bold; float: right; } -- GitLab