mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 17:14:44 +01:00
* API: report failed Ajax requests to user incl. a hint that server error-log should contain more information
This commit is contained in:
parent
533f13faf8
commit
9e20212b3e
@ -33,6 +33,14 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
|
||||
/**
|
||||
* Internal implementation of the JSON request object.
|
||||
*
|
||||
* @param {string} _menuaction
|
||||
* @param {array} _parameters
|
||||
* @param {function} _callback
|
||||
* @param {object} _context
|
||||
* @param {boolean} _async
|
||||
* @param {object} _sender
|
||||
* @param {egw} _egw
|
||||
*/
|
||||
function json_request(_menuaction, _parameters, _callback, _context,
|
||||
_async, _sender, _egw)
|
||||
@ -69,7 +77,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
/**
|
||||
* Sends the assembled request to the server
|
||||
* @param {boolean} [async=false] Overrides async provided in constructor to give an easy way to make simple async requests
|
||||
* @param {string} method='POST' allow to eg. use a (cachable) 'GET' request instead of POST
|
||||
* @param {string} method ='POST' allow to eg. use a (cachable) 'GET' request instead of POST
|
||||
*
|
||||
* @return {jqXHR} jQuery jqXHR request object
|
||||
*/
|
||||
@ -103,13 +111,18 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
// Don't error about an abort
|
||||
if(_err !== 'abort')
|
||||
{
|
||||
this.egw.debug('error', 'Ajax request to', this.url, ' failed:', _err);
|
||||
this.egw.message.call(this.egw, this.egw.lang('Ajax request failed')+': '+_xmlhttp.statusText+' ('+_xmlhttp.status+
|
||||
")\n\n"+this.egw.lang('Server error log should contain more information about the problem.')+
|
||||
"\n"+this.egw.lang('Trying it again will usually not help!')+
|
||||
"\n\nURL: "+this.url+"\n"+_xmlhttp.getAllResponseHeaders().match(/^Date:.*$/m)[0]);
|
||||
|
||||
this.egw.debug('error', 'Ajax request to', this.url, ' failed: ', _err, _xmlhttp.status, _xmlhttp.statusText);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return this.request;
|
||||
}
|
||||
};
|
||||
|
||||
json_request.prototype.handleResponse = function(data) {
|
||||
if (data && typeof data.response != 'undefined')
|
||||
@ -162,8 +175,10 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
);
|
||||
} catch(e) {
|
||||
var msg = e.message ? e.message : e + '';
|
||||
var stack = e.stack ? "\n-- Stack trace --\n" + e.stack : ""
|
||||
this.egw.debug('error', 'Exception "' + msg + '" while handling JSON response from ' + this.url + ' [' + JSON.stringify(this.parameters) + '] type "' + res.type + '", plugin', plugin, 'response', res, stack);
|
||||
var stack = e.stack ? "\n-- Stack trace --\n" + e.stack : "";
|
||||
this.egw.debug('error', 'Exception "' + msg + '" while handling JSON response from ' +
|
||||
this.url + ' [' + JSON.stringify(this.parameters) + '] type "' + res.type +
|
||||
'", plugin', plugin, 'response', res, stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -175,7 +190,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
}
|
||||
}
|
||||
this.request = null;
|
||||
}
|
||||
};
|
||||
|
||||
var json = {
|
||||
|
||||
@ -228,7 +243,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
// Add the entry
|
||||
plugins[_type].push({
|
||||
'callback': _callback,
|
||||
'context': _context,
|
||||
'context': _context
|
||||
});
|
||||
},
|
||||
|
||||
@ -273,7 +288,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
{
|
||||
req.alertHandler(
|
||||
res.data.message,
|
||||
res.data.details)
|
||||
res.data.details);
|
||||
return true;
|
||||
}
|
||||
throw 'Invalid parameters';
|
||||
@ -326,7 +341,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
catch (e)
|
||||
{
|
||||
req.egw.debug('error', 'Error while executing script: ',
|
||||
res.data,e)
|
||||
res.data,e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -129,6 +129,9 @@ egw.extend('message', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
||||
.text(matches[2]));
|
||||
msg_div.append(jQuery(_wnd.document.createElement('span')).text(parts[1]));
|
||||
}
|
||||
// center the message
|
||||
msg_div.css('right', ((jQuery(_wnd).innerWidth()-msg_div.width())/2)+'px');
|
||||
|
||||
if (_type == 'success') // clear message again after some time, if no error
|
||||
{
|
||||
message_timer = _wnd.setTimeout(function() {
|
||||
|
@ -55,6 +55,7 @@ addressbooks to sync in addition to personal addressbook groupdav de Adressbüch
|
||||
admin common de Admin
|
||||
administration common de Administration
|
||||
afghanistan common de AFGHANISTAN
|
||||
ajax request failed common de Ajax Anfrage fehlgeschlagen
|
||||
albania common de ALBANIEN
|
||||
algeria common de ALGERIEN
|
||||
all common de alle
|
||||
@ -724,6 +725,7 @@ serbia common de SERBIEN
|
||||
server %1 has been added common de Server %1 wurde zugefügt
|
||||
server answered. processing response... common de Server antwortet. Bearbeite Antwort...
|
||||
server contacted. waiting for response... common de Server kontaktiert. Warte auf Antwort...
|
||||
server error log should contain more information about the problem. common de Das Fehlerprotokoll des Servers sollte mehr Informationen über das Problem enthalten.
|
||||
server is unwilling to perform. common de Server ist zur Ausführung nicht bereit.
|
||||
server name common de Server Name
|
||||
session has been killed common de Session wurde beendet
|
||||
@ -826,6 +828,7 @@ top common de Oben
|
||||
total common de Gesamt
|
||||
transparant bg for the icons? common de Transparenter Hintergrund für Symbole
|
||||
trinidad and tobago common de TRINIDAD AND TOBAGO
|
||||
trying it again will usually not help! common de Es nochmal zu versuchen hilft im Allgemeinen nicht!
|
||||
tuesday common de Dienstag
|
||||
tunisia common de TUNISIEN
|
||||
turkey common de TÜRKEI
|
||||
|
@ -55,6 +55,7 @@ addressbooks to sync in addition to personal addressbook groupdav en Addressbook
|
||||
admin common en Admin
|
||||
administration common en Administration
|
||||
afghanistan common en AFGHANISTAN
|
||||
ajax request failed common en Ajax request failed
|
||||
albania common en ALBANIA
|
||||
algeria common en ALGERIA
|
||||
all common en All
|
||||
@ -724,6 +725,7 @@ serbia common en Serbia
|
||||
server %1 has been added common en Server %1 has been added.
|
||||
server answered. processing response... common en Server answered. Processing response...
|
||||
server contacted. waiting for response... common en Server contacted. Waiting for response...
|
||||
server error log should contain more information about the problem. common en Server error log should contain more information about the problem.
|
||||
server is unwilling to perform. common en Server is unwilling to perform.
|
||||
server name common en Server name
|
||||
session has been killed common en Session has been killed.
|
||||
@ -826,6 +828,7 @@ top common en Top
|
||||
total common en Total
|
||||
transparant bg for the icons? common en Transparant bg for the icons
|
||||
trinidad and tobago common en TRINIDAD AND TOBAGO
|
||||
trying it again will usually not help! common en Trying it again will usually not help!
|
||||
tuesday common en Tuesday
|
||||
tunisia common en TUNISIA
|
||||
turkey common en TURKEY
|
||||
|
Loading…
Reference in New Issue
Block a user