Index: pro-bachkim-filespace/sourcecode/assets/js/grid.js
===================================================================
--- pro-bachkim-filespace/sourcecode/assets/js/grid.js	(revision 139)
+++ pro-bachkim-filespace/sourcecode/assets/js/grid.js	(revision 140)
@@ -118,7 +118,7 @@
 				var parentDirID = o.manager.getTreeCurrentNode();
 				if (o.data.DIRECTORIES.length > 0) {
-					for (var i = 0; i < o.data.DIRECTORIES.length; i++) {
-						if (o.data.DIRECTORIES[i].parentID == parentDirID) {
-							var li = createNode ({item: o.data.DIRECTORIES[i]});
+					for (var d in o.data.DIRECTORIES) {
+						if (o.data.DIRECTORIES[d].parentID == parentDirID) {
+							var li = createNode ({item: o.data.DIRECTORIES[d]});
 							$(ul).append(li);
 						}
@@ -127,7 +127,7 @@
 				
 				if (o.data.FILES.length > 0) {
-					for (var i = 0; i < o.data.FILES.length; i++) {
-						if (o.data.FILES[i].parentID == parentDirID) {
-							var li = createNode ({item: o.data.FILES[i]});
+					for (var f in o.data.FILES) {
+						if (o.data.FILES[f].parentID == parentDirID) {
+							var li = createNode ({item: o.data.FILES[f]});
 							$(ul).append(li);
 						}
@@ -192,5 +192,5 @@
 			 ******************/
 			
-			this.reloadGrid = function (nodeID) {
+			this.reloadGrid = function () {
 				initGrid();
 			}
Index: pro-bachkim-filespace/sourcecode/assets/js/manager.js
===================================================================
--- pro-bachkim-filespace/sourcecode/assets/js/manager.js	(revision 139)
+++ pro-bachkim-filespace/sourcecode/assets/js/manager.js	(revision 140)
@@ -197,6 +197,9 @@
 				}
 				
-				for (var i = 0; i < data.length; i++) {
-					if (data[i].id == id) return i;
+				//for (var i = 0; i < data.length; i++) {
+				for (var i in data) {
+					if (data[i].id == id) {
+						return i;
+					}
 				}
 			}
@@ -218,5 +221,5 @@
 				}
 				
-				for (var i = 0; i < data.length; i++) {
+				for(i in data) {
 					if (data[i].parentID == parentID) {
 						aryItem[index] = data[i];
@@ -238,5 +241,4 @@
 									self.updateData({updateAll:true});
 									o.oTree.refeshTree();
-									console.log(o);
 								},
 								callbackDone:function () {$(o).find('i').removeClass('icon-spin');},
@@ -261,5 +263,5 @@
 			
 			var btnCopyClick = function () {				
-				copy();
+				copy('copy');
 			}
 
@@ -268,4 +270,7 @@
 			}
 			
+			var btnCutClick = function () {
+				copy('move');
+			}
 			
 			var bindEventToToolbars = function () {
@@ -275,8 +280,8 @@
 				$(btnDel).click(function(e){btnDelClick()});
 				$(btnCopy).click(function(e){btnCopyClick()});
+				$(btnCut).click(function(e){btnCutClick()});
 				$(btnPaste).click(function(e){btnPasteClick()})
 				
-				/*btnCut
-				btnShare
+				/*btnShare
 				btnPreview
 				btnDownload
@@ -364,5 +369,5 @@
 					o.oTree.createNode(node);
 					o.data.DIRECTORIES[$(o.data.DIRECTORIES).length] = node;
-					if (o.oGrid) o.oGrid.reloadGrid(parseData.parentID);
+					if (o.oGrid) o.oGrid.reloadGrid();
 				}
 			}
@@ -372,6 +377,6 @@
 			/********************************
 			 * COPY & PASTE & MOVE - START  *
-			 ************=*******************/
-			var copy = function (){
+			 ************=*******************/	
+			var copy = function (act){
 				//detect selected items
 				//push to clipboard
@@ -381,4 +386,7 @@
 					var node = o.oTree.getSelectedNode();
 					var itemID = $(node).attr('id');
+					
+					if (itemID == 0) return false;
+					
 					items[0] = o.data.DIRECTORIES[searchItemByID(itemID, 'directory')];
 					items[0].type = 'directory';
@@ -387,6 +395,7 @@
 				if ($(items).length > 0) {
 					oClipBoard.items = items;
-					oClipBoard.act = 'copy';
-				}
+					oClipBoard.act = act;
+				}
+				return true;
 			}
 			
@@ -398,24 +407,46 @@
 				var items = [];
 				var destination = self.getTreeCurrentNode();
-
-				$(oClipBoard.items).each(function (index) {
-					var node = new Object;
-					if (this.type == 'directory')
-						buildTreeFromParent(this.id, node);
-					else {
-						node.id = this.id;
-						node.type = 'file';
-					}
-
-					items[index] = node;
-				});
-
-				var postdata = {destination:destination,data:JSON.stringify(items)};
-				var script = 'copy';
+				if (oClipBoard.act != 'copy') {
+					$(oClipBoard.items).each(function (index) {
+						var node = new Object;
+						if (this.type == 'directory')
+							buildTreeFromParent(this.id, node);
+						else {
+							node.id = this.id;
+							node.type = 'file';
+						}
+	
+						items[index] = node;
+					});
+				}
+				else {
+					items = oClipBoard.items;
+				}
+				
+				var postdata = {act:oClipBoard.act,destination:destination,data:JSON.stringify(items)};
+				var script = oClipBoard.act;
+				
 				sendCommand ({
 					postdata:postdata,
 					script:script,
 					callbackSuccess:function(parseData){
-						console.log(parseData);
+						if (oClipBoard.act == 'copy'){
+							$(parseData.DIRECTORIES).each(function (index) {
+								o.data.DIRECTORIES[$(o.data.DIRECTORIES).length] = this;
+							});
+							
+							$(parseData.FILES).each(function (index) {
+								o.data.FILES[$(o.data.FILES).length] = this;
+							});
+													
+							o.data.DIRECTORIES.sort(function (a,b) {
+								return a.parentID - b.parentID;
+							});						
+							
+							o.oTree.setData (o.data.DIRECTORIES);
+							o.oGrid.setData (o.data);						
+							o.oTree.createCopyNode(parseData.DIRECTORIES);
+							o.oGrid.reloadGrid();
+						}
 					}
 				});
@@ -424,5 +455,5 @@
 
 			var move = function () {
-
+				
 			}
 
@@ -453,4 +484,6 @@
 				
 				confirmText += '<br /><div style="color:red">(hÃ nh Äá»ng nÃ y sáºœ xÃ³a táº¥t cáº£ thÆ° má»¥c con vÃ  cÃ¡c file trong cÃ¡c thÆ° má»¥c ÄÃ£ chá»n)</div>';
+				
+				var parentID = item[0].parentID;
 				
 				for (var i = 0; i < item.length; i++) {
@@ -496,5 +529,5 @@
 									var delobj = JSON.stringify(item);
 									var postdata = {delobj:delobj};
-									var script = 'deletedir';
+									var script = 'delete';
 									sendCommand ({
 										postdata:postdata,
@@ -516,31 +549,21 @@
 										},
 										callbackDone: function (obj) {
-											var dirs = [];
-											var files = [];
 											if($(parseData.DIRECTORIES).length > 0) {
-												$(o.data.DIRECTORIES).each(function (index){
-													var found = $.inArray(this.id, parseData.DIRECTORIES);
-													if(found == -1) {
-														dirs[$(dirs).length] = this;
-													}
+												$(parseData.DIRECTORIES).each(function(index){
+													delete o.data.DIRECTORIES[searchItemByID(this, 'directory')];
 												});
-												
-												o.data.DIRECTORIES = dirs;
 											}
 											
 											if($(parseData.FILES).length > 0) {
-												$(o.data.FILES).each(function (index){
-													var found = $.inArray(this.id, parseData.FILES);
-													if(found == -1) {
-														files[$(dirs).length] = this;
-													}
-												})
-												
-												o.data.FILES = files;
+												$(parseData.FILES).each(function(index){
+													delete o.data.FILES[searchItemByID(this, 'file')];
+												});
 											}
 											
 											o.oTree.setData (o.data.DIRECTORIES);
 											o.oGrid.setData (o.data);
-										},
+											self.setTreeCurrentNode(parentID);
+											o.oGrid.reloadGrid();
+									},
 										callbackFail: function(){}
 									});
@@ -556,5 +579,5 @@
 				//then fire action of Grid
 				treeCurrentNode = treeNode;
-				if (o.oGrid) o.oGrid.reloadGrid(treeNode);
+				if (o.oGrid) o.oGrid.reloadGrid();
 			};
 			
Index: pro-bachkim-filespace/sourcecode/assets/js/tree.js
===================================================================
--- pro-bachkim-filespace/sourcecode/assets/js/tree.js	(revision 139)
+++ pro-bachkim-filespace/sourcecode/assets/js/tree.js	(revision 140)
@@ -18,7 +18,7 @@
 			var selectedNode = null;
 			var documentBoundEvent = false;
+			var self = this;
 			
 			var createNode = function (node) {
-				
 				if( !node ) var node = {};
 				if( node.item == undefined ) node.item = null; //item.id, item.name, item.parentID
@@ -258,5 +258,6 @@
 
 			this.refeshTree = function () {
-				for (var i = 0; i < o.data.length; i++) {
+				//for (var i = 0; i < o.data.length; i++) {
+				for (var i in o.data) {
 					var node = nodeIsExisted(o.data[i].id);
 					var defaulState = isCollapsedNode(node) ? 0:1;
@@ -287,9 +288,11 @@
 				return treeNodes[0];
 			}
-
-			this.initialize = function () {
-				initTree();
-				return this;
-			};
+			
+			this.createCopyNode = function (data) {
+				for(var i in data) {
+					createNode ({item: data[i]});
+				}
+				self.refeshTree();
+			}
 
 			this.rename = function (key) {
@@ -305,4 +308,9 @@
 			}
 			
+			this.initialize = function () {
+				initTree();
+				return this;
+			};
+			
 			return this.initialize();
 		}
