- Support action in form of "task/action" in goto_url()

release-0.6
alecpl 14 years ago
parent 22c6b5b6a0
commit 6465a92a38

@ -4887,12 +4887,20 @@ function rcube_webmail()
this.goto_url = function(action, query, lock) this.goto_url = function(action, query, lock)
{ {
var querystring = query ? '&'+query : ''; var url = this.env.comm_path,
this.redirect(this.env.comm_path+'&_action='+action+querystring, lock); 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 // 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; var url = this.env.comm_path;
@ -4903,17 +4911,17 @@ function rcube_webmail()
} }
// trigger plugin hook // trigger plugin hook
var result = this.triggerEvent('request'+action, querystring); var result = this.triggerEvent('request'+action, query);
if (typeof result != 'undefined') { if (typeof result != 'undefined') {
// abort if one the handlers returned false // abort if one the handlers returned false
if (result === false) if (result === false)
return false; return false;
else else
querystring = result; query = result;
} }
url += '&_remote=1&_action=' + action + (querystring ? '&' : '') + querystring; url += '&_remote=1&_action=' + action + (query ? '&' : '') + query;
// send request // send request
console.log('HTTP GET: ' + url); console.log('HTTP GET: ' + url);

Loading…
Cancel
Save