Index: /sandbox/filemanager/setup/phpgw_pt-br.lang
===================================================================
--- /sandbox/filemanager/setup/phpgw_pt-br.lang	(revision 1925)
+++ /sandbox/filemanager/setup/phpgw_pt-br.lang	(revision 1997)
@@ -150,5 +150,5 @@
 Preferences	filemanager	pt-br	Preferências
 Search	filemanager	pt-br	Pesquisar
-View	filemanger	pt-br	Vizualização
+View	filemanger	pt-br	Visualização
 View as list	filemanager	pt-br	Ver como lista
 View as icons	filemanager	pt-br	Ver como ícones
Index: /sandbox/filemanager/inc/class.uifilemanager.inc.php
===================================================================
--- /sandbox/filemanager/inc/class.uifilemanager.inc.php	(revision 1929)
+++ /sandbox/filemanager/inc/class.uifilemanager.inc.php	(revision 1997)
@@ -80,4 +80,6 @@
 		var $sortby;
 		var $messages;
+		var $limit; //for paging (paginacao)
+		var $offset; //for paging (paginacao)
 
 		var $now;
@@ -176,5 +178,4 @@
 			if($test[mime_type]!='Directory')
 			{
-
 				$this->bo->vfs->override_acl = 1;
 
@@ -464,5 +465,5 @@
 			else
 			{
-				$this->readFilesInfo();
+				//$this->readFilesInfo();
 				$this->fileListing();
 			}
@@ -505,4 +506,7 @@
 					'string'        => $this->path,
 					'relatives'     => array(RELATIVE_NONE)
+			));
+			$return['files_count'] = $this->bo->vfs->count_files(array(
+					'string'        => $this->path,
 			));
 			$quota = $this->bo->vfs->get_quota(array(
@@ -537,19 +541,19 @@
 					$tuple['icon'] = $this->mime_icon($files['mime_type']);
 				$tuple['type'] = $files['type'];
-				$tuple['creatd'] = $this->vfs_functions->dateString2timeStamp($files['created']);
-				$tuple['modifd'] = $this->vfs_functions->dateString2timeStamp($files['modified']);
+				$tuple['created'] = $this->vfs_functions->dateString2timeStamp($files['created']);
+				$tuple['modified'] = $this->vfs_functions->dateString2timeStamp($files['modified']);
 				$tuple['size'] = $files['size'];
-				$tuple['mime'] = $files['mime_type'];
+				$tuple['mime_type'] = $files['mime_type'];
 				$tuple['pub'] = $files['type'];
-				$tuple['creatdby'] = $GLOBALS['phpgw']->accounts->id2name($files['createdby_id']);
-				$tuple['modifdby'] = $files['modifiedby_id']?$GLOBALS['phpgw']->accounts->id2name($files['modifiedby_id']):'';
+				$tuple['createdby_id'] = $GLOBALS['phpgw']->accounts->id2name($files['createdby_id']);
+				$tuple['modifiedby_id'] = $files['modifiedby_id']?$GLOBALS['phpgw']->accounts->id2name($files['modifiedby_id']):'';
 				$tuple['owner'] = $GLOBALS['phpgw']->accounts->id2name($files['owner_id']);
-				$tuple['comm'] = $files['comment'];
-				$tuple['vers'] = $files['version'];
+				$tuple['comment'] = $files['comment'];
+				$tuple['version'] = $files['version'];
 				$output[] = $tuple;
 
 			}
 			// TODO Order files directly into SQL
-			foreach ($output as $key => $row) {
+			/*foreach ($output as $key => $row) {
 				$temp[$key]  = strtoupper($row[$this->criteria]);
 			}
@@ -557,5 +561,5 @@
 				array_multisort($temp, SORT_ASC, $output);
 			else
-				array_multisort($temp, SORT_DESC, $output);
+				array_multisort($temp, SORT_DESC, $output);*/
 			$return['files'] = $output;
 			$return['quota']['quotaSize'] = ($quota*1024*1024);
@@ -581,4 +585,5 @@
 				$this->groups_applications[$value['account_name']] = $applications->read_account_specific();
 			}
+
 
 			// selectbox for change/move/and copy to
@@ -706,4 +711,6 @@
 			else
 			{
+				/*$this->limit = $this->limit ? $this->limit : 0;
+				$this->offset = $this->offset ? $this->offset : 100;*/
 				$ls_array = $this->bo->vfs->ls(array(
 					'string' => $this->path,
@@ -711,5 +718,8 @@
 					'checksubdirs' => False,
 					'nofiles'	=> False,
-					'orderby'	=> $this->sortby
+					'orderby'	=> $this->criteria,
+					'otype'		=> $this->otype,
+					'limit'		=> $this->limit,
+					'offset'	=> $this->offset
 				));
 
Index: /sandbox/filemanager/inc/upload.php
===================================================================
--- /sandbox/filemanager/inc/upload.php	(revision 1924)
+++ /sandbox/filemanager/inc/upload.php	(revision 1997)
@@ -1,5 +1,4 @@
 <?php
 require_once '../../header.session.inc.php';
-
 /* This single file is used to increase upload_max_filesize and post_max_size using .htaccess*/
 if(!isset($GLOBALS['phpgw_info'])){
@@ -20,5 +19,4 @@
 $path = $_POST['path'];
 $show_upload_boxes = count($_FILES['upload_file']['name'])-1;
-
 
 function create_summaryImage($file){
@@ -133,5 +131,4 @@
 			else
 			{
-
 				if ($bo->vfs->cp(array(
 					'from'=> $_FILES['upload_file']['tmp_name'][$i],
@@ -186,6 +183,7 @@
 		}
 	}
-if (count($return) > 0)
+if (count($return) > 0){
 		$_SESSION['response'] = serialize($return);
+}
 	else
 		 $_SESSION['response'] = serialize( array( 0 => 'Ok' ) );
Index: /sandbox/filemanager/js/config.js
===================================================================
--- /sandbox/filemanager/js/config.js	(revision 1909)
+++ /sandbox/filemanager/js/config.js	(revision 1997)
@@ -4,5 +4,5 @@
 }
 function load_quota(el){
-	cExecute('/index.php?menuaction=filemanager.uiconfig.load_quota&name='+base64_encode(el.value),loadq_handler);
+	cExecute('index.php?menuaction=filemanager.uiconfig.load_quota&name='+base64_encode(el.value),loadq_handler);
 }
 
@@ -10,5 +10,5 @@
 	var dirName = document.getElementById('search1').value;
 	var ownerName = document.getElementById('search2').value;
-	cExecute('/index.php?menuaction=filemanager.uiconfig.set_owner&dir='+base64_encode(dirName)+'&owner='+ownerName,alert);
+	cExecute('index.php?menuaction=filemanager.uiconfig.set_owner&dir='+base64_encode(dirName)+'&owner='+ownerName,alert);
 }
 
@@ -25,10 +25,10 @@
 	}
 
-	cExecute('/index.php?menuaction=filemanager.uiconfig.set_permission&dir='+base64_encode(dirName)+'&perms='+permission+'&owner='+ownerName,alert);
+	cExecute('index.php?menuaction=filemanager.uiconfig.set_permission&dir='+base64_encode(dirName)+'&perms='+permission+'&owner='+ownerName,alert);
 }
 function save_quota(){
 	var dirName = document.getElementById('search1').value;
 	var Qsize = document.getElementById('quota_size').value;
-	cExecute('/index.php?menuaction=filemanager.uiconfig.update_quota&dir='+base64_encode(dirName)+'&val='+Qsize,alert);
+	cExecute('index.php?menuaction=filemanager.uiconfig.update_quota&dir='+base64_encode(dirName)+'&val='+Qsize,alert);
 }
 function dir_handler(data){
@@ -49,5 +49,5 @@
 		if (timeO)
 			clearTimeout(timeO);
-		timeO = setTimeout('cExecute(\'/index.php?menuaction=filemanager.uiconfig.search_dir&name='+el.value+'\',dir_handler)',700);
+		timeO = setTimeout('cExecute(\'index.php?menuaction=filemanager.uiconfig.search_dir&name='+el.value+'\',dir_handler)',700);
 	}
 }
@@ -61,5 +61,5 @@
 		if (timeO)
 			clearTimeout(timeO);
-		timeO = setTimeout('cExecute(\'/index.php?menuaction=filemanager.uiconfig.search_user&name='+el.value+'\',user_handler)',700);
+		timeO = setTimeout('cExecute(\'index.php?menuaction=filemanager.uiconfig.search_user&name='+el.value+'\',user_handler)',700);
 	}
 }
