Index: trunk/mobile/calendar.php
===================================================================
--- trunk/mobile/calendar.php	(revision 454)
+++ trunk/mobile/calendar.php	(revision 517)
@@ -21,6 +21,4 @@
 	include('mobile_header.inc.php');
 
-	// Utiliza o novo header para a página principal.
-	print_header();
 
 	$accountId = $GLOBALS['phpgw_info']['user']['account_id'];
@@ -95,4 +93,6 @@
 	}
 
+	// Utiliza o novo header para a página principal.
+	print_header();
 	// Utiliza o novo footer.
 	print_footer();
Index: trunk/mobile/setup/phpgw_pt-br.lang
===================================================================
--- trunk/mobile/setup/phpgw_pt-br.lang	(revision 480)
+++ trunk/mobile/setup/phpgw_pt-br.lang	(revision 517)
@@ -1,8 +1,27 @@
+Calendar	mobile	pt-br	Agenda
+contact center	mobile	pt-br	Endereços
+E-mail	mobile	pt-br	Caixa de Entrada
 From	mobile	pt-br	De
+Logout	mobile	pt-br	Sair
+To	mobile	pt-br	Para
+Subject	mobile	pt-br	Assunto
+Send	mobile	pt-br	Enviar
+Reply	mobile	pt-br	Responder
 Folder	mobile	pt-br	Pasta
+of	mobile	pt-br	de
 Inbox	mobile	pt-br	Caixa de Entrada
 Return	mobile	pt-br	Retornar à lista de E-mails
+Logout	mobile	pt-br	Sair
+Calendar	mobile	pt-br	Agenda
+Contact Center	mobile	pt-br	Contatos
+Create mail	mobile	pt-br	Novo Mail
+E-mail	mobile	pt-br	Cx Entrada
 This message have attachment(s)	mobile	pt-br	Este e-mail possui anexo(s)
 This message don't have attachment(s)	mobile	pt-br	Este e-mail não possui anexo(s)
 Catalog	mobile	pt-br	Catálogo
 Phone	mobile	pt-br	Telefone
+Message sent successfully	mobile	pt-br	Mensagem enviada com sucesso
+Message not sent	mobile	pt-br	Mensagem não enviada
+error	mobile	pt-br	Error: 
+Some addresses in the To field were not recognized. Please make sure that all addresses are properly formed	mobile	pt-br	Alguns endereços no campo "Para" não foram reconhecidos. Por favor certifique-se que todos endereços estão corretos
+Empty folder	mobile	pt-br	Pasta vazia
Index: trunk/mobile/mobilemail_index.php
===================================================================
--- trunk/mobile/mobilemail_index.php	(revision 454)
+++ trunk/mobile/mobilemail_index.php	(revision 517)
@@ -70,7 +70,7 @@
 	 * Carrega o objeto mobilemail *
 	\*******************************/
-	print_header();
 	$obj = CreateObject('mobile.mobilemail');
 	$obj->index();
+	print_header();
 	print_footer();
 
Index: trunk/mobile/inc/class.mobilemail.inc.php
===================================================================
--- trunk/mobile/inc/class.mobilemail.inc.php	(revision 488)
+++ trunk/mobile/inc/class.mobilemail.inc.php	(revision 517)
@@ -20,8 +20,11 @@
 		// Define as funções públicas
 		var $public_functions = array(
-			'mail_list'		=> True,
+			'mail_list'	=> True,
 			'change_folder' => True,
 			'change_page'	=> True,
-			'show_msg'		=> True,
+			'show_msg'	=> True,
+			'send_mail'	=> True,
+			//'reply_msg'	=> True,
+			'new_msg'	=> True,
 		);
 
@@ -157,4 +160,5 @@
 			$p->set_block('view_msg_t', 'mail_body');
 			$p->set_block('view_msg_t', 'mail_footer');
+			$p->set_block('view_msg_t', 'reply_msg');
 			$p->set_block('view_msg_t', 'attachment_list');
 			$p->set_block('view_msg_t', 'begin_anchor');
@@ -165,5 +169,5 @@
 			$p->set_var('from', $msg['from']['full']);
 			$p->set_var('to_label', lang("To"));
-			$p->set_var('to', $msg['toaddress2']);
+
 			$p->set_var('subject_label', lang("Subject"));
 			$p->set_var('subject', $msg['subject']);
@@ -177,4 +181,10 @@
 			$p->set_var('link_text', lang("Return"));
 			$p->set_var('link', "index.php?menuaction=mobile.mobilemail.mail_list");
+
+
+			$p->set_var('reply_text', lang("Reply"));
+			$msg_number = $_GET['msg_number'];
+			$msg_folder = $_GET['msg_folder'];
+			$p->set_var('reply', "index.php?menuaction=mobile.mobilemail.new_msg&msg_number=$msg_number&msg_folder=$msg_folder");
 
 			if (!empty($msg['attachments']) && !empty($msg['attachments']['names']))
