diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index a6edd85670..aed0ecc9ba 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -320,6 +320,7 @@ abstract class egw_framework 'meta_robots' => $robots, 'dir_code' => lang('language_direction_rtl') != 'rtl' ? '' : ' dir="rtl"', 'include_wz_tooltip'=> $include_wz_tooltip, + 'webserver_url' => $GLOBALS['egw_info']['server']['webserver_url'], ); } diff --git a/phpgwapi/inc/class.egw_json.inc.php b/phpgwapi/inc/class.egw_json.inc.php index 7de187d89b..8450e60592 100644 --- a/phpgwapi/inc/class.egw_json.inc.php +++ b/phpgwapi/inc/class.egw_json.inc.php @@ -295,7 +295,8 @@ class egw_json_response */ public function redirect($url) { - self::script("location.href = '$url';"); + //self::script("location.href = '$url';"); + $this->addGeneric('redirect', $url); } /** diff --git a/phpgwapi/js/egw_json.js b/phpgwapi/js/egw_json.js index 6699c2adce..4ff51497a4 100644 --- a/phpgwapi/js/egw_json.js +++ b/phpgwapi/js/egw_json.js @@ -12,16 +12,15 @@ /* The egw_json_request is the javaScript side implementation of class.egw_json.inc.php.*/ /* 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 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 this.menuaction = _menuaction; this.parameters = _parameters; - this.url = _url; + this.url = window.egw_webserverUrl + '/json.php'; this.sender = null; this.callback = null; this.alertHandler = this.alertFunc; @@ -134,6 +133,12 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe hasResponse = true; } break; + case 'redirect': + if (typeof data.response[i].data == 'string') + { + window.location.href = data.response[i].data; + } + break; } }