@@ -71,5 +71,5 @@
 		var okToDel = prompt(get_lang('Please type the text "%1" to delete',randNum)+': '+dirName);
 		if (okToDel == randNum)
-			cExecute('/index.php?menuaction=filemanager.uiconfig.removeFolder&dir='+base64_encode(dirName),alert);
+			cExecute('index.php?menuaction=filemanager.uiconfig.removeFolder&dir='+base64_encode(dirName),alert);
 	}
 }
@@ -79,5 +79,5 @@
 	var toName = prompt(get_lang('Enter the name you want to move %1 to:',dirName),dirName);
 	if (toName.length > 1){
-			cExecute('/index.php?menuaction=filemanager.uiconfig.renameFolder&dir='+base64_encode(dirName)+'&to='+base64_encode(toName),alert);
+			cExecute('index.php?menuaction=filemanager.uiconfig.renameFolder&dir='+base64_encode(dirName)+'&to='+base64_encode(toName),alert);
 	}
 }
@@ -86,5 +86,5 @@
 	var toName = prompt(get_lang('Enter the name of folder you want to create:'),'/home/');
 	if (toName.length > 1){
-		cExecute('/index.php?menuaction=filemanager.uiconfig.createFolder&name='+base64_encode(toName),alert);
+		cExecute('index.php?menuaction=filemanager.uiconfig.createFolder&name='+base64_encode(toName),alert);
 	}
 }