@@ -196,5 +206,6 @@
 			$p->pfp('out', 'attachment_list');
 			//$p->pfp('view_msg_t', 'mail_footer');
-			$p->pfp('out', 'mail_footer');
+			$p->pfp('out', 'reply_msg');
+			//$p->pfp('out', 'mail_footer');
 
 		}
@@ -212,4 +223,5 @@
 			$this->print_folder_selection();
 			$this->mail_list();
+
 			$this->save_session();
 
@@ -325,6 +337,6 @@
 			$params = array(
 				'folder' 			=> $this->folders[$this->current_folder]['folder_id'],
-				'msg_range_begin' 	=> $this->current_page * 10 - 9,
-				'msg_range_end'		=> $this->current_page * 10,
+				'msg_range_begin' 	=> $this->current_page * $this->messages_per_page - ($this->messages_per_page - 1),
+				'msg_range_end'		=> $this->current_page * $this->messages_per_page,
 				'sort_box_type'		=> 'SORTARRIVAL',
 				'sort_box_reverse'	=> 1
@@ -396,5 +408,5 @@
 				);
 				$p->set_block('mobilemail_t', 'empty_list');
-				$p->set_var('empty_message', lang('No messages in the mailbox'));
+				$p->set_var('empty_message', lang('Empty folder'));
 				$p->pfp('out', 'empty_list');
 			}
@@ -457,5 +469,4 @@
 
 				}
-				//Apresenta numero da pagina e o total de paginas
 				$pages .= " ".$page." ".lang("of")." ".$number_of_pages." ";
 
@@ -515,4 +526,240 @@
 		}
 
