Index: /branches/2.2/filemanager/tp/expressowindow/xsl/upload.xsl
===================================================================
--- /branches/2.2/filemanager/tp/expressowindow/xsl/upload.xsl	(revision 3898)
+++ /branches/2.2/filemanager/tp/expressowindow/xsl/upload.xsl	(revision 3913)
@@ -36,5 +36,5 @@
 					<span style="margin-right:{($width)-250}px;">
 						<label style="margin-left:1px;"><xsl:value-of select="$lang_file"/></label>
-						<label style="margin-left:200px;"><xsl:value-of select="$lang_comment"/></label>
+						<label style="margin-left:210px;"><xsl:value-of select="$lang_comment"/></label>
 					</span>
 					<br/>
Index: /branches/2.2/filemanager/inc/class.vfs_functions.inc.php
===================================================================
--- /branches/2.2/filemanager/inc/class.vfs_functions.inc.php	(revision 3019)
+++ /branches/2.2/filemanager/inc/class.vfs_functions.inc.php	(revision 3913)
@@ -66,27 +66,26 @@
 			// here local vars are created from the HTTP vars
 			@reset($GLOBALS['HTTP_POST_VARS']);
-			while(list($name,) = @each($GLOBALS['HTTP_POST_VARS']))
-			{
-				$this->$name = $GLOBALS['HTTP_POST_VARS'][$name];
+			while( list($name,) = @each($GLOBALS['HTTP_POST_VARS']) )
+			{
+				$this->$name = base64_decode($GLOBALS['HTTP_POST_VARS'][$name]);
 			}
 
 			@reset($GLOBALS['HTTP_GET_VARS']);
-			while(list($name,) = @each($GLOBALS['HTTP_GET_VARS']))
+			while(list($name,) = @each($GLOBALS['HTTP_GET_VARS']) )
 			{
 				$$name = $GLOBALS['HTTP_GET_VARS'][$name];
 				$this->$name = $GLOBALS['HTTP_GET_VARS'][$name];
-
 			}
 
 			$to_decode = array
 			(
-				'op'	=> array('op' => ''),
+				'op'		=> array('op' => ''),
 				'path'	=> array('path' => ''),
-				'file'	=> array('file' => ''),
+				'file'		=> array('file' => ''),
 				'sortby'	=> array('sortby' => ''),
 				'messages'	=> array('messages'	=> ''),
 				'comment'	=> array('comment' => ''),
 				'from'	=> array('from' => ''),
-				'fileman' => array('fileman' => ''),
+				'fileman'	=> array('fileman' => ''),
 				'to'	=> array('to' => '')
 			);
@@ -122,5 +121,5 @@
 				}
 			}
-
+			
 			// get appl. and user prefs
 			$pref = CreateObject('phpgwapi.preferences', $this->bo->userinfo['username']);
@@ -131,10 +130,11 @@
 
 			//always show name
-
 			$this->prefs[name] =1;		
 			
 		}
