allow to optionally specify app for redirect instead of always using current app

This commit is contained in:
Ralf Becker 2014-01-27 16:28:39 +00:00
parent ba5254040d
commit 99ce5b41f9
3 changed files with 7 additions and 4 deletions

View File

@ -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'],
));
}
}

View File

@ -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;

View File

@ -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;
}