forked from extern/egroupware
Added handling for global redirect and handling of ?cd=10 in redirect url, which should trigger the url to be loaded inside the top window
This commit is contained in:
parent
e513532840
commit
04267ed34d
@ -323,10 +323,16 @@ class egw_json_response
|
||||
*
|
||||
* @param string $url
|
||||
*/
|
||||
public function redirect($url)
|
||||
public function redirect($url, $global = false)
|
||||
{
|
||||
//self::script("location.href = '$url';");
|
||||
$this->addGeneric('redirect', $url);
|
||||
if (is_string($url) && is_bool($global))
|
||||
{
|
||||
//self::script("location.href = '$url';");
|
||||
$this->addGeneric('redirect', array(
|
||||
'url' => $url,
|
||||
'global' => $global,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -229,9 +229,21 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
|
||||
}
|
||||
break;
|
||||
case 'redirect':
|
||||
if (typeof res.data == 'string')
|
||||
if (typeof res.data.url == 'string' &&
|
||||
typeof res.data.global == 'boolean')
|
||||
{
|
||||
window.location.href = res.data;
|
||||
//Special handling for framework reload
|
||||
if (res.data.url.indexOf("?cd=10") > 0)
|
||||
res.data.global = true;
|
||||
|
||||
if (res.data.global)
|
||||
{
|
||||
egw_topWindow().location.href = res.data.url;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href = res.data.url;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user