Index: /trunk/library/mime/mime.php
===================================================================
--- /trunk/library/mime/mime.php	(revision 5135)
+++ /trunk/library/mime/mime.php	(revision 5158)
@@ -877,4 +877,9 @@
                 $this->_html_images[$key]['name']
                     = $this->_basename($this->_html_images[$key]['name']);
+              
+                //Alteração para o Expresso.
+                //Ver https://dev.prognus.com.br/expresso/ticket/1256
+                $this->_htmlbody = str_replace("src=\"cid:".substr($value['cid'], 0, strpos($value['cid'], '@'))."\"", "src=\"cid:".$value['cid']."\"", $this->_htmlbody);
+
             }
         }
Index: /trunk/API/class.servicelocator.php
===================================================================
--- /trunk/API/class.servicelocator.php	(revision 5124)
+++ /trunk/API/class.servicelocator.php	(revision 5158)
@@ -4,32 +4,21 @@
 * Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
 *
-* This program is free software; you can redistribute it and/or modify it under
-* the terms of the GNU Affero General Public License version 3 as published by
-* the Free Software Foundation with the addition of the following permission
-* added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED
-* WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE
-* WARRANTY OF NON INFRINGEMENT  OF THIRD PARTY RIGHTS.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT
-* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-* FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-* details.
-*
-* You should have received a copy of the GNU Affero General Public License
-* along with this program; if not, see www.gnu.org/licenses or write to
-* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-* MA 02110-1301 USA.
-*
-* This code is based on the OpenXchange Connector and on the Prognus pSync
-* Connector both developed by the community and licensed under the GPL
-* version 2 or above as published by the Free Software Foundation.
+*  This program is free software; you can redistribute it and/or 
+*  modify it under the terms of the GNU General Public License 
+*  as published by the Free Software Foundation; either version 2 
+*  of the License, or (at your option) any later version. 
+*   
+*  This program is distributed in the hope that it will be useful, 
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+*  GNU General Public License for more details. 
+*   
+*  You should have received a copy of the GNU General Public License 
+*  along with this program; if not, write to the Free Software 
+*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.  
 *
 * You can contact Prognus Software Livre headquarters at Av. Tancredo Neves,
 * 6731, PTI, Bl. 05, Esp. 02, Sl. 10, Foz do Iguaçu - PR - Brasil or at
 * e-mail address prognus@prognus.com.br.
-*
-*
-* Faz a localização dos serviços que serão utilizados pela aplicação e que estão localizados na API
-* 
 *
 * @package    expressoMail
Index: /trunk/listAdmin/setup/setup.inc.php
===================================================================
--- /trunk/listAdmin/setup/setup.inc.php	(revision 4186)
+++ /trunk/listAdmin/setup/setup.inc.php	(revision 5158)
@@ -9,5 +9,5 @@
 	$setup_info['listAdmin']['name'] = 'listAdmin';
 	$setup_info['listAdmin']['title'] = 'Mailman Admin';
-	$setup_info['listAdmin']['version'] = '2.2.1';
+	$setup_info['listAdmin']['version'] = '2.4.0';
 	$setup_info['listAdmin']['app_order'] = 10;
 	$setup_info['listAdmin']['enable'] = 1;
@@ -30,5 +30,5 @@
 	$setup_info['listAdmin']['depends'][] = array(
 		'appname' => 'phpgwapi',
-		'versions' => Array('2.0','2.1','2.2')
+		'versions' => Array('2.0','2.1','2.2', '2.2.1', '2.4.0')
 	);
 ?>
Index: /trunk/contactcenter/inc/class.ui_data.inc.php
===================================================================
--- /trunk/contactcenter/inc/class.ui_data.inc.php	(revision 5131)
+++ /trunk/contactcenter/inc/class.ui_data.inc.php	(revision 5158)
@@ -2123,5 +2123,5 @@
                                 // a entrada em $data['contact_in_list'][$i]
                                 $set_catalog = $this->set_catalog($level, false);
-                                $contact_data = unserialize($this->get_catalog_add_contact($dn, false));
+                                $contact_data = unserialize($this->get_catalog_add_contact(utf8_encode($dn), false));
                                 $tmp_contact[] = $contact_data[0][0];
                                 $tmp_contact[] = $contact_data[1][0];
