Index: pro-violet-viettel/www/deploy/api/platform/modules/space/actions/actions.class.php
===================================================================
--- pro-violet-viettel/www/deploy/api/platform/modules/space/actions/actions.class.php	(revision 876)
+++ pro-violet-viettel/www/deploy/api/platform/modules/space/actions/actions.class.php	(revision 878)
@@ -18,21 +18,43 @@
         $this->forward('default', 'module');
     }
-
-    private function CreateSpaceDir($folderName, $parentId, $userId) {
-        $c = new Criteria();
+    
+    private function autoDirName ($folderName, $parentId, $userId) {
+    	
+    	$c = new Criteria();
+    	$c->add(TblspacecategoryPeer::CAT_PARENT, $parentId);
+    	$c->add(TblspacecategoryPeer::CAT_USER, $userId);
+    	$c->add(TblspacecategoryPeer::CAT_NAME, $folderName);
+    	$category = TblspacecategoryPeer::doSelectOne($c);
+    	
+    	if (!is_null($category)) {
+    		$newFolderName = 'Copy of ' . $folderName;
+    		$folderName = $this->autoDirName($newFolderName, $parentId, $userId);
+    	}
+    	
+    	return $folderName;
+    }
+
+    private function CreateSpaceDir($folderName, $parentId, $userId, &$objNewDir = null) {
+        /* $c = new Criteria();
         $c->add(TblspacecategoryPeer::CAT_PARENT, $parentId);
         $c->add(TblspacecategoryPeer::CAT_USER, $userId);
         $c->add(TblspacecategoryPeer::CAT_NAME, $folderName);
         $category = TblspacecategoryPeer::doSelectOne($c);
-        if ($category != null) {
+        error_log(var_export($category, TRUE) . "\n", 3, '/srv/www/sbg/log/filename.log');
+        
+        if (!is_null($category)) {
             $folderName = 'Copy of ' . $folderName;
-        } else {
-            $category = new Tblspacecategory();
-            $category->setCatName($folderName);
-            $category->setCatParent($parentId);
-            $category->setCatUser($userId);
-            $category->setCatDate(date('Y-m-d H:i:s'));
-            $category->save();
-        }
+        } */
+        
+    	$folderName = $this->autoDirName($folderName, $parentId, $userId);
+    	
+        $category = new Tblspacecategory();
+        $category->setCatName($folderName);
+        $category->setCatParent($parentId);
+        $category->setCatUser($userId);
+        $category->setCatDate(date('Y-m-d H:i:s'));
+        $category->save();
+        
+        $objNewDir = $category;
         return $category->getCatId();
     }
@@ -88,15 +110,14 @@
         $c->add(TblspacecategoryPeer::CAT_USER, $userId);
         $currentDir = TblspacecategoryPeer::doSelectOne($c);
-        
-        $newDirID = $this->CreateSpaceDir($currentDir->getCatName(), $destination, $userId);
+        $objNewDir = null;
+        
+        $newDirID = $this->CreateSpaceDir($currentDir->getCatName(), $destination, $userId, $objNewDir);
         
         $newDir = new stdClass();
         $newDir->id = $newDirID;
-        $newDir->name = $sourceObj->name;
+        $newDir->name = $objNewDir->getCatName();
         $newDir->parentID = $destination;
         
         $aryNewTree['DIRECTORIES'][] = $newDir;
-        
-        error_log(date('YmdHis').' - $aryNewTree: '.var_export($aryNewTree, TRUE), 3, '/srv/www/sgb/log/file.log');
         
         if (isset($sourceObj->childDirs)) {
@@ -283,8 +304,10 @@
 
     public function executeMkdir() {
+    	$objNewDir = null;
         $userId = $this->getRequestParameter('userid');
         $parentId = $this->getRequestParameter('parent_id');
         $folderName = $this->getRequestParameter('name');
-        $this->catId = $this->CreateSpaceDir($folderName, $parentId, $userId);
+        $this->catId = $this->CreateSpaceDir($folderName, $parentId, $userId, $objNewDir);
+        $this->catName = $objNewDir->getCatName();
         $this->errCode = '';
         $this->errMsg = '';
@@ -410,4 +433,5 @@
         $this->errCode = '';
         $this->aryNewTree = $aryNewTree;
+        error_log(date('YmdHis').' - $aryNewTree: '.var_export($aryNewTree, TRUE), 3, '/srv/www/sbg/log/file.log');
     }
 
Index: pro-violet-viettel/www/deploy/api/platform/modules/space/templates/mkdirSuccess.php
===================================================================
--- pro-violet-viettel/www/deploy/api/platform/modules/space/templates/mkdirSuccess.php	(revision 876)
+++ pro-violet-viettel/www/deploy/api/platform/modules/space/templates/mkdirSuccess.php	(revision 878)
@@ -1,1 +1,1 @@
-<status id="<?php echo $catId; ?>" err="<?php echo $errMsg; ?>" errCode="<?php echo $errCode; ?>" />
+<status id="<?php echo $catId; ?>" name="<?php echo $catName ? $catName : '';?>" err="<?php echo $errMsg; ?>" errCode="<?php echo $errCode; ?>" />
