Change to prepare module skincoloreditor

This commit is contained in:
Laurent Destailleur 2012-01-15 19:07:01 +01:00
parent 7cb398c6ff
commit c7b88d396a
4 changed files with 20 additions and 17 deletions

View File

@ -372,7 +372,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='')
* @param int $entity Multi company id, -1 for all entities
* @return int <0 if KO, >0 if OK
*
* @see dolibarr_get_const, dolibarr_sel_const
* @see dolibarr_get_const, dolibarr_set_const, dol_set_user_param
*/
function dolibarr_del_const($db, $name, $entity=1)
{
@ -406,7 +406,7 @@ function dolibarr_del_const($db, $name, $entity=1)
* @param int $entity Multi company id
* @return string Valeur de la constante
*
* @see dolibarr_del_const, dolibarr_set_const
* @see dolibarr_del_const, dolibarr_set_const, dol_set_user_param
*/
function dolibarr_get_const($db, $name, $entity=1)
{
@ -441,7 +441,7 @@ function dolibarr_get_const($db, $name, $entity=1)
* @param int $entity Multi company id (0 means all entities)
* @return int -1 if KO, 1 if OK
*
* @see dolibarr_del_const, dolibarr_get_const
* @see dolibarr_del_const, dolibarr_get_const, dol_set_user_param
*/
function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
{

View File

@ -901,6 +901,8 @@ function weight_convert($weight,&$from_unit,$to_unit)
* @param user Object user
* @param tab Tableau (cle=>valeur) des parametres a sauvegarder
* @return int <0 if KO, >0 if OK
*
* @see dolibarr_get_const, dolibarr_set_const, dolibarr_del_const
*/
function dol_set_user_param($db, $conf, &$user, $tab)
{
@ -949,8 +951,8 @@ function dol_set_user_param($db, $conf, &$user, $tab)
$db->rollback();
return -1;
}
$user->page_param[$key] = $value;
$user->conf->$key = $value;
//print "key=".$key." user->conf->key=".$user->conf->$key;
}
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
@ -23,13 +23,13 @@
* \brief File for CSS style sheet Eldy
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
//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 cause need to do translations
//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);
//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled because need to load user to know its personal theme choices
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
@ -70,9 +70,10 @@ $img_button=dol_buildpath($path.'/theme/eldy/img/button_bg.png',1);
// Example: Ocean: $colred=220;$colgreen=220;$colblue=240;
//$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)));
//var_dump($user->conf->THEME_ELDY_RGB);
$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($user->conf->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($user->conf->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($user->conf->THEME_ELDY_RGB,4,2)));
// Colors
$isred=max(0,(2*$colred-$colgreen-$colblue)/2); // 0 - 255

View File

@ -238,19 +238,19 @@ class User extends CommonObject
$sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param";
$sql.= " WHERE fk_user = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
$result=$this->db->query($sql);
if ($result)
$resql=$this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($result);
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $this->db->fetch_object($result);
$obj = $this->db->fetch_object($resql);
$p=$obj->param;
if ($p) $this->conf->$p = $obj->value;
$i++;
}
$this->db->free($result);
$this->db->free($resql);
}
else
{