NEW Can edit Background color for Top menu and Background color for

table title line (works only with theme menu eldy).
This commit is contained in:
Laurent Destailleur 2015-06-26 16:21:09 +02:00
parent 57b0de25e2
commit 8f691138e8
8 changed files with 113 additions and 30 deletions

View File

@ -462,6 +462,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/lead*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;

View File

@ -68,7 +68,15 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity);
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', join(',',colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())),'chaine',0,'',$conf->entity);
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE", $_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity);
@ -148,7 +156,7 @@ if ($action == 'edit') // Edit
print '</table><br>'."\n";
// Themes
// Themes and themes options
show_theme(null,1);
print '<br>';

View File

@ -582,6 +582,24 @@ class FormOther
}
}
/**
* Output a HTML thumb of color or a text if not defined.
*
* @param string $color String with hex (FFFFFF) or comma RGB ('255,255,255')
* @param string $textifnotdefined Text to show if color not defined
* @return string HTML code for color thumb
* @see selectColor
*/
static function showColor($color, $textifnotdefined='')
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$color = colorArrayToHex(colorStringToArray($color,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
else print $textifnotdefined;
}
/**
* Output a HTML code to select a color
*
@ -591,7 +609,7 @@ class FormOther
* @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')
* @return void
* @deprecated
* @deprecated Use instead selectColor
* @see selectColor()
*/
function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='')
@ -609,8 +627,9 @@ class FormOther
* @param array $arrayofcolors Array of colors. Example: array('29527A','5229A3','A32929','7A367A','B1365F','0D7813')
* @param string $morecss Add css style into input field
* @return string
* @see showColor
*/
function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='')
static function selectColor($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='', $morecss='')
{
// Deprecation warning
if ($form_name) {

View File

@ -651,7 +651,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
$masktri='00000';
$maskcounter='00000';
}
$maskraz=-1;
$maskoffset=0;
$resetEveryMonth=false;
@ -670,7 +670,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
}
else $maskrefclient='';
// fail if there is neither a global nor a third party counter
if (! $hasglobalcounter && ($maskrefclient_maskcounter == ''))
{
@ -1915,29 +1915,30 @@ function fetchObjectByElement($element_id,$element_type) {
/**
* Convert an array with RGB value into hex RGB value
* Convert an array with RGB value into hex RGB value.
* This is the opposite function of colorStringToArray
*
* @param array $arraycolor Array
* @param string $colorifnotfound Color code to return if entry not defined or not a RGB format
* @return string RGB hex value (without # before). For example: FF00FF
* @see Make the opposite of colorStringToArray
* @return string RGB hex value (without # before). For example: 'FF00FF', '01FF02'
* @see colorStringToArray
*/
function colorArrayToHex($arraycolor,$colorifnotfound='888888')
{
if (! is_array($arraycolor)) return $colorifnotfound;
if (empty($arraycolor)) return $colorifnotfound;
return dechex($arraycolor[0]).dechex($arraycolor[1]).dechex($arraycolor[2]);
return sprintf("%02s",dechex($arraycolor[0])).sprintf("%02s",dechex($arraycolor[1])).sprintf("%02s",dechex($arraycolor[2]));
}
/**
* Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,255).
* This is the opposite function of colorArrayToHex.
* If entry is already an array, return it.
*
* @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
* @param array $colorifnotfound Color code array to return if entry not defined
* @return string RGB hex value (without # before). For example: FF00FF
* @see Make the opposite of colorArrayToHex
* @see colorArrayToHex
*/
function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
{

View File

@ -254,7 +254,10 @@ function entity_prepare_head($object, $aEntities)
*/
function show_theme($fuser,$edit=0,$foruserprofile=false)
{
global $conf,$langs,$bc;
global $conf,$langs,$db;
global $bc;
$formother = new FormOther($db);
//$dirthemes=array(empty($conf->global->MAIN_FORCETHEMEDIR)?'/theme':$conf->global->MAIN_FORCETHEMEDIR.'/theme');
$dirthemes=array('/theme');
@ -380,9 +383,48 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
$hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
print '<td colspan="'.($colspan-1).'"><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
print ' ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
print '</tr>';
//if ($conf->theme == 'eldy')
//{
// TopMenuBackgroundColor
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td colspan="'.($colspan-1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),''),'THEME_ELDY_TOPMENU_BACK1','formcolor',1).' ';
}
else
{
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");
}
print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
// BackgroundTableTitleColor
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("BackgroundTableTitleColor").'</td>';
print '<td colspan="'.($colspan-1).'">';
if ($edit)
{
print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1,array()),''),'THEME_ELDY_BACKTITLE1','formcolor',1).' ';
}
else
{
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
}
print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
//}
print '</tr>';
}
print '</table>';

View File

@ -1644,3 +1644,9 @@ ConfFileMuseContainCustom=Installing an external module from application save th
HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over
PressF5AfterChangingThis=Press F5 on keyboard after changing this value to have it effective
NotSupportedByAllThemes=Will works with eldy theme but is not supported by all themes
BackgroundColor=Background color
TopMenuBackgroundColor=Background color for Top menu
LeftMenuBackgroundColor=Background color for Left menu
BackgroundTableTitleColor=Background color for table title line
BackgroundTableLineOddColor=Background color for odd table lines
BackgroundTableLineEvenColor=Background color for even table lines

