Index: /branches/2.2/filemanager/inc/class.vfs_functions.inc.php
===================================================================
--- /branches/2.2/filemanager/inc/class.vfs_functions.inc.php	(revision 3913)
+++ /branches/2.2/filemanager/inc/class.vfs_functions.inc.php	(revision 3924)
@@ -164,12 +164,13 @@
 		}
 
-		function setRestricted(){
+		function setRestricted()
+		{
 			$GLOBALS['phpgw_info']['flags'] = array
 				(
-					'currentapp'    => 'filemanager',
-					'noheader'      => True,
-					'nonavbar' => True,
-					'nofooter'      => True,
-					'noappheader'   => True,
+					'currentapp'		=> 'filemanager',
+					'noheader'		=> True,
+					'nonavbar'		=> True,
+					'nofooter'		=> True,
+					'noappheader'	=> True,
 					'enable_browser_class'  => True
 				);
@@ -432,12 +433,23 @@
 				{
 					$_return[] = array( "true" => lang('renamed %1 to %2', $this->file ,$this->to ) );
+					
+					// Get Type Mime Type
+					$mimeType = $this->bo->vfs->get_ext_mime_type(array ('string' => $this->to )); 
+					
+					$this->bo->vfs->set_attributes( array(
+															'string'		=> $this->to,
+															'relatives'	=> array(RELATIVE_ALL),
+															'attributes'	=> array('mime_type' => $mimeType)
+					 ));
 				}
 				else
 				{
-					$_return[] = array("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/js/draw_api.js
===================================================================
--- /branches/2.2/filemanager/js/draw_api.js	(revision 3913)
+++ /branches/2.2/filemanager/js/draw_api.js	(revision 3924)
@@ -550,4 +550,61 @@
 	var _parent	= ( arguments[1] ) ? arguments[1] : null ; 
 
+	if( _arg == 'archive' )
+	{	
+		var filesUrl		= this.getCheckedFiles();
+		var password	= prompt(get_lang('Please, type a strong password (suggestion: at least 8 characters, letters and numbers) or leave it empty to archive only'));
+		
+		if ( password == null)
+			return;
+		
+		if ( password.length > 0 )
+		{
+			var password2 = prompt(get_lang('Please, retype your password'));
+			
+			if ( password != password2 )
+			{
+				alert(get_lang('Error:')+get_lang('passwords are differents'));
+				return;
+			}
+		}
+		
+		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);
+	}		
+
+	if( _arg == 'delete' )
+	{	
+		var filesUrl = this.getCheckedFiles();
+		cExecute_('./index.php?menuaction=filemanager.vfs_functions.delete&path='+base64_encode(currentPath)+filesUrl,handler.del);
+	}	
+
+	if( _arg == 'edit' )
+	{	
+		var files				= document.getElementsByName('fileman');
+		var one_checked	= false;
+		
+		for (i = 0; i <  files.length; i++)
+		{	
+			if ( files[i].checked )
+			{
+				one_checked = true;
+				var filename=files[i].value;
+			}
+		}
+		
+		if (one_checked)
+		{
+			var address = (document.location.toString() ).split("&");
+			;
+			document.location = address[0]+"&"+_arg+".x=1&filename="+base64_encode(filename)+".&path="+base64_encode(currentPath);
+		}
+		else
+		{
+			write_msg( get_lang('Please select a file') );
+		}
+	}		
+
 	if( _arg == 'new' )
 	{
@@ -555,8 +612,28 @@
 
 		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', '' ]
+		[ 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 == 'reload')
+	{		
+		last_folder = last_folder ? last_folder : currentPath;
+		current_folder = ( current_folder != "" ) ? current_folder : currentPath;
+		cExecute_('./index.php?menuaction=filemanager.uifilemanager.dir_ls&path='+base64_encode(currentPath)+'&criteria='+criteria+'&otype='+order_type+'&limit='+preferences.files_per_page+'&offset='+offset,folderList.drawFiles);
+	}	
+
+	if( _arg == 'tools' )
+	{		
+		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"' ]
 		];
 
@@ -573,15 +650,15 @@
 			if( files[i].checked )
 			{
-				files[i].checked	= false;
+				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";
+				var	_input			= document.createElement("input"); 
+					_input.id		= 'input_'+files[i].value;
+					_input.size		= "35";
+					_input.zIndex	= "99999";
 					_input.value		= _span.innerHTML;
-					_input.type			= 'text';
+					_input.type		= 'text';
 
 				// OnkeyUp
@@ -595,11 +672,12 @@
 					}
 				});
-
-				// Onblur	
-				//configEvents( _input, "onblur", function()
-				//{ 
-					//handler.rename( _input, _span );
-				//});		
-
+				
+				//OnBlur
+				configEvents( _input, "onblur", function(e)
+				{
+					_parentNode.style.height = (parseInt(_parentNode.style.height) - 4 );
+					handler.rename( _input, _span );
+				});
+				
 				if( _parentNode != null )
 				{	
@@ -617,119 +695,49 @@
 		}
 	}	
-
-	switch ( _arg )
-	{
-
-		case 'edit':
-			var one_checked = false;
-			files=document.getElementsByName('fileman');
-			for (i = 0; i <  files.length; i++)
-				if (files[i].checked){
-					one_checked = true;
-					var filename=files[i].value;
-				}
-			if (one_checked){
-				address = document.location.toString();
-				address = address.split("&");
-				document.location = address[0]+"&"+_arg+".x=1&filename="+base64_encode(filename)+".&path="+base64_encode(currentPath);
-			}
-			else
-			{
-				write_msg(get_lang('Please select a file'));
-				return;
-			}
-			break;
-		case 'delete':
-			var filesUrl = this.getCheckedFiles();
-			cExecute_('./index.php?menuaction=filemanager.vfs_functions.delete&path='+
-				base64_encode(currentPath)+filesUrl,handler.del);
-			break;
-		case 'archive':
-			var filesUrl = this.getCheckedFiles();
-			password = prompt(get_lang('Please, type a strong password (suggestion: at least 8 characters, letters and numbers) or leave it empty to archive only'));
-			if (password == null)
-				return;
-			if (password.length > 0)
-			{
-				password2 = prompt(get_lang('Please, retype your password'));
-				if (password != password2)
-				{
-					alert(get_lang('Error:')+get_lang('passwords are differents'));
-					return;
-				}
-			}
-			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);
-			break;
-		case 'move_to':
-		case 'copy_to':
-			
-			var filesUrl = this.getCheckedFiles();
-			
-			if ( filesUrl != undefined)
-			{
-				DocY -= ( folders.length * 30 );
-				
-				var action = ( ( _arg == 'move_to') ? get_lang('move to:') : get_lang('copy to:') );
-				
-				loadXtools();
-				
-				var _xml 	= Xtools.xml('files');
-				var _files	= _xml.documentElement; 
-				var _links	= _xml.createElement('links');
-				
-				for( var i = 0 ; i < folders.length ; i++ )
-				{	
-					var _lk = _xml.createElement('lk');
+	
+	if ( ( _arg == 'move_to' ) || ( _arg == 'copy_to' ) )
+	{	
+		var filesUrl = this.getCheckedFiles();
+
+		if ( filesUrl != undefined )
+		{
+			DocY -= ( folders.length * 30 );
+
+			var action = ( ( _arg == 'move_to') ? get_lang('move to:') : get_lang('copy to:') );
+
+			loadXtools();
+
+			var _xml 	= Xtools.xml('files');
+			var _files	= _xml.documentElement; 
+			var _links	= _xml.createElement('links');
+
+			for( var i = 0 ; i < folders.length ; i++ )
+			{	
+				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 );
-				}
 				
-				_files.appendChild( _links );
-
-				var img_1 = path_filemanager + "templates/default/images/button_copy_to.png";
-				var img_2 = path_filemanager + "templates/default/images/button_move_to.png";
-				var img_3 = templatePath+"images/group_close.gif";	
-				
-				var pArgs = 
-				{
-					'action'	: action,
-					'img'		: ( ( _arg == 'move_to') ? img_2 : img_1 ),
-					'img_1'		: img_3,
-					'width'		: 380,
-					'height'	: 200
-				};
-				
-				var code = Xtools.parse( _files, "copy_move_files.xsl", pArgs );
-
-				draw_window( code , 380, 200 );
+				_links.appendChild( _lk );
 			}
 
-			break;
-		
-		case 'reload':
-			
-			last_folder = last_folder ? last_folder : currentPath;
-			current_folder = ( current_folder != "" ) ? current_folder : currentPath;
-			cExecute_('./index.php?menuaction=filemanager.uifilemanager.dir_ls&path='+base64_encode(currentPath)+'&criteria='+criteria+'&otype='+order_type+'&limit='+preferences.files_per_page+'&offset='+offset,folderList.drawFiles);
-			return;
-
-		case 'tools':
-			
-			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"' ]
-			];
-						
-			draw_menu( itens, _parent );
-			
-			break;
-		default:
-			return;
+			_files.appendChild( _links );
+
+			var img_1 = path_filemanager + "templates/default/images/button_copy_to.png";
+			var img_2 = path_filemanager + "templates/default/images/button_move_to.png";
+			var img_3 = templatePath + "images/group_close.gif";	
+
+			var pArgs = 
+			{
+				'action'		: action,
+				'img'		: ( ( _arg == 'move_to') ? img_2 : img_1 ),
+				'img_1'		: img_3,
+				'width'		: 380,
+				'height'		: 200
+			};
+
+			var code = Xtools.parse( _files, "copy_move_files.xsl", pArgs );
+
+			draw_window( code , 380, 200 );
+		}
 	}
 }