-	// String format is YYYY-MM-DD HH:MM
-		function dateString2timeStamp($string){
+		
+		// String format is YYYY-MM-DD HH:MM
+		function dateString2timeStamp($string)
+		{
 			return mktime($string[11].$string[12],
 				$string[14].$string[15],
@@ -145,4 +145,5 @@
 				$string[2].$string[3]);
 		}
+		
 		function verifyLock($file,$relative){
 			$ls_array = $this->bo->vfs->ls(array(
@@ -408,32 +409,37 @@
 		function rename()
 		{
-			if ($this->file)
-			{
-				if($badchar = $this->bo->bad_chars($this->to, True, True))
-				{
-					echo "Error|badchar|".$badchar;
-					return false;
+			$_return = array();
+			
+			if ( $this->file )
+			{
+				if( $badchar = $this->bo->bad_chars($this->to, True, True) )
+				{
+					$_return[] = array( "error" => $badchar);	
 				}
 				if(ereg("/", $this->to) || ereg("\\\\", $this->to))
 				{
-					echo "Error|slashes";
-					return false;
+					$_return[] = array( "error"=> "slashes");
 				}
 				elseif(!$this->verifyLock($this->file,RELATIVE_CURRENT))
-					echo "Error|editing";
+				{
+					$_return[] = array( "error" => "editing" );
+				}
 				elseif ($this->bo->vfs->mv(array(
-					'from'  => $this->path.'/'.$this->file,
-					'to'    => $this->path.'/'.$this->to,
-					'relatives' => array(RELATIVE_NONE,RELATIVE_NONE)
+						'from'  => $this->path.'/'.$this->file,
+						'to'    => $this->path.'/'.$this->to,
+						'relatives' => array(RELATIVE_NONE,RELATIVE_NONE)
 				)))
 				{
-					echo "True|".$this->file."|".$this->to;
+					$_return[] = array( "true" => lang('renamed %1 to %2', $this->file ,$this->to ) );
 				}
 				else
 				{
-					echo "Error|".$this->file."|".$this->to;
-				}
-			}
-		}
-
+					$_return[] = array("error" => $this->file . " " . $this->to );
+				}
+			}
+			else
+				$_return[] = array("error" => "whitout file ");
+			
+			echo serialize( $_return );
+		}
 	}
Index: /branches/2.2/filemanager/inc/class.uifilemanager.inc.php
===================================================================
--- /branches/2.2/filemanager/inc/class.uifilemanager.inc.php	(revision 3897)
+++ /branches/2.2/filemanager/inc/class.uifilemanager.inc.php	(revision 3913)
@@ -394,5 +394,5 @@
 
 
-		if ($_SESSION['phpgw_info']['user']['filemanager']['flush'] != 'flushed') {
+		if ( $_SESSION['phpgw_info']['user']['filemanager']['flush'] != 'flushed' ) {
 			/* Flush journal-deleted */
 			$this->bo->vfs->flush_journal(array(
Index: /branches/2.2/filemanager/js/draw_api.js
===================================================================
--- /branches/2.2/filemanager/js/draw_api.js	(revision 3895)
+++ /branches/2.2/filemanager/js/draw_api.js	(revision 3913)
@@ -32,18 +32,18 @@
 
 				var	_created = _xml.createElement('created'); 
-					_created.appendChild( _xml.createTextNode(response[i]['created']) );
-					_info.appendChild( _created );
+				_created.appendChild( _xml.createTextNode(response[i]['created']) );
+				_info.appendChild( _created );
 
 				var	_version = _xml.createElement('version');
-					_version.appendChild( _xml.createTextNode(response[i]['version']) );
-					_info.appendChild(_version);
+				_version.appendChild( _xml.createTextNode(response[i]['version']) );
+				_info.appendChild(_version);
 
 				var	_who = _xml.createElement('who');
-					_who.appendChild( _xml.createTextNode(response[i]['who']) );
-					_info.appendChild( _who );
+				_who.appendChild( _xml.createTextNode(response[i]['who']) );
+				_info.appendChild( _who );
 
 				var _operation	= _xml.createElement('operation');
-					_operation.appendChild( _xml.createTextNode( response[i]['operation']) );
-					_info.appendChild( _operation );
+				_operation.appendChild( _xml.createTextNode( response[i]['operation']) );
+				_info.appendChild( _operation );
 			}
 
@@ -69,5 +69,5 @@
 	
 	cExecute_('./index.php?menuaction=filemanager.uifilemanager.history&file='
-				+ base64_encode(filename)+"&path="+base64_encode(currentPath), handlerLoadHistory );
+		+ base64_encode(filename)+"&path="+base64_encode(currentPath), handlerLoadHistory );
 }
 
@@ -151,15 +151,21 @@
 
 	var _optionsItens 				= document.createElement("div");
-		_optionsItens.id			= "fastMenuFileManager";
-		_optionsItens.className		= "x-menu";
-		_optionsItens.style.zIndex	= zIndex++;
-		_optionsItens.innerHTML		= _itens;
-		_optionsItens.onclick		= function(){ showHidden.hiddenObject(false); };
-		_optionsItens.onmouseout	= function(){ showHidden.hiddenObject(false); };
-		_optionsItens.onmouseover	= function(){ showHidden.hiddenObject(true); };	
+	_optionsItens.id			= "fastMenuFileManager";
+	_optionsItens.className		= "x-menu";
+	_optionsItens.style.zIndex	= zIndex++;
+	_optionsItens.innerHTML		= _itens;
+	_optionsItens.onclick		= function(){
+		showHidden.hiddenObject(false);
+	};
+	_optionsItens.onmouseout	= function(){
+		showHidden.hiddenObject(false);
+	};
+	_optionsItens.onmouseover	= function(){
+		showHidden.hiddenObject(true);
+	};	
 							  
-		showHidden.action('onmouseover', 'onmouseout', _optionsItens);
-
-		_parent.parentNode.appendChild( _optionsItens );
+	showHidden.action('onmouseover', 'onmouseout', _optionsItens);
+
+	_parent.parentNode.appendChild( _optionsItens );
 }
 
@@ -179,8 +185,8 @@
 	}
 	headerMsgLock = true;
-        headerDiv = document.getElementById("main_title");
-        labelBefore = headerDiv.innerHTML;
-        headerDiv.innerHTML = '<table width=100% cellspacing="0" cellpadding="0" border="0"><tbody><tr><th width="40%"></th><th noWrap class="action_info_th">'+message+'</th><th width="40%"></th></tr></tbody></table>';
-        setTimeout('headerMsgLock = false; document.getElementById("main_title").innerHTML = labelBefore;', 3000);
+	headerDiv = document.getElementById("main_title");
+	labelBefore = headerDiv.innerHTML;
+	headerDiv.innerHTML = '<table width=100% cellspacing="0" cellpadding="0" border="0"><tbody><tr><th width="40%"></th><th noWrap class="action_info_th">'+message+'</th><th width="40%"></th></tr></tbody></table>';
+	setTimeout('headerMsgLock = false; document.getElementById("main_title").innerHTML = labelBefore;', 3000);
 }
 
@@ -276,5 +282,5 @@
 	newpage += fl.td+sp_hd+' id="name">'+get_lang('file name')+sp_tl;
 	newpage += fl.td+sp_hd+' id="folder">'+get_lang('folder')+sp_tl;
