Index: trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php
===================================================================
--- trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php	(revision 5850)
+++ trunk/expressoAdmin1_2/inc/class.imap_functions.inc.php	(revision 7551)
@@ -147,5 +147,8 @@
 			$result['msg'] .= $this->functions->lang('Server returns') . ': ' . imap_last_error();
 		}
-		
+		ob_start();
+		print_r($result);
+		$output = ob_get_clean();
+		file_put_contents( "/tmp/angelo.log",  $output , FILE_APPEND);		
 		return $result;
 	}
Index: trunk/prototype/config/PostgreSQL.srv
===================================================================
--- trunk/prototype/config/PostgreSQL.srv	(revision 6081)
+++ trunk/prototype/config/PostgreSQL.srv	(revision 7551)
@@ -7,5 +7,5 @@
 ;host = 127.0.0.1
 port = 5432
-dbname = expresso
+dbname = expresso24angelo
 user = postgres
 ; Caso o usuario tenha senha...
Index: trunk/prototype/modules/mail/interceptors/Helpers.php
===================================================================
--- trunk/prototype/modules/mail/interceptors/Helpers.php	(revision 6641)
+++ trunk/prototype/modules/mail/interceptors/Helpers.php	(revision 7551)
@@ -96,5 +96,5 @@
 					
 					/**
-					 * Devido hÃ¡ inconsistencias na chamada do interceptor addDefaultElementsFilter (followupflag:before.find)
+					 * Devido a inconsistencias na chamada do interceptor addDefaultElementsFilter (followupflag:before.find)
 					 * os followupflag defaults sÃ£o inseridos no retorno, por isso Ã© necessÃ¡rio procurar o objeto correto
 					 * atravÃ©s do id
Index: trunk/prototype/request.php
===================================================================
--- trunk/prototype/request.php	(revision 6443)
+++ trunk/prototype/request.php	(revision 7551)
@@ -42,10 +42,16 @@
 }
 ////////////////////////////////////////////////////////////////////////////////////////
-
-
 echo json_encode( toUtf8(Controller::call( $id ? 'read' : 'find',
 				    Controller::URI( $concept, $id, $service ),
 				    $properties,
 				    $criteria )) );
-
+/*
+ob_start();
+print_r("\n"."-----------"."\n");
+print_r("conceito: ".$concept."\n");
+print_r("tempo: ".(mktime() - $time));
+print_r("\n"."-----------"."\n");
+$output = ob_get_clean();
+file_put_contents( "/tmp/angelo.log",  $output , FILE_APPEND);
+*/
 Controller::closeAll();
Index: trunk/calendar/inc/class.socalendar_sql.inc.php
===================================================================
--- trunk/calendar/inc/class.socalendar_sql.inc.php	(revision 7432)
+++ trunk/calendar/inc/class.socalendar_sql.inc.php	(revision 7551)
@@ -963,6 +963,4 @@
 				}else
 					$type = 'E';
-			
-
 			$sql = 'UPDATE phpgw_cal SET '
 					. 'owner='.(int)$event['owner'].', '
Index: trunk/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 7460)
+++ trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 7551)
@@ -194,4 +194,5 @@
 	function get_range_msgs2($params)
 	{ 	
+		$tmp = mktime();
 		include_once dirname(__FILE__).'/../../prototype/api/controller.php';
             // Free others requests
@@ -217,5 +218,5 @@
                     $return['tot_unseen'] = ($search_box_type == 'SEEN') ? 0 : $msgs_info->unseen;
 
-                    $sort_array_msg = $this->get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$msg_range_begin,$msg_range_end);
+                    $sort_array_msg = $this->get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$msg_range_begin,$msg_range_end,$tmp);
 
                     $num_msgs = ($search_box_type=="UNSEEN") ? $msgs_info->unseen : (($search_box_type=="SEEN") ? ($msgs_info->messages - $msgs_info->unseen) : $msgs_info->messages);
@@ -232,5 +233,5 @@
                                     $return[$i] = $this->get_info_head_msg( $msg_number , $sample );					
                                     $i++;
-                            } 
+                            }
 							
 							$filter = array('AND', array('=', 'folderName', $folder), array('IN','messageNumber', $sort_array_msg));
@@ -267,13 +268,10 @@
 							}
                     }
-                    $return['num_msgs'] =  $num_msgs;				
+                    $return['num_msgs'] =  $num_msgs;       			
 		} else {
 			$num_msgs = imap_num_msg($this->mbox);
-			$sort_array_msg = $this-> get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$msg_range_begin,$num_msgs);
-
-
+			$sort_array_msg = $this-> get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$msg_range_begin,$num_msgs,$tmp);
 			$return['tot_unseen'] = 0;
 			$i = 0;
-
                         if(is_array($sort_array_msg)){
 
@@ -295,6 +293,12 @@
       			$return['num_msgs'] = count($sort_array_msg)+($msg_range_begin-1);
                 }