Index: /trunk/calendar/inc/class.uicalendar.inc.php
===================================================================
--- /trunk/calendar/inc/class.uicalendar.inc.php	(revision 5132)
+++ /trunk/calendar/inc/class.uicalendar.inc.php	(revision 5158)
@@ -991,4 +991,5 @@
 			}
                         
+            if($_SESSION['phpgw_info']['expressomail']['user']['account_id'] != $owner){
                         $label_suggest = lang('Suggest new hour'); 
                         $button_right_suggestion = "<td><input type=\"button\" style=\"height: 16px; width: 110px; font-size: 10px;\" value=\"" . $label_suggest . "\"onclick=\"show_suggestion()\";</td>"; 
@@ -1000,4 +1001,11 @@
 				'button_right_suggestion' => $button_right_suggestion
 			));
+			}else{
+				$p->set_var(array(
+						'button_left'	=> $button_left,
+						'button_center'	=> $button_center,
+						'button_right'	=> $button_right,
+				));
+			}			
 			$p->pfp('phpgw_body','view_event');
 
Index: /trunk/expressoMail1_2/setup/phpgw_pt-br.lang
===================================================================
--- /trunk/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 5134)
+++ /trunk/expressoMail1_2/setup/phpgw_pt-br.lang	(revision 5158)
@@ -571,5 +571,5 @@
 Users from your organization	expressoMail1_2	pt-br	Usuários da sua organização
 Use shortcuts?	expressoMail1_2	pt-br	Usar teclas de atalho?
-Use plain text editor with standard ?	expressoMail1_2	pt-br	Usar editor de texto simples como padrão ?
+Use plain text editor as standard ?	expressoMail1_2	pt-br	Usar editor de texto simples como padrão ?
 Validity of certificate: 	expressoMail1_2	pt-br	Validade do certificado:
 View HTML source	expressoMail1_2	pt-br	Ver código html
Index: /trunk/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 5134)
+++ /trunk/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 5158)
@@ -1759,7 +1759,4 @@
                 $image['cid'] = eregi_replace("<", "", $image['cid']);
                 $image['cid'] = eregi_replace(">", "", $image['cid']);
-				//if is Draft Ticket #1256
-				$image['cid'] = str_replace("@localhost", "@prognus.org", $image['cid']);
-				$body = eregi_replace("<br/>", "", $body);
 				
                 $body = str_replace("src=\"cid:".$image['cid']."\"", " src=\"./inc/get_archive.php?msgFolder=$msg_folder&msgNumber=$msgno&indexPart=".$image['pid']."\" ", $body);
@@ -2091,10 +2088,19 @@
 		$msgs_in_the_server = $this->get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$msg_range_begin,$msg_range_end);
 		$msgs_in_the_server = array_keys($msgs_in_the_server);
-		if(!count($msgs_in_the_server))
-			return array();
-
+
+		$num_msgs = (count($msgs_in_the_server) - imap_num_recent($this->mbox));
+
+		$dif = ($params['msg_range_end'] - $params['msg_range_begin']) +1;
+		if(!count($msgs_in_the_server)){
+			$msg_range_begin -= $dif;
+			$msg_range_end -= $dif;
+			$msgs_in_the_server = $this->get_msgs($folder, $sort_box_type, $search_box_type, $sort_box_reverse,$msg_range_begin,$msg_range_end);
+			$msgs_in_the_server = array_keys($msgs_in_the_server);	
+			$num_msgs = NULL;
+			$return['msg_range_begin'] = $msg_range_begin;
+			$return['msg_range_end'] = $msg_range_end;
+		}		
 		$return['new_msgs'] = imap_num_recent($this->mbox);
-		$num_msgs = (count($msgs_in_the_server) - imap_num_recent($this->mbox));
-
+		
 		$msgs_in_the_client = explode(",", $msgs_existent);
 
@@ -2117,8 +2123,12 @@
 				$aux++;
 			}
-		}else if($num_msgs < $msg_range_end && $return['new_msgs'] == 0 && count($msg_to_insert) > 0){
+		}else if($num_msgs < $msg_range_end && $return['new_msgs'] == 0 && count($msg_to_insert) > 0 && $msg_range_end == $dif){
 			$return['tot_msgs'] = $num_msgs;
 		}
 		
+		if(!count($msgs_in_the_server)){
+			return Array();
+		}	
+
 		$msg_to_delete = array_diff($msgs_in_the_client, $msgs_in_the_server);
 		$msgs_to_exec = array();