-    	if (preferences.mime_type =='1')
+	if (preferences.mime_type =='1')
 		newpage += fl.td+sp_hd+' id="mime_type">'+get_lang('mime type')+sp_tl;
 	if (preferences.size =='1')
@@ -314,86 +320,86 @@
 }
 folderList.prototype.createLine = function(file){
-		var fl = folderList;
-		retBuff = '<tr id="line_'+file.name+'" onmouseout="clearTimeout(menuTimeout)" onmousedown="_dragArea.dragEl=this;_dragArea.operation=\'drag\'">';
+	var fl = folderList;
+	retBuff = '<tr id="line_'+file.name+'" onmouseout="clearTimeout(menuTimeout)" onmousedown="_dragArea.dragEl=this;_dragArea.operation=\'drag\'">';
+	retBuff += fl.td;
+	retBuff += '<input name="fileman" value="'+file.name+'" type="checkbox"></td>';
+	if (permissions['private']) {
+		retBuff += '<td><div id="restrict_'+file.name+'" onclick="setRestricted(\''+file.name+'\')" ';
+		retBuff += 'style="background-image:url('+templatePath+'images/button_'+(file.pub == '1'?'lock':'unlock')+'.png);background-repeat: repeat-none;width:15px;height:12px;"></div></td>';
+	}
+	else
+		retBuff += '<td></td>';
+
+	switch (file.mime_type)
+	{
+		case 'text/html':
+			retBuff += '<td><a href="./index.php?menuaction=filemanager.uifilemanager.export&file='+base64_encode(file.name)+'&path='+base64_encode(currentPath)+'"><div class="exportButton" alt="'+get_lang('export')+'" title="'+get_lang('export')+'"></div></a></td>';
+			break;
+		case 'application/zip':
+			retBuff += '<td><div class="exportButton" onclick="unarchive(\''+file.name+'\')" alt="'+get_lang('unarchive')+'" title="'+get_lang('unarchive')+'"></a></td>'
+			break;
+		default:
+			retBuff += '<td></td>';
+	}
+	retBuff += fl.td+'<div style="background-image:url('+(file.icon)+'); background-repeat: no-repeat; height:16px; padding-left: 18px; overflow: hidden;">';
+	if((file.mime_type).toUpperCase().indexOf('IMAGE') == 0)
+		var mousefunc = 'draw_card(\'preview\',\''+file.name+'\')'
+	else
+		var mousefunc = 'hide_card()';
+	retBuff += '<span class="fileLink" onmouseover="'+mousefunc+'" id="name_'+file.name+'" onclick="window.open(\'./index.php?menuaction=filemanager.uifilemanager.view&file='+base64_encode(file.name)+'&path='+base64_encode(currentPath)+'\');">'+file.name+'</span></div></td>';
+	if (preferences.mime_type =='1') retBuff += fl.td+file.mime_type+'</td>';
+	if (preferences.size =='1') retBuff += fl.td+borkb(file.size)+'</td>';
+	var now = new Date();
+	var midnight = Date.parse(now.toDateString());
+	var dtString = "";
+	if (preferences.created =='1') {
+		var created = new Date();
+		created.setTime(file.created*1000);
+		if (created.getTime() > midnight)
+			if (created.getMinutes() < 10 )
+				dtString = created.getHours()+":0"+created.getMinutes();
+			else
+				dtString = created.getHours()+":"+created.getMinutes();
+		else {
+			dtString = (created.getDate() < 10) ? "0"+created.getDate()+"/" : created.getDate()+"/";
+			dtString += (created.getMonth() < 9) ? "0" : "";
+			dtString += (created.getMonth()+1)+"/"+created.getFullYear();
+		}
+		retBuff += fl.td+dtString+'</td>';
+	}
+	if (preferences.modified =='1'){
+		var modified = new Date();
+		modified.setTime(file.modified*1000);
+		if (file.modified != "")
+			if (modified.getTime() > midnight)
+				if (modified.getMinutes() < 10)
+					dtString = modified.getHours()+":0"+modified.getMinutes();
+				else
+					dtString = modified.getHours()+":"+modified.getMinutes();
+			else {
+				dtString = (modified.getDate() < 10) ? "0"+modified.getDate()+"/" : modified.getDate()+"/";
+				dtString += (modified.getMonth() < 9) ? "0" : "";
+				dtString += (modified.getMonth()+1)+"/"+modified.getFullYear();
+			}
+		else
+			dtString = "";
+		retBuff += fl.td+dtString+'</td>';
+	}
+	if (preferences.owner =='1'){
 		retBuff += fl.td;
-		retBuff += '<input name="fileman" value="'+file.name+'" type="checkbox"></td>';
-		if (permissions['private']) {
-			retBuff += '<td><div id="restrict_'+file.name+'" onclick="setRestricted(\''+file.name+'\')" ';
-                        retBuff += 'style="background-image:url('+templatePath+'images/button_'+(file.pub == '1'?'lock':'unlock')+'.png);background-repeat: repeat-none;width:15px;height:12px;"></div></td>';
-		}
-		else
-			retBuff += '<td></td>';
-
-		switch (file.mime_type)
-		{
-			case 'text/html':
-				retBuff += '<td><a href="./index.php?menuaction=filemanager.uifilemanager.export&file='+base64_encode(file.name)+'&path='+base64_encode(currentPath)+'"><div class="exportButton" alt="'+get_lang('export')+'" title="'+get_lang('export')+'"></div></a></td>';
-				break;
-			case 'application/zip':
-				retBuff += '<td><div class="exportButton" onclick="unarchive(\''+file.name+'\')" alt="'+get_lang('unarchive')+'" title="'+get_lang('unarchive')+'"></a></td>'
-				break;
-			default:
-				retBuff += '<td></td>';
-		}
-		retBuff += fl.td+'<div style="background-image:url('+(file.icon)+'); background-repeat: no-repeat; height:16px; padding-left: 18px; overflow: hidden;">';
-		if((file.mime_type).toUpperCase().indexOf('IMAGE') == 0)
-			var mousefunc = 'draw_card(\'preview\',\''+file.name+'\')'
-		else
-			var mousefunc = 'hide_card()';
-		retBuff += '<span class="fileLink" onmouseover="'+mousefunc+'" id="name_'+file.name+'" onclick="window.open(\'./index.php?menuaction=filemanager.uifilemanager.view&file='+base64_encode(file.name)+'&path='+base64_encode(currentPath)+'\');">'+file.name+'</span></div></td>';
-		if (preferences.mime_type =='1') retBuff += fl.td+file.mime_type+'</td>';
-		if (preferences.size =='1') retBuff += fl.td+borkb(file.size)+'</td>';
-		var now = new Date();
-		var midnight = Date.parse(now.toDateString());
-		var dtString = "";
-		if (preferences.created =='1') {
-			var created = new Date();
-			created.setTime(file.created*1000);
-			if (created.getTime() > midnight)
-				if (created.getMinutes() < 10 )
-					dtString = created.getHours()+":0"+created.getMinutes();
-				else
-					dtString = created.getHours()+":"+created.getMinutes();
-			else {
-				dtString = (created.getDate() < 10) ? "0"+created.getDate()+"/" : created.getDate()+"/";
-				dtString += (created.getMonth() < 9) ? "0" : "";
-				dtString += (created.getMonth()+1)+"/"+created.getFullYear();
-			}
-			retBuff += fl.td+dtString+'</td>';
-		}
-		if (preferences.modified =='1'){
-			var modified = new Date();
-			modified.setTime(file.modified*1000);
-			if (file.modified != "")
-				if (modified.getTime() > midnight)
-	                                if (modified.getMinutes() < 10)
-        	                                dtString = modified.getHours()+":0"+modified.getMinutes();
-                	                else
-						dtString = modified.getHours()+":"+modified.getMinutes();
-				else {
-	                                dtString = (modified.getDate() < 10) ? "0"+modified.getDate()+"/" : modified.getDate()+"/";
-        	                        dtString += (modified.getMonth() < 9) ? "0" : "";
-                	                dtString += (modified.getMonth()+1)+"/"+modified.getFullYear();
-				}
-			else
-				dtString = "";
-			retBuff += fl.td+dtString+'</td>';
-		}
-		if (preferences.owner =='1'){
-			retBuff += fl.td;
-			retBuff += '<div onmouseover="draw_card(\'user\',\''+file.owner+'\')">'+file.owner+'</div></td>';
-		}
-		if (preferences.createdby_id =='1'){
-			retBuff += fl.td;
-			retBuff += '<div onmouseover="draw_card(\'user\',\''+file.createdby_id+'\')">'+file.createdby_id+'</div></td>';
-		}
-		if (preferences.modifiedby_id =='1'){
-			retBuff += fl.td;
-			retBuff += '<div onmouseover="draw_card(\'user\',\''+file.modifiedby_id+'\')">'+file.modifiedby_id+'</div></td>';
-		}
-		if (preferences.comment =='1') retBuff += fl.td+'<input id="'+file.name+'" class="inputComment" onkeydown="enterComments(event,this)" onclick="presetComments(this)" onblur="setComments(this)" value="'+(file.comment==null?'':file.comment)+'" alt="'+get_lang('Click to change comments')+'" title="'+get_lang('Click to change comments')+'"></input></td>';
-		if (preferences.version =='1') retBuff += fl.td+'<span onclick="loadHistory(\''+file.name+'\')">'+file.version+'</span></td>';
-		retBuff += "</tr>";
-		return retBuff;
+		retBuff += '<div onmouseover="draw_card(\'user\',\''+file.owner+'\')">'+file.owner+'</div></td>';
+	}
+	if (preferences.createdby_id =='1'){
+		retBuff += fl.td;
+		retBuff += '<div onmouseover="draw_card(\'user\',\''+file.createdby_id+'\')">'+file.createdby_id+'</div></td>';
+	}
+	if (preferences.modifiedby_id =='1'){
+		retBuff += fl.td;
+		retBuff += '<div onmouseover="draw_card(\'user\',\''+file.modifiedby_id+'\')">'+file.modifiedby_id+'</div></td>';
+	}
+	if (preferences.comment =='1') retBuff += fl.td+'<input id="'+file.name+'" class="inputComment" onkeydown="enterComments(event,this)" onclick="presetComments(this)" onblur="setComments(this)" value="'+(file.comment==null?'':file.comment)+'" alt="'+get_lang('Click to change comments')+'" title="'+get_lang('Click to change comments')+'"></input></td>';
+	if (preferences.version =='1') retBuff += fl.td+'<span onclick="loadHistory(\''+file.name+'\')">'+file.version+'</span></td>';
+	retBuff += "</tr>";
+	return retBuff;
 }
 folderList.prototype.updateQuota = function(quotaSize,usedSpace){
@@ -500,5 +506,7 @@
 	}
 	var pageContent = '<table><tbody><tr>';
