From 99ce5b41f9523fdbb561ccf5fb00e4aea5cb96b0 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 27 Jan 2014 16:28:39 +0000 Subject: [PATCH] allow to optionally specify app for redirect instead of always using current app --- phpgwapi/inc/class.egw_json.inc.php | 4 +++- phpgwapi/js/egw_json.js | 5 +++-- phpgwapi/js/jsapi/egw_json.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.egw_json.inc.php b/phpgwapi/inc/class.egw_json.inc.php index 8ff6192480..ed39d1a349 100644 --- a/phpgwapi/inc/class.egw_json.inc.php +++ b/phpgwapi/inc/class.egw_json.inc.php @@ -462,9 +462,10 @@ class egw_json_response * * @param string $url * @param boolean $global specifies whether to redirect the whole framework + * @param string $app=null default current app from flags * or only the current application */ - public function redirect($url, $global = false) + public function redirect($url, $global = false, $app=null) { if (is_string($url) && is_bool($global)) { @@ -472,6 +473,7 @@ class egw_json_response $this->addGeneric('redirect', array( 'url' => $url, 'global' => $global, + 'app' => $app ? $app : $GLOBALS['egw_info']['flags']['currentapp'], )); } } diff --git a/phpgwapi/js/egw_json.js b/phpgwapi/js/egw_json.js index 6d936cfe7b..dfa3a85bf8 100644 --- a/phpgwapi/js/egw_json.js +++ b/phpgwapi/js/egw_json.js @@ -528,7 +528,8 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe case 'redirect': //console.log(res.data.url); if (typeof res.data.url == 'string' && - typeof res.data.global == 'boolean') + typeof res.data.global == 'boolean' && + typeof res.data.app == 'string') { //Special handling for framework reload res.data.global |= (res.data.url.indexOf("?cd=10") > 0); @@ -539,7 +540,7 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe } else { - egw_appWindowOpen(this.app, res.data.url); + egw_appWindowOpen(res.data.app, res.data.url); } hasResponse = true; diff --git a/phpgwapi/js/jsapi/egw_json.js b/phpgwapi/js/jsapi/egw_json.js index 66bbec7432..c772096611 100644 --- a/phpgwapi/js/jsapi/egw_json.js +++ b/phpgwapi/js/jsapi/egw_json.js @@ -400,7 +400,7 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) { } else { - egw_appWindowOpen(req.egw.getAppName(), res.data.url); + egw_appWindowOpen(res.data.app, res.data.url); } return true; }