diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-09-25 10:34:54 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-09-25 10:34:54 +0000 |
| commit | 59d69157f949461046670cfbeb07895f8062250b (patch) | |
| tree | a4003d23322559e0f0075adb94f8fd0468c7f279 /roundcubemail/program | |
| parent | 84719095d83013360139dd0ad766636a688fe9e4 (diff) | |
- Support action in form of "task/action" in goto_url()
git-svn-id: https://svn.roundcube.net/trunk@3988 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/js/app.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js index c08ba34b4..321a7bfbf 100644 --- a/roundcubemail/program/js/app.js +++ b/roundcubemail/program/js/app.js @@ -4887,12 +4887,20 @@ function rcube_webmail() this.goto_url = function(action, query, lock) { - var querystring = query ? '&'+query : ''; - this.redirect(this.env.comm_path+'&_action='+action+querystring, lock); + var url = this.env.comm_path, + querystring = query ? '&'+query : ''; + + // overwrite task name + if (action.match(/([a-z]+)\/([a-z-_]+)/)) { + action = RegExp.$2; + url = url.replace(/\_task=[a-z]+/, '_task='+RegExp.$1); + } + + this.redirect(url+'&_action='+action+querystring, lock); }; // send a http request to the server - this.http_request = function(action, querystring, lock) + this.http_request = function(action, query, lock) { var url = this.env.comm_path; @@ -4903,17 +4911,17 @@ function rcube_webmail() } // trigger plugin hook - var result = this.triggerEvent('request'+action, querystring); + var result = this.triggerEvent('request'+action, query); if (typeof result != 'undefined') { // abort if one the handlers returned false if (result === false) return false; else - querystring = result; + query = result; } - url += '&_remote=1&_action=' + action + (querystring ? '&' : '') + querystring; + url += '&_remote=1&_action=' + action + (query ? '&' : '') + query; // send request console.log('HTTP GET: ' + url); |
