Permalink
Browse files

Ajax now returns arguments

  • Loading branch information...
1 parent 88610f0 commit 8977d02ad16887dc938725fb8932e4503d8d7a38 @deepwinter deepwinter committed May 6, 2011
Showing with 16 additions and 6 deletions.
  1. +16 −6 modules/mopcore/classes/controller/ajax.php
@@ -22,6 +22,7 @@ public function action_handleRequest($uri){
public function action_data($uri)
{
//request to child, just data
+ $arguments = explode('/', $uri);
try {
$subRequest = Request::Factory($uri);
@@ -31,22 +32,26 @@ public function action_data($uri)
$message = $e->getMessage() . $e->getTrace();
$ajaxResponse = array(
'returnValue' => FALSE,
- 'response' => $message
+ 'response' => $message,
+ 'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
return;
}
$ajaxResponse = array(
'returnValue' => TRUE,
- 'response'=>$data
+ 'response'=>$data,
+ 'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
}
public function action_html($uri)
{
+ $arguments = explode('/', $uri);
+
try {
$subRequest = Request::Factory($uri);
$html = $subRequest->execute()->data();
@@ -55,7 +60,8 @@ public function action_html($uri)
$message = $e->getMessage() . $e->getTrace();
$ajaxResponse = array(
'returnValue' => FALSE,
- 'response' => $message
+ 'response' => $message,
+ 'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
@@ -87,12 +93,15 @@ public function action_html($uri)
'css'=>$cssResources
),
'returnValue' => TRUE,
+ 'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
}
public function action_compound($uri)
{
+ $arguments = explode('/', $uri);
+
try {
$subRequest = Request::Factory($uri);
$requestResponse = $subRequest->execute();
@@ -101,8 +110,8 @@ public function action_compound($uri)
$message = $e->getMessage() . $e->getTrace();
$ajaxResponse = array(
'returnValue' => FALSE,
- 'response' => $message
-
+ 'response' => $message,
+ 'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
return;
@@ -134,7 +143,8 @@ public function action_compound($uri)
);
$ajaxResponse = array(
'returnValue' => TRUE,
- 'response'=>$compoundResponse
+ 'response'=>$compoundResponse,
+ 'arguments'=>$arguments
);
$this->response->body(json_encode($ajaxResponse));
}

0 comments on commit 8977d02

Please sign in to comment.