@@ -92,4 +92,4 @@
 function reconstruct_folder(){
 	var dirName = document.getElementById('search1').value;
-	cExecute('/index.php?menuaction=filemanager.uiconfig.reconstructFolder&dir='+base64_encode(dirName),alert);
+	cExecute('index.php?menuaction=filemanager.uiconfig.reconstructFolder&dir='+base64_encode(dirName),alert);
 }
Index: /sandbox/filemanager/js/draw_api.js
===================================================================
--- /sandbox/filemanager/js/draw_api.js	(revision 1925)
+++ /sandbox/filemanager/js/draw_api.js	(revision 1997)
@@ -104,8 +104,8 @@
 	}
 	headerMsgLock = true;
-	headerDiv = document.getElementById("divAppboxHeader");
-	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("divAppboxHeader").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);
 }
 
@@ -117,8 +117,8 @@
 	}
 	headerMsgLock = true;
-	headerDiv = document.getElementById("divAppboxHeader");
+	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_error_th">'+message+'</th><th width="40%"></th></tr></tbody></table>';
-	setTimeout('headerMsgLock = false; document.getElementById("divAppboxHeader").innerHTML = labelBefore;', 3000);
+	setTimeout('headerMsgLock = false; document.getElementById("main_title").innerHTML = labelBefore;', 3000);
 }
 
@@ -191,5 +191,5 @@
 	newpage += fl.td+sp_hd+' id="folder">'+get_lang('folder')+sp_tl;
     	if (preferences.mime_type =='1')
-		newpage += fl.td+sp_hd+' id="mime">'+get_lang('mime type')+sp_tl;
+		newpage += fl.td+sp_hd+' id="mime_type">'+get_lang('mime type')+sp_tl;
 	if (preferences.size =='1')
 		newpage += fl.td+sp_hd+' id="size">'+get_lang('size')+'</a>'+sp_tl;
@@ -199,10 +199,10 @@
 		newpage += fl.td+sp_hd+' id="modified">'+get_lang('modified')+'</a>'+sp_tl;
 	if (preferences.createdby_id =='1')
-		newpage += fl.td+sp_hd+' id="creatdby">'+get_lang('created by')+'</a>'+sp_tl;
+		newpage += fl.td+sp_hd+' id="createdby_id">'+get_lang('created by')+'</a>'+sp_tl;
 	if (preferences.modifiedby_id =='1')
-		newpage += fl.td+sp_hd+' id="modifdby">'+get_lang('modified by')+'</a>'+sp_tl;
+		newpage += fl.td+sp_hd+' id="modifiedby_id">'+get_lang('modified by')+'</a>'+sp_tl;
 	if (preferences.comment =='1')
