From 1ba722b8d1d210e1215508db76f8ba9a16a577c7 Mon Sep 17 00:00:00 2001 From: ovclas Date: Wed, 4 Jul 2012 06:07:27 +0000 Subject: [PATCH] isseu 2112 improve setRedirectUrl method git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10829 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/module/ModuleObject.class.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index 3d87ec54b..0119ec3ce 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -28,6 +28,7 @@ var $stop_proc = false; ///< a flag to indicating whether to stop the execution of code. var $module_config = NULL; + var $ajaxRequestMethod = array('XMLRPC', 'JSON'); /** * setter to set the name of module @@ -54,8 +55,19 @@ * @remark redirect_url is used only for ajax requests * @return void **/ - function setRedirectUrl($url='./') { - $this->add('redirect_url', $url); + function setRedirectUrl($url='./', $output = NULL) { + $ajaxRequestMethod = array_flip($this->ajaxRequestMethod); + if(!isset($ajaxRequestMethod[Context::getRequestMethod()])) + { + $this->add('redirect_url', $url); + } + else + { + if($output !== NULL && is_object($output)) + { + return $output; + } + } } /**