-	var createButton = function(name) { return '<td name="'+name+'" class="toolButton" onclick="toolbar.control(\''+name+'\');" title="'+name+'"><img src="'+templatePath+'images/button_'+name+'.png" alt="'+name+'"><small>'+get_lang(name.replace('_',' '))+'</small></td>'; }
+	var createButton = function(name) {
+		return '<td name="'+name+'" class="toolButton" onclick="toolbar.control(\''+name+'\');" title="'+name+'"><img src="'+templatePath+'images/button_'+name+'.png" alt="'+name+'"><small>'+get_lang(name.replace('_',' '))+'</small></td>';
+	}
 
 	if (permissions['edit'] != 0){
@@ -536,46 +544,81 @@
 toolbar.prototype.control = function ()
 {
+	if( arguments.length == 0 )
+		return;
+
 	var _arg 	= arguments[0];
 	var _parent	= ( arguments[1] ) ? arguments[1] : null ; 
 
+	if( _arg == 'new' )
+	{
+		var _address =  ( document.location.toString() ).split("?");
+
+		var itens = [
+			[ get_lang('empty file'),'javascript:newEmptyFile()',templatePath+'images/group_close.gif', '' ],
+			[ get_lang('File from model'), _address[0]+"?menuaction=filemanager.uifilemanager.fileModels", templatePath+'images/group_close.gif', '' ],
+			[ get_lang('Upload'), 'javascript:newUpload()', templatePath+'images/group_close.gif', '' ],
+			[ get_lang('Advanced Upload'), 'javascript:newAdvancedUpload()', templatePath+'images/group_close.gif', '' ]
+		];
+
+		draw_menu( itens, _parent );
+	}
+
+	if( _arg == 'rename' )
+	{
+		var files			= document.getElementsByName('fileman');
+		var flagCheked	= false;
+		
+		for( var i = 0; i < files.length; i++ )
+		{
+			if( files[i].checked )
+			{
+				files[i].checked	= false;
+				var _span			= document.getElementById( 'name_' + files[i].value );
+				var	_parentNode	= _span.parentNode;
+					_parentNode.style.height = (parseInt(_parentNode.style.height) + 4 );
+				
+				var	_input				= document.createElement("input"); 
+					_input.id			= 'input_'+files[i].value;
+					_input.size			= "35";
+					_input.zIndex		= "99999";
+					_input.value		= _span.innerHTML;
+					_input.type			= 'text';
+
+				// OnkeyUp
+				configEvents( _input, "onkeyup", function(e)
+				{
+					if( e.keyCode == 13 ) 
+					{
+						_parentNode.style.height = (parseInt(_parentNode.style.height) - 4 );
+						
+						handler.rename( _input, _span );
+					}
+				});
+
+				// Onblur	
+				//configEvents( _input, "onblur", function()
+				//{ 
+					//handler.rename( _input, _span );
+				//});		
+
+				if( _parentNode != null )
+				{	
+					// Remove Span
+					if( _span != null )
+						_parentNode.removeChild( _span );
+						
+					// Add Input
+					if( _input != null ) 
+						_parentNode.appendChild( _input );
+				}
+				
+				_input.focus();
+			}
+		}
+	}	
+
 	switch ( _arg )
 	{
-		case 'new':
-			
-			address = document.location.toString();
-			address = address.split("?");
-			
-			var itens = [
-			             	[ get_lang('empty file'),'javascript:newEmptyFile()',templatePath+'images/group_close.gif', '' ],
-			             	[ get_lang('File from model'), address[0]+"?menuaction=filemanager.uifilemanager.fileModels", templatePath+'images/group_close.gif', '' ],
-			             	[ get_lang('Upload'), 'javascript:newUpload()', templatePath+'images/group_close.gif', '' ],
-						[ get_lang('Advanced Upload'), 'javascript:newAdvancedUpload()', templatePath+'images/group_close.gif', '' ]
-			            ];
-			
-			draw_menu( itens, _parent );
-
-			break;
-			
-		case 'rename':
-			var one_checked = false;
-			files=document.getElementsByName('fileman');
-			for (i = 0; i <  files.length; i++)
-				if (files[i].checked){
-					one_checked = true;
-					files[i].checked = false;
-					var nameLink = document.getElementById('name_'+files[i].value);
-					var inputName = document.createElement('INPUT');
-					inputName.id = 'input_'+files[i].value;
-					var filename = nameLink.innerHTML;
-					inputName.value = filename;
-					inputName.onclick = function () { oldValue = inputName.value; }
-					inputName.onblur = function () { if (inputName.value == oldValue) handler.rename(); else cExecute_('./index.php?menuaction=filemanager.vfs_functions.rename&file='+base64_encode(this.id.substr(6))+'&to='+base64_encode(this.value)+"&path="+base64_encode(currentPath),handler.rename) };
-					inputName.onkeydown=function (event) {if (event.keyCode == KEY_ENTER) this.blur(); };
-					nameLink.parentNode.appendChild(inputName);
-					nameLink.parentNode.removeChild(nameLink);
-				}
-			if (!one_checked)
-				write_msg(get_lang('Please select a file'));
-			break;
+
 		case 'edit':
 			var one_checked = false;
@@ -600,5 +643,5 @@
 			var filesUrl = this.getCheckedFiles();
 			cExecute_('./index.php?menuaction=filemanager.vfs_functions.delete&path='+
-					base64_encode(currentPath)+filesUrl,handler.del);
+				base64_encode(currentPath)+filesUrl,handler.del);
 			break;
 		case 'archive':
@@ -618,5 +661,5 @@
 			var pswd = crypt.encode(password);
 			cExecute_('./index.php?menuaction=filemanager.vfs_functions.archive&pswd='
-					+ base64_encode(pswd.toString())+'&path='+base64_encode(currentPath)+filesUrl,handler.archive);
+				+ base64_encode(pswd.toString())+'&path='+base64_encode(currentPath)+filesUrl,handler.archive);
 			break;
 		case 'move_to':
@@ -640,7 +683,7 @@
 				{	
 					var _lk = _xml.createElement('lk');
-						_lk.setAttribute('function', "javascript:"+escape(_arg)+"('"+folders[i]+"','"+filesUrl+"'); close_window();" );
-						_lk.appendChild( _xml.createTextNode( folders[i].replace( my_home_filemanager , get_lang("My folder") ) ) );
-						_links.appendChild( _lk );
+					_lk.setAttribute('function', "javascript:"+escape(_arg)+"('"+folders[i]+"','"+filesUrl+"'); close_window();" );
+					_lk.appendChild( _xml.createTextNode( folders[i].replace( my_home_filemanager , get_lang("My folder") ) ) );
+					_links.appendChild( _lk );
 				}
 				
@@ -677,10 +720,10 @@
 			
 			var itens = [
-			             	[ get_lang('Preferences'), 'preferences/preferences.php?appname=filemanager', templatePath+'images/preferences.png', 'width="16px" height="16px"' ],
-			             	[ get_lang('Edit Folders'), 'javascript:editFolders()', templatePath+'images/button_createdir.png', 'width="16px" height="16px"'],
-			             	[ get_lang('Share Folders'), './index.php?menuaction=preferences.uiaclprefs.index&acl_app=filemanager', templatePath+'images/mime16_directory.png', 'width="16px" height="16px"'],
-			             	[ get_lang('View'), 'javascript:EditColumns()', templatePath+'images/editpaste.png', 'width="16px" height="16px"' ],
-			             	[ get_lang('Archive'), 'javascript:toolbar.control("archive")', templatePath+'images/button_zip.png', 'width="16px" height="16px"' ]
-			            ];
+			[ get_lang('Preferences'), 'preferences/preferences.php?appname=filemanager', templatePath+'images/preferences.png', 'width="16px" height="16px"' ],
+			[ get_lang('Edit Folders'), 'javascript:editFolders()', templatePath+'images/button_createdir.png', 'width="16px" height="16px"'],
+			[ get_lang('Share Folders'), './index.php?menuaction=preferences.uiaclprefs.index&acl_app=filemanager', templatePath+'images/mime16_directory.png', 'width="16px" height="16px"'],
+			[ get_lang('View'), 'javascript:EditColumns()', templatePath+'images/editpaste.png', 'width="16px" height="16px"' ],
+			[ get_lang('Archive'), 'javascript:toolbar.control("archive")', templatePath+'images/button_zip.png', 'width="16px" height="16px"' ]
+			];
 						
 			draw_menu( itens, _parent );
