Skip to content
Snippets Groups Projects
Commit 3c91b8c8 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Force to select "use personalized value" to select a personalized screen

option.
parent 24f71005
No related branches found
No related tags found
No related merge requests found
......@@ -277,6 +277,10 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
if (empty($foruserprofile)) $selected_theme=$conf->global->MAIN_THEME;
else $selected_theme=((is_object($fuser) && ! empty($fuser->conf->MAIN_THEME))?$fuser->conf->MAIN_THEME:'');
$hoverdisabled='';
if (empty($foruserprofile)) $hoverdisabled=(isset($conf->global->THEME_ELDY_USE_HOVER) && $conf->global->THEME_ELDY_USE_HOVER == '0');
else $hoverdisabled=(is_object($fuser)?(empty($fuser->conf->THEME_ELDY_USE_HOVER) || $fuser->conf->THEME_ELDY_USE_HOVER == '0'):'');
$colspan=2;
if ($foruserprofile) $colspan=4;
......@@ -295,7 +299,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("DefaultSkin").'</td>';
print '<td>'.$conf->global->MAIN_THEME.'</td>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' id="check_MAIN_THEME" name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
}
......@@ -359,11 +363,11 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '</a><br>';
if ($subdir == $selected_theme)
{
print '<input '.($edit?'':'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
print '<input '.($edit?'':'disabled').' type="radio" class="'.($var?'imp':'').'pair themethumbs" style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
}
else
{
print '<input '.($edit?'':'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
print '<input '.($edit?'':'disabled').' type="radio" class="'.($var?'imp':'').'pair themethumbs" style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
}
print '</div>';
......@@ -378,57 +382,101 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '</td></tr>';
if (! $foruserprofile)
// Use Hover
$var=!$var;
if ($foruserprofile)
{
/* Must first change option to choose color of highlight insteado of yes or no.
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER" disabled="disabled" type="checkbox" '.($conf->global->THEME_ELDY_USE_HOVER?" checked":"").'></td>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($selected_theme?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled="disabled"').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
print '</tr>';
*/
}
else
{
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("HighlightLinesOnMouseHover").'</td>';
print '<td colspan="'.($colspan-1).'"><input '.$bc[$var].' name="check_THEME_ELDY_USE_HOVER"'.($edit?'':' disabled').' type="checkbox" '.($hoverdisabled?"":" checked").'>';
print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
print '</tr>';
}
// TopMenuBackgroundColor
if ($foruserprofile)
{
/*$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("TopMenuBackgroundColor").'</td>';
print '<td>'.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'</td>';
print '<td align="left" class="nowrap" width="20%"><input '.$bc[$var].' name="check_THEME_ELDY_TOPMENU_BACK1" id="check_THEME_ELDY_TOPMENU_BACK1" type="checkbox" '.(! empty($object->conf->THEME_ELDY_TOPMENU_BACK1)?" checked":"");
print (empty($dolibarr_main_demo) && $edit)?'':' disabled="disabled"'; // Disabled for demo
print '> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';
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 '';
}
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';*/
}
else
{
$var=!$var;
print '<tr '.$bc[$var].'>';
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 ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
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="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
if ($foruserprofile)
{
}
else
{
$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>';
//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>';
}
......@@ -93,7 +93,18 @@ if ($action == 'update' && ($caneditfield || ! empty($user->admin)))
if ($_POST["check_MAIN_THEME"]=="on") $tabparam["MAIN_THEME"]=$_POST["main_theme"];
else $tabparam["MAIN_THEME"]='';
$tabparam["MAIN_SEARCHFORM_CONTACT"]=$_POST["main_searchform_contact"];
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array()))));
if ($val == '') $tabparam['THEME_ELDY_TOPMENU_BACK1']='';
else $tabparam['THEME_ELDY_TOPMENU_BACK1']=join(',',colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array()));
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
if ($val == '') $tabparam['THEME_ELDY_BACKTITLE1']='';
else $tabparam['THEME_ELDY_BACKTITLE1']=join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()));
if (GETPOST('check_THEME_ELDY_USE_HOVER') == 'on') $tabparam["THEME_ELDY_USE_HOVER"]=1;
else $tabparam["THEME_ELDY_USE_HOVER"]=0;
$tabparam["MAIN_SEARCHFORM_CONTACT"]=$_POST["main_searchform_contact"];
$tabparam["MAIN_SEARCHFORM_SOCIETE"]=$_POST["main_searchform_societe"];
$tabparam["MAIN_SEARCHFORM_PRODUITSERVICE"]=$_POST["main_searchform_produitservice"];
......@@ -152,17 +163,48 @@ print '</table><br>';
if ($action == 'edit')
{
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
$("#main_lang_default").change(function() {
$("#check_MAIN_LANG_DEFAULT").prop("checked", true);
});
$("#main_size_liste_limit").keyup(function() {
if ($(this).val().length) $("#check_SIZE_LISTE_LIMIT").prop("checked", true);
else $("#check_SIZE_LISTE_LIMIT").prop("checked", false);
});
});
</script>';
if (! empty($conf->use_javascript_ajax))
{/*
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
$("#main_lang_default").change(function() {
$("#check_MAIN_LANG_DEFAULT").prop("checked", true);
});
$("#main_size_liste_limit").keyup(function() {
if ($(this).val().length) $("#check_SIZE_LISTE_LIMIT").prop("checked", true);
else $("#check_SIZE_LISTE_LIMIT").prop("checked", false);
});
});
</script>';*/
}
if (! empty($conf->use_javascript_ajax))
{
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_myfunc()
{
if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); }
else { jQuery("#main_size_liste_limit").attr(\'disabled\',\'disabled\'); }
if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
}
init_myfunc();
jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); });
jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); });
jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); });
jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); });
jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); });
});
</script>';
}
clearstatcache();
$var=true;
......@@ -197,7 +239,7 @@ if ($action == 'edit')
print '</table><br>';
// Theme
show_theme($object,(($user->admin || empty($dolibarr_main_demo))?1:0),true);
show_theme($object, (($user->admin || empty($dolibarr_main_demo))?1:0), true);
dol_fiche_end();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment