mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
if "common" prefs are not loaded, do not display page generation time
Before we queried page_generation_time common preference without a callback, which send a synchronious request to server to fetch common preferences, when it returned it looked for the preference again and send the next synchronious request to the server, in an infinit loop. Now setting _callback parameter of egw.preference() to false, just returns undefined, if common preferences are not yet loaded, but dont try to query them from server
This commit is contained in:
parent
748e861580
commit
45111b8cd9
@ -146,7 +146,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
json_request.prototype.handleResponse = function(data) {
|
||||
if (data && typeof data.response != 'undefined')
|
||||
{
|
||||
if (egw.preference('show_generation_time', 'common') == "1")
|
||||
if (egw.preference('show_generation_time', 'common', false) == "1")
|
||||
{
|
||||
var gen_time_div = jQuery('#divGenTime').length > 0 ? jQuery('#divGenTime')
|
||||
:jQuery('<div id="divGenTime" class="pageGenTime"><span class="pageTime"></span></div>').appendTo('#egw_fw_footer');
|
||||
|
@ -55,7 +55,8 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function()
|
||||
*
|
||||
* @param {string} _name name of the preference, eg. 'dateformat', or '*' to get all the application's preferences
|
||||
* @param {string} _app default 'common'
|
||||
* @param {function} _callback optional callback, if preference needs loading first
|
||||
* @param {function|false|undefined} _callback optional callback, if preference needs loading first
|
||||
* if false given and preference is not loaded, undefined is return and no (synchronious) request is send to server
|
||||
* @param {object} _context context for callback
|
||||
* @return string|bool preference value or false, if callback given and preference not yet loaded
|
||||
*/
|
||||
@ -65,6 +66,7 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function()
|
||||
|
||||
if (typeof prefs[_app] == 'undefined')
|
||||
{
|
||||
if (_callback === false) return undefined;
|
||||
var request = this.json('EGroupware\\Api\\Framework::ajax_get_preference', [_app], _callback, _context);
|
||||
request.sendRequest(typeof _callback == 'function', 'GET'); // use synchronous (cachable) GET request
|
||||
if (typeof prefs[_app] == 'undefined') prefs[_app] = {};
|
||||
|
Loading…
Reference in New Issue
Block a user