@@ -701,5 +744,5 @@
 	{
 		cExecute_('./index.php?menuaction=filemanager.vfs_functions.unarchive&pswd='
-				+ base64_encode(password)+'&path='+base64_encode(currentPath)+'&file='+base64_encode(filename), handler.archive);
+			+ base64_encode(password)+'&path='+base64_encode(currentPath)+'&file='+base64_encode(filename), handler.archive);
 	}
 	else
@@ -710,5 +753,5 @@
 {
 	cExecute_( './index.php?menuaction=filemanager.vfs_functions.moveto&from='
-			+ base64_encode(currentPath)+'&to='+base64_encode(to)+filesUrl, handler.moveto );
+		+ base64_encode(currentPath)+'&to='+base64_encode(to)+filesUrl, handler.moveto );
 }
 
@@ -716,5 +759,5 @@
 {
 	cExecute_('./index.php?menuaction=filemanager.vfs_functions.copyto&from='
-				+ base64_encode(currentPath)+'&to='+base64_encode(to)+filesUrl, handler.copyto );
+		+ base64_encode(currentPath)+'&to='+base64_encode(to)+filesUrl, handler.copyto );
 }
 
@@ -767,5 +810,5 @@
 			var parentDir_en = base64_encode( parentDir );
 			cExecute_('./index.php?menuaction=filemanager.uifilemanager.createdir&path='
-					+ parentDir_en+'&filename='+base64_encode(name), handler.refreshDir);
+				+ parentDir_en+'&filename='+base64_encode(name), handler.refreshDir);
 				
 			currentPath = parentDir + '/' + name;