-		newpage += fl.td+sp_hd+' id="comm">'+get_lang('comment')+'</a>'+sp_tl;
-	if (preferences.version =='1') newpage += fl.td+sp_hd+' id="vers">'+get_lang('version')+'</a>'+sp_tl+'</tr>';
+		newpage += fl.td+sp_hd+' id="comment">'+get_lang('comment')+'</a>'+sp_tl;
+	if (preferences.version =='1') newpage += fl.td+sp_hd+' id="version">'+get_lang('version')+'</a>'+sp_tl+'</tr>';
 
 	for (var i=0; i < files.length; i++)
@@ -239,5 +239,5 @@
 			retBuff += '<td></td>';
 
-		switch (file.mime)
+		switch (file.mime_type)
 		{
 			case 'text/html':
@@ -251,10 +251,10 @@
 		}
 		retBuff += fl.td+'<div style="background-image:url('+(file.icon)+'); background-repeat: no-repeat; height:16px; padding-left: 18px; overflow: hidden;">';
-		if((file.mime).toUpperCase().indexOf('IMAGE') == 0)
+		if((file.mime_type).toUpperCase().indexOf('IMAGE') == 0)
 			var mousefunc = 'draw_card(\'preview\',\''+file.name+'\')'
 		else
 			var mousefunc = 'hide_card()';
 		retBuff += '<a onmouseover="'+mousefunc+'" id="name_'+file.name+'" href="./index.php?menuaction=filemanager.uifilemanager.view&file='+base64_encode(file.name)+'&path='+base64_encode(currentPath)+'" target="_blank">'+file.name+'</a></div></td>';
-		if (preferences.mime_type =='1') retBuff += fl.td+file.mime+'</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();
@@ -263,5 +263,5 @@
 		if (preferences.created =='1') {
 			var created = new Date();
-			created.setTime(file.creatd*1000);
+			created.setTime(file.created*1000);
 			if (created.getTime() > midnight)
 				if (created.getMinutes() < 10 )
@@ -269,12 +269,15 @@
 				else
 					dtString = created.getHours()+":"+created.getMinutes();
-			else
-				dtString = created.getDate()+"/"+created.getMonth()+"/"+created.getFullYear();
+			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.modifd*1000);
-			if (file.modifd != "")
+			modified.setTime(file.modified*1000);
+			if (file.modified != "")
 				if (modified.getTime() > midnight)
 	                                if (modified.getMinutes() < 10)
@@ -282,6 +285,9 @@
                 	                else
 						dtString = modified.getHours()+":"+modified.getMinutes();
-				else
-					dtString = modified.getDate()+"/"+modified.getMonth()+"/"+modified.getFullYear();
+				else {
+	                                dtString = (modified.getDate() < 10) ? "0"+modified.getDate()+"/" : modified.getDate()+"/";
+        	                        dtString += (modified.getMonth() < 9) ? "0" : "";
+                	                dtString += (modified.getMonth()+1)+"/"+modified.getFullYear();
+				}
 			else
 				dtString = "";
