Index: /pro-violet-viettel/www/deploy/20150304/assets/js/grid.js
===================================================================
--- /pro-violet-viettel/www/deploy/20150304/assets/js/grid.js	(revision 925)
+++ /pro-violet-viettel/www/deploy/20150304/assets/js/grid.js	(revision 926)
@@ -277,4 +277,9 @@
 			}
 
+			this.setHighLightNode = function (id, type) {
+				var node = $(oContainer).find('LI#'+type+id);
+				highlightNode(node);
+			}
+
 			this.selectAllNode = function () {
 				highLightAllNode();
Index: /pro-violet-viettel/www/deploy/20150304/assets/js/manager.js
===================================================================
--- /pro-violet-viettel/www/deploy/20150304/assets/js/manager.js	(revision 925)
+++ /pro-violet-viettel/www/deploy/20150304/assets/js/manager.js	(revision 926)
@@ -188,6 +188,4 @@
                                             .width();
                                     maxWidth = getDirTreeMaxWidth();
-
-                                    console.log(maxWidth);
 
                                     $(o.tree).height(dirTreeHeight - 5);
@@ -872,19 +870,38 @@
                                  * RENAME - START *
                                  **********************************************/
-                                	var rename = function (item) {
-                                		/*
-                                		 * item = {id,name,type,parentID,newName}
-                                		 */
-                                        var postdata = {
-                                                data: JSON.stringify(item)
-                                            };
-                                		 sendCommand({
-                                             postdata: postdata,
-                                             script: 'rename',
-                                             callbackSuccess: function (parseData) {
-                                                 console.log(parseData);
+                            	var rename = function (item) {
+                            		/*
+                            		 * item = {id,name,type,parentID,newName}
+                            		 */
+                                    var postdata = {
+                                            data: JSON.stringify(item)
+                                        };
+                            		 sendCommand({
+                                         postdata: postdata,
+                                         script: 'rename',
+                                         callbackSuccess: function (parseData) {
+                                        	 var newItem = null;
+                                             if (item.type == 'directory') {
+                                            	 newItem = parseData.DIRECTORIES;
+                                            	 o.data.DIRECTORIES[searchItemByID(item.id, 'directory')].name = newItem.name;
                                              }
-                                         });
-                                	}
+                                             else if (item.type == 'file') {
+                                            	 newItem = parseData.FILES;
+                                            	 o.data.FILES[searchItemByID(item.id, 'file')].name = newItem.name;
+                                             }
+
+                                             self.updateData({
+                                                 updateAll: true
+                                             });
+
+                                             o.oTree.refeshTree();
+                                             self.setTreeCurrentNode(item.parentID);
+                                             o.oGrid.setHighLightNode(item.id,item.type);
+                                         },
+                                         callbackFail: function (errors) {
+                                        	 alert (errors.err);
+                                         }
+                                     });
+                            	}
                                 /***********************************************
                                  * RENAME - END *
@@ -984,5 +1001,5 @@
                                                 },
                                                 callback: function (result) {
-                                                	console.log(items);
+                                                	//console.log(items);
                                                 }
                                         }
@@ -991,5 +1008,5 @@
                                     }
 
-                                    console.log(items);
+                                    //console.log(items);
                                 }
 
@@ -1079,5 +1096,5 @@
 
                                 this.searchParents = function (objDir) {
-                                	var parentID = objDir.parentID;
+                                	var parentID = objDir == undefined ? 0 : objDir.parentID;
                                 	var aryDirs = [];
 
@@ -1269,6 +1286,5 @@
                                             : o.oTree;
                                     if (!p.updateAll) {
-                                        var index = searchItemByID(p.item.id,
-                                                p.type);
+                                        var index = searchItemByID(p.item.id, p.type);
                                         switch (p.type) {
                                             case 'directory':
@@ -1360,4 +1376,5 @@
 
                                 	var nodeID = self.getTreeCurrentNode();
+                                	nodeID = nodeID == undefined ? 0 : nodeID;
                                 	if (nodeID != 0) {
                                 		var node = o.data.DIRECTORIES[searchItemByID(nodeID, 'directory')];
@@ -1371,13 +1388,15 @@
 
                                 	for(var idx = 0; idx < aryPath.length; idx++) {
-                                		var i = $('<i></i>',{'class':'ace-icon fa fa-folder home-icon'});
-                                		var a = $('<a></a>',{text: aryPath[idx].name});
-                                		var li = $('<li></li>');
-                                		if (aryPath[idx].id == 0)
-                                			$(li).append(i, a);
-                                		else
-                                			$(li).append(a);
-
-                                		$(navigatorBar).append(li);
+                                		if(aryPath[idx] != undefined ){
+	                                		var i = $('<i></i>',{'class':'ace-icon fa fa-folder home-icon'});
+	                                		var a = $('<a></a>',{text: aryPath[idx].name});
+	                                		var li = $('<li></li>');
+	                                		if (aryPath[idx].id == 0)
+	                                			$(li).append(i, a);
+	                                		else
+	                                			$(li).append(a);
+
+	                                		$(navigatorBar).append(li);
+                                		}
                                 	}
 
Index: /pro-violet-viettel/www/deploy/20150304/assets/js/tree.js
===================================================================
--- /pro-violet-viettel/www/deploy/20150304/assets/js/tree.js	(revision 925)
+++ /pro-violet-viettel/www/deploy/20150304/assets/js/tree.js	(revision 926)
@@ -5,7 +5,7 @@
 			if( o.data == undefined ) o.data = null;
 			if( o.rootName == undefined ) o.rootName = 'ThÆ° má»¥c gá»c';
-			
+
 			if( o.draggable == undefined ) o.draggable = false;
-			
+
 			if( o.expandSpeed == undefined ) o.expandSpeed= 500;
 			if( o.collapseSpeed == undefined ) o.collapseSpeed= 500;
@@ -13,5 +13,5 @@
 			if( o.collapseEasing == undefined ) o.collapseEasing = null;
 			if( o.manager ==  undefined) o.manager = null;
-			
+
 			var treeNodes = [];
 			var oContainer = this;
@@ -19,7 +19,7 @@
 			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
@@ -28,9 +28,9 @@
 				if( node.showContextMenu == undefined ) node.showContextMenu = true; //0: collapsed; 1:expanded;
 				if (node.callback == undefined ) node.callback = null;
-				
+
 				var nodeClass = node.isRoot == true ? 'home':'directory';
 				var hidden = (node.isRoot == true || node.item.parentID == 0 ) ? null:'display:none';
 				var defaulState = (node.isRoot == false && node.defaultStatus == 1 ) ? 'expanded' : 'collapsed';
-				
+
 				var a = $('<a></a>',{id: node.item.id,href: '#',rel: node.item.name,text: node.item.name});
 				var li = $('<li></li>',{'class': nodeClass,rel: 'folder'})
@@ -39,5 +39,5 @@
 				var ul = null;
 				bindNodeEvents(a);
-				
+
 				treeNodes[node.item.id] = {id:node.item.id, name:node.item.name, parentID:node.item.parentID, html:ul, status:defaulState, isRoot:node.isRoot};
 				if (node.isRoot == true) {
@@ -47,5 +47,5 @@
 				else {
 					var preUL = $(oContainer).find('UL.vstree[rel^="node-1"]');
-					
+
 					if (preUL != null) {
 						if (node.item.parentID == 0) {
@@ -63,5 +63,5 @@
 							for (var i = 0; i < $(liArray).length; i++) {
 								var id = $(liArray[i]).find('A').attr('id');
-								
+
 								if (id == node.item.parentID) {
 									var groupUL = $(oContainer).find('UL.vstree[rel^="node' + id + '"]');
@@ -78,22 +78,22 @@
 					}
 				}
-				
+
 				if (node.callback != null) node.callback(this);
 				//return (parentNode.length == 1);
 				return true;
 			};
-			
+
 			var bindNodeEvents = function (node) {
 				if (node == null) return false;
-								
+
 				//click event
 				$(node).bind("click", function (e){if(e.button == 0)nodeClick(this);return false;});
 			};
-			
+
 			var nodeClick = function (node) {
 				var folderID = $(node).attr('id');
 				selectedNode = highlightNode(node);
 				o.manager.setTreeCurrentNode(folderID);
-				
+
 				if (treeNodes[folderID].isRoot) {
 					return;
@@ -107,8 +107,8 @@
 					treeNodes[folderID].status = 'collapsed';
 				}
-				
+
 				o.manager.refreshStatusBar();
 			};
-			
+
 			var highlightNode = function (node) {
 				$(oContainer).find('.currentDir').removeClass('currentDir');
@@ -117,5 +117,5 @@
 				return node;
 			}
-			
+
 			var expandNode = function (node) {
 				var li = $(node).parent();
@@ -123,5 +123,5 @@
 				$(li).removeClass('collapsed').addClass('expanded');
 			};
-			
+
 			var collapseNode = function (node) {
 				var li = $(node).parent();
@@ -129,14 +129,14 @@
 				$(li).removeClass('expanded').addClass('collapsed');
 			};
-			
+
 			var isCollapsedNode = function (node) {
 				return $(node).parent().hasClass('collapsed');
 			}
-			
+
 			var nodeIsExisted = function (nodeID) {
 				var node = $(oContainer).find('UL.vstree LI.directory > A#' + nodeID);
 				return ($(node).length > 0) ? node : false;
 			}
-			
+
 			var initTree = function () {
 				$(oContainer).attr('unselectable','on')
@@ -154,9 +154,9 @@
 					return;
 				}
-				
+
 				o.data.sort(function (a,b) {
 					return a.parentID - b.parentID;
 				});
-				
+
 				$(oContainer).find ('.vstree').remove();
 				var homeNode = createNode({
@@ -164,5 +164,5 @@
 					isRoot: true
 				});
-				
+
 				if (homeNode && o.data.length > 0) {
 					for (var i = 0; i < o.data.length; i++) {
@@ -172,5 +172,5 @@
 				o.manager.setTreeCurrentNode(0);
 			};
-			
+
 			/******************
 			 * RENAME - START *
@@ -186,5 +186,5 @@
 						e.stopPropagation();
 					});
-				
+
 				$(node).text('');
 				$(node).append(editor);
@@ -192,5 +192,5 @@
 				$(editor).select();
 			}
-			
+
 			var renameCancel = function (node) {
 				var dirID = $(node).attr('id');
@@ -199,19 +199,33 @@
 				$(node).focus();
 			}
-			
+
 			var renameComplete = function (node) {
 				var editor = $(node).find('>INPUT');
-				var dirID = $(node).attr('id');
+				var id = $(node).attr('id');
+				var idx = o.manager.searchItemByID(id, 'directory');
+				var dir = o.data[idx];
+				var name = dir.name;
 				var newName = $(editor).val();
+
+				var item = {
+						id:id,
+						name:name,
+						type:'directory',
+						parentID: dir.parentID,
+						newName:newName
+						};
+
+				o.manager.rename(item);
+
 				$(node).attr('rel', newName);
 				$(node).text(newName);
 				$(node).find('>INPUT').remove();
-				treeNodes[dirID].name = newName;
-				updateData(dirID, 'rename');
+				/*treeNodes[id].name = newName;
+				updateData(id, 'rename');*/
 			}
 			/******************
 			 * RENAME - END *
 			 ******************/
-			
+
 			/******************
 			 * DELTE - START *
@@ -238,8 +252,8 @@
 					}
 				}
-				
+
 				o.manager.updateData({item:treeNodes[id], from:'tree', type:'directory', callback:act});
 			}
-			
+
 			this.createNode = function (node) {
 				createNode ({item: node});
@@ -248,9 +262,9 @@
 				});
 				if (node.parentID != 0) {
-					var parentNode = $(oContainer).find('UL LI > A#' + node.parentID);				
+					var parentNode = $(oContainer).find('UL LI > A#' + node.parentID);
 					expandNode(parentNode);
 				}
 			}
-			
+
 			this.activeNode = function (node) {
 				var dirID = $(node).attr('id');
@@ -266,31 +280,35 @@
 					var node = nodeIsExisted(o.data[i].id);
 					var defaulState = isCollapsedNode(node) ? 0:1;
-					if (node == false) 
+					if (node == false)
 						createNode ({item: o.data[i],defaulState:defaulState});
+					else {
+						var node = $(oContainer).find('UL.vstree LI.directory > A#' + o.data[i].id);
+						$(node).text(o.data[i].name);
+					}
 				}
 
 				o.manager.setTreeCurrentNode($(selectedNode).attr('id'));
 			}
-			
+
 			this.getSelectedNode = function () {
 				return selectedNode;
 			}
-			
+
 			this.deletion = function (id) {
 				destroyNode($(oContainer).find('A#'+id));
 			}
-			
+
 			this.findNodebyID = function (id) {
-				
-			}
-			
+
+			}
+
 			this.setData = function (data) {
 				o.data = data;
 			}
-			
+
 			this.getRoot = function () {
 				return treeNodes[0];
 			}
-			
+
 			this.createCopyNode = function (data) {
 				for(var i in data) {
@@ -311,14 +329,14 @@
 				return true;
 			}
-			
+
 			this.getRootName = function () {
 				return o.rootName;
 			}
-			
+
 			this.initialize = function () {
 				initTree();
 				return this;
 			};
-			
+
 			return this.initialize();
 		}