@@ -780,6 +823,6 @@
 			{	
 				if ( confirm(get_lang('Do you really want to remove folder: %1?',
-						Dfolder.replace(my_home_filemanager, get_lang("My folder"))), '') )
-				{
+					Dfolder.replace(my_home_filemanager, get_lang("My folder"))), '') )
+					{
 					var Dfolder_en = base64_encode( Dfolder );
 					
@@ -806,7 +849,7 @@
 				{
 					var fd = _xml.createElement('name');
-						fd.setAttribute('value', folders[i] );
-						fd.appendChild( _xml.createTextNode(folders[i].replace(my_home_filemanager, get_lang("My folder"))) );
-						_folders.appendChild(fd);
+					fd.setAttribute('value', folders[i] );
+					fd.appendChild( _xml.createTextNode(folders[i].replace(my_home_filemanager, get_lang("My folder"))) );
+					_folders.appendChild(fd);
 				}
 			}
@@ -841,6 +884,10 @@
 		menu.style.top = (DocY+20)+"px";
 		menu.width = "100%";
-		menu.onmouseout = function () { menuTimeout = setTimeout("hide_card()",50);}
-		menu.onmouseover = function () { clearTimeout(menuTimeout); };
+		menu.onmouseout = function () {
+			menuTimeout = setTimeout("hide_card()",50);
+		}
+		menu.onmouseover = function () {
+			clearTimeout(menuTimeout);
+		};
 		menu.style.zIndex='1';
 		document.getElementById('divAppbox').appendChild(menu);