-				
-                return $return;
+				ob_start();
+				print_r("\n");
+				print_r("saindo da get_range_msgs2: "."\n");
+				print_r("tempo estimado: ".(mktime() - $tmp));
+				print_r("\n"."------------------------");
+				$output = ob_get_clean();
+				file_put_contents( "/tmp/angelo.log",  $output , FILE_APPEND);           	
+                return $return;                
     }
 	
@@ -401,5 +405,5 @@
         */
 	function get_info_head_msg( $msg_number , $appendSample = false )
-	{             
+	{         
             $return = false;
             $cached = false;
@@ -415,6 +419,5 @@
                    $cached = true;   
             }
-            
-            $header = imap_headerinfo($this->mbox, imap_msgno( $this->mbox , $msg_number )); //Resgata o objeto Header da mensagem , nescessario mesmo com o cache pois as flags podem ser atualizadas por outro cliente de email
+            $header = imap_headerinfo($this->mbox,imap_msgno($this->mbox,$msg_number)); //Resgata o objeto Header da mensagem , nescessario mesmo com o cache pois as flags podem ser atualizadas por outro cliente de email
             $return['Recent'] = $header->Recent;
             $return['Unseen'] = $header->Unseen;
@@ -489,8 +492,4 @@
             if( $this->useCache === true )
                 $this->cache->set( 'infoHead://'.$this->username.'://'.$this->mboxFolder.'://'.$msg_number , $return , $this->expirationCache);
-                    
-					
-					
-					
             return $return;
 	}
@@ -3286,4 +3285,5 @@
 	function messages_sort($sort_box_type,$sort_box_reverse, $search_box_type,$offsetBegin,$offsetEnd,$folder)
 	{
+		$tmp = mktime();
 		$sort = array();
 		if ($sort_box_type != "SORTFROM" && $search_box_type!= "FLAGGED"){
@@ -3295,5 +3295,5 @@
 				$slice_array = false;
 			else
-				$slice_array = true;
+				$slice_array = true;		
 		}
 		else
@@ -3358,4 +3358,10 @@
 		if ($slice_array)
 			$sort = array_slice($sort,$offsetBegin-1,$offsetEnd-($offsetBegin-1),true);
+		ob_start();
+		print_r("------------------------"."\n");
+		print_r("saindo da messages_sort: "."\n");
+		print_r("tempo estimado: ".(mktime() - $tmp));
+		$output = ob_get_clean();
+		file_put_contents( "/tmp/angelo.log",  $output , FILE_APPEND);		
 		return $sort;
 
@@ -3836,5 +3842,5 @@
 	}
 
-	function get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$offsetBegin = 0,$offsetEnd = 0)
+	function get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$offsetBegin = 0,$offsetEnd = 0,$tmp)
 	{
 		if(!$this->mbox || !is_resource($this->mbox))
@@ -3845,5 +3851,5 @@
 			$offsetBegin = 1;
 		}
-		return $this->messages_sort($sort_box_type,$sort_box_reverse, $search_box_type,$offsetBegin,$offsetEnd,$folder);
+		return $this->messages_sort($sort_box_type,$sort_box_reverse, $search_box_type,$offsetBegin,$offsetEnd,$folder,$tmp);
 	}
 
