- Rewrote redirect function

- Setting the webserver url in head
This commit is contained in:
Andreas Stöckel 2010-06-02 08:10:43 +00:00
parent b9f98321f5
commit ca263fc6d8
3 changed files with 11 additions and 4 deletions

View File

@ -320,6 +320,7 @@ abstract class egw_framework
'meta_robots' => $robots, 'meta_robots' => $robots,
'dir_code' => lang('language_direction_rtl') != 'rtl' ? '' : ' dir="rtl"', 'dir_code' => lang('language_direction_rtl') != 'rtl' ? '' : ' dir="rtl"',
'include_wz_tooltip'=> $include_wz_tooltip, 'include_wz_tooltip'=> $include_wz_tooltip,
'webserver_url' => $GLOBALS['egw_info']['server']['webserver_url'],
); );
} }

View File

@ -295,7 +295,8 @@ class egw_json_response
*/ */
public function redirect($url) public function redirect($url)
{ {
self::script("location.href = '$url';"); //self::script("location.href = '$url';");
$this->addGeneric('redirect', $url);
} }
/** /**

View File

@ -12,16 +12,15 @@
/* The egw_json_request is the javaScript side implementation of class.egw_json.inc.php.*/ /* The egw_json_request is the javaScript side implementation of class.egw_json.inc.php.*/
/* The constructor of the egw_json_request class. /* The constructor of the egw_json_request class.
* @param string _url the url of the AJAX handler on the server
* @param string _menuaction the menuaction function which should be called and which handles the actual request * @param string _menuaction the menuaction function which should be called and which handles the actual request
* @param array _parameters which should be passed to the menuaction function. * @param array _parameters which should be passed to the menuaction function.
*/ */
function egw_json_request(_url, _menuaction, _parameters) function egw_json_request(_menuaction, _parameters)
{ {
//Copy the supplied parameters //Copy the supplied parameters
this.menuaction = _menuaction; this.menuaction = _menuaction;
this.parameters = _parameters; this.parameters = _parameters;
this.url = _url; this.url = window.egw_webserverUrl + '/json.php';
this.sender = null; this.sender = null;
this.callback = null; this.callback = null;
this.alertHandler = this.alertFunc; this.alertHandler = this.alertFunc;
@ -134,6 +133,12 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
hasResponse = true; hasResponse = true;
} }
break; break;
case 'redirect':
if (typeof data.response[i].data == 'string')
{
window.location.href = data.response[i].data;
}
break;
} }
} }