mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
NEW Change in theme colors does not need to use the refresh button
This commit is contained in:
@@ -280,6 +280,10 @@ if ($action == 'update') {
|
||||
|
||||
$_SESSION["mainmenu"] = ""; // The menu manager may have changed
|
||||
|
||||
if (GETPOST('dol_resetcache')) {
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOST('page_y', 'int') : ''));
|
||||
exit;
|
||||
}
|
||||
@@ -309,6 +313,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
|
||||
print '<input type="hidden" name="dol_resetcache" value="1">';
|
||||
|
||||
$head = ihm_prepare_head();
|
||||
|
||||
@@ -649,6 +654,7 @@ if ($mode == 'login') {
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
|
||||
print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@@ -562,7 +562,7 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
value: value
|
||||
},
|
||||
function() { /* handler for success of post */
|
||||
console.log("Ajax url request to set constant is a success. forcereload="+forcereload+" value="+value);
|
||||
console.log("Ajax url request to set constant is a success. Make complementary actions and then forcereload="+forcereload+" value="+value);
|
||||
if (value == 0) {
|
||||
$("#set_" + code).show();
|
||||
$("#del_" + code).hide();
|
||||
@@ -615,9 +615,19 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
}
|
||||
});
|
||||
if (forcereload) {
|
||||
location.reload();
|
||||
var url = window.location.href;
|
||||
if (url.indexOf('dol_resetcache') < 0) {
|
||||
if (url.indexOf('?') > -1) {
|
||||
url = url + "&dol_resetcache=1";
|
||||
} else {
|
||||
url = url + "?dol_resetcache=1";
|
||||
}
|
||||
}
|
||||
window.location.href = url;
|
||||
//location.reload();
|
||||
return false;
|
||||
}
|
||||
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
|
||||
}).fail(function(error) { console.log("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -642,7 +652,7 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
token: token
|
||||
},
|
||||
function() {
|
||||
console.log("Ajax url request to delete constant is success forcereload="+forcereload);
|
||||
console.log("Ajax url request to delete constant is success. Make complementary actions and then forcereload="+forcereload);
|
||||
$("#del_" + code).hide();
|
||||
$("#set_" + code).show();
|
||||
$.each(input, function(type, data) {
|
||||
@@ -686,9 +696,19 @@ function delConstant(url, code, input, entity, strict, forcereload, userid, toke
|
||||
}
|
||||
});
|
||||
if (forcereload) {
|
||||
location.reload();
|
||||
var url = window.location.href;
|
||||
if (url.indexOf('dol_resetcache') < 0) {
|
||||
if (url.indexOf('?') > -1) {
|
||||
url = url + "&dol_resetcache=1";
|
||||
} else {
|
||||
url = url + "?dol_resetcache=1";
|
||||
}
|
||||
}
|
||||
window.location.href = url;
|
||||
//location.reload();
|
||||
return false;
|
||||
}
|
||||
}).fail(function(error) { location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
|
||||
}).fail(function(error) { console.log("Error, we force reload"); location.reload(); }); /* When it fails, we always force reload to have setEventErrorMessages in session visible */
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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 .= ' }
|
||||
});
|
||||
|
||||
@@ -507,6 +507,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// BorderTableActive
|
||||
/* Disabled because not supported by md theme
|
||||
if ($foruserprofile) {
|
||||
} else {
|
||||
$default = $langs->trans('No');
|
||||
@@ -524,6 +525,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
*/
|
||||
|
||||
// Background color THEME_ELDY_BACKBODY
|
||||
if ($foruserprofile) {
|
||||
|
||||
@@ -1512,12 +1512,14 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
|
||||
if (GETPOST('version', 'int')) {
|
||||
$ext = 'version='.GETPOST('version', 'int'); // usefull to force no cache on css/js
|
||||
}
|
||||
// Refresh value of MAIN_IHM_PARAMS_REV before forging the parameter line.
|
||||
if (GETPOST('dol_resetcache')) {
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
$themeparam = '?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').'&userid='.$user->id.'&entity='.$conf->entity;
|
||||
|
||||
$themeparam .= ($ext ? '&'.$ext : '').'&revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV");
|
||||
if (!empty($_SESSION['dol_resetcache'])) {
|
||||
$themeparam .= '&dol_resetcache='.$_SESSION['dol_resetcache'];
|
||||
}
|
||||
if (GETPOSTISSET('dol_hide_topmenu')) {
|
||||
$themeparam .= '&dol_hide_topmenu='.GETPOST('dol_hide_topmenu', 'int');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user