summaryrefslogtreecommitdiff
path: root/roundcubemail/program/js
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-06-01 15:35:53 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-06-01 15:35:53 +0000
commit66cf63f213b507601b6841ac119418be7759800d (patch)
treeba8311d128edb7c1eb962db7b1143d9e10b86f79 /roundcubemail/program/js
parent4e3a7d8f4c769a981423180d3843889aac02c530 (diff)
Use event system on the client to handle ajax callbacks
git-svn-id: https://svn.roundcube.net/trunk@2589 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/js')
-rw-r--r--roundcubemail/program/js/app.js6
-rw-r--r--roundcubemail/program/js/common.js8
2 files changed, 10 insertions, 4 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js
index 5e323e229..4f12e808a 100644
--- a/roundcubemail/program/js/app.js
+++ b/roundcubemail/program/js/app.js
@@ -3923,6 +3923,12 @@ function rcube_webmail()
console.log(response.exec);
eval(response.exec);
}
+
+ // execute callback functions of plugins
+ if (response.callbacks && response.callbacks.length) {
+ for (var i=0; i < response.callbacks.length; i++)
+ this.triggerEvent(response.callbacks[i][0], response.callbacks[i][1]);
+ }
// process the response data according to the sent action
switch (response.action) {
diff --git a/roundcubemail/program/js/common.js b/roundcubemail/program/js/common.js
index 25b654612..1fd10c255 100644
--- a/roundcubemail/program/js/common.js
+++ b/roundcubemail/program/js/common.js
@@ -288,8 +288,8 @@ triggerEvent: function(evt, e)
{
var ret, h;
if (typeof e == 'undefined')
- e = {};
- if (typeof e == 'object')
+ e = this;
+ else if (typeof e == 'object')
e.event = evt;
if (this._events && this._events[evt] && !this._event_exec) {
@@ -297,9 +297,9 @@ triggerEvent: function(evt, e)
for (var i=0; i < this._events[evt].length; i++) {
if ((h = this._events[evt][i])) {
if (typeof h.func == 'function')
- ret = h.func.call ? h.func.call(h.obj, this, e) : h.func(this, e);
+ ret = h.func.call ? h.func.call(h.obj, e) : h.func(e);
else if (typeof h.obj[h.func] == 'function')
- ret = h.obj[h.func](this, e);
+ ret = h.obj[h.func](e);
// cancel event execution
if (typeof ret != 'undefined' && !ret)