@@ -294,12 +300,12 @@
 		if (preferences.createdby_id =='1'){
 			retBuff += fl.td;
-			retBuff += '<div onmouseover="draw_card(\'user\',\''+file.creatdby+'\')">'+file.creatdby+'</div></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.modifdby+'\')">'+file.modifdby+'</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.comm==null?'':file.comm)+'" 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.vers+'</span></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;
@@ -317,9 +323,10 @@
 	loadPermissions(returnData.permissions);
 	var files = returnData.files;
+	draw_paging(returnData.files_count,data);
 	fl.init();
 	fl.clear();
 	var newpage = '';
 	if (preferences.viewIcons == 1){
-		for (var i=0; i < files.length; i++)
+		for (var i = 0; i < files.length; i++)
 		{
 			newicon = '<div class="icon">';
@@ -341,22 +348,22 @@
 		newpage += fl.td+sp_hd+'name\')" id="name">'+get_lang('file name')+sp_tl;
 		if (preferences.mime_type =='1')
-			newpage += fl.td+sp_hd+'mime\')" id="mime">'+get_lang('mime type')+sp_tl;
+			newpage += fl.td+sp_hd+'mime_type\')" id="mime_type">'+get_lang('mime type')+sp_tl;
 		if (preferences.size =='1')
 			newpage += fl.td+sp_hd+'size\')" id="size">'+get_lang('size')+'</a>'+sp_tl;
 		if (preferences.created =='1')
-			newpage += fl.td+sp_hd+'creatd\')" id="creatd">'+get_lang('created')+'</a>'+sp_tl;
+			newpage += fl.td+sp_hd+'created\')" id="created">'+get_lang('created')+'</a>'+sp_tl;
 		if (preferences.modified =='1')
-			newpage += fl.td+sp_hd+'modifd\')" id="modifd">'+get_lang('modified')+'</a>'+sp_tl;
+			newpage += fl.td+sp_hd+'modified\')" id="modified">'+get_lang('modified')+'</a>'+sp_tl;
 		if (preferences.owner =='1')
 			newpage += fl.td+sp_hd+'owner\')" id="owner">'+get_lang('owner')+'</a>'+sp_tl;
 		if (preferences.createdby_id =='1')
-			newpage += fl.td+sp_hd+'creatdby\')" id="creatdby">'+get_lang('created by')+'</a>'+sp_tl;
+			newpage += fl.td+sp_hd+'createdby_id\')" id="createdby_id">'+get_lang('created by')+'</a>'+sp_tl;
 		if (preferences.modifiedby_id =='1')
-			newpage += fl.td+sp_hd+'modifdby\')" id="modifdby">'+get_lang('modified by')+'</a>'+sp_tl;
+			newpage += fl.td+sp_hd+'modifiedby_id\')" id="modifiedby_id">'+get_lang('modified by')+'</a>'+sp_tl;
 		if (preferences.comment =='1')
-			newpage += fl.td+sp_hd+'comm\')" id="comm">'+get_lang('comment')+'</a>'+sp_tl;
-		if (preferences.version =='1') newpage += fl.td+sp_hd+'vers\')" id="vers">'+get_lang('version')+'</a>'+sp_tl+'</tr>';
+			newpage += fl.td+sp_hd+'comment\')" id="comment">'+get_lang('comment')+'</a>'+sp_tl;
+		if (preferences.version =='1') newpage += fl.td+sp_hd+'version\')" id="version">'+get_lang('version')+'</a>'+sp_tl+'</tr>';
 		if (files != null)
-			for (var i=0; i < files.length; i++)
+			for (var i = 0; i < files.length; i++)
 			{
 				newpage += fl.createLine(files[i]);
@@ -536,5 +543,7 @@
 			break;
 		case 'reload':
-			cExecute('./index.php?menuaction=filemanager.uifilemanager.dir_ls&path='+base64_encode(currentPath)+'&criteria='+criteria+'&otype='+order_type,folderList.drawFiles);
+			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='+filesperpage+'&offset='+offset,folderList.drawFiles);
 			return;
 		case 'tools':
@@ -660,2 +669,107 @@
 }
 
+function draw_paging(num_files,data){
+        num_files = parseInt(num_files);
+        total_pages = 1;
+
+        if(last_folder != current_folder){
+                lastPage = 1;
+                current_page = 1;
+                last_folder = current_folder;
+        }
+
+        if(num_files > parseInt(filesperpage)) {
+                total_pages = parseInt(num_files/filesperpage);
+                if((num_files/filesperpage) > total_pages)
+                        total_pages++;
+        }
+
+        if(total_pages == 1) {
+                if(span_paging = document.getElementById("span_paging")) {
+                        span_paging.parentNode.removeChild(span_paging);
+                }
+                return;
+        }
+
+        span_paging = document.getElementById("span_paging");
+        if(!span_paging){
+                span_paging = document.createElement("DIV");
+                span_paging.id = "span_paging";
+                span_paging.className = "boxHeaderText";
+                span_paging.align="right";
+                document.getElementById("div_menu_c3").appendChild(span_paging);
+        }
+        span_paging.style.width="100%";
+        span_paging.innerHTML="";
+        files_range_begin = 1;
+        files_range_end = filesperpage;
+        if(current_page != 1) {
+                lnk_page = document.createElement("A");
+                lnk_page.setAttribute("href", "javascript:current_page=1;offset=0;toolbar.control('reload');");
+        }
+        else {
+                lnk_page = document.createElement("SPAN");
+        }
+        span_paging.appendChild(lnk_page);
+
+        lnk_page.innerHTML = "&lt;&lt;";
+        lnk_page.title = get_lang("First");
+        span_paging.innerHTML += "&nbsp;";
+
+        if(current_page == lastPage + numPages)
+                lastPage = current_page - 1;
+        else if((lastPage != 1 && lastPage == current_page) || current_page == total_pages)
+                lastPage = current_page - (numPages - 1);
+        else if(current_page == 1)
+                lastPage = 1;
+
+        if(lastPage < 1)
+                lastPage = 1;
+        else if(lastPage > 1 && (lastPage > (total_pages -(numPages - 1))))
+                lastPage = total_pages -(numPages - 1);
+
+        var     hasMarked = false;
+
+        for(i = lastPage; i <= total_pages; i++) {
+
+                if(current_page == i || (i == total_pages && !hasMarked)) {
+                        lnk_page = document.createElement("SPAN");
+                        span_paging.appendChild(lnk_page);
+                        lnk_page.innerHTML = "&nbsp;<b>"+i+"</b>&nbsp;";
+                        hasMarked = true;
+                        continue;
+                }
+                else{
+                        lnk_page = document.createElement("A");
+                        span_paging.appendChild(lnk_page);
+                        files_range_begin = ((i*filesperpage)-(filesperpage-1));
+                        files_range_end = (i*filesperpage);
+                        lnk_page.setAttribute("href", "javascript:current_page="+i+";offset=((current_page-1)*filesperpage);toolbar.control('reload');");
+               }
+
+                lnk_page.innerHTML = "&nbsp;...&nbsp;";
+
+                if(i == (lastPage + numPages))
+                                break;
+                else if(lastPage == 1 || i != lastPage)
+                        lnk_page.innerHTML = "&nbsp;"+i+"&nbsp;";
+
+                span_paging.innerHTML += "&nbsp;";                                                                            
+        }
+
+        if(current_page != total_pages) {
+                lnk_page = document.createElement("A");
+                files_range_begin = ((total_pages*filesperpage)-(filesperpage-1));
+                files_range_end = (total_pages*filesperpage);
+                lnk_page.setAttribute("href", "javascript:current_page="+total_pages+";offset=((current_page-1)*filesperpage);toolbar.control('reload');");
+	}
+        else {
+                lnk_page = document.createElement("SPAN");
+        }
+        span_paging.innerHTML += "&nbsp;";
+        span_paging.appendChild(lnk_page);
+
+        lnk_page.title = get_lang("Last");
+        lnk_page.innerHTML = "&gt;&gt;";
+}
+
Index: /sandbox/filemanager/js/handler.js
===================================================================
--- /sandbox/filemanager/js/handler.js	(revision 1929)
+++ /sandbox/filemanager/js/handler.js	(revision 1997)
@@ -12,7 +12,7 @@
                         if (returnVal[i] != ""){
                                 deletedFiles += ", "+returnVal[i];
-                                var element = document.getElementById("name_"+returnVal[i]);
+                                /*var element = document.getElementById("name_"+returnVal[i]);
                                 var pai = element.parentNode.parentNode.parentNode;
-                                pai.parentNode.removeChild(pai);
+                                pai.parentNode.removeChild(pai);*/
                         }
 			if (i > 3) //to avoid big message
@@ -24,5 +24,6 @@
                 write_msg(get_lang('Deleted %1',deletedFiles.substr(2)));
         //Repaint stripes 
-        folderList.drawStripes();
+	toolbar.control('reload');
+        //folderList.drawStripes();
 }
 handler.prototype.rename = function(data) {
Index: /sandbox/filemanager/js/common_functions.js
===================================================================
--- /sandbox/filemanager/js/common_functions.js	(revision 1929)
+++ /sandbox/filemanager/js/common_functions.js	(revision 1997)
@@ -6,4 +6,11 @@
 			contentFolders.childNodes[i].className = "l";
 	el.className = "sl";
+	current_folder = currentPath;
+        if(last_folder != current_folder){
+                lastPage = 1;
+                current_page = 1;
+                last_folder = current_folder;
+		offset = 0;
+        }
 	toolbar.control('reload');
 }
Index: /sandbox/filemanager/js/global.js
===================================================================
--- /sandbox/filemanager/js/global.js	(revision 1880)
+++ /sandbox/filemanager/js/global.js	(revision 1997)
@@ -29,2 +29,10 @@
                                         'mda','mar','mdz','prf','pst');
 
+var last_folder = currentPath;
+var current_folder = currentPath;
+var current_page = current_page ? current_page : 1;
+var lastPage = lastPage ? lastPage : 1;
+var numPages = numPages ? numPages : 5;
+var filesperpage = 10;
+var offset = (current_page-1)*filesperpage;
+
