1. Christian Salazar
  2. YiiFileManagerFilePicker

Commits

Christian Salazar  committed 2087130

FIX ISSUE #4

  • Participants
  • Parent commits 8c25a9b
  • Branches master

Comments (0)

Files changed (2)

File assets/yiifilemanager-fileviewer-widget.js

View file
  • Ignore whitespace
 			// on success this call will launch the yiifileman_on_action() event
 			_send({ action: action , file_ids: file_ids }, function(ok,resp){
 				opts.onAfterAction(w,action, info, ok, resp);
-				if(ok){
+				if((ok==true) && (resp === true)){
 					if(action=='select'){
 						_cancel_method(w); // ok hide the dialog
 					}else

File demo-component/MyYiiFileManViewer.php

View file
  • Ignore whitespace
 
 	/**
 	 	do something in your own system whenever a 'select' or 'delete' action occurs.
+			
+		this error (if happens) can be shown in client side by implementing the
+		JS event handler: onAfterAction checking for argument 'response', it
+		will contain the value returned here and the dialog box will not close
+		until you return exactly: true (without quotes).
 
 	 	@param string $action 'select' or 'delete'
 		@param array $file_ids array of file_id numbers
-		@returns bool true|false values
+		@returns bool true or the error string. see more about in issue #4.
 	 */
 	public function yiifileman_on_action($action, $file_ids){
+		/*
+	    sample implementation:
+		if($action == 'select'){
+			extract($this->yiifileman_data());
+			$error="";
+			foreach($file_ids as $file_id){
+				$csv = $fileman->get_file_path($identity, $file_id);
+				if(true == Yii::app()->anyapi->validatePaymentsFile($csv,$error)){
+					//ok continue next file
+				}else{
+					return "please fix errors: ".$error;
+				}
+			}
+		}
+		*/
 		// call parent to perform default stuff
 		return parent::yiifileman_on_action($action, $file_ids);
 	}