forked from Wavyzz/dolibarr
Fixed: Several fix in color management (function at wrong place, mark
param that are deprecated, convertion of value to get correct format in all situation)
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||||
|
|
||||||
$graphwidth=DolGraph::getDefaultGraphSizeForStats('width',700);
|
$graphwidth=DolGraph::getDefaultGraphSizeForStats('width',700);
|
||||||
@@ -69,7 +70,7 @@ dol_mkdir($dir);
|
|||||||
|
|
||||||
if ($mode)
|
if ($mode)
|
||||||
{
|
{
|
||||||
// Define sql
|
// Define sql
|
||||||
if ($mode == 'memberbycountry')
|
if ($mode == 'memberbycountry')
|
||||||
{
|
{
|
||||||
$label=$langs->trans("Country");
|
$label=$langs->trans("Country");
|
||||||
|
|||||||
@@ -560,13 +560,13 @@ class FormOther
|
|||||||
*
|
*
|
||||||
* @param string $set_color Pre-selected color
|
* @param string $set_color Pre-selected color
|
||||||
* @param string $prefix Name of HTML field
|
* @param string $prefix Name of HTML field
|
||||||
* @param string $form_name Name of form
|
* @param string $form_name Deprecated. Not used.
|
||||||
* @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
|
* @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
|
||||||
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
|
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
|
||||||
* @return void
|
* @return void
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function select_color($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='')
|
function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='')
|
||||||
{
|
{
|
||||||
print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors);
|
print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors);
|
||||||
}
|
}
|
||||||
@@ -576,13 +576,13 @@ class FormOther
|
|||||||
*
|
*
|
||||||
* @param string $set_color Pre-selected color
|
* @param string $set_color Pre-selected color
|
||||||
* @param string $prefix Name of HTML field
|
* @param string $prefix Name of HTML field
|
||||||
* @param string $form_name Name of form
|
* @param string $form_name Deprecated. Not used.
|
||||||
* @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
|
* @param int $showcolorbox 1=Show color code and color box, 0=Show only color code
|
||||||
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
|
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
|
||||||
* @param string $morecss Add css style into input field
|
* @param string $morecss Add css style into input field
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function selectColor($set_color='', $prefix='f_color', $form_name='objForm', $showcolorbox=1, $arrayofcolors='', $morecss='')
|
function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='')
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
|
|||||||
@@ -4835,19 +4835,6 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert an array with RGB value into hex RGB value
|
|
||||||
*
|
|
||||||
* @param array $arraycolor Array
|
|
||||||
* @param string $colorifnotfound Color code to return if entry not defined
|
|
||||||
* @return string RGB hex value (without # before). For example: FF00FF
|
|
||||||
*/
|
|
||||||
function colorArrayToHex($arraycolor,$colorifnotfound='888888')
|
|
||||||
{
|
|
||||||
if (! is_array($arraycolor)) return $colorifnotfound;
|
|
||||||
return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set focus onto field with selector
|
* Set focus onto field with selector
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1836,3 +1836,42 @@ function fetchObjectByElement($element_id,$element_type) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert an array with RGB value into hex RGB value
|
||||||
|
*
|
||||||
|
* @param array $arraycolor Array
|
||||||
|
* @param string $colorifnotfound Color code to return if entry not defined
|
||||||
|
* @return string RGB hex value (without # before). For example: FF00FF
|
||||||
|
* @see Make the opposite of colorStringToArray
|
||||||
|
*/
|
||||||
|
function colorArrayToHex($arraycolor,$colorifnotfound='888888')
|
||||||
|
{
|
||||||
|
if (! is_array($arraycolor)) return $colorifnotfound;
|
||||||
|
return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,255)
|
||||||
|
*
|
||||||
|
* @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
|
||||||
|
* @param string $colorifnotfound Color code to return if entry not defined
|
||||||
|
* @return string RGB hex value (without # before). For example: FF00FF
|
||||||
|
* @see Make the opposite of colorArrayToHex
|
||||||
|
*/
|
||||||
|
function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
|
||||||
|
{
|
||||||
|
if (is_array($stringcolor)) return $stringcolor; // If already into correct output format, we return as is
|
||||||
|
$tmp=preg_match('/^([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])$/',$stringcolor,$reg);
|
||||||
|
if (! $tmp)
|
||||||
|
{
|
||||||
|
$tmp=explode(',',$stringcolor);
|
||||||
|
if (count($tmp) < 3) return $colorifnotfound;
|
||||||
|
return $tmp;
|
||||||
|
}
|
||||||
|
return array(hexdec($reg[1]),hexdec($reg[2]),hexdec($reg[3]));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
|||||||
session_cache_limiter(FALSE);
|
session_cache_limiter(FALSE);
|
||||||
|
|
||||||
require_once '../../main.inc.php';
|
require_once '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
// Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined)
|
// 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']);
|
if (empty($user->id) && ! empty($_SESSION['dol_login'])) $user->fetch('',$_SESSION['dol_login']);
|
||||||
@@ -131,12 +132,8 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
|
|||||||
$conf->global->THEME_ELDY_LINEIMPAIR2='255,255,255';
|
$conf->global->THEME_ELDY_LINEIMPAIR2='255,255,255';
|
||||||
$conf->global->THEME_ELDY_LINEIMPAIRHOVER='238,246,252';
|
$conf->global->THEME_ELDY_LINEIMPAIRHOVER='238,246,252';
|
||||||
$conf->global->THEME_ELDY_TEXT='50,50,130';
|
$conf->global->THEME_ELDY_TEXT='50,50,130';
|
||||||
/*if ($dol_use_jmobile)
|
$conf->global->THEME_ELDY_FONT_SIZE1='12';
|
||||||
{
|
$conf->global->THEME_ELDY_FONT_SIZE2='11';
|
||||||
$conf->global->THEME_ELDY_BACKTABCARD1='245,245,245'; // topmenu
|
|
||||||
$conf->global->THEME_ELDY_BACKTABCARD2='245,245,245';
|
|
||||||
$conf->global->THEME_ELDY_BACKTABACTIVE='245,245,245';
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1);
|
$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1);
|
||||||
@@ -167,6 +164,10 @@ if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && empty($user->conf->
|
|||||||
$colorbacklinepairhover='';
|
$colorbacklinepairhover='';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format color value to match expected format (may be 'FFFFFF' or '255,255,255')
|
||||||
|
$colorbacktabcard1=join(',',colorStringToArray($colorbacktabcard1));
|
||||||
|
$colorbacktabcard2=join(',',colorStringToArray($colorbacktabcard2));
|
||||||
|
|
||||||
// Set text color to black or white
|
// Set text color to black or white
|
||||||
$tmppart=explode(',',$colorbackhmenu1);
|
$tmppart=explode(',',$colorbackhmenu1);
|
||||||
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
|
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
|
||||||
|
|||||||
Reference in New Issue
Block a user