@@ -3217,5 +3227,5 @@
         {		
 			$cid = base_convert(microtime().$j, 10, 36); //Gera um cid
-			$body = str_replace($cid_imgs[1][$j], '"cid:'.$cid.'@'.$_SESSION['phpgw_info']['expressomail']['server']['domain_name'].'"', $body ); //tira o src da imagem e coloca o cid, ele e concatenado com o domain do servidor por que a biblioteaca mime faz isso na hora de gerar o mime.
+			$body = str_replace($cid_imgs[1][$j], '"cid:'.$cid.'"', $body ); //tira o src da imagem e coloca o cid.
 			$count    = strlen($cid_imgs[6][$j]);
 					
Index: /trunk/expressoMail1_2/inc/hook_settings.inc.php
===================================================================
--- /trunk/expressoMail1_2/inc/hook_settings.inc.php	(revision 5134)
+++ /trunk/expressoMail1_2/inc/hook_settings.inc.php	(revision 5158)
@@ -475,5 +475,6 @@
 
 create_select_box('What is the maximum size of embedded images?','image_size',$default,'When user send an email with image in body message, it changes the size');
-create_check_box('Use plain text editor with standard ?','plain_text_editor',''); 
+create_check_box('Use plain text editor as standard ?','plain_text_editor','');
+
 
 $default = array( 
Index: /trunk/expressoMail1_2/js/main.js
===================================================================
--- /trunk/expressoMail1_2/js/main.js	(revision 5134)
+++ /trunk/expressoMail1_2/js/main.js	(revision 5158)
@@ -405,5 +405,10 @@
 
 function refresh(alert_new_msg){
+
 	var handler_refresh = function(data){
+		
+		if(data['msg_range_end'])
+			if(data['msg_range_end'] > 0)
+				current_page = data['msg_range_end']/preferences.max_email_per_page;
 		if(!verify_session(data))
 			return;
@@ -850,5 +855,5 @@
                     msgs_number = currentTab.toString().substr(0,currentTab.toString().indexOf('_r'));
 	}
-
+	refresh();
 	if (parseInt(msgs_number) > 0 || msgs_number.length > 0){
 		if(!not_opem_previus){
@@ -1168,4 +1173,5 @@
 		data.cc = data.cc.replace(/&lt;/gi,"<");
 		data.cc = data.cc.replace(/&gt;/gi,">");
+		var _array_cc = data.cc.split(",");
 	}
 	if (document.getElementById("cco_" + border_ID)){
@@ -1308,5 +1314,17 @@
 			Element("to_" + new_border_ID).value = data.to;
 			Element("to_" + new_border_ID).value += ', ' + data.to_all;
+			
 			if (data.cc){
+			data.cc = new Array();
+			var j = 0;
+				for(i = 0; i < _array_cc.length; i++) {
+				if(_array_cc[i].lastIndexOf(Element("user_email").value) == "-1"){
+					data.cc[j++] = _array_cc[i];
+				}
+			}
+                        if (data.cc != get_lang("undisclosed-recipient"))
+                                data.cc = data.cc.join(",");
+                        else
+								data.cc = "";			
 				document.getElementById("cc_" + new_border_ID).value = data.cc;
 				document.getElementById("a_cc_link_" + new_border_ID).style.display='none';
@@ -1503,6 +1521,15 @@
 		default:
 	}
-
-	
+	//Insere o conteúdo da mensagem e a assinatura no editor de texto simples
+     if (preferences.plain_text_editor == 1){
+	   Element('textplain_rt_checkbox_'+new_border_ID).checked = true;
+	   var txtarea = Element('body_'+new_border_ID);
+	   if (txtarea != null){
+		   if (data.body != undefined)
+		    txtarea.value = data.body;
+	      if (preferences.use_signature == "1")
+            txtarea.value += '\n' + signature;     
+       }
+	 } 
 	Element("border_id_" + new_border_ID).title = title;
 	set_border_caption("border_id_" + new_border_ID, title);
@@ -2382,5 +2409,5 @@
 
 	var folder= Element('border_id_0').innerHTML;
-	var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML;
+	//var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML; 
 	
 	msgs_number = get_selected_messages();
@@ -2399,14 +2426,13 @@
 	var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y);
 	seekDot = (is_ie ? /width=24/gi : /width="24"/gi);
-	thead = thead.replace(seekDot, "style='display:none'");
+	//thead = thead.replace(seekDot, "style='display:none'"); 
+	var thead = "<tr class=\"message_header\"><td id=\"message_header_SORTFROM_0\" class=\"th_resizable\" align=\"left\" width=\"20%\">De</td><td id=\"message_header_SORTSUBJECT_0\" class=\"th_resizable\" align=\"left\" width=\"*\">Assunto</td><td id=\"message_header_SORTARRIVAL_0\" class=\"th_resizable\" align=\"center\" width=\"11%\"><b>Data</b><img src=\"templates/default/images/arrow_descendant.gif\"></td><td id=\"message_header_SORTSIZE_0\" class=\"th_resizable\" align=\"left\" width=\"11%\">Tamanho</td></tr>";
 	tbody = tbody.replace(seekDot, "style='display:none'");
 	seekDot = (is_ie ? /width=16/gi : /width="16"/gi);
-	thead = thead.replace(seekDot, "style='display:none'");
+	//thead = thead.replace(seekDot, "style='display:none'"); 
 	tbody = tbody.replace(seekDot, "style='display:none'");
 	seekDot = (is_ie ? /width=12/gi : /width="12"/gi);
-	thead = thead.replace(seekDot, "style='display:none'");
+	//thead = thead.replace(seekDot, "style='display:none'"); 
 	tbody = tbody.replace(seekDot, "style='display:none'");
-	thead = thead.replace("<td style=\"cursor: pointer;\"></td>", "");		
-	thead = thead.replace("<td style=\"cursor: pointer;\" style='display:none'><input title=\"Selecionar todas as mensagens.\" class=\"checkbox\" id=\"chk_box_select_all_messages\" type=\"checkbox\"></td>", "");
 	while (1){
 		try{
Index: /trunk/expressoMail1_2/js/messages_controller.js
===================================================================
--- /trunk/expressoMail1_2/js/messages_controller.js	(revision 5134)
+++ /trunk/expressoMail1_2/js/messages_controller.js	(revision 5158)
@@ -54,8 +54,10 @@
 				this.aux_interface_remove_mails(msgs_number, 'local_Trash', border_ID);
 				draw_tree_local_folders();
+				update_local_box(); 
 				refresh(); 
 			}else{
 			expresso_local_messages.delete_msgs(msgs_number, border_ID);
 			draw_tree_local_folders();
+				update_local_box(); 
 				refresh();
 			}
@@ -131,5 +133,5 @@
 		if (this.is_local_folder(ttree.FOLDER)) {
 			folder = prompt(get_lang("Enter a name for the box"), "");
-		        if(folder.match(/[\/\\\!\@\#\$\%\&\*\(\)]/gi)){
+		        if(folder.match(/[\/\\\!\@\#\$\%\&\*\+\(\)]/gi)){
 			    alert(get_lang("It's not possible rename this folder. try other folder name"));
 			    return false;
@@ -167,5 +169,5 @@
 				return false;
 			}
-			if(folder.match(/[\/\\\!\@\#\$\%\&\*\(\)]/gi)){
+			if(folder.match(/[\/\\\!\@\#\$\%\&\*\+\(\)]/gi)){
 			    alert(get_lang("cannot create folder. try other folder name"));
 			    return false;
@@ -345,4 +347,5 @@
 			}
 		}
+		new_folder_name = this.get_folder_name(new_folder_name);
 		if (msgs_number.length == 1)
 			write_msg(get_lang("The message was moved to folder ") + new_folder_name);
@@ -363,4 +366,19 @@
 	}
 
+	messages_proxy.prototype.get_folder_name = function(new_folder_name){
+		switch (new_folder_name) {
+			case 'local_Inbox':
+				return 'Local_Caixa de Entrada';
+			case 'local_Sent':
+				return 'Local_Enviados';
+			case 'local_Trash':
+				return 'Local_Lixeira';
+			case 'local_Drafts':
+				return 'Local_Rascunhos';
+			default:
+				return new_folder_name;
+		}
+	}
+	
    	messages_proxy.prototype.msg_img = function(msgs_number,folder_name,call_back) {
      if(this.is_local_folder(folder_name)){
Index: /trunk/expressoMail1_2/js/draw_api.js
===================================================================
--- /trunk/expressoMail1_2/js/draw_api.js	(revision 5134)
+++ /trunk/expressoMail1_2/js/draw_api.js	(revision 5158)
@@ -1366,5 +1366,5 @@
 		    test = false;
 
-		if( (headers_msgs.from != undefined) && headers_msgs.from.email.toLowerCase() == Element("user_email").value.toLowerCase() && !(preferences.from_to_sent == "1" && test) && !(msg_folder.substr(0,5) == "user/"))
+		if( (headers_msgs.from != undefined) && headers_msgs.from.email.toLowerCase() == Element("user_email").value.toLowerCase() && (preferences.from_to_sent == "1") && !(msg_folder.substr(0,5) == "user/"))
 		{
 			td_element3.onmouseover = function () {this.title=headers_msgs.to.email;};
@@ -1395,6 +1395,17 @@
 				spanSender.onmouseover = function (event) {this.style.textDecoration = "underline";try {InfoContact.begin(this,headers_msgs.from.email)} catch(e){};};
 				spanSender.onmouseout = function (){try {this.style.textDecoration = "none";clearTimeout(InfoContact.timeout);} catch(e){}};
-				if ( headers_msgs.from !== undefined )
+				folder = special_folders['Sent'];
+				current = get_current_folder();
+				if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)){
+					if (headers_msgs.to) {
+						if (headers_msgs.to.name != null){
+							spanSender.innerHTML += headers_msgs.to.name;
+						}else if(headers_msgs.to.email != null) {
+							spanSender.innerHTML += headers_msgs.to.email;
+						}
+					}
+				}else if(headers_msgs.from !== undefined){
 				spanSender.innerHTML =  headers_msgs.from.name != null ? headers_msgs.from.name : headers_msgs.from.email;
+				}
 				if (spanSender.innerHTML.indexOf(" ") == '-1' && spanSender.innerHTML.length > 25){
 					spanSender.innerHTML = spanSender.innerHTML.substring(0,25) + "...";
@@ -1550,5 +1561,11 @@
 			break;
 	}
+	folder = special_folders['Sent'];
+	current = get_current_folder();
+	if ((preferences.from_to_sent == "1") && (current.substr(current.length - folder.length, folder.length) == folder)) {
+        document.getElementById("message_header_SORTFROM_"+numBox).innerHTML    = get_lang("To");
+    }else{
 	document.getElementById("message_header_SORTFROM_"+numBox).innerHTML 	= get_lang("From");
+    }
 	document.getElementById("message_header_SORTSUBJECT_"+numBox).innerHTML = get_lang("Subject");
 	document.getElementById("message_header_SORTARRIVAL_"+numBox).innerHTML = get_lang("Date");
Index: /trunk/expressoMail1_2/js/rich_text_editor.js
===================================================================
--- /trunk/expressoMail1_2/js/rich_text_editor.js	(revision 5134)
+++ /trunk/expressoMail1_2/js/rich_text_editor.js	(revision 5158)
@@ -104,5 +104,8 @@
         
         if(preferences.plain_text_editor == 1)
+            {
           RichTextEditor.plain[ID] = true;  
+                RichTextEditor.editorReady = true;
+            }
         else 
 		  RichTextEditor.active(pObj);
@@ -380,5 +383,10 @@
            var divBr = '<div style="'+fontSize+fontFamily+'"><br type="_moz"></div>';
           
-           editor.insertHtml(divBr+divBr+divBr+data);
+		    if(reply === undefined)
+				editor.insertHtml(divBr+divBr+data);
+			else if(reply == 'edit')
+				editor.insertHtml(data);
+			else
+				editor.insertHtml(divBr+data);
            
            if(selection !== null) selection.selectRanges(selectionRanges); 
Index: /trunk/expressoMail1_2/js/TreeShow.js
===================================================================
--- /trunk/expressoMail1_2/js/TreeShow.js	(revision 4562)
+++ /trunk/expressoMail1_2/js/TreeShow.js	(revision 5158)
@@ -112,5 +112,5 @@
 						return false; //Não posso criar pastas contendo a string local_					
 					}
-					if(button.match(/[\/\\\!\@\#\$\%\&\*\(\)]/gi)){
+					if(button.match(/[\/\\\!\@\#\$\%\&\*\+\(\)]/gi)){
 					    alert(get_lang("cannot create folder. try other folder name"));
 				            return false;
@@ -138,5 +138,5 @@
 					}
 
-					if(button1.match(/[\/\\\!\@\#\$\%\&\*\(\)]/gi)){
+					if(button1.match(/[\/\\\!\@\#\$\%\&\*\+\(\)]/gi)){
 					    alert(get_lang("It's not possible rename this folder. try other folder name"));
 					    return false;
