christiansalazar avatar christiansalazar committed 52f49ab

more info available when onSuccess

Comments (0)

Files changed (5)

IYiiFileManagerAction.php

 	public function isValidRequest($listener, $ipsource,&$error);
 	public function onDataArrival($instance, $identity, $file_id);
 	// must be used to give response to the caller end point
-	public function onSuccess($transid="");
+	public function onSuccess($transid="",$data=null);
 	public function onError($error, $extra="",$transid="");
 }
 		
 		in your own extended class (protected/components/MyIncomingDataAction.php):
 
-			public function onSuccess($transid){
+			public function onSuccess($transid,$data=null){
+				// data is an array containing more info, see the base class action for details.
 				echo "OK".$transid;
 			}
 			public function onError($error, $info="", $transid=""){

YiiFileManagerAbstractAction.php

 	public function getApi(){
 		return new YiiFileManagerRemoteApi();
 	}
-	public function onSuccess($transactionid=""){
+	public function onSuccess($transactionid="",$data=null){
 		// do nothing in this default implementation
 		// maybe: echo "OK"; to 
 	}
 					$file_id = $item; }else $file_id = $resp;
 				$this->onDataArrival($instance, $listener['identity_id'], $file_id);
 				// happy ending
-				$this->onSuccess($tid);
-				return array($tid, $listener, $instance, $file_id);
+				$this->onSuccess($tid, array($listener, $instance, $file_id));
+				return true;
 			}
 		}else{
 			$this->onError("invalid_request",$error,$tid);

templates/MyIncomingDataAction.php

 	public function getFilemanager(){
 		return Yii::app()->fileman; 
 	}
-	public function onSuccess($transid=""){
+	public function onSuccess($transid="",$data=null){
 		
 	}
 	public function onError($error, $extra="",$transid=""){

templates/YiiFileManagerRemoteTesterCommand.php

 	public function getFilemanager(){
 		return filemanager();
 	}
-	public function onSuccess($tid=""){
-		printf("transactionId successfull: %s\n",$tid);
+	public function onSuccess($tid="",$data=null){
+		printf("transactionId successfull: %s, data(json)=%s\n",
+			$tid,json_encode($data));
 	}
 	public function onError($a, $b="",$tid=""){
-		printf(__METHOD__.": %s, %s\n",$a,$b);
+		printf(__METHOD__.": transid=%s, %s, %s\n",$tid, $a,$b);
 	}
 }
 //
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.