summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-05-21 08:42:59 +0000
committeralecpl <alec@alec.pl>2010-05-21 08:42:59 +0000
commit2bb1f633fb2c5055a561414b5650a9247662169b (patch)
tree3579b461c0144d87c019b44f7fb9554ecc02fa55 /program
parenta2a36103cfd88a95b45a2602ab13fd4a49efdf2f (diff)
- Added 'actionbefore', 'actionafter', 'responsebefore', 'responseafter' events
- Removed response.callbacks feature
Diffstat (limited to 'program')
-rw-r--r--program/js/app.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 5e081d9a3..991ba0385 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -439,7 +439,8 @@ function rcube_webmail()
return ret !== null ? ret : (obj ? false : true);
}
- // trigger plugin hook
+ // trigger plugin hooks
+ this.triggerEvent('actionbefore', {props:props, action:command});
var event_ret = this.triggerEvent('before'+command, props);
if (typeof event_ret != 'undefined') {
// abort if one the handlers returned false
@@ -865,7 +866,7 @@ function rcube_webmail()
// all checks passed, send message
this.set_busy(true, 'sendingmessage');
var form = this.gui_objects.messageform;
- form.target = "savetarget";
+ form.target = 'savetarget';
form._draft.value = '';
form.submit();
@@ -880,7 +881,7 @@ function rcube_webmail()
// Reset the auto-save timer
self.clearTimeout(this.save_timer);
- this.upload_file(props)
+ this.upload_file(props)
break;
case 'remove-attachment':
@@ -896,7 +897,7 @@ function rcube_webmail()
var uid;
if (uid = this.get_single_uid())
this.goto_url('compose', '_reply_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(command=='reply-all' ? '&_all=1' : ''), true);
- break;
+ break;
case 'forward':
var uid;
@@ -1045,6 +1046,7 @@ function rcube_webmail()
}
this.triggerEvent('after'+command, props);
+ this.triggerEvent('actionafter', {props:props, action:command});
return obj ? false : true;
};
@@ -4908,6 +4910,9 @@ function rcube_webmail()
if (response.unlock)
this.set_busy(false);
+ this.triggerEvent('responsebefore', {response: response});
+ this.triggerEvent('responsebefore'+response.action, {response: response});
+
// set env vars
if (response.env)
this.set_env(response.env);
@@ -4925,12 +4930,6 @@ function rcube_webmail()
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) {
case 'delete':
@@ -4989,6 +4988,9 @@ function rcube_webmail()
}
break;
}
+
+ this.triggerEvent('responseafter', {response: response});
+ this.triggerEvent('responseafter'+response.action, {response: response});
};
// handle HTTP request errors