NEW Change in theme colors does not need to use the refresh button

This commit is contained in:
Laurent Destailleur
2022-02-06 22:11:44 +01:00
parent 3fa3cd28cd
commit 9b1f04209d
5 changed files with 48 additions and 18 deletions

View File

@@ -563,9 +563,9 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
if (empty($conf->use_javascript_ajax) || $forcenoajax) {
if (empty($conf->global->$code)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&token='.newToken().'&entity='.$entity.($mode ? '&mode='.$mode : '').'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&token='.newToken().'&entity='.$entity.($mode ? '&mode='.$mode : '').($forcereload ? '&dol_resetcache=1' : '').'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&token='.newToken().'&entity='.$entity.($mode ? '&mode='.$mode : '').'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&token='.newToken().'&entity='.$entity.($mode ? '&mode='.$mode : '').($forcereload ? '&dol_resetcache=1' : '').'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
}
} else {
$out = "\n<!-- Ajax code to switch constant ".$code." -->".'
@@ -573,10 +573,10 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
$(document).ready(function() {
var input = '.json_encode($input).';
var url = \''.DOL_URL_ROOT.'/core/ajax/constantonoff.php\';
var code = \''.$code.'\';
var entity = \''.$entity.'\';
var strict = \''.$strict.'\';
var userid = \''.$user->id.'\';
var code = \''.dol_escape_js($code).'\';
var entity = \''.dol_escape_js($entity).'\';
var strict = \''.dol_escape_js($strict).'\';
var userid = \''.dol_escape_js($user->id).'\';
var yesButton = \''.dol_escape_js($langs->transnoentities("Yes")).'\';
var noButton = \''.dol_escape_js($langs->transnoentities("No")).'\';
var token = \''.currentToken().'\';
@@ -588,7 +588,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
if (input.alert.set.noButton) noButton = input.alert.set.noButton;
confirmConstantAction("set", url, code, input, input.alert.set, entity, yesButton, noButton, strict, userid, token);
} else {
setConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);
setConstant(url, code, input, entity, 0, '.((int) $forcereload).', userid, token);
}
});
@@ -600,9 +600,9 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
confirmConstantAction("del", url, code, input, input.alert.del, entity, yesButton, noButton, strict, userid, token);
} else {';
if (empty($setzeroinsteadofdel)) {
$out .=' delConstant(url, code, input, entity, 0, '.$forcereload.', userid, token);';
$out .=' delConstant(url, code, input, entity, 0, '.((int) $forcereload).', userid, token);';
} else {
$out .=' setConstant(url, code, input, entity, 0, '.$forcereload.', userid, token, 0);';
$out .=' setConstant(url, code, input, entity, 0, '.((int) $forcereload).', userid, token, 0);';
}
$out .= ' }
});