From 75306dcc7193b57196baf65fc1f08c8ce92505cf Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Wed, 23 Dec 2009 15:24:22 +0100 Subject: [PATCH] Merge Ajax exception handler from DIMP. --- kronolith/js/kronolith.js | 15 ++++++++++++++- kronolith/lib/Kronolith.php | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 352b35dbf..f1a2a33be 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -35,7 +35,7 @@ KronolithCore = { mapInitialized: false, doActionOpts: { - onException: function(r, e) { KronolithCore.debug('onException', e); }, + onException: this.onAjaxException.bind(this), onFailure: function(t, o) { KronolithCore.debug('onFailure', t); }, evalJS: false, evalJSON: true @@ -3587,6 +3587,19 @@ KronolithCore = { } }, + /* Extend AJAX exception handling. */ + onAjaxException: function(parentfunc, r, e) + { + /* Make sure loading images are closed. */ + this.loading--; + if (!this.loading) { + $('kronolithLoading').hide(); + } + this._closeRedBox(); + this.showNotifications([ { type: 'horde.error', message: Kronolith.text.ajax_error } ]); + KronolithCore.debug('onException', e); + } + toggleCalendar: function(elm) { elm.toggleClassName('on'); diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index c741e0ba9..c92d170b4 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -298,6 +298,7 @@ class Kronolith /* Gettext strings used in core javascript files. */ $code['text'] = array( + 'ajax_error' => _("Error when communicating with the server."), 'ajax_timeout' => _("There has been no contact with the calendar server for several minutes. The server may be temporarily unavailable or network problems may be interrupting your session. You will not see any updates until the connection is restored."), 'ajax_recover' => _("The connection to the calendar server has been restored."), 'alarm' => _("Alarm:"), -- 2.11.0