diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-05-29 17:16:45 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-05-29 17:16:45 +0000 |
| commit | a52aba3c07aa75390a52fc88393fbba3e7bb2821 (patch) | |
| tree | e1ed21d10f1a5d163e289461d61af65598c6f9e9 /roundcubemail/program | |
| parent | 137763a9c92e6e6345cfa2e938872e11df0a0aac (diff) | |
- Add request* event triggers in http_post/http_request (#1486054)
git-svn-id: https://svn.roundcube.net/trunk@3687 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/js/app.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js index fbbae4a0b..dcc212071 100644 --- a/roundcubemail/program/js/app.js +++ b/roundcubemail/program/js/app.js @@ -4884,9 +4884,19 @@ function rcube_webmail() // send a http request to the server this.http_request = function(action, querystring, lock) { - querystring += (querystring ? '&' : '') + '_remote=1'; - var url = this.env.comm_path + '&_action=' + action + '&' + querystring + // trigger plugin hook + var result = this.triggerEvent('request'+action, querystring); + if (typeof result != 'undefined') { + // abort if one the handlers returned false + if (result === false) + return false; + else + querystring = result; + } + querystring += (querystring ? '&' : '') + '_remote=1'; + var url = this.env.comm_path + '&_action=' + action + '&' + querystring; + // send request console.log('HTTP GET: ' + url); $.get(url, { _unlock:(lock?1:0) }, function(data){ ref.http_response(data); }, 'json'); @@ -4904,6 +4914,16 @@ function rcube_webmail() else postdata += (postdata ? '&' : '') + '_remote=1' + (lock ? '&_unlock=1' : ''); + // trigger plugin hook + var result = this.triggerEvent('request'+action, postdata); + if (typeof result != 'undefined') { + // abort if one the handlers returned false + if (result === false) + return false; + else + postdata = result; + } + // send request console.log('HTTP POST: ' + url); $.post(url, postdata, function(data){ ref.http_response(data); }, 'json'); |