Index: /branches/2.2/filemanager/js/handler.js
===================================================================
--- /branches/2.2/filemanager/js/handler.js	(revision 3897)
+++ /branches/2.2/filemanager/js/handler.js	(revision 3913)
@@ -4,5 +4,5 @@
 	{
 		var returnVal = data.split('|');
-		
+
 		if (returnVal[0] == 'False')
 		{
@@ -10,14 +10,14 @@
 		}
 		else
-		
+
 		if (returnVal[0] == 'wpasswd')
-		{
-			write_error(get_lang('Wrong password'));
-			return;
-		}
-		else
-			 write_msg(get_lang('Your operation was successfully executed'));
-		
-		toolbar.control('reload');
+	{
+		write_error(get_lang('Wrong password'));
+		return;
+	}
+	else
+		write_msg(get_lang('Your operation was successfully executed'));
+
+	toolbar.control('reload');
 	}
 
@@ -25,5 +25,5 @@
 	{
 		var returnVal = data.split('|');
-		
+
 		if (returnVal[0] == 'NODIR')
 			write_error(get_lang('Could not copy file because no destination directory is given'));
@@ -149,46 +149,48 @@
 	}
 
-	function rename(data) 
-	{
-		if ( data == null )
-		{
-			var returnVal = new Array ("True",oldValue,oldValue);
-		}
-		else
-			var returnVal = data.split('|');
-		
-		if ( returnVal[0] == "True" )
-		{
-			if ( returnVal[1] != returnVal[2] ) 
-				write_msg(get_lang('Renamed %1 to %2',returnVal[1],returnVal[2]));
-			
-			var nameLink = document.createElement('A');
-			var inputName = document.getElementById('input_'+returnVal[1]);
-			var trFile = inputName.parentNode.parentNode.parentNode;
-
-			nameLink.innerHTML = returnVal[2];
-			nameLink.href="./index.php?menuaction=filemanager.uifilemanager.view&file="
-					+ base64_encode(returnVal[2])+"&path="+base64_encode(currentPath);
-			nameLink.target = "_blank";
-			nameLink.id = "name_"+returnVal[2];
-
-			inputName.parentNode.appendChild(nameLink);
-			inputName.parentNode.removeChild(inputName);
-			trFile.innerHTML = trFile.innerHTML.replace(returnVal[1],returnVal[2]);
-			trFile.id = trFile.id.replace(returnVal[1],returnVal[2]);
-			toolbar.control('reload');
-		}
-		else
-		{
-			if ( returnVal[1] == "badchar" )
-				write_error(get_lang('File names cannot contain "%1"',returnVal[2]));
-			else if (returnVal[1] == "slashes")
-				write_error(get_lang('File names cannot contain \\ or /'));
-			else if (returnVal[1] == "editing")
-				write_error(get_lang('This file is being edited right now'));
-			else
-				write_error(get_lang('Could not rename %1 to %2', returnVal[1], returnVal[2]));
-		}
-
+	function rename() 
+	{
+		var _handlerRename =  function(data)
+		{
+			var _data = unserialize( data );
+
+			for( var i = 0 ; i < _data.length; i++ )
+			{	
+				if( _data[i]['error'] )
+					write_msg(_data[i]['error'] );
+
+				if( _data[i]['true'] )
+					write_msg(_data[i]['true'] );
+			}
+		}
+
+		if( arguments.length > 1 )
+		{	
+			var _input	= arguments[0];
+			var _span	= arguments[1]	;
+			var _parent	= _input.parentNode;
+
+			_input.style.height = ( parseInt(_input.style.height) - 4 );
+
+			_span.style.className	= "fileLink";
+			_span.innerHTML = _input.value;
+
+			if( _parent != null )
+			{	
+				// Remove Input
+				if( _input != null )
+					_parent.removeChild( _input );
+
+				// Add Span
+				if( _span != null ) 
+					_parent.appendChild( _span );
+
+				var url		= './index.php?menuaction=filemanager.vfs_functions.rename';
+				var params	= 'file='+base64_encode(_input.id.substr(6))+'&to='+base64_encode(_input.value)+'&path='+base64_encode(currentPath);
+
+				cExecute_(  url,  _handlerRename , params );
+			}
+
+		}
 	}
 	
@@ -197,6 +199,6 @@
 		if (data.indexOf("True") == 0)
 		{
-				returnVal = data.split('|');
-				var img_lock = document.getElementById('restrict_'+returnVal[1]);
+			returnVal = data.split('|');
+			var img_lock = document.getElementById('restrict_'+returnVal[1]);
 
 			if (img_lock.style.backgroundImage.indexOf('button_unlock') > 0)
@@ -243,5 +245,5 @@
 			 * response['max_postsize] = diretiva do PHP para POST_MAX_SIZE;
 			 */ 
-			
+
 			write_msg( get_lang("ERROR: Use the advanced file sending!") );
 			return false;
@@ -257,9 +259,9 @@
 					{	
 						var _indexOf = response[i]['file'].toUpperCase().indexOf(_inputs[j].value.toUpperCase() );
-						
+
 						if( response[i]['file'].toUpperCase() === _inputs[j].value.toUpperCase() && _indexOf > -1 )
 						{	
 							_inputs[j].parentNode.setAttribute("erroUpload", "true");
-							
+
 							var _parent	= _inputs[j].parentNode;
 							var _div = _parent.firstChild;	
@@ -271,9 +273,9 @@
 							_div.style.cursor			= "pointer";
 							_div.onclick	= function(){this.style.display = 'none';} ;
-							
+
 							if( response[i]['size_max'] )
 							{
 								_div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: Tamanho do arquivo " 
-											  + borkb( response[i]['size'] ) + "  - Permitido  " + borkb( response[i]['size_max'] );
+									+ borkb( response[i]['size'] ) + "  - Permitido  " + borkb( response[i]['size_max'] );
 							}
 							else if( response[i]['badchar'] )
@@ -291,5 +293,5 @@
 							else if( response[i]['undefined'] )
 							{
-								_div.innerHTML = "<span style='font-weight:bold' >Arquivo Duplicado </span>:: "  + response[i]['file'];	
+								_div.innerHTML = "<span style='font-weight:bold' >Erro </span>:: "  + response[i]['undefined'];	
 							}
 							else if( response[i]['filesize'] )
@@ -298,8 +300,13 @@
 							}
 						}
+						else
+						{
+							write_msg( response[i]['undefined'] );
+							_winBuild( "dwindownewUpload" , "remove" );	
+						}
 					}
 				}	
 			}
