From 46f81649eb217bbef513f5c7bd39d1def66f836a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 25 Aug 2013 15:14:19 +0000 Subject: [PATCH] also fix calls to deprecated ajaxResponse class to use egw_json_response singleton, should be fixed in code for current apps --- .../inc/class.notifications_ajax.inc.php | 7 +--- phpgwapi/inc/class.egw_json.inc.php | 38 +++++-------------- 2 files changed, 11 insertions(+), 34 deletions(-) diff --git a/notifications/inc/class.notifications_ajax.inc.php b/notifications/inc/class.notifications_ajax.inc.php index 54fcf38d26..008bb8f389 100644 --- a/notifications/inc/class.notifications_ajax.inc.php +++ b/notifications/inc/class.notifications_ajax.inc.php @@ -81,7 +81,7 @@ class notifications_ajax { /** * the xml response object * - * @var xajaxResponse + * @var egw_json_response */ private $response; @@ -90,10 +90,7 @@ class notifications_ajax { * */ public function __construct() { - if(class_exists('xajaxResponse')) - { - $this->response = new xajaxResponse(); - } + $this->response = egw_json_response::get(); $this->recipient = (object)$GLOBALS['egw']->accounts->read($GLOBALS['egw_info']['user']['account_id']); $this->config = (object)config::read(self::_appname); diff --git a/phpgwapi/inc/class.egw_json.inc.php b/phpgwapi/inc/class.egw_json.inc.php index 047b287eb7..76736e248f 100644 --- a/phpgwapi/inc/class.egw_json.inc.php +++ b/phpgwapi/inc/class.egw_json.inc.php @@ -590,26 +590,16 @@ class egw_json_response /** * Deprecated legacy xajax wrapper functions for the new egw_json interface */ -class xajaxResponse extends egw_json_response +class xajaxResponse { - public function addScript($script) + public function __call($name, $args) { - $this->script($script); - } - - public function addAlert($message) - { - $this->alert($message, ''); - } - - public function addAssign($id, $key, $value) - { - $this->assign($id, $key, $value); - } - - public function addRedirect($url) - { - $this->redirect($url); + if (substr($name, 0, 3) == 'add') + { + $name = substr($name, 3); + $name[0] = strtolower($name[0]); + } + return call_user_func_array(array(egw_json_response::get(), $name), $args); } public function addScriptCall($func) @@ -617,17 +607,7 @@ class xajaxResponse extends egw_json_response $args = func_get_args(); $func = array_shift($args); - $this->apply($func, $args); - } - - public function addIncludeCSS($url) - { - $this->includeCSS($url); - } - - public function addIncludeScript($url) - { - $this->includeScript($url); + return call_user_func(array(egw_json_response::get(), 'apply'), $func, $args); } public function getXML()