View File

@ -114,12 +114,15 @@ $usegradient=1;
// Eldy colors
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
{
$conf->global->THEME_ELDY_TOPMENU_BACK1='140,150,180'; // topmenu (140,160,185)
$conf->global->THEME_ELDY_TOPMENU_BACK2='236,236,236';
// Case of option always editable
if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_TOPMENU_BACK1='140,150,180'; // topmenu (140,160,185)
if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1='140,150,180'; // title of arrays TO MATCH ELDY (140,160,185)
//if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1='230,230,230'; // title of arrays TO MATCH BOOTSTRAP
// Cas of option editable if option THEME_ELDY_ENABLE_PERSONALIZED is on
$conf->global->THEME_ELDY_TOPMENU_BACK2='236,236,236';
$conf->global->THEME_ELDY_VERMENU_BACK1='255,255,255'; // vmenu
$conf->global->THEME_ELDY_VERMENU_BACK2='255,255,255';
$conf->global->THEME_ELDY_BACKTITLE1='140,150,180'; // title of arrays TO MATCH ELDY (140,160,185)
//$conf->global->THEME_ELDY_BACKTITLE1='230,230,230'; // title of arrays TO MATCH BOOTSTRAP
$conf->global->THEME_ELDY_BACKTITLE2='230,230,230';
$conf->global->THEME_ELDY_BACKTABCARD1='255,255,255';
$conf->global->THEME_ELDY_BACKTABCARD2='210,210,210'; // card
@ -136,7 +139,8 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
$conf->global->THEME_ELDY_FONT_SIZE2='11';
}
$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);
// Cas of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on
$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);
$colorbackhmenu2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK2)?$colorbackhmenu2:$conf->global->THEME_ELDY_TOPMENU_BACK2) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK2)?$colorbackhmenu2:$user->conf->THEME_ELDY_TOPMENU_BACK2);
$colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1);
$colorbackvmenu2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK2)?$colorbackvmenu2:$conf->global->THEME_ELDY_VERMENU_BACK2) :(empty($user->conf->THEME_ELDY_VERMENU_BACK2)?$colorbackvmenu2:$user->conf->THEME_ELDY_VERMENU_BACK2);
@ -155,6 +159,7 @@ $colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty(
$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);
$fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1);
$fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2);
// Hover can be disabled with THEME_ELDY_USE_HOVER=0
if ((! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && (isset($user->conf->THEME_ELDY_USE_HOVER) && $user->conf->THEME_ELDY_USE_HOVER == '0'))
|| (empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED) && (isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0')))
@ -605,8 +610,9 @@ div.ficheaddleft {
$minwidthtmenu=66; /* minimul widht for one top menu entry */
$heightmenu=46; /* height of top menu, part with image */
$heightmenu2=48; /* height of top menu, part with login */
$disableimages = 0;
$maxwidthloginblock = 110;
if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { $maxwidthloginblock = 180; }
if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE) || $dol_optimize_smallscreen) { $disableimages = 1; $maxwidthloginblock = 180; }
?>
div#id-top {
@ -622,8 +628,8 @@ div#id-top {
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(0,0,0,.3)) );
<?php } ?>
<?php if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { ?>
height: 26px;
<?php if ($disableimages) { ?>
height: 28px;
<?php } else { ?>
height: <?php print $heightmenu2; ?>px;
<?php } ?>
@ -734,19 +740,19 @@ div.tmenuleft
width: 5px;
background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menutab-r.png',1); ?>) 0 -6px no-repeat;
<?php } ?>
<?php if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { ?>
height: 24px;
<?php if ($disableimages) { ?>
height: 26px;
<?php } else { ?>
height: <?php print $heightmenu; ?>px;
<?php } ?>
}
div.tmenucenter
{
padding-top: <?php print empty($conf->global->THEME_ELDY_DISABLE_IMAGE)?'2':'4'; ?>px;
padding-top: <?php print $disableimages?'4':'2'; ?>px;
padding-left: 0px;
padding-right: 0px;
<?php if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { ?>
height: 22px;
<?php if ($disableimages) { ?>
height: 24px;
<?php } else { ?>
height: <?php print $heightmenu; ?>px;
<?php } ?>
@ -892,7 +898,7 @@ foreach($mainmenuusedarray as $val)
.tmenuimage {
padding:0 0 0 0 !important;
margin:0 0px 0 0 !important;
<?php if (! empty($conf->global->THEME_ELDY_DISABLE_IMAGE)) { ?>
<?php if ($disableimages) { ?>
display: none;
<?php } ?>
}
@ -1017,7 +1023,7 @@ div.login_block_user {
}
div.login_block_other {
display: inline-block;
clear: both;
clear: both;
}
div.login_block_other { padding-top: 3px; text-align: right; }
.login_block_elem {

View File

@ -1412,7 +1412,7 @@ else
{
print '<tr><td>'.$langs->trans("ColorUser").'</td>';
print '<td colspan="2">';
if ($object->color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$object->color.'" value="'.$object->color.'">';
print $formother->showColor($object->color, '');
print '</td>';
print "</tr>\n";
}