Index: trunk/expressoMail1_2/js/draw_api.min.js
===================================================================
--- trunk/expressoMail1_2/js/draw_api.min.js	(revision 7547)
+++ trunk/expressoMail1_2/js/draw_api.min.js	(revision 7551)
@@ -1,3 +1,2 @@
-
 focusIn="";canMakeBox=true;fastSearch=false;selectedPagingMsgs={};allMsgsSelected=false;totalFolderMsgs=0;var jqXHR=new Array();var idattachbycontent=0;onceOpenedHeadersMessages={};var cache=new Array();var openTab={'type':[],'content_id':[],'imapUid':[],'countFile':[0,0,0,0,0,0,0,0,0,0],'imapBox':[],'toPreserve':[],'condition':[]};var autoSaveControl={'timer':[],'status':[]};var tabTypes={'new':4,'forward':6,'reply_with_history':7,'reply_to_all_with_history':8,'reply_without_history':9,'reply_to_all_without_history':10,'edit':5};var currentTab,numBox=0;function draw_tree_folders(folders){if(Element('dftree_tree_folders')){if(!expresso_offline){var update_tree_folders=function(data){draw_quota(data);var unseen_in_mailbox=0;var unseen_in_shared_folders=0;for(var i=0;i<data.length;i++){if(data[i].folder_unseen>0)
 {unseen_in_mailbox=parseInt(unseen_in_mailbox+data[i].folder_unseen);if(data[i].folder_id.indexOf('INBOX')!==0)
@@ -278,5 +277,5 @@
 add_className(tr_element,'flagged_msg');td_element1=createTDElement(0,0,"td_msg");chk_box_element=document.createElement("INPUT");chk_box_element.setAttribute("type","checkbox");chk_box_element.className="checkbox";chk_box_element.setAttribute("id","check_box_message_"+headers_msgs.msg_number);$(chk_box_element).click(function(e){updateSelectedMsgs($(this).is(':checked'),headers_msgs.msg_number);$(".selected_shortcut_msg").removeClass("current_selected_shortcut_msg selected_shortcut_msg");$(".current_selected_shortcut_msg").removeClass("current_selected_shortcut_msg selected_shortcut_msg");if(preferences.use_shortcuts=='1')
 $(this).parents("tr:first").addClass("current_selected_shortcut_msg selected_shortcut_msg");changeBgColor(e,headers_msgs.msg_number);$(this).blur();});td_element1.appendChild(chk_box_element);td_element2=createTDElement(0,1,"td_msg");if(headers_msgs.attachment&&(headers_msgs.attachment==1||headers_msgs.attachment.number_attachments>0))
-td_element2.innerHTML="<img src ='templates/"+template+"/images/clip.gif' >";td_element21=createTDElement(0,2,"td_msg",null,"td_message_answered_"+headers_msgs.msg_number);if((headers_msgs.Forwarded=='F')||(headers_msgs.Draft=='X'&&headers_msgs.Answered=='A')){td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);};td_element21.innerHTML="<img src ='templates/"+template+"/images/forwarded.png' title='"+get_lang('Forwarded')+"'>";headers_msgs.Draft=''
+$(td_element2).css({'background-image':'url(templates/'+template+'/images/mail-gifs.gif)','background-position':'0 -242px'});td_element21=createTDElement(0,2,"td_msg",null,"td_message_answered_"+headers_msgs.msg_number);if((headers_msgs.Forwarded=='F')||(headers_msgs.Draft=='X'&&headers_msgs.Answered=='A')){td_element21.onclick=function(){search_emails(headers_msgs.subject.replace(/^(re: ?|fw: ?|enc: ?|res: ?|fwd: ?)*/gi,''),true);};td_element21.innerHTML="<img src ='templates/"+template+"/images/forwarded.png' title='"+get_lang('Forwarded')+"'>";headers_msgs.Draft=''
 headers_msgs.Answered='';headers_msgs.Forwarded='F';}
 else if(headers_msgs.Draft=='X')
@@ -382,6 +381,6 @@
 else
 _name=info_msg.from.email.length>_maxChar?info_msg.from.email.substring(0,_maxChar)+"...":info_msg.from.email;}
-td.innerHTML=_name.bold()+', '+info_msg.smalldate;if(info_msg.attachments&&info_msg.attachments.length>0)
-td.innerHTML+="&nbsp<img style='cursor:pointer' onclick='javascript:Element(\"option_hide_more_"+ID+"\").onclick()' src ='templates/"+template+"/images/clip.gif' title='"+info_msg.attachments[0].name+"'>";if(typeof(info_msg.signature)=='string')
+td.innerHTML=_name.bold()+', '+info_msg.smalldate;if(info_msg.attachments&&info_msg.attachments.length>0){td.innerHTML+="&nbsp";$(td).css({'background-image':'url(templates/'+template+'/images/mail-gifs.gif)','background-position':'0 -242px'});$(td).find('img').css({'cursor':'pointer','title':info_msg.attachments[0].name}).click(function(){$("option_hide_more_"+ID).click();});}
+if(typeof(info_msg.signature)=='string')
 {if(info_msg.signature!="void")
 td.innerHTML+='&nbsp;<img style="cursor:pointer" onclick="alert(\''+get_lang("This message is signed, and you can trust.")+info_msg.signature+'\');" src="templates/'+template+'/images/signed.gif">';else
@@ -656,5 +655,5 @@
 table.parentNode.removeChild(table);table=document.createElement("TABLE");tbody=document.createElement("TBODY");table.appendChild(tbody);table.id="table_quota";table.width="102";table.border="0";table.cellSpacing=0;table.cellPadding=0;td11=document.createElement("TD");td11.align="center";td11.setAttribute("noWrap","true");td11.innerHTML+='<div id="quota_progressbar" class="boxHeaderText" style="display: block; float: left; height: 13px; width: 121px;"></div>&nbsp;<span class="boxHeaderText" style="line-height : 0px;">'+value+"% ("+borkb(q_used*1024)+"/"+borkb(q_limit*1024)+")</span>";tr2=document.createElement("TR");td22=document.createElement("TD");tr2.appendChild(td11);tbody.appendChild(tr2);div.appendChild(table);$("#quota_progressbar").progressbar({value:value});if(value>90){if(value>=100)
 write_msg(get_lang("Your Mailbox is 100% full! You must free more space or will not receive messages."));else
-write_msg(get_lang("Warning: Your Mailbox is almost full!"));$("#quota_progressbar").find(".ui-progressbar-value").css({"background-image":"url(templates/default/images/dsalert.gif)","border-color":"red"});}
+write_msg(get_lang("Warning: Your Mailbox is almost full!"));$("#quota_progressbar").find(".ui-progressbar-value").css({"background-image":"url(templates/default/images/mail-gifs.gif)","border-color":"red",'background-position':'0 -305px'});}
 else if(value>80)
 $("#quota_progressbar").find(".ui-progressbar-value").css({"background-image":"url(templates/default/images/dswarn.gif)","border-color":"yellow"});}}