+		/*
+		 * @function new_msg()
+		 * @abstract Gera o formulário para criar novo e-mail.
+		 * @author Rommel de Brito Cysne <rommel.cysne@serpro.gov.br>
+		 
+		function new_msg()
+		{
+			$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+			$p->set_file(
+				Array(
+					'new_msg_t' => 'new_msg.tpl'
+				)
+			);
+
+			$p->set_block('new_msg_t', 'msg_header');
+			$p->set_block('new_msg_t', 'text');
+			$p->set_block('new_msg_t', 'begin_form');
+			$p->set_block('new_msg_t', 'end_form');
+			$p->set_block('new_msg_t', 'hidden_area');
+
+			$p->set_var('to_label', lang("To"));
+			$p->set_var('to', "");
+			$p->set_var('to_mail', "");
+
+			$p->set_var('subject_label', lang("Subject"));
+			$p->set_var('subject', "");
+
+			$p->set_var('msg_number', $_GET['msg_number']);
+			$p->set_var('msg_folder', $_GET['msg_folder']);
+
+			$p->set_var('send_label', lang("Send"));
+
+			$p->set_var('form_action', "index.php?menuaction=mobile.mobilemail.send_mail");
+
+			$p->pfp('out', 'begin_form');
+			$p->pfp('out', 'msg_header');
+			$p->pfp('out', 'text');
+			$p->pfp('out', 'hidden_area');
+			$p->pfp('out', 'end_form');
+
+		
+		}
+*/
+		/*
+		 * @function new_msg()
+		 * @abstract Gera o formulário para criar/enviar novo e-mail ou resposta de e-mail.
+		 * @author Rommel de Brito Cysne <rommel.cysne@serpro.gov.br>
+		 */
+		function new_msg()
+		{
+			$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+			$p->set_file(
+				Array(
+					'new_msg_t' => 'new_msg.tpl'
+				)
+			);
+
+
+			if (isset($_GET['msg_number']))
+			{
+				$params = array(
+					'msg_number' => $_GET['msg_number'],
+				);
+
+				$msg_number = $_GET['msg_number'];
+			}
+		
+			$msg = $this->imap_functions->get_info_msg($params);
+
+
+			$p->set_block('new_msg_t', 'msg_header');
+			$p->set_block('new_msg_t', 'text');
+			$p->set_block('new_msg_t', 'begin_form');
+			$p->set_block('new_msg_t', 'end_form');
+			$p->set_block('new_msg_t', 'hidden_area');
+
+			if($_GET['clk'])
+			{
+
+				$p->set_var('to_label', lang("To"));
+				$p->set_var('to', "");
+				$p->set_var('to_mail', "");
+				$p->set_var('subject_label', lang("Subject"));
+				$p->set_var('subject', "");
+
+			}
+			else if($_GET['cc_mob'])
+			{
+
+				$p->set_var('to_label', lang("To"));
+				$p->set_var('to', $_GET['input_to']);
+				$p->set_var('to_mail', $_GET['input_to_mail']);
+
+				$p->set_var('subject_label', lang("Subject"));
+				$p->set_var('subject', "");
+
+				$p->set_var('msg_number', $_GET['msg_number']);
+				$p->set_var('msg_folder', $_GET['msg_folder']);
+
+				$p->set_var('read_only', 'readonly');
+			}
+			else
+			{
+
+				$p->set_var('from_label', lang("From"));
+				$p->set_var('from', $msg['toaddress2']);
+
+				$p->set_var('to_label', lang("To"));
+				$mail_to = $msg['from']['full'];
+				$p->set_var('to', $msg['from']['name']);
+				$p->set_var('to_mail', $msg['from']['email']);
+
+				$p->set_var('subject_label', lang("Subject"));
+				$p->set_var('subject', "Re:" . $msg['subject']);
+
+				$p->set_var('msg_number', $_GET['msg_number']);
+				$p->set_var('msg_folder', $_GET['msg_folder']);
+
+				$p->set_var('read_only', "readonly");
+			}
+
+			$p->set_var('send_label', lang("Send"));
+
+			$p->set_var('form_action', "index.php?menuaction=mobile.mobilemail.send_mail");
+
+			$p->pfp('out', 'begin_form');
+			$p->pfp('out', 'msg_header');
+			$p->pfp('out', 'text');
+			$p->pfp('out', 'hidden_area');
+			$p->pfp('out', 'end_form');
+
+		
+		}
+
+		/*
+		 * @function send_mail()
+		 * @abstract Função que realiza o envio de e-mails.
+		 * @author Rommel de Brito Cysne <rommel.cysne@serpro.gov.br>
+		 */
+		function send_mail()
+		{
+			//Chamada da classe phpmailer
+			include_once("/var/www/expresso/phpgwapi/inc/class.phpmailer.inc.php");
+
+			//Recebe os dados do form (passados pelo POST)
+			$userName = $_POST['input_to']; //"User Someone";
+			$userMail = $_POST['input_to_mail']; //"user.someone@mail.com.br";
+			$subject = $_POST['input_subject']; //"Mail Subject";
+			$body = $_POST['body']; //"Mail body. Any text.";
+
+			if($userMail == "")
+			{
+				$userMail = $userName;
+			}
+
+			//Cria objeto
+			$mail = new PHPMailer();
+
+			if(!$this->imap_functions->add_recipients("to", $userMail, &$mail))
+			{
+				$error_msg = lang("Some addresses in the To field were not recognized. Please make sure that all addresses are properly formed");
+			}
+
+			$mail->IsSMTP();
+			$mail->Host = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpServer'];
+			$mail->Port = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpPort'];
+
+			//Envia os emails em formato HTML; se false -> desativa.
+			$mail->IsHTML(true);
+			//Email do remetente da mensagem
+			$mail->Sender = $mail->From = $_SESSION['phpgw_info']['expressomail']['user']['email'];
+			//Nome do remetente do email
+			$mail->SenderName = $mail->FromName = $_SESSION['phpgw_info']['expressomail']['user']['fullname'];
+			//Endereço de destino do email, ou seja, pra onde a mensagem vai
+			//$mail->AddAddress("$userMail");
+			//Assunto da mensagem
+			$mail->Subject = $subject;
+			//Corpo da mensagem
+			$mail->Body .= "<br />$body<br />";
+
+			//Cria um objeto template
+			$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+			//Define o template para mensagens de retorno da funcao
+			$p->set_file(
+				Array(
+					'sent_msg_t' => 'sent_msg.tpl'
+				)
+			);
+
+			$p->set_block('sent_msg_t','retorno');
+			header('Refresh: 1; url=./');
+
+			//Se o e-mail nao for enviado por qualquer motivo...
+			if(!$mail->Send())
+			{
+				//... é exibida a mensagem abaixo e o respectivo erro...
+				$p->set_var('msg', lang("Message not sent"));
+				$p->set_var('erro', lang("error") . $mail->ErrorInfo);
+
+			//... caso contrário...
+			}else {
+				//... mostra mensagem de sucesso e link de retorno à lista de e-mail
+				$p->set_var('msg', lang("Message sent successfully"));
+				//$p->set_var('link_text', lang("Return"));
+				//$p->set_var('link', "mobilemail_index.php");
+
+			}
+
+			$p->pfp('out','retorno');
+
+
+		}
+
+
+
+
+		//PAREI
+		function delete_msg()
+		{
+		
+			$this->username           = $_SESSION['phpgw_info']['expressomail']['user']['userid'];
+			$this->password           = $_SESSION['phpgw_info']['expressomail']['user']['passwd'];
+			$this->imap_server        = $_SESSION['phpgw_info']['expressomail']['email_server']['imapServer'];
+			$this->imap_port          = $_SESSION['phpgw_info']['expressomail']['email_server']['imapPort'];
+			$this->imap_delimiter = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'];
+
+			$mbox_stream = @imap_open("{".$this->imap_server.":".$this->imap_port.$this->imap_options."}".$folder, $this->username, $this->password) or die(serialize(array('imap_error' => imap_last_error())));
+
+
+		}
+
+		function retorna()
+		{
+			
+		}
+
 	}
 ?>