-			
+
 			for( var j = 0 ; j < _inputs.length ; j++ )
 			{	
@@ -335,4 +342,4 @@
 
 	window.handler = new handler;
-	
+
 })();
Index: /branches/2.2/filemanager/js/common_functions.js
===================================================================
--- /branches/2.2/filemanager/js/common_functions.js	(revision 3888)
+++ /branches/2.2/filemanager/js/common_functions.js	(revision 3913)
@@ -31,4 +31,28 @@
 }
 
+function configEvents(pObj, pEvent, pHandler)
+{
+	if ( typeof pObj == 'object' )
+	{
+		if ( pEvent.substring(0, 2) == 'on' )
+			pEvent = pEvent.substring(2, pEvent.length );
+
+		if ( arguments.length == 3 )
+		{
+			if ( pObj.addEventListener )
+				pObj.addEventListener(pEvent, pHandler, false );
+			else if ( pObj.attachEvent )
+				pObj.attachEvent( 'on' + pEvent, pHandler );
+		}
+		else if ( arguments.length == 4 )
+		{
+			if ( pObj.removeEventListener )
+				pObj.removeEventListener( pEvent, pHandler, false );
+			else if ( pObj.detachEvent )
+				pObj.detachEvent( 'on' + pEvent, pHandler );
+		}
+	}
+}
+
 function maxFileSize()
 {
@@ -172,5 +196,5 @@
 			var _html = Xtools.parse( Xtools.xml("upload_files"), "upload.xsl", pArgs );
 			
-			draw_window( _html, 490, 350, get_lang("upload files"), "newUpload" );
+			draw_window( _html, 550, 350, get_lang("upload files"), "newUpload" );
 		
 			if( pArgs.emails_to != null )