Index: /branches/2.2/filemanager/js/connector.js
===================================================================
--- /branches/2.2/filemanager/js/connector.js	(revision 3879)
+++ /branches/2.2/filemanager/js/connector.js	(revision 3924)
@@ -122,11 +122,16 @@
 }
 
-function cExecute_(requestURL, handler, params){
-	if (connector.isVisibleBar == true){
+function cExecute_( requestURL, handler, params)
+{
+	if (connector.isVisibleBar == true)
+	{
 		setTimeout('cExecute_("'+requestURL+'",'+handler+')',150);
 		return;
 	}
+	
 	connector.showProgressBar();
-	var AjaxRequest = function () {
+	
+	var AjaxRequest = function () 
+	{
 		Ajax = false;
 		if (window.XMLHttpRequest) //Gecko
Index: /branches/2.2/filemanager/js/handler.js
===================================================================
--- /branches/2.2/filemanager/js/handler.js	(revision 3913)
+++ /branches/2.2/filemanager/js/handler.js	(revision 3924)
@@ -146,23 +146,9 @@
 	function refreshDir(data) 
 	{
-		cExecute_('./index.php?menuaction=filemanager.uifilemanager.get_folders_list',handler.draw_folders_list);
+		cExecute_('./index.php?menuaction=filemanager.uifilemanager.get_folders_list', handler.draw_folders_list);
 	}
 
 	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 )
 		{	
@@ -176,14 +162,35 @@
 			_span.innerHTML = _input.value;
 
+			var _handlerRename =  function(data)
+			{
+				var _data = unserialize( data );
+
+				for( var i = 0 ; i < _data.length; i++ )
+				{	
+					if( _data[i]['error'] )
+					{	
+						// Remove Input
+						if( _input != null )
+							_parent.removeChild( _input );
+
+						// Add Span
+						if( _span != null ) 
+						{	
+							_parent.appendChild( _span );
+						}
+
+						write_msg("ERROR : " + _data[i]['error'] );
+					}
+
+					if( _data[i]['true'] )
+					{
+						write_msg( _data[i]['true'] );
+						toolbar.control('reload');
+					}
+				}
+			}
+
 			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);