Index: trunk/mobile/inc/class.ui_mobilecc.inc.php
===================================================================
--- trunk/mobile/inc/class.ui_mobilecc.inc.php	(revision 491)
+++ trunk/mobile/inc/class.ui_mobilecc.inc.php	(revision 517)
@@ -5,6 +5,5 @@
 		var $bo;
 		var $page_info = array (
-				'actual_catalog' => false,
-				'is_external_catalog' => false
+				'actual_catalog' => false
 			);
 		
@@ -13,67 +12,17 @@
 		);
 		
-		/**
-		 * Construtor...
-		 * 
-		 */
-		public function ui_mobilecc() {
+		function ui_mobilecc() {
 			$this->nextmatchs	= CreateObject('phpgwapi.nextmatchs');
 		}
 		
-		/**
-		 * Inicia um BO de catálogo do módulo de contactcenter.
-		 * @return 
-		 * @param $catalog String com o catálogo
-		 */
-		private function set_catalog($catalog) {
-			if(strpos($catalog,'bo_global_ldap_catalog')===false) //Ldap?
-				$this->bo= CreateObject("contactcenter.".$catalog);
-			else {
-				$exploded = explode("#",$catalog);
-				$this->bo= CreateObject("contactcenter.bo_global_ldap_catalog",$exploded[1],$exploded[2],$exploded[3]);
-				if($exploded[3]==1)
-					$this->page_info['is_external_catalog'] = true;
-				else {
-					$this->page_info['is_external_catalog'] = false;
-				}
-					
-			}
+		function set_catalog($catalog) {
+			$this->bo= CreateObject("contactcenter.".$catalog);
 			$this->page_info['actual_catalog'] = $catalog;
 		}
 		
-		/**
-		 * Busca um nome a partir do catálogo. Se nenhum for informado previamente,
-		 * retorna um array vazio.
-		 * 
-		 * Caso o catálogo atual seja grupos, a busca será por títulos, caso seja
-		 * contatos pessoais, será por names_ordered, se for contato no ldap, será
-		 * por cn.
-		 * 
-		 * @return array, com os ids relativos a busca
-		 * @param $name string com o nome à ser buscado.
-		 */
-		public function find($name) {
-			if(!$this->page_info["actual_catalog"])
-				return array();
-			
-			if($this->page_info['actual_catalog']=="bo_group_manager") { //parametros de busca para grupos
-				$id = 'group.id_group';
-				$what = array('group.title',$id);
-				$search = "group.title";
-			}
-			else { //parametros de busca para pessoas
-				$id = 'contact.id_contact';
-				$search = "contact.names_ordered";
-				$what = array('contact.names_ordered',$id);
-			}
-			
-			if ((strpos($this->page_info["actual_catalog"],'bo_global_ldap_catalog')!==false) &&
-					(!$this->page_info['is_external_catalog'])) { //Ldap do expresso, leva em conta alguns atributos do expresso
-
-				array_push($what,'contact.object_class',
-						'contact.account_visible',
-						'contact.account_status'
-						);
-				
+		function find($name) {
+			if(($this->page_info['actual_catalog']!="bo_people_catalog") 
+				&& ($this->page_info['actual_catalog']!="bo_group_manager")
+				&& ($this->page_info['actual_catalog']!="bo_shared_catalog_manager")) {
 				$rules = array(
 							0 => array(
@@ -102,36 +51,28 @@
 				$rules = array();
 			}
-
-			
-			
-			if ($name != '') { //String em branco, não preciso adicionar essa regra
-				array_push($rules,array(
-								'field' => $search,
-								'type' 	=> 'iLIKE',
-								'value'	=> '%'.$name.'%'
-							));		
-			}
-														
-			$ids = $this->bo->find($what,$rules);
-
-			foreach($ids as $id_r) { //Quero apenas os ids, como valores nas posições do array
+			$search='contact.names_ordered';
+			$id = 'contact.id_contact';
+			if($this->page_info['actual_catalog']=="bo_group_manager") {
+				$search = 'group.title';
+				$id = 'group.id_group';
+			}
+			
+			array_push($rules,array(
+							'field' => $search,
+							'type' 	=> 'iLIKE',
+							'value'	=> '%'.$name.'%'
+						));		
+					
+			$ids = $this->bo->find(array($id),$rules);
+			foreach($ids as $id_r) {
 				$retorno[] = $id_r[substr($id,strpos($id,".")+1)];
 			}
-			
 			return $retorno;
 		}
-		
-		/**
-		 * Monta a lista de contatos na tela, de acordo com a busca. Se não foi feita
-		 * busca, mostra apenas o formulário para pesquisa.
-		 * 
-		 * @return 
-		 */
-		
+			
 		function contacts_list() {
-
+			
 			$entries = array();
 			$actual_page = 0;
-
 			/////////////// Pego os ids referente a consulta, se a mesma foi feita
 			if(isset($_POST['name'])) {
@@ -145,5 +86,5 @@
 				}
 			}
-			else if(isset($_GET['page'])) { 
+			else if(isset($_GET['page'])) {
 				$this->set_catalog($_SESSION["mobile_search_catalog"]);
 				$ids = array_slice($_SESSION["mobile_search_ids"],($_GET['page']-1)*10,10); //Página solicitada
@@ -152,11 +93,11 @@
 			else 
 				$ids = false;
-
+				
 			///////////// Pego os dados dos ids da página em questão.
-			if(!is_array($ids) || count($_SESSION["mobile_search_ids"])>100) { 
+			if(!is_array($ids)) {
 				$entries = array();
 			}
 			else { //Só pego os dados completos caso haja resultado na busca
-				if($this->page_info['actual_catalog']!="bo_group_manager") { //Se não for grupo, tenho que ordenar as connections
+				if(($this->page_info['actual_catalog']=="bo_people_catalog")) {
 					$entries = $this->bo->get_multiple_entries($ids,array("names_ordered"=>true,"id_contact"=>true,"connections"=>true));
 					/**
@@ -172,5 +113,5 @@
 						}
 						array_multisort($default, SORT_DESC, $type, SORT_ASC, $valor['connections']);
-					}//Fim da ordenação
+					}
 				}
 				else {
@@ -178,5 +119,5 @@
 				}
 			}
-			
+
 			///////////////// Monto os dados gerais da página no template.
 			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
@@ -201,44 +142,28 @@
 			$p->set_var($texts);
 
-			/////////// Preenche o combo de catálogos
-			
-			$bo_cc = CreateObject("contactcenter.bo_contactcenter");
-			$branchs = $bo_cc->get_catalog_tree();
-			
-			foreach($branchs as $branch) {
-
-				if($branch['class']!="bo_global_ldap_catalog") 
-					$p->set_var(array('option_value'=>$branch['class'],'option_text'=>$branch['name']));
-				
-				else 
-					$p->set_var(array('option_value'=>$branch['class']."#".
-							$branch['class_args'][0]."#".
-							$branch['value']."#".
-							$branch['external'],
-							'option_text'=>$branch['name'])); //No value eu passo também o id, o contexto e se é externo, quando é um ldap
-
-				if(($this->page_info['actual_catalog']==$branch['class']) || 
-						($this->page_info['actual_catalog']==$branch['class']."#".$branch['class_args'][0]."#".$branch['value']."#".$branch['external']))
-					$p->set_var('selected','selected');
-				else
-					$p->set_var('selected','');
-				$p->parse('options','option',True);	
-			}
+			/////////// Preenche o combo
+			$p->set_var(array('option_value'=>'bo_people_catalog','option_text'=>'Pessoal'));
+			if($this->page_info['actual_catalog']=="bo_people_catalog")
+				$p->set_var('selected','selected');
+			else
+				$p->set_var('selected','');
+			$p->parse('options','option',True);
+			$p->set_var(array('option_value'=>'bo_group_manager','option_text'=>'Grupos'));
+			if($this->page_info['actual_catalog']=="bo_group_manager")
+				$p->set_var('selected','selected');
+			else
+				$p->set_var('selected','');
+			$p->parse('options','option',True);
+
 
 			/////////// Monta o resultado da pesquisa
 			$p->set_var('th_theme',$GLOBALS['phpgw_info']['theme']['th_bg']);
-						
-			if(empty($entries) && isset($_POST["name"]) && count($_SESSION["mobile_search_ids"])<=100) { //Se foi feita a busca e não teve resultados...
+			if(empty($entries) && isset($_POST["name"])) { //Se foi feita a busca e não teve resultados...
 				$p->set_var('message',lang('No matches found'));
 				$p->parse('rows','row_empty',True);
 			}
-			else if(count($_SESSION["mobile_search_ids"])>100) { //Muitos resultados...
-				$p->set_var('message',lang('too many results'));
-				$p->parse('rows','row_empty',True);			
-			}
-			else if((isset($_POST["name"])) || (isset($_GET["page"]))){ //Renderizar...
-				
+			else if((isset($_POST["name"])) || (isset($_GET["page"]))){ //Se teve resultados...
 				/////////// Preenche o cabeçalho da consulta
-				if($this->page_info['actual_catalog']!="bo_group_manager") {
+				if($this->page_info['actual_catalog']=="bo_people_catalog") {
 					$p->set_var(
 							array('lang_people_name' => lang("Name"),
@@ -254,10 +179,8 @@
 					$p->parse('header','group_header',True);
 				}
-				
 				/////////// Preencho as linhas do resultado
 				foreach($entries as $entry) {
 					$this->nextmatchs->template_alternate_row_color($p);
-					if(($this->page_info['actual_catalog']!="bo_group_manager") &&
-							 (strpos($this->page_info['actual_catalog'],'bo_global_ldap_catalog')===false)){ //People
+					if($this->page_info['actual_catalog']=="bo_people_catalog") {
 						$var = array('row_nome'=>$entry['names_ordered']);
 						$conn1 = array_shift($entry['connections']);
@@ -278,8 +201,9 @@
 							$var['row_telefone'] = $conn1['connection_value'];
 						}
+						$var['form_action'] = "index.php?menuaction=mobile.mobilemail.new_msg";
 						$p->set_var($var);
 						$p->parse('rows','row',True);
 					}
-					else if($this->page_info['actual_catalog']=="bo_group_manager"){ //Grupos
+					else {
 						$var = array(
 								'row_group_name'=>$entry['short_name'],
@@ -290,58 +214,33 @@
 						$p->parse('rows','row_group',True);
 					}
-					else { //Ldap
-						$var = array('row_nome'=>$entry['names_ordered'][0]);
-						$conn1 = array_shift($entry['connections']);
-						if(($conn1==NULL)) {
-							$var['row_telefone'] = '&nbsp;';
-							$var['row_email'] = '&nbsp;';
-						}
-						else if($conn1['id_type']==1) {
-							$var['row_email'] = $conn1['connection_value'];
-							$conn2=array_shift($entry['connections']);
-							if($conn2==NULL)
-								$var['row_telefone'] = '&nbsp';
-							else
-								$var['row_telefone'] = $conn2['connection_value'];
-						}
-						else if($conn1['id_type']==2) {
-							$var['row_email'] = '&nbsp;';
-							$var['row_telefone'] = $conn1['connection_value'];
-						}
-						$p->set_var($var);
-						$p->parse('rows','row',True);
-					}
 				}
 			}
 			
 			////////////////// Monto a paginação
-			if(!empty($entries) && count($_SESSION["mobile_search_ids"])<=100) {
-				$num_pages = count($_SESSION["mobile_search_ids"])/10;
-				
-				if((count($_SESSION["mobile_search_ids"])%10!=0) || ($num_pages<1))
-					$num_pages++;
-				if($actual_page!=0) {
-					for($i=1;$i<=$num_pages;$i++) {
-						$p->set_var('num_page',$i);
-						$p->set_var('display_page',$i);
-						if($i!=$actual_page)
-							$p->parse('pages','page',True);
-						else
-							$p->parse('pages','page_no_link',True);
-					}
-				}
-				
-				if($actual_page>1) {
-					$p->set_var('num_page',$actual_page-1);
-					$p->set_var('display_page','<');
-					$p->parse('back','page',True);
-				}
-				
-				if(($actual_page!=floor($num_pages)) && (floor($num_pages)>1) && ($actual_page!=0)) {
-					$p->set_var('num_page',$actual_page+1);
-					$p->set_var('display_page','>');
-					$p->parse('next','page',True);
-				}	
-			}			
+			$num_pages = count($_SESSION["mobile_search_ids"])/10;
+			if((count($_SESSION["mobile_search_ids"])%10!=0) || ($num_pages<1))
+				$num_pages++;
+			if($actual_page!=0) {
+				for($i=1;$i<=$num_pages;$i++) {
+					$p->set_var('num_page',$i);
+					$p->set_var('display_page',$i);
+					if($i!=$actual_page)
+						$p->parse('pages','page',True);
+					else
+						$p->parse('pages','page_no_link',True);
+				}
+			}
+			
+			if($actual_page>1) {
+				$p->set_var('num_page',$actual_page-1);
+				$p->set_var('display_page','<');
+				$p->parse('back','page',True);
+			}
+			
+			if(($actual_page!=floor($num_pages)) && (floor($num_pages)>1) && ($actual_page!=0)) {
+				$p->set_var('num_page',$actual_page+1);
+				$p->set_var('display_page','>');
+				$p->parse('next','page',True);
+			}				
 			
 			$p->pfp('out','body');
Index: trunk/mobile/index.php
===================================================================
--- trunk/mobile/index.php	(revision 454)
+++ trunk/mobile/index.php	(revision 517)
@@ -73,6 +73,6 @@
 	//if((is_array($public_functions) && $public_functions[$method]) && ! $invalid_data)
 	{
+		execmethod($_GET['menuaction']);
 		print_header();
-		execmethod($_GET['menuaction']);
 		print_footer();
 		unset($mobileapp);
Index: trunk/mobile/mobile_header.inc.php
===================================================================
--- trunk/mobile/mobile_header.inc.php	(revision 480)
+++ trunk/mobile/mobile_header.inc.php	(revision 517)
@@ -72,4 +72,46 @@
 		$p->parse('home_t', 'mobile_header');
 
+		/********************************\
+		 * Cria o link para o new_mail  *
+		\********************************/
+		$q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+		$q->set_file(
+				Array(
+					'new_mail_t' => 'home.tpl'
+				)
+		);
+
+		$q->set_block('new_mail_t', 'new_mail');
+		$q->set_block('new_mail_t', 'begin_anchor');
+		$q->set_block('new_mail_t', 'end_anchor');
+
+		$q->set_var('href', 'index.php?menuaction=mobile.mobilemail.new_msg&clk=01');
+		$q->set_var('lang_newmail', lang('Create mail'));
+		$q->fp('new_mail_t', 'begin_anchor');
+		$q->fp('new_mail_t', 'end_anchor');
+
+		$p->set_var('newmail', trim($q->fp('new_mail_t', 'new_mail')));
+
+		/********************************\
+		 * Cria o link para o mobilemail *
+		\********************************/
+		$q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+		$q->set_file(
+				Array(
+					'mobilemail_t' => 'home.tpl'
+				)
+		);
+
+		$q->set_block('mobilemail_t', 'mobilemail');
+		$q->set_block('mobilemail_t', 'begin_anchor');
+		$q->set_block('mobilemail_t', 'end_anchor');
+
+		$q->set_var('href', 'mobilemail_index.php');
+		$q->set_var('lang_email', lang('E-mail'));
+		$q->fp('mobilemail_t', 'begin_anchor');
+		$q->fp('mobilemail_t', 'end_anchor');
+
+		$p->set_var('mobilemail', trim($q->fp('mobilemail_t', 'mobilemail')));
+
 		/*****************************\
 		 * Cria o link para a agenda *
@@ -97,5 +139,5 @@
 		 * Cria o link para o mobilemail *
 		\********************************/
-		$q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+/*		$q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
 		$q->set_file(
 				Array(
@@ -114,13 +156,14 @@
 
 		$p->set_var('mobilemail', trim($q->fp('mobilemail_t', 'mobilemail')));
-
-		/********************************\
-		 * Cria o link para o cc		 *
-		\********************************/
-		$q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
-		$q->set_file(
-				Array(
-					'cc_t' => 'home.tpl'
-				)
+*/
+
+		/********************************\
+		 * Cria o link para o cc	 *
+ 		\********************************/
+		$q = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+		$q->set_file(
+			Array(
+				'cc_t' => 'home.tpl'
+			)
 		);
 
@@ -128,12 +171,11 @@
 		$q->set_block('cc_t', 'begin_anchor');
 		$q->set_block('cc_t', 'end_anchor');
-
+		
 		$q->set_var('href', 'index.php?menuaction=mobile.ui_mobilecc.contacts_list');
-		$q->set_var('lang_cc', lang('contact center'));
+		$q->set_var('lang_cc', lang('Contact Center'));
 		$q->fp('cc_t', 'begin_anchor');
 		$q->fp('cc_t', 'end_anchor');
-
+		
 		$p->set_var('contactcenter', trim($q->fp('cc_t', 'mobilecc')));
-
 
 		/**************************************\
Index: trunk/mobile/templates/default/home.tpl
===================================================================
--- trunk/mobile/templates/default/home.tpl	(revision 480)
+++ trunk/mobile/templates/default/home.tpl	(revision 517)
@@ -9,5 +9,5 @@
 </head>
 <body style="background-color:white !important">
-<p>&nbsp;&nbsp;<strong>{fullname}: [{account_lid}]</strong></p>
+<!--<p>&nbsp;&nbsp;<strong>{fullname}: [{account_lid}]</strong></p>-->
 <hr />
 <!-- END mobile_header -->
@@ -15,7 +15,18 @@
 <!-- BEGIN mobile_navbar -->
 <!-- TODO: Yep! Deveria ser flexível, não hardcoded do jeito que tá -->
-<p>&nbsp;&nbsp;<strong>Expresso Mini</strong> :: {agenda} :: {mobilemail} :: {contactcenter} :: <a href="./login.php?cd=1">{lang_logout}</a></p>
+<!--<p>&nbsp;&nbsp;<strong>:: Expresso Mini</strong> </p>-->
+<p>
+:: {newmail} <br>
+:: {mobilemail} <br>
+:: {agenda} <br>
+:: {contactcenter} <br>
+:: <a href="./login.php?cd=1">{lang_logout}</a>
+</p>
 <hr />
 <!-- END mobile_navbar -->
+
+<!-- BEGIN new_mail -->
+{begin_anchor}{lang_newmail}{end_anchor}
+<!-- END new_mail -->
 
 <!-- BEGIN agenda -->
@@ -26,4 +37,5 @@
 {begin_anchor}{lang_email}{end_anchor}
 <!-- END mobilemail -->
+
 <!-- BEGIN mobilecc -->
 {begin_anchor}{lang_cc}{end_anchor}
Index: trunk/mobile/templates/default/cc_main.tpl
===================================================================
--- trunk/mobile/templates/default/cc_main.tpl	(revision 480)
+++ trunk/mobile/templates/default/cc_main.tpl	(revision 517)
@@ -20,4 +20,5 @@
 	
 </table>
+</form>
 <table border="0" width="90%">
 			<tr bgcolor="{th_theme}">
@@ -33,5 +34,4 @@
 	</tr>
 </table>
-</form>
 <!-- END body -->
 
@@ -48,9 +48,17 @@
 
 <!-- BEGIN row -->
+<form id="cc_form" name="cc_form" method="POST" action="{form_action}">
 	<tr bgcolor="{tr_color}">
 		<td>{row_nome}</td>
 		<td align="center">{row_telefone}</td>
-		<td align="center">{row_email}</td>
+		<td align="center"><a href="{form_action}&input_to={row_nome}&input_to_mail={row_email}&cc_mob=1">{row_email}</a></td>
+
 	</tr>
+		<input type="hidden" id="input_to" name="input_to" value="{row_nome}" style="display: none;"/>
+		<input type="hidden" id="input_to_mail" name="input_to_mail" value="{row_email}" style="display: none;"/>
+		<input type="hidden" id="input_subject" name="input_subject" value="" style="display: none;"/>
+		<input type="hidden" id="body" name="body" value="" style="display: none;"/>
+		<input type="hidden" id="cc_mob" name="cc_mob" value="1" style="display: none;"/>
+</form>	
 <!-- END row -->
 
Index: trunk/mobile/templates/default/mobilemail.tpl
===================================================================
--- trunk/mobile/templates/default/mobilemail.tpl	(revision 488)
+++ trunk/mobile/templates/default/mobilemail.tpl	(revision 517)
@@ -24,5 +24,6 @@
 
 <!-- BEGIN mail_row -->
-<p>&nbsp;&nbsp;<strong>{from_label}</strong>: <a href="index.php?menuaction=mobile.mobilemail.show_msg&msg_number={msg_number}&msg_folder={msg_folder}">{from}<br>&nbsp;&nbsp;&nbsp;&nbsp;{subject} - {date}</a></p>
+<p>&nbsp;&nbsp;<strong>{from_label}</strong>: <a href="index.php?menuaction=mobile.mobilemail.show_msg&msg_number={msg_number}&msg_folder={msg_folder}">{from}<br>
+&nbsp;&nbsp;&nbsp;&nbsp;{subject} - {date}</a></p>
 <!-- END mail_row -->
 
@@ -47,4 +48,8 @@
 <!-- END page_item -->
 
+<!-- BEGIN page_item1 -->
+{number_of_pages}{space}
+<!-- END page_item1 -->
+
 <!-- BEGIN end_anchor -->
 </a>
Index: trunk/mobile/templates/default/view_msg.tpl
===================================================================
--- trunk/mobile/templates/default/view_msg.tpl	(revision 454)
+++ trunk/mobile/templates/default/view_msg.tpl	(revision 517)
@@ -1,8 +1,7 @@
 <!-- BEGIN mail_header -->
 <p>&nbsp;&nbsp;<strong>{from_label}</strong>: {from}</p>
-<p>&nbsp;&nbsp;<strong>{to_label}</strong>: {to}</p>
+<!--<p>&nbsp;&nbsp;<strong>{to_label}</strong>: {to}</p>-->
 <p>&nbsp;&nbsp;<strong>{subject_label}</strong>: {subject}</p>
 <p>&nbsp;&nbsp;<strong>{date_label}</strong>: {date}</p>
-<br />
 <br />
 <!-- END mail_header -->
@@ -13,4 +12,8 @@
 <br />
 <!-- END mail_body -->
+
+<!-- BEGIN reply_msg -->
+<p>&nbsp;&nbsp;&nbsp;<a href="{reply}">{reply_text}</a></p>
+<!-- END reply_msg -->
 
 <!-- BEGIN mail_footer -->
@@ -23,9 +26,9 @@
 <!-- END attachment_list -->
 
+<!-- BEGIN begin_anchor -->
+<a href="{link}">
+<!-- END begin_anchor -->
+
 <!-- BEGIN end_anchor -->
 </a>
 <!-- END end_anchor -->
-
-<!-- BEGIN begin_anchor -->
-<a href="{link}">
-<!-- END begin_anchor -->
Index: trunk/mobile/templates/css/mobile.css
===================================================================
--- trunk/mobile/templates/css/mobile.css	(revision 488)
+++ trunk/mobile/templates/css/mobile.css	(revision 517)
@@ -78,8 +78,4 @@
 	/*	padding-top:1px;
 	padding-bottom:1px;*/
-}
-hr{
-	border: 2;
-	width: 99%;
 }
 
@@ -442,4 +438,4 @@
 	color: #000066;
 	font-weight: bold;
-	padding-top: 70px;
-}
+	padding-top: 1px;
+}
