Index: tags/mobile/0.1.004/setup/phpgw_en.lang
===================================================================
--- tags/mobile/0.1.004/setup/phpgw_en.lang	(revision 454)
+++ tags/mobile/0.1.004/setup/phpgw_en.lang	(revision 454)
@@ -0,0 +1,4 @@
+From	mobile	pt-br	From
+Folder	mobile	pt-br	Folder
+Inbox	mobile	pt-br	Inbox
+Return	mobile	pt-br	Return
Index: tags/mobile/0.1.004/setup/phpgw_pt-br.lang
===================================================================
--- tags/mobile/0.1.004/setup/phpgw_pt-br.lang	(revision 611)
+++ tags/mobile/0.1.004/setup/phpgw_pt-br.lang	(revision 611)
@@ -0,0 +1,57 @@
+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
+People	mobile	pt-br	Pessoal
+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
+Accept	mobile	pt-br	Aceitar
+Accepted	mobile	pt-br	aceitou
+Reject	mobile	pt-br	Rejeitar
+Rejected	mobile	pt-br	rejeitou
+Location	mobile	pt-br	Local
+Start Date/Time	mobile	pt-br	Data/Hora Início
+End Date/Time	mobile	pt-br	Data/Hora Término
+schedule	mobile	pt-br	Agendar
+continue scheduling	mobile	pt-br	Continuar o agendamento
+already_addeds:	mobile	pt-br	Já adicionados:
+Start Date	mobile	pt-br	Data(Início)
+End Date	mobile	pt-br	Data(Término)
+Start Time	mobile	pt-br	Hora(Início)
+End Time	mobile	pt-br	Hora(Término)
+keep add participants	mobile	pt-br	Adicionar participantes
+your suggested time of <b> %1 - %2 </b> conflicts with the following existing calendar entries:	mobile	pt-br	Horário sugerido: <B> %1 - %2 </B> está em conflito com as seguintes entradas no calendário:
+scheduling conflict	mobile	pt-br	Conflito de agendamento
+ignore conflict	mobile	pt-br	Ignorar conflito
+re-edit event	mobile	pt-br	Re-Editar evento
+username_mobile	mobile	pt-br	Usuário
+password_mobile	mobile	pt-br	Senha
+the search argument must have at least 4 digits	mobile	pt-br	O argumento da busca deve possuir pelo menos 4 dígitos
+choose the participants	mobile	pt-br	Escolha os participantes
+Added	mobile	pt-br	Adicionado
+To See Commitment	mobile	pt-br	Para ver compromisso
+To accept	mobile	pt-br	Aceitar
+To reject	mobile	pt-br	Rejeitar
+alarm	mobile	pt-br	Alarme
+To Delegate	mobile	pt-br	Delegar
Index: tags/mobile/0.1.004/setup/setup.inc.php
===================================================================
--- tags/mobile/0.1.004/setup/setup.inc.php	(revision 686)
+++ tags/mobile/0.1.004/setup/setup.inc.php	(revision 686)
@@ -0,0 +1,43 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare                                                               *
+	* http://www.egroupware.org                                                *
+	* The file written by Mário César Kolling <mario.kolling@serpro.gov.br>    *
+	* --------------------------------------------                             *
+	*  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.                                              *
+	\**************************************************************************/
+
+	/* Basic information about this app */
+	$setup_info['mobile']['name']      = 'mobile';
+	$setup_info['mobile']['title']     = 'ExpressoMini';
+	$setup_info['mobile']['version']   = '0.1.004';
+	$setup_info['mobile']['app_order'] = 4;
+	$setup_info['mobile']['enable']    = 2;
+
+	$setup_info['mobile']['author'] = 'Mário César Kolling';
+	$setup_info['mobile']['note']   = 'Mobile é uma versão mais simples do Expresso, desenvolvida para ser utilizada através de dispositivos móveis';
+	$setup_info['mobile']['license']  = 'GPL';
+	$setup_info['mobile']['description'] = 'Mobile é uma versão mais simples do Expresso, desenvolvida para ser utilizada' .
+			' através de dispositivos móveis. Atualmente compreende um módulo de visualização de agenda e outro de leitura' .
+			' de e-mails.';
+
+	$setup_info['mobile']['maintainer'] = 'Mário César Kolling';
+	$setup_info['mobile']['maintainer_email'] = 'mario.kolling@serpro.gov.br';
+
+	/* The hooks this app includes, needed for hooks registration */
+	//$setup_info['mobile']['hooks'][] = 'admin';
+	//$setup_info['mobile']['hooks'][] = 'preferences';
+	//$setup_info['mobile']['hooks'][] = 'config_validate';
+
+	/* mobile Tables */
+
+	/* Dependencies for this app to work */
+	//TODO: Adicionar expressoMail1_2 e calendar como dependências
+	$setup_info['mobile']['depends'][] = array(
+		'appname' => 'phpgwapi',
+		'versions' => Array('0.9.14', '0.9.15' ,'0.9.24','1.0.0', '1.0.1')
+	);
+?>
Index: tags/mobile/0.1.004/inc/class.ui_mobilecalendar.inc.php
===================================================================
--- tags/mobile/0.1.004/inc/class.ui_mobilecalendar.inc.php	(revision 623)
+++ tags/mobile/0.1.004/inc/class.ui_mobilecalendar.inc.php	(revision 623)
@@ -0,0 +1,919 @@
+<?php
+    class ui_mobilecalendar {
+		
+		var $bo;
+		var $cat;
+		var $link_tpl;		
+		
+		var $public_functions = array(
+			'add' => true,
+			'init_schedule' => true,
+			'add_participants' => true,
+			'add_participant' => true,
+			'edit' => true,
+			'update' =>true,
+			'overlap' => true,
+			'index' => true
+		);
+		
+		function ui_mobilecalendar() {
+			$this->bo = CreateObject('calendar.bocalendar',1);			
+			$this->cat = &$this->bo->cat;
+			$GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
+	
+			$this->link_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+			$this->link_tpl->set_unknowns('remove');
+			$this->link_tpl->set_file(
+				Array(
+					'link_picture'	=> 'link_pict.tpl'
+				)
+			);
+			$this->link_tpl->set_block('link_picture','link_pict','link_pict');
+			$this->link_tpl->set_block('link_picture','pict','pict');
+			$this->link_tpl->set_block('link_picture','link_open','link_open');
+			$this->link_tpl->set_block('link_picture','link_close','link_close');
+			$this->link_tpl->set_block('link_picture','link_text','link_text');
+		}
+		
+		function index() {
+			$accountId = $GLOBALS['phpgw_info']['user']['account_id'];
+			$uicalendar = CreateObject("calendar.uicalendar");
+			$daysofWeek = array(lang('Sunday'), lang('Monday'),lang('Tuesday'),lang('Wednesday'),lang('Thursday'),lang('Friday'),lang('Saturday'));
+			$year = $uicalendar->bo->year;
+			$month = $uicalendar->bo->month;
+			$day = $uicalendar->bo->day;
+			$start = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, $day) + $GLOBALS['phpgw']->datetime->tz_offset;
+			$tstart = $start - $GLOBALS['phpgw']->datetime->tz_offset;
+			$tstop = $tstart + 604800;
+			$uicalendar->bo->so->owner = $accountId;
+			$uicalendar->bo->so->open_box($accountId);
+			$uicalendar->bo->store_to_cache(
+				Array(
+					'syear'  => date('Y',$tstart),
+					'owner'	=> $accountId,
+					'smonth' => date('m',$tstart),
+					'sday'   => date('d',$tstart),
+					'eyear'  => date('Y',$tstop),
+					'emonth' => date('m',$tstop),
+					'eday'   => date('d',$tstop)
+				)
+			);
+			$daily = $uicalendar->bo->cached_events;
+			$p = CreateObject('phpgwapi.Template', "../mobile/templates/".$GLOBALS['phpgw_info']['server']['template_set']);
+			$p->set_file(Array('view' => 'calendar.tpl'));
+			$data[] = array();
+			@ksort($daily);
+			$p->set_block("view","body");
+			if($daily){
+				$p->set_block('view','view_event');
+				foreach($daily as $date => $day_params)	{
+					$year  = (int)substr($date,0,4);
+					$month = (int)substr($date,4,2);
+					$day   = (int)substr($date,6,2);
+					$day_of_week = $daysofWeek[$GLOBALS['phpgw']->datetime->day_of_week($year,$month,$day)];
+					$p->set_var("header_date",$day_of_week." - ".$day."/".$month."/".$year);
+					for($i = 0; $i < count($day_params);$i++)
+					{
+		
+						//Verifica se o usuario conectado é o dono do agendamento, se for não serão exibidos os links
+						//Aceitar e Rejeitar
+						$display = "";
+						if($accountId == $day_params[$i]['owner'])
+						{
+							$display = "none";
+						}
+		
+						$vars = $uicalendar->bo->event2array($day_params[$i]);
+						$data  = array (
+									"title_field"		=> $vars['title']['field'],
+									"title_data"		=> $vars['title']['data'],
+									"location_field"	=> $vars['location']['field'],
+									"location_data"		=> $vars['location']['data'] ? $vars['location']['data'] : "&nbsp;",
+									"startdate_field"	=> $vars['startdate']['field'],
+									"startdate_data" 	=> substr($vars['startdate']['data'],13, 17),
+									"enddate_field" 	=> $vars['enddate']['field'],
+									"enddate_data" 		=> substr($vars['enddate']['data'],13, 17),
+									"description_field"	=> $vars['description']['field'],
+									"description_data"	=> $vars['description']['data'] ? $vars['description']['data'] : "&nbsp;",
+									//Links Aceitar e Rejeitar o compromisso
+									"accept_title"		=> lang("Accept"),
+									"accept_data"		=> "index.php?menuaction=mobile.ui_mobilemail.set_action&cal_id=" . $day_params[$i]['id'] . "&action=3",
+									"reject_title"		=> lang("Reject"),
+									"reject_data"		=> "index.php?menuaction=mobile.ui_mobilemail.set_action&cal_id=" . $day_params[$i]['id'] . "&action=0",
+									"display"		=> $display
+									);
+		
+			//			print_r($vars);
+				    	 	$p->set_var($data);
+				    	 	$p->parse('views','view_event',True);
+					}
+				}
+				$p->parse('events','views');
+				//$p->pfp('out','views');
+			}
+			else {
+				$p->set_block('view','no_event');
+				$syear  = date('Y',$tstart);
+				$smonth = date('m',$tstart);
+				$sday   = date('d',$tstart);
+				$eyear  = date('Y',$tstop);
+				$emonth = date('m',$tstop);
+				$eday	= date('d',$tstop);
+				$p->set_var("start_date",$sday."/".$smonth."/".$syear);
+				$p->set_var("end_date", $eday."/".$emonth."/".$eyear);
+				$p->parse('events','no_event');
+		//		$p->pfp('out','no_event');
+			}
+			$p->set_var("lang_schedule",lang("schedule"));
+			//$p->pfp('out','body');
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out','body'));
+		}
+		
+		function page($_page='',$params='')
+		{
+			if($_page == '')
+			{
+				$page_ = explode('.',$this->bo->prefs['calendar']['defaultcalendar']);
+				$_page = $page_[0];
+
+				if ($_page=='planner_cat' || $_page=='planner_user')
+				{
+					$_page = 'planner';
+				}
+				elseif ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 'planner'))
+				{
+					$_page = 'month';
+					$GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar','month');
+					$GLOBALS['phpgw']->preferences->save_repository();
+				}
+			}
+			if($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home' ||
+				strstr($GLOBALS['phpgw_info']['flags']['currentapp'],'mail'))	// email, felamimail, ...
+			{
+				$page_app = 'calendar';
+			}
+			else
+			{
+				$page_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
+			}
+			if (is_array($params))
+			{
+				$params['menuaction'] = $page_app.'.ui'.$page_app.'.'.$_page;
+			}
+			else
+			{
+				$params = 'menuaction='.$page_app.'.ui'.$page_app.'.'.$_page.$params;
+			}
+			return $GLOBALS['phpgw']->link('/index.php',$params);
+		}
+		
+		function init_schedule() {
+			$_SESSION['mobile_calendar'] = NULL;
+			$this->add_participants();
+		}
+		
+		function add_participants() {
+
+			$ui_cc = CreateObject('mobile.ui_mobilecc');
+			$ui_cc->contacts_list(true);
+		}
+		
+		function add_participant() {
+			
+			$participants = $_SESSION["mobile_calendar"];
+			
+			if(!is_array($participants))
+				$participants = array();
+				
+			$participants[$_GET['user']] = $_GET['cn'];
+			
+			$_SESSION["mobile_calendar"] = $participants;
+				
+			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+			$p->set_file(Array('continue' => 'keep_add_participants.tpl'));
+			$p->set_block('continue','body');
+			$p->set_var('lang_add_participants',lang('keep add participants'));
+			$p->set_var('lang_continue',lang('continue scheduling'));
+			//$p->pfp('out','body');
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out','body'));
+		}
+		
+		function add($cd=0,$readsess=0)
+		{
+			if(!$this->bo->check_perms(PHPGW_ACL_ADD))
+			{
+				$this->index();
+			}
+			
+			if($readsess)
+			{
+				$event = $this->bo->restore_from_appsession;
+				if(!$event['owner'])
+				{
+					$this->bo->add_attribute('owner',$this->bo->owner);
+				}
+				$can_edit = True;
+			}
+			else
+			{
+				$this->bo->event_init();
+				$this->bo->add_attribute('id',0);
+
+				$can_edit = True;
+				$participants = (string)(get_var('participants',array('GET'),FALSE));
+				$starthour = (int)(get_var('hour',array('GET'),$this->bo->prefs['calendar']['workdaystarts']));
+				$startmin  = (int)(get_var('minute',array('GET'),0));
+				$endmin    = $startmin + (int)$this->bo->prefs['calendar']['defaultlength'];
+				$endhour   = $starthour + $this->bo->normalizeminutes($endmin);
+				
+				$subject	= (string)(get_var('title',array('GET'),0));
+				if ($subject != '0')
+				{
+					$description	= (string)(get_var('description',array('GET'),0));
+					$location	= (string)(get_var('location',array('GET'),0));
+				}
+				else
+					unset($subject);
+				
+				$this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0);
+				$this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$endhour,$endmin,0);
+				$this->bo->set_title($subject);
+				$this->bo->set_description($description);
+				$this->bo->add_attribute('location',$location);
+				$this->bo->set_ex_participants('');
+				$this->bo->add_attribute('uid','');
+				$this->bo->add_attribute('priority',2);
+				if(@$this->bo->prefs['calendar']['default_private'])
+				{
+					$this->bo->set_class(False);
+				}
+				else
+				{
+					$this->bo->set_class(True);
+				}
+
+				$this->bo->add_attribute('participants','A',$this->bo->owner);
+				$this->bo->set_recur_none();
+				$event = $this->bo->get_cached_event();
+				
+			}
+			$this->edit_form(
+				Array(
+					'event' => $event,
+					'cd' => $cd
+				)
+			);
+			//$GLOBALS['phpgw']->common->phpgw_footer();
+		}
+		
+		function edit($params='')
+		{
+			if($this->debug)
+			{
+				echo '<!-- params[readsess] = '.$params['readsess'].' -->'."\n";
+				echo '<!-- params[cd] = '.$params['cd'].' -->'."\n";
+			}
+
+			if(isset($_GET['readsess']))
+			{
+				$params['readsess'] = $_GET['readsess'];
+				$params['cd'] = 0;
+			}
+
+			if($this->debug)
+			{
+				echo '<!-- params[readsess] = '.$params['readsess'].' -->'."\n";
+				echo '<!-- params[cd] = '.$params['cd'].' -->'."\n";
+			}
+
+			if($params != '' && @is_array($params) && @isset($params['readsess']))
+			{
+				$can_edit = True;
+				$this->edit_form(
+					Array(
+						'event' => $this->bo->restore_from_appsession(),
+						'cd' => $params['cd']
+					)
+				);
+			}
+			elseif(isset($_GET['cal_id']))
+			{
+				$cal_id = (int)$_GET['cal_id'];
+				$event = $this->bo->read_entry($cal_id);
+
+				if(!$this->bo->check_perms(PHPGW_ACL_EDIT,$event))
+				{
+					Header('Location: '.$this->page('view','&cal_id='.$cal_id));
+					$GLOBALS['phpgw']->common->phpgw_exit();
+				}
+				if(@isset($_POST['edit_type']) && $_POST['edit_type'] == 'single')
+				{
+					$event['id'] = 0;
+					$this->bo->set_recur_date($event,$_POST['date']);
+					$event['recur_type'] = MCAL_RECUR_NONE;
+					$event['recur_interval'] = 0;
+					$event['recur_data'] = 0;
+					$event['recur_enddate']['month'] = 0;
+					$event['recur_enddate']['mday'] = 0;
+					$event['recur_enddate']['year'] = 0;
+					$event['recur_exception'] = array();
+				}
+				$this->edit_form(
+					Array(
+						'event' => $event,
+						'cd'	=> $cd
+					)
+				);
+			}
+ 		}
+		
+		function update() {
+			$params = array();
+			$params['from_mobile'] = true;
+			$this->bo->update($params);
+		}
+		
+		function edit_form($param)
+		{
+			if(!is_array($param))
+			{
+				$this->index();
+			}
+			
+			if(isset($param['event']))
+			{
+				$event = $param['event'];
+			}
+			
+			$hourformat = substr($this->bo->users_timeformat,0,1);
+			
+			// $sb = CreateObject('phpgwapi.sbox');
+			$sb = CreateObject('phpgwapi.sbox2');
+			$jscal = CreateObject('phpgwapi.jscalendar');	// before phpgw_header() !!!
+			
+			unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['noappheader'] = True;
+			$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Editing event') : lang('Adding event');
+			//$GLOBALS['phpgw']->common->phpgw_header();
+
+			$p = &$GLOBALS['phpgw']->template;
+			$p->set_file(
+				Array(
+					'edit'		=> 'edit.tpl',
+					'form_button'	=> 'form_button_script.tpl'
+				)
+			);
+			$p->set_block('edit','edit_entry','edit_entry');
+			$p->set_block('edit','list','list');
+			$p->set_block('edit','hr','hr');
+			
+			$vars = Array(
+				'font'			=> $this->theme['font'],
+				'bg_color'		=> $this->theme['bg_text'],
+				'action_url'		=> $GLOBALS['phpgw']->link('/mobile/index.php',Array('menuaction'=>'mobile.ui_mobilecalendar.update')),
+				'accounts_link'		=> $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.accounts_popup'),
+				'common_hidden'	=> '<input type="hidden" name="cal[id]" value="'.$event['id'].'">'."\n"
+					. '<input type="hidden" name="cal[owner]" value="'.$event['owner'].'">'."\n"
+					. '<input type="hidden" name="cal[uid]" value="'.$event['uid'].'">'."\n"
+					. ($_GET['cal_id'] && $event['id'] == 0?'<input type="hidden" name="cal[reference]" value="'.$_GET['cal_id'].'">'."\n":
+					(@isset($event['reference'])?'<input type="hidden" name="cal[reference]" value="'.$event['reference'].'">'."\n":''))
+					. (@isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && $GLOBALS['phpgw_info']['server']['deny_user_grants_access']?
+					'<input type="hidden" name="participants[]" value="'.$this->bo->owner.'">'."\n":''),
+				'errormsg'		=> ($param['cd']?$GLOBALS['phpgw']->common->check_code($param['cd']):''),
+				'row_owner'		=> '<input type="hidden" name="participants[]" value="'.$event['owner'].$event['participants'][$event['owner']].'">'
+			);
+			
+			$p->set_var($vars);
+
+// Brief Description
+			$var['title'] = Array(
+				'tr_color' => $this->theme['th_bg'],
+				'field'	=> lang('Title'),
+				'data'	=> '<input name="cal[title]" size="15" maxlength="80" value="'.$event['title'].'">'
+			);
+
+// Location
+			$var['location'] = Array(
+				'field'	=> lang('Location'),
+				'data'	=> '<input name="cal[location]" size="15" maxlength="255" value="'.$event['location'].'">'
+			);
+
+// Date
+
+			$start = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$var['startdate'] = Array(
+				'field'	=> lang('Start Date'),
+
+				'data'	=> $GLOBALS['phpgw']->common->dateformatorder(
+				   $sb->getYears('start[year]',(int)$GLOBALS['phpgw']->common->show_date($start,'Y')),
+				   $sb->getMonths('start[month]',(int)$GLOBALS['phpgw']->common->show_date($start,'n')),
+				   $sb->getDays('start[mday]',(int)$GLOBALS['phpgw']->common->show_date($start,'d')),
+				   true
+				)
+
+//				'data' => $jscal->input('start[str]',$start)
+			);
+
+// Time
+			if ($this->bo->prefs['common']['timeformat'] == '12')
+			{
+				$str .= '<input type="radio" name="start[ampm]" value="am"'.($event['start']['hour'] >= 12?'':' checked').'>am'."\n"
+					. '<input type="radio" name="start[ampm]" value="pm"'.($event['start']['hour'] >= 12?' checked':'').'>pm'."\n";
+			}
+			$var['starttime'] = Array(
+				'field'	=> lang('Start Time'),
+				'data'	=> '<input name="start[hour]" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($start,$hourformat).'" maxlength="2">:<input name="start[min]" size="2" value="'.$GLOBALS['phpgw']->common->show_date($start,'i').'" maxlength="2">'."\n".$str
+			);
+
+// End Date
+			$end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$var['enddate'] = Array(
+				'field'	=> lang('End Date'),
+
+				'data'	=> $GLOBALS['phpgw']->common->dateformatorder(
+				   $sb->getYears('end[year]',(int)$GLOBALS['phpgw']->common->show_date($end,'Y')),
+				   $sb->getMonths('end[month]',(int)$GLOBALS['phpgw']->common->show_date($end,'n')),
+				   $sb->getDays('end[mday]',(int)$GLOBALS['phpgw']->common->show_date($end,'d')),true
+				)
+
+//				'data' => $jscal->input('end[str]',$end)
+			);
+
+// End Time
+			if ($this->bo->prefs['common']['timeformat'] == '12')
+			{
+				$str = '<input type="radio" name="end[ampm]" value="am"'.($event['end']['hour'] >= 12?'':' checked').'>am'."\n"
+					. '<input type="radio" name="end[ampm]" value="pm"'.($event['end']['hour'] >= 12?' checked':'').'>pm'."\n";
+			}
+			$var['endtime'] = Array(
+				'field'	=> lang('End Time'),
+				'data'	=> '<input name="end[hour]" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($end,$hourformat).'" maxlength="2">:<input name="end[min]" size="2" value="'.$GLOBALS['phpgw']->common->show_date($end,'i').'" maxlength="2">'."\n".$str
+			);
+
+
+			$participants = $_SESSION['mobile_calendar'];
+			$str = " ";
+			foreach($participants as $id => $nome) {
+				$str.="<option value='$id' selected>$nome</option>";
+			}
+			
+			
+			$var['participants'] = array
+						(
+							'field'	=> lang('Participants'),							
+							'data'	=> "
+							<select id='user_list' name='participants[]' style='width: 220px' multiple size='5'>".$str."</select></center>
+									<script src='../calendar/templates/celepar/js/edit.js' type='text/javascript'></script>
+									"
+						);
+			
+
+			/*$var['owner'] = Array(
+					'field'	=> $GLOBALS['phpgw']->common->grab_owner_name($event['owner']).' '.lang('Participates'),
+					'data'	=> '<input type="checkbox" name="participants[]" value="'.$event['owner'].$event['participants'][$event['owner']].'" checked read-only="true">'
+				);*/
+
+
+			if (!isset($this->fields))
+			{
+				$this->custom_fields = CreateObject('calendar.bocustom_fields');
+				$this->fields = &$this->custom_fields->fields;
+				$this->stock_fields = &$this->custom_fields->stock_fields;
+			}
+			$preserved = False;
+			foreach($this->fields as $field => $data)
+			{
+				/*if($field=='owner')
+					$p->set_var('display',"visibility:hidden");
+				else
+					$p->set_var('display'," ");*/
+				if (!$data['disabled'])
+				{
+					if (isset($var[$field]))
+					{
+						switch($field)
+						{
+							case 'startdate':
+								$this->output_template_array($p,'row','list',$var['startdate']);
+								$this->output_template_array($p,'row','list',$var['starttime']);
+								break;
+							case 'enddate':
+								$this->output_template_array($p,'row','list',$var['enddate']);
+								$this->output_template_array($p,'row','list',$var['endtime']);
+								break;
+							default:
+								$this->output_template_array($p,'row','list',$var[$field]);
+						}
+					}
+					elseif (!isset($this->stock_fields[$field]))	// Custom field
+					{
+						$lang = lang($name = substr($field,1));
+						$size = 'SIZE='.($data['shown'] ? $data['shown'] : ($data['length'] ? $data['length'] : 30)).
+							' MAXLENGTH='.($data['length'] ? $data['length'] : 255);
+						$v = array(
+							'field'	=> $lang == $name.'*' ? $name : $lang,
+							'data'	=> '<input name="cal['.htmlspecialchars($field).']" '.$size.' value="'.$event['#'.$name].'">'
+						);
+						if ($data['title'])
+						{
+							$v['tr_color'] = $this->theme['th_bg'];
+						}
+						if (!$data['length'] && $data['title'])
+						{
+							$p->set_var('tr_color',$this->theme['th_bg']);
+							$p->set_var('hr_text','<center><b>'.$v['field'].'</b></center>');
+							$p->parse('row','hr',True);
+						}
+						else
+						{
+							$this->output_template_array($p,'row','list',$v);
+						}
+					}
+				}
+				else	// preserve disabled fields
+				{
+					switch ($field)
+					{
+						case 'owner':
+							$preserved[$field] = $event['id'] ? $event['participants'][$event['owner']] : 'A';
+							break;
+						case 'recure_type':
+							foreach(array('recur_type','recur_enddate','recur_data','recur_interval') as $field)
+							{
+								$preserved[$field] = $event[$field];
+							}
+							break;
+						case 'startdate':
+						case 'enddate':
+							$field = substr($field,0,-4);
+						default:
+							$preserved[$field] = $event[$field];
+					}
+				}
+			}
+			unset($var);
+			if (is_array($preserved))
+			{
+				//echo "preserving<pre>"; print_r($preserved); echo "</pre>\n";
+				$p->set_var('common_hidden',$p->get_var('common_hidden').'<input type="hidden" name="preserved" value="'.htmlspecialchars(serialize($preserved)).'">'."\n");
+			}
+			$p->set_var('submit_button',lang('Save'));
+			
+			
+
+			$delete_button = $cancel_button = '';
+			if ($event['id'] > 0)
+			{
+				$var = Array(
+					'action_url_button'	=> $this->page('delete','&cal_id='.$event['id']),
+					'action_text_button'	=> lang('Delete'),
+					'action_confirm_button'	=> "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"",
+					'action_extra_field'	=> ''
+				);
+				$p->set_var($var);
+				$delete_button = $p->fp('out','form_button');
+				
+			}
+			$p->set_var('delete_button',$delete_button);
+
+			if ($this->bo->return_to)
+			{
+				$var = Array(
+					'action_url_button'	=> $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to),
+					'action_text_button'	=> lang('Cancel'),
+					'action_confirm_button'	=> '',
+					'action_extra_field'	=> ''
+				);
+				$p->set_var($var);
+				$cancel_button = $p->fp('out','form_button');
+			}
+			
+			$p->set_var('lang_add_participants',lang("keep add participants"));
+			
+			$p->set_var('cancel_button',$cancel_button);
+			$p->pparse('out','edit_entry');
+			
+		}
+		
+		function get_organizations($context, $selected='', $recursive = false)
+		{
+			$s = CreateObject('phpgwapi.sector_search_ldap');
+						
+			return ($recursive ? 
+				$s->get_organizations($context, $selected, false ,false) :
+				$s->get_sectors($selected, false, false));
+		}		
+		
+		function output_template_array(&$p,$row,$list,$var)
+		{
+			if (!isset($var['hidden_vars']))
+			{
+				$var['hidden_vars'] = '';
+			}
+			if (!isset($var['tr_color']))
+			{
+				$var['tr_color'] = $GLOBALS['phpgw']->nextmatchs->alternate_row_color();
+			}
+			$p->set_var($var);
+			$p->parse($row,$list,True);
+		}
+		
+		function overlap($params) {
+			ini_set("display_errors","1");
+			if(!is_array($params))
+			{
+			}
+			else
+			{
+				$overlapping_events = $params['o_events'];
+				$event = $params['this_event'];
+			}
+
+			$month = $event['start']['month'];
+			$mday = $event['start']['mday'];
+			$year = $event['start']['year'];
+
+			$start = mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$mday,$year) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+
+			$overlap = '';
+			for($i=0;$i<count($overlapping_events);$i++)
+			{
+				$overlapped_event = $this->bo->read_entry($overlapping_events[$i],True);
+				$overlap .= '<li>'.$this->link_to_entry($overlapped_event,$month,$mday,$year);
+				$overlap .= '<ul>';
+				foreach($overlapped_event['participants'] as $id => $status)
+				{
+					$conflict = isset($event['participants'][$id]);
+					$overlap .= '<li>'.($conflict?'<b>':'').
+						$GLOBALS['phpgw']->common->grab_owner_name($id).
+						($conflict?'</b> - '.lang('Scheduling conflict'):'')."</li>\n";
+				}
+				$overlap .= "</ul>\n";
+			}
+
+			unset($GLOBALS['phpgw_info']['flags']['noheader']);
+			unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
+			$GLOBALS['phpgw_info']['flags']['noappheader'] = True;
+			$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
+			$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Scheduling Conflict');
+			//$GLOBALS['phpgw']->common->phpgw_header();
+
+			$p = $GLOBALS['phpgw']->template;
+			$p->set_file(
+				Array(
+					'overlap'	=> 'overlap.tpl',
+   					'form_button'	=> 'form_button_script.tpl'
+				)
+			);
+
+			$var = Array(
+				'color'		=> $this->theme['bg_text'],
+				'overlap_title' => lang('Scheduling Conflict'),
+				'overlap_text'	=> lang('Your suggested time of <B> %1 - %2 </B> conflicts with the following existing calendar entries:',$GLOBALS['phpgw']->common->show_date($start),$GLOBALS['phpgw']->common->show_date($end)),
+				'overlap_list'	=> $overlap
+			);
+			$p->set_var($var);
+
+			$date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday);
+			$var = Array(
+				'action_url_button'	=> $GLOBALS['phpgw']->link('/mobile/index.php',Array('menuaction'=>'mobile.ui_mobilecalendar.update','readsess'=>1)),
+				'action_text_button'	=> lang('Ignore Conflict'),
+				'action_confirm_button'	=> '',
+				'action_extra_field'	=> ''
+			);
+			$this->output_template_array($p,'resubmit_button','form_button',$var);
+
+			$var = Array(
+				'action_url_button'	=> $GLOBALS['phpgw']->link('/mobile/index.php',Array('menuaction'=>'mobile.ui_mobilecalendar.edit','readsess'=>1,'date'=>$date)),
+				'action_text_button'	=> lang('Re-Edit Event'),
+				'action_confirm_button'	=> '',
+				'action_extra_field'	=> ''
+			);
+			$this->output_template_array($p,'reedit_button','form_button',$var);
+			$p->pparse('out','overlap');
+		}
+		
+		function link_to_entry($event,$month,$day,$year)
+		{
+			$str = '';
+			$is_private = !$event['public'] && !$this->bo->check_perms(PHPGW_ACL_READ,$event);
+			$viewable = !$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_READ,$event);
+
+			$starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset;
+			$rawdate = mktime(0,0,0,$month,$day,$year);
+			$rawdate_offset = $rawdate - $GLOBALS['phpgw']->datetime->tz_offset;
+			$nextday = mktime(0,0,0,$month,$day + 1,$year) - $GLOBALS['phpgw']->datetime->tz_offset;
+			if ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') && $starttime == $endtime)
+			{
+				$time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat);
+			}
+			elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60)
+			{
+				$time = '[ '.lang('All Day').' ]';
+			}
+			elseif ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') || $starttime != $endtime)
+			{
+				if($starttime < $rawdate_offset && $event['recur_type'] == MCAL_RECUR_NONE)
+				{
+					$start_time = $GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat);
+				}
+				else
+				{
+					$start_time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat);
+				}
+
+				if($endtime >= ($rawdate_offset + 86400))
+				{
+					$end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat);
+				}
+				else
+				{
+					$end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat);
+				}
+				$time = $start_time.'-'.$end_time;
+			}
+			else
+			{
+				$time = '';
+			}
+			
+			$texttitle = $texttime = $textdesc = $textlocation = $textstatus = '';
+
+			
+			
+			if(!$is_private)
+			{
+				//$text .= $this->bo->display_status($event['users_status']);
+				
+				// split text for better display by templates, also see $texttime $texttitle $textdesc $textlocation	
+				$textstatus=$this->bo->display_status($event['users_status']); 
+				
+			}
+
+			/*
+			$text = '<nobr>&nbsp;'.$time.'&nbsp;</nobr> '.$this->bo->get_short_field($event,$is_private,'title').$text.
+				(!$is_private && $event['description'] ? ': <i>'.$this->bo->get_short_field($event,$is_private,'description').'</i>':'').
+				$GLOBALS['phpgw']->browser->br;
+			*/
+			
+			$texttime=$time;
+			$texttitle=$this->bo->get_short_field($event,$is_private,'title');
+			$textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):'');
+			// added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set
+			$textlocation=$this->bo->get_short_field($event,$is_private,'location');
+
+			if ($viewable)
+			{
+				$date = sprintf('%04d%02d%02d',$year,$month,$day);
+				$this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date));
+				$this->link_tpl->set_var('lang_view',lang('View this entry'));
+				$this->link_tpl->set_var('desc', $textdesc);
+				$this->link_tpl->set_var('location', $textlocation);
+				$this->link_tpl->parse('picture','link_open',True);
+			}
+			if (!$is_private)
+			{
+				if($event['priority'] == 3)
+				{
+					$picture[] = Array(
+						'pict'	=> $GLOBALS['phpgw']->common->image('calendar','high'),
+						'width'	=> 16,
+						'height'=> 16,
+						'title' => lang('high priority')
+					);
+				}
+				if($event['recur_type'] == MCAL_RECUR_NONE)
+				{
+					$picture[] = Array(
+						'pict'	=> $GLOBALS['phpgw']->common->image('calendar','circle'),
+						'width'	=> 9,
+						'height'=> 9,
+						'title' => lang('single event')
+					);
+				}
+				else
+				{
+					$picture[] = Array(
+						'pict'	=> $GLOBALS['phpgw']->common->image('calendar','recur'),
+						'width'	=> 12,
+						'height'=> 12,
+						'title' => lang('recurring event')
+					);
+				}
+			}
+			$participants = $this->planner_participants($event['participants']);
+			if(count($event['participants']) > 1)
+			{
+				$picture[] = Array(
+					'pict'	=> $GLOBALS['phpgw']->common->image('calendar','multi_3'),
+					'width'	=> 14,
+					'height'=> 14,
+					'title' => $participants
+				);
+			}
+			else
+			{
+				$picture[] = Array(
+					'pict'	=>  $GLOBALS['phpgw']->common->image('calendar','single'),
+					'width'	=> 14,
+					'height'=> 14,
+					'title' => $participants
+				);
+			}
+			if($event['public'] == 0)
+			{
+				$picture[] = Array(
+					'pict'	=> $GLOBALS['phpgw']->common->image('calendar','private'),
+					'width'	=> 13,
+					'height'=> 13,
+					'title' => lang('private')
+				);
+			}
+			if(@isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private)
+			{
+				// if the alarm is to go off the day before the event
+				// the icon does not show up because of 'alarm_today'
+				// - TOM
+				if($this->bo->alarm_today($event,$rawdate_offset,$starttime))
+				{
+					$picture[] = Array(
+						'pict'  => $GLOBALS['phpgw']->common->image('calendar','alarm'),
+						'width' => 13,
+						'height'=> 13,
+						'title' => lang('alarm')
+					);
+				}
+			}
+
+			$description = $this->bo->get_short_field($event,$is_private,'description');
+			for($i=0;$i<count($picture);$i++)
+			{
+				$var = Array(
+					'pic_image' => $picture[$i]['pict'],
+					'width'     => $picture[$i]['width'],
+					'height'    => $picture[$i]['height'],
+					'title'     => $picture[$i]['title']
+				);
+				$this->output_template_array($this->link_tpl,'picture','pict',$var);
+			}
+			if ($texttitle)
+			{
+				$var = Array(
+			//		'text' => $text,
+					'time'=> $texttime,
+					'title'=> $texttitle,
+					'users_status'=>$textstatus,
+					'desc'=> $textdesc,
+					'location'=> "<br><b>Local:</b> ".$textlocation
+				);
+				$this->output_template_array($this->link_tpl,'picture','link_text',$var);
+			}
+
+			if ($viewable)
+			{
+				$this->link_tpl->parse('picture','link_close',True);
+			}
+			$str = $this->link_tpl->fp('out','link_pict');
+			$this->link_tpl->set_var('picture','');
+			$this->link_tpl->set_var('out','');
+//			unset($p);
+			return $str;
+		}
+		
+		
+		function planner_participants($parts)
+		{
+			static $id2lid;
+
+			$names = '';
+			while (list($id,$status) = each($parts))
+			{
+				$status = substr($this->bo->get_long_status($status),0,1);
+
+				if (!isset($id2lid[$id]))
+				{
+					$id2lid[$id] = $GLOBALS['phpgw']->common->grab_owner_name($id);
+				}
+				if (strlen($names))
+				{
+					$names .= ",\n";
+				}
+				$names .= $id2lid[$id]." ($status)";
+			}
+			if($this->debug)
+			{
+				echo '<!-- Inside participants() : '.$names.' -->'."\n";
+			}
+			return $names;
+		}
+		
+		
+	}
+	
+
+	
+?>
Index: tags/mobile/0.1.004/inc/class.mobiletemplate.inc.php
===================================================================
--- tags/mobile/0.1.004/inc/class.mobiletemplate.inc.php	(revision 623)
+++ tags/mobile/0.1.004/inc/class.mobiletemplate.inc.php	(revision 623)
@@ -0,0 +1,74 @@
+<?php 
+	class mobiletemplate
+	{
+		private $template;
+		
+		/*
+		* @function mobiletemplate
+	 	* @abstract Construtor da classe, que monta o template home
+	 	* @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>
+	 	*/		
+		function mobiletemplate(){
+			$this->template = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+			$this->template->set_file(Array('home_t' => 'home.tpl'));	
+			$this->template->set_block('home_t', 'mobile_home');			
+		}
+
+		/*
+		* @function set_content
+	 	* @abstract Carrega o atributo "content" do template principal
+	 	* @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>
+	 	*/		
+		public function set_content($content){
+			$pre_content = $this->template->get_var("content");
+			$this->template->set_var("content", $pre_content.$content);
+		}
+
+		/*
+		* @function print_all
+	 	* @abstract Imprime toda tela do Expresso Mini
+	 	* @author Nilton Emilio Buhrer Neto <niltonneto@celepar.pr.gov.br>
+	 	*/
+		public function print_page($class, $method){		
+			$this->print_header();
+			$this->print_navbar();
+			$filename = 'inc/class.'.$class.'.inc.php';
+			include_once($filename);	
+			$obj = new $class();		
+			$obj -> $method();		
+			$this->template->pfp('out', 'mobile_home');
+		}
+	
+		/*
+		* @function print_navbar
+	 	* @abstract Imprime o início da tela do Expresso Mini => barra de navegação
+	 	* @author Mário César Kolling <mario.kolling@serpro.gov.br>
+	 	*/
+		private function print_navbar(){
+			$this-> template->set_var('href_newmail', 'index.php?menuaction=mobile.ui_mobilemail.new_msg&clk=01');
+			$this-> template->set_var('lang_newmail', lang('Create mail'));
+			$this-> template->set_var('href_email', "index.php?menuaction=mobile.ui_mobilemail.mail_list");
+			$this-> template->set_var('lang_email', lang('E-mail'));
+			$this-> template->set_var('href_calendar', "index.php?menuaction=mobile.ui_mobilecalendar.index");
+			$this-> template->set_var('lang_calendar', lang('Calendar'));
+			$this-> template->set_var('href_cc', 'index.php?menuaction=mobile.ui_mobilecc.contacts_list');
+			$this-> template->set_var('lang_cc', lang('Contact Center'));		
+		}
+
+		/*
+		* @function print_header
+	 	* @abstract Imprime o início da tela do Expresso Mini => headers html
+	 	* @author Mário César Kolling <mario.kolling@serpro.gov.br>
+	 	*/		
+		private function print_header(){
+			$GLOBALS['phpgw']->accounts->read_repository();
+			$var  = Array(
+				'fullname'	=> $GLOBALS['phpgw']->accounts->data['fullname'],
+				'account_lid'	=> $GLOBALS['phpgw_info']['user']['account_lid'],
+				'lang_logout'	=> lang('Logout'),
+				'template_set'	=> $GLOBALS['phpgw_info']['server']['template_set']
+			);		
+			$this->template->set_var($var);		
+		}		
+	}
+?>
Index: tags/mobile/0.1.004/inc/common.inc.php
===================================================================
--- tags/mobile/0.1.004/inc/common.inc.php	(revision 454)
+++ tags/mobile/0.1.004/inc/common.inc.php	(revision 454)
@@ -0,0 +1,21 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare                                                               *
+	* http://www.egroupware.org                                                *
+	* The file written by Mário César Kolling <mario.kolling@serpro.gov.br>    *
+	* --------------------------------------------                             *
+	*  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.                                              *
+	\**************************************************************************/
+
+
+	/*
+	 * Não é necessário
+	 */
+	function mobileExecMethod($method, $functionparams = '_UNDEF_', $loglevel = 3, $classparams = '_UNDEF_'){
+
+	}
+
+?>
Index: tags/mobile/0.1.004/inc/class.ui_mobilemail.inc.php
===================================================================
--- tags/mobile/0.1.004/inc/class.ui_mobilemail.inc.php	(revision 623)
+++ tags/mobile/0.1.004/inc/class.ui_mobilemail.inc.php	(revision 623)
@@ -0,0 +1,829 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare                                                               *
+	* http://www.egroupware.org                                                *
+	* The file written by Mário César Kolling <mario.kolling@serpro.gov.br>    *
+	* --------------------------------------------                             *
+	*  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.                                              *
+	\**************************************************************************/
+
+	//TODO: Criar a Classe Widget.
+
+	include_once(PHPGW_INCLUDE_ROOT.'/expressoMail1_2/inc/class.imap_functions.inc.php');
+
+	// Classe principal do Mini Mail
+	class ui_mobilemail{
+
+		// Define as funções públicas
+		var $public_functions = array(
+			'mail_list'	=> True,
+			'change_folder' => True,
+			'change_page'	=> True,
+			'show_msg'	=> True,
+			'send_mail'	=> True,
+			//'reply_msg'	=> True,
+			'new_msg'	=> True,
+		);
+
+		var $folders; // Pastas imap
+		var $current_folder; // Pasta corrente
+		var $current_page; // Página corrente da lista de e-mails da pasta corrente
+		var $imap_functions; // Variável que recebe um objeto do tipo class.imap_functions.inc.php
+		var $allowed_tags = '<p><a><br><em><strong><ol><li><ul><div><font>'; // Tags html que não serão removidas
+			// ao mostrar corpo do e-mail
+
+
+		/*
+		 * @function mobilemail
+		 * @abstract Método construtor da classe principal do Mini Mail
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 */
+		function ui_mobilemail()
+		{
+			
+			$this-> load_session();						
+			// Recupera atributos da classe gravados na sessão
+			$folders = $GLOBALS['phpgw']->session->appsession('mobilemail.folders','mobile');
+			$current_folder = $GLOBALS['phpgw']->session->appsession('mobilemail.current_folder','mobile');
+			$current_page = $GLOBALS['phpgw']->session->appsession('mobilemail.current_page','mobile');
+
+			// Inicializa a classe class.imap_functions.inc.php
+			$this->imap_functions = new imap_functions();
+
+			// Testa a existência dos atributos da classe recuperadas da sessão, e as carrega ou inicializa.
+			if ($folders)
+			{
+				$this->folders = $folders;
+			}
+			else
+			{
+				$this->folders = $this->imap_functions->get_folders_list();
+			}
+
+			if ($current_folder)
+			{
+				$this->current_folder = $current_folder;
+			}
+			else
+			{
+				$this->current_folder = 0; // Define o folder INBOX como o folder corrente
+			}
+
+			if ($current_page)
+			{
+				$this->current_page = $current_page;
+			}
+			else
+			{
+				$this->current_page = 1; // Define a primeira página como página padrão
+			}
+
+		}
+
+		/*
+		 * @function save_session
+		 * @abstract Salva os atributos da classe na sessão
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 */
+		function save_session()
+		{
+
+			$GLOBALS['phpgw']->session->appsession('mobilemail.folders','mobile',$this->folders);
+			$GLOBALS['phpgw']->session->appsession('mobilemail.current_folder','mobile',$this->current_folder);
+			$GLOBALS['phpgw']->session->appsession('mobilemail.current_page','mobile',$this->current_page);
+
+		}
+
+		/*
+		 * @function change_page
+		 * @abstract Troca a página de exibição da lista de e-mails, e mostra a nova página
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 */
+		function change_page()
+		{
+			if (isset($_GET['page']))
+			{
+				$this->current_page = $_GET['page'];
+			}
+			$this->mail_list();
+			$this->save_session();
+		}
+
+		/*
+		 * @function change_folder
+		 * @abstract Troca a pasta do imap, e mostra a primeira página da nova pasta
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 */
+		function change_folder()
+		{
+			$folder = $_GET['folder'];
+			if (isset($folder))
+			{
+				$this->current_folder = $folder;
+				$this->current_page = 1;
+			}
+			$this->mail_list();
+			$this->save_session();
+		}
+
+		/*
+		 * @function show_msg
+		 * @abstract Mostra a mensagem de e-mail requisitada
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 */
+		 // TODO: retirar msg_folder dos parâmentros necessários no GET e usar $this->current_folder
+		function show_msg()
+		{
+			$params = array();
+
+			//TODO: testar chamar sem parâmetros para determinar se ocorre algum problema
+			if (isset($_GET['msg_number']) && isset($_GET['msg_folder']))
+			{
+				$params = array(
+					'msg_number' => $_GET['msg_number'],
+					'msg_folder' => $_GET['msg_folder'],
+				);
+			}
+
+			$msg = $this->imap_functions->get_info_msg($params);
+
+			// Carrega o template
+			$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+			$p->set_file(
+				Array(
+					'view_msg_t' => 'view_msg.tpl'
+				)
+			);
+			$p->set_block('view_msg_t', 'mail_header');
+			$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');
+			$p->set_block('view_msg_t', 'end_anchor');
+
+			// Define o cabeçalho do e-mail
+			$p->set_var('from_label', lang("From"));
+			$p->set_var('from', $msg['from']['full']);
+			$p->set_var('to_label', lang("To"));
+
+			$p->set_var('subject_label', lang("Subject"));
+			$p->set_var('subject', $msg['subject']);
+			$p->set_var('date_label', lang("Date"));
+			$p->set_var('date', $msg['fulldate']);
+
+
+			// Mostra o corpo do e-mail
+			$p->set_var('body', strip_tags($msg['body'], $this->allowed_tags)); // Usa a função strip_tags() para filtrar
+				// as tags que estão presentes no corpo do e-mail.
+			$p->set_var('link_text', lang("Return"));
+			$p->set_var('link', "index.php?menuaction=mobile.ui_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.ui_mobilemail.new_msg&msg_number=$msg_number&msg_folder=$msg_folder");
+
+			if (!empty($msg['attachments']) && !empty($msg['attachments']['names']))
+			{
+				$p->set_var('attachment_message', lang('This message have attachment(s)'));
+			}
+			else
+			{
+				$p->set_var('attachment_message', lang('This message don\'t have attachment(s)'));
+			}
+
+			$p->parse('view_msg_t', 'end_anchor');
+			$p->parse('view_msg_t', 'begin_anchor');
+			//$p->pfp('view_msg_t', 'mail_header');
+			/*$p->pfp('out', 'mail_header');
+			//$p->pfp('view_msg_t', 'mail_body');
+			$p->pfp('out', 'mail_body');
+			//$p->pfp('view_msg_t', 'attachment_list');
+			$p->pfp('out', 'attachment_list');
+			//$p->pfp('view_msg_t', 'mail_footer');
+			$p->pfp('out', 'reply_msg');
+			//$p->pfp('out', 'mail_footer');*/
+
+			//$p->pfp('view_msg_t', 'mail_header');
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'mail_header'));
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'mail_body'));
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'attachment_list'));
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'reply_msg'));
+		}
+
+		/*
+		 * @function index
+		 * @abstract Página inicial da aplicação mobilemail, mantém o estado atual. Ou seja, mostra lista de e-mails
+		 * do folder e página definidos pelos parâmetros current_folder e current_page.
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 */
+		 // TODO: Talvez seja melhor voltar sempre para o Inbox e primeira página
+		function index()
+		{						
+			$this->print_folder_selection();
+			$this->mail_list();
+			$this->save_session();
+
+		}
+		
+		function load_session(){			
+			/************************************\
+			 * Inicialização do expressoMail1_2 *
+			\************************************/
+			// Get Data from ldap_manager and emailadmin.
+			$ldap_manager = CreateObject('contactcenter.bo_ldap_manager');
+			$boemailadmin	= CreateObject('emailadmin.bo');
+			$emailadmin_profile = $boemailadmin->getProfileList();
+			$_SESSION['phpgw_info']['expressomail']['email_server'] = $boemailadmin->getProfile($emailadmin_profile[0]['profileID']);
+			$_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user'];
+			$_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server'];
+			$_SESSION['phpgw_info']['expressomail']['ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null;
+			$_SESSION['phpgw_info']['expressomail']['user']['email'] = $GLOBALS['phpgw']->preferences->values['email'];
+		
+			// Fix problem with cyrus delimiter changes in preferences.
+			// Dots in names: enabled/disabled.
+			$save_in_folder = @eregi_replace("INBOX/", "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']);
+			$save_in_folder = @eregi_replace("INBOX.", "INBOX".$_SESSION['phpgw_info']['expressomail']['email_server']['imapDelimiter'], $save_in_folder);
+			$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder'] = $save_in_folder;
+			// End Fix.
+		
+		    // Loading Admin Config Module
+		    $c = CreateObject('phpgwapi.config','expressoMail1_2');
+		    $c->read_repository();
+		    $current_config = $c->config_data;
+		    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] = $current_config['expressoMail_enable_log_messages'];
+		    // Begin Set Anti-Spam options.
+		    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_ham'] = $current_config['expressoMail_command_for_ham'];
+		    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_command_for_spam'] = $current_config['expressoMail_command_for_spam'];
+		    $_SESSION['phpgw_info']['server']['expressomail']['expressoMail_use_spam_filter'] = $current_config['expressoMail_use_spam_filter'];
+		    echo '<script> var array_lang = new Array();var use_spam_filter = \''.$current_config['expressoMail_use_spam_filter'].'\' </script>';
+			// End Set Anti-Spam options.
+		
+		    // Set Imap Folder names options
+		    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'] 	= $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']	? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder']		: "Trash";
+		    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'] 	= $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'] ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'] 	: "Drafts";
+		    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'] 	= $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']	? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']		: "Spam";
+		    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']	= $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'] 	? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'] 		: "Sent";
+			include("../expressoMail1_2/inc/load_lang.php");		    
+		}
+
+		/*
+		 * @function print_folder_selection
+		 * @abstract Imprime o folder corrente (INBOX)
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 */
+		function print_folder_selection()
+		{
+
+			$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+			$p->set_file(
+				Array(
+					'mobilemail_t' => 'mobilemail.tpl'
+				)
+			);
+			$p->set_block('mobilemail_t', 'inbox_folder_list');
+			$p->set_var('lang_folder', lang('Folder'));
+			$p->set_var('lang_inbox', lang('Inbox'));
+			//$p->set_var('folder_items', $folder_items);
+			$p->parse('mobilemail_t', 'inbox_folder_list');			
+			//$p->fpf('out', 'mobilemail_t');
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'mobilemail_t'));
+
+		}
+
+		/*
+		 * @function old_print_folder_selection
+		 * @abstract Imprime na tela a caixa de seleção de folders
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 */
+		function old_print_folder_selection()
+		{
+
+			// Processa as options
+			$folder_items = '';
+
+			foreach ($this->folders as $i => $j)
+			{
+
+				$option_selected = '';
+				$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+				$p->set_file(
+					Array(
+						'mobilemail_t' => 'mobilemail.tpl'
+					)
+				);
+				$p->set_block('mobilemail_t', 'folder_item');
+
+				if (is_numeric($i))
+				{
+					if ($i == $this->current_folder)
+					{
+						 $option_selected = 'selected="selected"';
+					}
+
+					$p->set_var('option_selected', $option_selected);
+					$p->set_var('folder_id', $j['folder_id']);
+					$p->set_var('folder_name', $j['folder_id']); // Mudar... provavelmente usar preg_replace
+													   			 // para substituir cpf pelo nome do usuário.
+
+					if ($j['folder_unseen'] > 0)
+					{
+						$p->set_var('folder_unseen', ' - ('.$j['folder_unseen'].')');
+					}
+
+					$folder_items .= $p->fp('mobile_t', 'folder_item');
+				}
+
+			}
+
+			// Processa o select
+			$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+			$p->set_file(
+				Array(
+					'mobilemail_t' => 'mobilemail.tpl'
+				)
+			);
+			$p->set_block('mobilemail_t', 'folder_list');
+			$p->set_var('folder_items', $folder_items);
+			$p->parse('mobilemail_t', 'folder_list');			
+			//$p->pfp('out', 'mobilemail_t');
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'mobilemail_t'));
+
+		}
+
+		/*
+		 * @function mail_list
+		 * @abstract Imprime a lista de e-mails
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 */
+		function mail_list()
+		{
+
+			$this->messages_per_page = 10; //TODO: Pegar esse valor de preferences
+//		var $pages;
+//		var $actual_page;
+//		var $number_of_messages;
+
+			if (!isset($this->number_of_messages))
+			{
+				$params = array(
+					'folder' => $this->folders[$this->current_folder]['folder_id'],
+				);
+				$this->number_of_messages = $this->imap_functions->get_num_msgs($params);
+			}
+
+			// Recalcular as páginas
+			$this->pages = ceil($this->number_of_messages/$this->messages_per_page);
+			$page = $this->current_page;
+
+			$params = array(
+				'folder' 			=> $this->folders[$this->current_folder]['folder_id'],
+				'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
+			);
+
+			$messages = $this->imap_functions->get_range_msgs2($params);
+			$this->print_mails_list($messages);
+			$this->print_page_navigation($this->pages, $this->current_page);
+
+		}
+
+		/*
+		 * @function print_mails_list
+		 * @abstract Imprime a lista de mensagens
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 * @param array Um array com a lista de mensagens recuperado por $this->imap_functions->get_range_msgs2($params)
+		 */
+		function print_mails_list($messages)
+		{
+
+			// Cria a lista de e-mails
+			$mail_rows = '';
+			if ($this->number_of_messages != 0)
+			{
+				foreach ($messages as $index => $msg)
+				{
+					$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+					$p->set_file(
+						Array(
+							'mobilemail_t' => 'mobilemail.tpl'
+						)
+					);
+					$p->set_block('mobilemail_t', 'mail_row');
+					$p->set_block('mobilemail_t', 'end_strong');
+                                        $p->set_block('mobilemail_t', 'begin_strong');
+                                        $p->set_var('unseen_bkg', "#FFFFFF");
+
+					if (is_numeric($index))
+					{
+						!empty($msg['from']['name']) ? $from = $msg['from']['name'] : $from = $msg['from']['email'];
+						!empty($msg['subject']) ? $subject = $msg['subject'] : $subject = lang('[empty subject]');
+						if ($msg['Unseen'] == 'U'){ //Setando as mensagens nao lidas
+	                                                $p->set_var('strong_unseen_begin', trim($p->fp('mobilemail_t', 'begin_strong')));
+                                                        $p->set_var('strong_unseen_end', trim($p->fp('mobilemail_t', 'end_strong')));
+	                                                $p->set_var('unseen_bkg', "#E0ECFF");
+	                                                //$p->set_var('unseen_bkg', "#E8EEF7");
+	                                }
+						$p->set_var('from', $from);
+						$p->set_var('subject', $subject);
+						$p->set_var('msg_number', $msg['msg_number']);
+						$p->set_var('date', $msg['udate']);
+						$p->set_var('msg_folder', $this->folders[$this->current_folder]['folder_id']);
+						$p->set_var('from_label', lang('From'));
+						$mail_rows .= $p->fp('mobilemail_t', 'mail_row');
+					}
+				}
+
+				// Imprime a lista de e-mails
+				$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+				$p->set_file(
+					Array(
+						'mobilemail_t' => 'mobilemail.tpl'
+					)
+				);
+				$p->set_block('mobilemail_t', 'mail_list');
+				$p->set_var('mail_rows', $mail_rows);
+				//$p->pfp('out', 'mail_list');
+				$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'mail_list'));
+			}
+			else
+			{
+				// Lista de e-mails vazia
+				$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+				$p->set_file(
+					Array(
+						'mobilemail_t' => 'mobilemail.tpl'
+					)
+				);
+				$p->set_block('mobilemail_t', 'empty_list');
+				$p->set_var('empty_message', lang('Empty folder'));				
+				//$p->pfp('out', 'empty_list');
+				$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'empty_list'));
+			}
+		}
+
+		/*
+		 * @funtion print_page_navigation
+		 * @abstract Imprime a barra de navegação da lista de e-mails da pasta corrente. Quem chama essa função é quem faz o controle do modelo.
+		 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+		 * @param integer Número de páginas que serão geradas
+		 * @param integer Página corrente
+		 */
+		// TODO: mover este método para a classe page_navigation subclasse de widget
+		function print_page_navigation($number_of_pages, $page = 1)
+		{
+
+			$pages = '';
+
+			if ($number_of_pages != 0)
+			{
+				// Geração das páginas
+				for ($i = 1; $i <= $number_of_pages ; $i++)
+				{
+
+					$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+					$p->set_file(
+						Array(
+							'mobilemail_t' => 'mobilemail.tpl'
+						)
+					);
+
+					$p->set_block('mobilemail_t', 'space');
+					$p->set_block('mobilemail_t', 'begin_anchor');
+					$p->set_block('mobilemail_t', 'end_anchor');
+					$p->set_block('mobilemail_t', 'page_item');
+					$p->set_block('mobilemail_t', 'begin_strong');
+					$p->set_block('mobilemail_t', 'end_strong');
+
+					if ($i == $page)
+					{
+						// Se for a página sendo gerada for a página corrente,
+						// não gera a âncora e destaca o número (negrito)
+						$p->set_var('end_anchor', '');
+						$p->set_var('begin_anchor', '');
+						$p->set_var('begin_strong', trim($p->fp('mobilemail_t', 'begin_strong')));
+						$p->set_var('end_strong', trim($p->fp('mobilemail_t', 'end_strong')));
+					}
+					else
+					{
+						// Senão, gera a âncora
+						$p->set_var('begin_strong', '');
+						$p->set_var('end_strong', '');
+						$p->set_var('end_anchor', trim($p->fp('mobilemail_t', 'end_anchor')));
+						$p->set_var('begin_anchor_href', "index.php?menuaction=mobile.ui_mobilemail.change_page&page=$i");
+						$p->set_var('begin_anchor', trim($p->fp('mobilemail_t', 'begin_anchor')));
+					}
+
+					$p->set_var('page', $i);
+					//$pages .= trim($p->fp('mobilemail_t', 'page_item'));
+
+				}
+				$pages .= " ".$page." ".lang("of")." ".$number_of_pages." ";
+
+				// Geração dos links "anterior" e "próximo"
+				$p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+				$p->set_file(
+					Array(
+						'mobilemail_t' => 'mobilemail.tpl'
+					)
+				);
+
+				//$p->set_block('mobilemail_t', 'space');
+				$p->set_block('mobilemail_t', 'mail_footer');
+				$p->set_block('mobilemail_t', 'previous');
+				$p->set_block('mobilemail_t', 'next');
+
+				$next_page = $page + 1;
+				$previous_page = $page - 1;
+
+				if ($page == 1)
+				{
+					// Se for a primeira página, não imprime o link "anterior""
+					$p->set_var('previous', '');
+					if ($page == $number_of_pages)
+					{
+						// Se só existir uma página, não imprime o link "próximo"
+						$p->set_var('next', '');
+					}
+					else
+					{
+						$p->set_var('next_href', "index.php?menuaction=mobile.ui_mobilemail.change_page&page=$next_page");
+						$p->set_var('next', trim($p->fp('mobilemail_t', 'next')));
+					}
+
+				}
+				else if ($page == $number_of_pages)
+				{
+					// Se for a última página, não imprime o link "próximo"
+					$p->set_var('next', '');
+					$p->set_var('previous_href', "index.php?menuaction=mobile.ui_mobilemail.change_page&page=$previous_page");
+					$p->set_var('previous', trim($p->fp('mobilemail_t', 'previous')));
+				}
+				else
+				{
+					// Senão, imprime os links "anterior" e "próximo"
+					$p->set_var('previous_href', "index.php?menuaction=mobile.ui_mobilemail.change_page&page=$previous_page");
+					$p->set_var('previous', trim($p->fp('mobilemail_t', 'previous')));
+
+					$p->set_var('next_href', "index.php?menuaction=mobile.ui_mobilemail.change_page&page=$next_page");
+					$p->set_var('next', trim($p->fp('mobilemail_t', 'next')));
+				}
+
+				$p->set_var('pages', $pages);
+				//$p->pfp('out', 'mail_footer');
+				$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'mail_footer'));
+			}
+
+		}
+
+		/*
+		 * @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.ui_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'];
+			}
+		
+			if($params)
+				$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.ui_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');
+			*/
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'begin_form'));
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'msg_header'));
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'text'));
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out', 'hidden_area'));
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('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(PHPGW_SERVER_ROOT."/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');
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('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: tags/mobile/0.1.004/inc/class.ui_mobilecc.inc.php
===================================================================
--- tags/mobile/0.1.004/inc/class.ui_mobilecc.inc.php	(revision 623)
+++ tags/mobile/0.1.004/inc/class.ui_mobilecc.inc.php	(revision 623)
@@ -0,0 +1,429 @@
+<?php
+	class ui_mobilecc{
+		
+		var $nextmatchs;
+		var $bo;		
+		var $page_info = array (
+				'actual_catalog' => false,
+				'is_external_catalog' => false
+			);
+		
+		var $public_functions = array(
+			'contacts_list' => true,
+		);
+		
+		/**
+		 * Construtor...
+		 * 
+		 */
+		public 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;
+				}
+					
+			}
+			$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'
+						);
+				
+				$rules = array(
+							0 => array(
+								'field' => 'contact.object_class',
+								'type'  => '=',
+								'value' => 'phpgwAccount'
+							),
+							1 => array(
+								'field' => 'contact.account_status',
+								'type'  => 'iLIKE',
+								'value' => '%'
+							),
+							2 => array(
+								'field' => 'contact.account_visible',
+								'type'  => '!=',
+								'value' => '-1'
+							),
+							3 => array(
+								'field' => 'contact.object_class',
+								'type'  => '=',
+								'value' => 'inetOrgPerson'
+							)
+						);
+			}
+			else{
+				$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);
+
+			if(is_array($ids)) foreach($ids as $id_r) { //Quero apenas os ids, como valores nas posições do array
+				$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($from_calendar=false) {
+
+			$entries = array();
+			$actual_page = 0;
+
+			if(isset($_POST['name']) && strlen($_POST['name'])<4) //Busca apenas para nomes com mais de 4 palavras
+				$ids = false;
+			else {
+				/////////////// Pego os ids referente a consulta, se a mesma foi feita
+				if(isset($_POST['name'])) {
+					$this->set_catalog($_POST['catalog']);
+					$ids = $this->find($_POST['name']);
+					if(is_array($ids)) {
+						$actual_page = 1;
+						$_SESSION["mobile_search_ids"] = $ids;
+						$_SESSION["mobile_search_catalog"] = $_POST['catalog'];
+						$ids = array_slice($ids,0,10); //Apenas a primeira página
+					}
+				}
+				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
+					$actual_page = $_GET['page'];
+				}
+				else 
+					$ids = false;
+			}
+
+			///////////// Pego os dados dos ids da página em questão.
+			if(!is_array($ids) || count($_SESSION["mobile_search_ids"])>100 || (isset($_POST["name"]) && strlen($_POST['name'])<4)) { 
+				$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
+					$entries = $this->bo->get_multiple_entries($ids,array("names_ordered"=>true,"uidnumber"=>true,"id_contact"=>true,"connections"=>true));
+					/**
+					 * As entradas vindas de get_multiple_entries não vem com as connections
+					 * ordenadas. Abaixo eu ordeno o array connections de cada entrada para ter
+					 * sempre na frente os valores defaults, primeiro o default de email, depois
+					 * o de telefone.
+					 */
+					foreach($entries as &$valor) {
+						/* Sempre iniciar os arrays, pois pode interferir na 
+						 * ordenação atual se tiverem valores antigos desnecessários 
+						 * causando erro de tamanhos inconsistentes */
+						$default = array(); 
+						$type = array();
+						
+						foreach($valor['connections'] as $key => $value) {
+							$default[$key] = $value['connection_is_default'];
+							$type[$key] = $value['id_type'];
+						}
+						array_multisort($default, SORT_DESC, $type, SORT_ASC, $valor['connections']);
+					}//Fim da ordenação
+				}
+				else {
+					$entries = $this->bo->get_multiple_entries($ids,array("id_group"=>true,"title"=>true,"short_name"=>true));
+				}
+
+			}
+			
+			///////////////// Monto os dados gerais da página no template.
+			$p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
+			
+			if(!$from_calendar)
+				$p->set_file(Array('entries' => 'cc_main.tpl'));
+			else
+				$p->set_file(Array('entries' => 'add_participants.tpl'));
+
+			$p->set_block('entries','body');
+			$p->set_block('entries','people_header');
+			$p->set_block('entries','group_header');
+			$p->set_block('entries','row');
+			$p->set_block('entries','row_group');
+			$p->set_block('entries','row_empty');
+			$p->set_block('entries','option');
+			$p->set_block('entries','page');
+			$p->set_block('entries','page_no_link');
+			$p->set_block('entries','row_addeds');
+			
+			
+			$texts = array(
+				'lang_name' => lang("Name"),
+				'lang_catalog' => lang("Catalog"),
+				'lang_buscar' => lang("Search")
+				);
+			$p->set_var($texts);
+
+			$p->set_var('lang_already_addeds:',lang('already_addeds:'));
+
+			if($from_calendar)
+				$p->set_var('lang_continue_scheduling',lang('continue scheduling'));
+
+			/////////// Preenche o combo de catálogos
+			
+			$bo_cc = CreateObject("contactcenter.bo_contactcenter");
+			$branchs = $bo_cc->get_catalog_tree();
+			
+			if(!$from_calendar) {
+				foreach($branchs as $branch) { //Pego apenas a estrutura dos ramos vindos do banco, pois as do ldap estão confusas e com dados aparentemente inconsistentes.
+					if($branch['class']!="bo_global_ldap_catalog" && $branch['class']!="bo_catalog_group_catalog") {
+						$p->set_var(array('option_value'=>$branch['class'],'option_text'=>$branch['name']));
+	
+						if($this->page_info['actual_catalog']==$branch['class'])
+							$p->set_var('selected','selected');
+						else
+							$p->set_var('selected','');
+						$p->parse('options','option',True);
+					}
+						
+				}
+			}
+			
+			/////////// Preenche o combo, com dados do ldap
+			$bo_ldap_manager = CreateObject("contactcenter.bo_ldap_manager");
+			$branchs = $bo_ldap_manager->get_all_ldap_sources();
+			
+			foreach($branchs as $id=>$branch) { //Ldaps expresso
+				$p->set_var(array('option_value'=>"bo_global_ldap_catalog#".
+						$id."#".
+						$branch['dn']."#".
+						0,
+						'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']=="bo_global_ldap_catalog#".$id."#".$branch['dn']."#". 0)
+					$p->set_var('selected','selected');
+				else
+					$p->set_var('selected','');
+				$p->parse('options','option',True);	
+			}
+			
+			if(!$from_calendar) {
+				$branchs = $bo_ldap_manager->get_external_ldap_sources();
+				if(is_array($branchs)) foreach($branchs as $id=>$branch) { //Ldaps externos
+					$p->set_var(array('option_value'=>"bo_global_ldap_catalog#".
+							$id."#".
+							$branch['dn']."#".
+							1,
+							'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']=="bo_global_ldap_catalog#".$id."#".$branch['dn']."#". 1)
+						$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 && strlen($_POST['name'])>=4) { //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"]) && strlen($_POST['name'])<4) { //Muitos resultados...
+				$p->set_var('message',lang('the search argument must have at least 4 digits'));
+				$p->parse('rows','row_empty',True);			
+			}
+			else if((isset($_POST["name"])) || (isset($_GET["page"]))){ //Renderizar...
+				
+				/////////// Preenche o cabeçalho da consulta
+				if($this->page_info['actual_catalog']!="bo_group_manager") {
+					$p->set_var(
+							array('lang_people_name' => lang("Name"),
+								'lang_phone' => lang("Phone"),
+								'lang_mail' => lang("Email")));
+					$p->parse('header','people_header',True);
+				}
+				else {
+					$p->set_var(
+							array('lang_group_name' => lang("Name"),
+								'lang_title' => lang("Title")
+								));
+					$p->parse('header','group_header',True);
+				}
+				
+				/////////// Preencho as linhas do resultado
+				foreach($entries as $id => $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
+						$var = array('row_nome'=>$entry['names_ordered']);
+						$conn1 = array_shift($entry['connections']);
+						if(($conn1==NULL)||($conn1['connection_is_default']!=1)) {
+							$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)||($conn2['connection_is_default']!=1))
+								$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'];
+						}
+						$var['form_action'] = "index.php?menuaction=mobile.ui_mobilemail.new_msg";
+						$p->set_var($var);
+						$p->parse('rows','row',True);
+					}
+					else if($this->page_info['actual_catalog']=="bo_group_manager"){ //Grupos
+						$var = array(
+								'row_group_name'=>$entry['short_name'],
+								'row_title' => $entry['title']
+								);
+						
+						$p->set_var($var);
+						$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'];
+						}
+						if(!$from_calendar)
+							$var['form_action'] = "index.php?menuaction=mobile.ui_mobilemail.new_msg";
+						else {
+							$var['id_contact'] = $entry['uidnumber'][0].'U';
+							$var['form_action'] = "index.php?menuaction=mobile.ui_mobilecalendar.add_participant";
+						}
+						$var['lang_select'] = lang("select");
+						$p->set_var($var);
+						$p->parse('rows','row',True);
+					}
+				}
+			}
+			
+			if($from_calendar) {
+				$p->set_var('lang_choose_the_participants',lang("choose the participants"));
+				$participants = $_SESSION['mobile_calendar'];
+				@reset($participants);
+				if(count($participants)) while (($participant = current($participants))!==false) {
+					$p->set_var('row_contact_name',$participant);
+					if(next($participants)!==false)
+						$p->set_var('row_separate',',');
+					else
+						$p->set_var('row_separate','.');
+					$p->parse('rows_addeds','row_addeds',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);
+				}	
+			}			
+			
+			//$p->pfp('out','body');
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out','body'));
+		}
+		
+	}
+?>
Index: tags/mobile/0.1.004/index.php
===================================================================
--- tags/mobile/0.1.004/index.php	(revision 623)
+++ tags/mobile/0.1.004/index.php	(revision 623)
@@ -0,0 +1,101 @@
+<?php
+	//TODO: Aplicar o conceito de subapp (mobileapp)
+
+	$phpgw_info = array();
+	$GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
+	
+	if(!$GLOBALS['sessionid'])
+	{		
+		$location = 'Location: login.php';
+		Header($location);
+		exit;
+	}
+
+	if ($GLOBALS['phpgw_info']['server']['use_https'] > 0)	{
+		if ($_SERVER['HTTPS'] != 'on') {
+   			Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+			exit;
+		}
+	}
+
+	/*
+		This is the menuaction driver for the multi-layered design
+	*/
+
+	if(isset($_GET['menuaction']))
+	{
+		list($mobileapp,$class,$method) = explode('.',@$_GET['menuaction']);
+		if(! $mobileapp || ! $class || ! $method)
+		{
+			$invalid_data = True;
+		}
+	}
+	else
+	{
+		$mobileapp = 'home';
+		$invalid_data = True;
+	}
+
+	
+	$GLOBALS['phpgw_info']['flags'] = array(
+		'noheader'   => True,
+		'nonavbar'   => True,
+		'currentapp' => 'mobile',
+		'mobileapp'  => $mobileapp,
+	);
+
+	include('../header.inc.php');
+	include('./mobile_header.inc.php');
+	
+	if($mobileapp == 'home')
+	{
+		start_prefered_app();
+	}
+	
+	$GLOBALS[$class] = CreateObject(sprintf('%s.%s','mobile',$class));
+	$public_functions = $GLOBALS[$class]->public_functions;
+	if((is_array($GLOBALS[$class]->public_functions) && $GLOBALS[$class]->public_functions[$method]) && ! $invalid_data)
+	{						
+		$GLOBALS['phpgw_info']['mobiletemplate'] = CreateObject("mobile.mobiletemplate");					
+		$GLOBALS['phpgw_info']['mobiletemplate'] -> print_page($class,$method);		
+		unset($mobileapp);
+		unset($class);
+		unset($method);
+		unset($invalid_data);
+
+	}
+	else
+	{
+		if(!$mobileapp || !$class || !$method)
+		{
+			if(@is_object($GLOBALS['phpgw']->log))
+			{
+				$GLOBALS['phpgw']->log->message(array(
+					'text' => 'W-BadmenuactionVariable, menuaction missing or corrupt: %1',
+					'p1'   => $menuaction,
+					'line' => __LINE__,
+					'file' => __FILE__
+				));
+			}
+		}
+
+		if(!is_array($GLOBALS[$class]->public_functions) || ! $GLOBALS[$class]->public_functions[$method] && $method)
+		{
+			if(@is_object($GLOBALS['phpgw']->log))
+			{
+				$GLOBALS['phpgw']->log->message(array(
+					'text' => 'W-BadmenuactionVariable, attempted to access private method: %1',
+					'p1'   => $method,
+					'line' => __LINE__,
+					'file' => __FILE__
+				));
+			}
+		}
+		if(@is_object($GLOBALS['phpgw']->log))
+		{
+			$GLOBALS['phpgw']->log->commit();
+		}		
+		start_prefered_app();
+	}
+
+?>
Index: tags/mobile/0.1.004/mobile_header.inc.php
===================================================================
--- tags/mobile/0.1.004/mobile_header.inc.php	(revision 623)
+++ tags/mobile/0.1.004/mobile_header.inc.php	(revision 623)
@@ -0,0 +1,43 @@
+<?php
+	/**************************************************************************\
+	* eGroupWare                                                               *
+	* http://www.egroupware.org                                                *
+	* The file written by Mário César Kolling <mario.kolling@serpro.gov.br>    *
+	* --------------------------------------------                             *
+	*  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.                                              *
+	\**************************************************************************/
+
+	/*******************************************\
+	 * Define a aplicação mobile preferencial  *
+	\*******************************************/
+	//TODO: Ler do banco do expresso as preferências do usuário e definir a aplicação móvel padrão
+	// por enquanto isto será hardcoded para mobilemail.
+	$GLOBALS['phpgw_info']['flags']['currentapp'] = 'mobile';
+	$GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app'] = 'mobilemail'; // mobilecalendar, mobilecc ou mobilemail
+
+	/*
+	 * @function start_prefered_app
+	 * @abstract Função que chama a aplicação móvel preferencial.
+	 * @author Mário César Kolling <mario.kolling@serpro.gov.br>
+	 */
+	function start_prefered_app(){
+		//TODO: Determinar qual a aplicação móvel preferida e iniciá-la.			
+		switch($GLOBALS['phpgw_info']['user']['preferences']['common']['default_mobile_app']){
+			case mobilemail:
+				$link = "ui_mobilemail.mail_list";		
+				break;
+			case mobilecalendar:
+				$link = "ui_mobilecalendar.index";
+				break;
+			case mobilecc:
+				$link = "ui_mobilecc.contacts_list";
+				break;		
+			default:
+				break;		
+		}		
+		$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link("index.php?menuaction=mobile.".$link));
+	}
+?>
Index: tags/mobile/0.1.004/login.php
===================================================================
--- tags/mobile/0.1.004/login.php	(revision 623)
+++ tags/mobile/0.1.004/login.php	(revision 623)
@@ -0,0 +1,145 @@
+<?php
+	//TODO: Trocar name="login" para name="user" no campo username
+	$phpgw_info = array();
+	$submit = False;
+
+	$GLOBALS['phpgw_info']['flags'] = array(
+		'disable_Template_class' => True,
+		'login'                  => True,
+		'currentapp'             => 'login',
+		'currentdir'             => '/mobile',
+		'noheader'               => True
+	);
+	
+	include('../header.inc.php');	
+	include('./mobile_header.inc.php');	
+	$GLOBALS['sessionid'] = @$_GET['sessionid'] ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
+	
+	if(isset($GLOBALS['sessionid']) && $_GET['cd'] != 10 && $_GET['cd'] != 1)
+		start_prefered_app();		
+		if ($GLOBALS['phpgw_info']['server']['use_https'] > 0)	{
+		if ($_SERVER['HTTPS'] != 'on') {
+   			Header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+			exit;
+		}
+	}
+	
+	$GLOBALS['phpgw']->session = CreateObject('phpgwapi.sessions');	
+	$GLOBALS['phpgw_info']['server']['template_dir'] = PHPGW_SERVER_ROOT.$GLOBALS['phpgw_info']['flags']['currentdir'].'/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'];	
+	$tmpl = CreateObject('phpgwapi.Template', $GLOBALS['phpgw_info']['server']['template_dir']);
+	$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'] = $GLOBALS['phpgw_info']['login_template_set'];
+	$tmpl->set_file(array('login_form' => 'login.tpl'));
+	$tmpl->set_var('cd',check_logoutcode($_GET['cd']));
+	
+	function check_logoutcode($code) {
+		switch($code) {
+			case 1:
+				logout();
+				return lang('You have been successfully logged out');
+
+			case 2:
+				return lang('Sorry, your login has expired');
+
+			case 4:
+				return lang('Cookies are required to login to this site.');
+
+			case 5:
+				return '<font color="FF0000">' . lang('Bad login or password') . '</font>';
+
+			case 6:
+				return '<font color="FF0000">' . lang('Your password has expired, and you do not have access to change it') . '</font>';
+
+			case 98:
+				return '<font color="FF0000">' . lang('Account is expired') . '</font>';
+
+			case 99:
+				return '<font color="FF0000">' . lang('Blocked, too many attempts') . '</font>';
+
+			case 10:
+				$GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
+				$GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
+				$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
+				if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php4')	{
+					$GLOBALS['phpgw']->session->phpgw_setcookie(PHPGW_PHPSESSID);
+				}
+				return '<font color="#FF0000">' . lang('Your session could not be verified.') . '</font>';
+
+			default:
+				return '&nbsp;';
+		}
+	}
+
+	if($GLOBALS['phpgw_info']['server']['auth_type'] == 'http' && isset($_SERVER['PHP_AUTH_USER']))	{
+		$submit = True;
+		$login  = $_SERVER['PHP_AUTH_USER'];
+		$passwd = $_SERVER['PHP_AUTH_PW'];
+		$passwd_type = 'text';
+	}
+	else {
+		$passwd = $_POST['passwd'];
+		$passwd_type = $_POST['passwd_type'];
+	}
+
+	if(isset($passwd_type) || $_POST['submitit_x'] || $_POST['submitit_y'] || $submit) {
+		if(getenv('REQUEST_METHOD') != 'POST' && $_SERVER['REQUEST_METHOD'] != 'POST' &&
+			!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER['SSL_CLIENT_S_DN'])){
+			$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link($GLOBALS['phpgw_info']['flags']['currentdir'].'/login.php','cd=5'));
+		}
+
+		if(!$submit)
+			$login = $_POST['login'];
+
+		$GLOBALS['sessionid'] = $GLOBALS['phpgw']->session->create(strtolower($login),$passwd,$passwd_type,'u');
+
+		if(!isset($GLOBALS['sessionid']) || ! $GLOBALS['sessionid']){
+			$GLOBALS['phpgw']->redirect($GLOBALS['phpgw_info']['server']['webserver_url'] .$GLOBALS['phpgw_info']['flags']['currentdir'].'/login.php?cd=' . $GLOBALS['phpgw']->session->cd_reason);
+		}
+		else{		
+			start_prefered_app();
+		}
+	}
+	elseif ($_GET['lang'])	{
+		$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $_GET['lang'];
+	}
+	elseif(!isset($_COOKIE['last_loginid']) || !$prefs->account_id)	{
+		list($lang) = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
+		$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $lang;
+	}
+
+	$tmpl->set_var('charset',$GLOBALS['phpgw']->translation->charset());
+	$tmpl->set_var('cookie',$last_loginid);
+	/*$tmpl->set_var('lang_username',lang('username'));
+	$tmpl->set_var('lang_password',lang('password'));
+	$tmpl->set_var('lang_login',lang('login'));*/
+	//a função lang não funciona no login em dispositivos móveis... verificar o motivo...
+	$tmpl->set_var('lang_username',"Usuário");
+	$tmpl->set_var('lang_password',"Senha");
+	$tmpl->set_var('lang_login',"Login");	
+	$tmpl->set_var('website_title', $GLOBALS['phpgw_info']['server']['site_title']);
+	$tmpl->set_var('template_set',$GLOBALS['phpgw_info']['login_template_set']);
+	$tmpl->set_var('language_select','');
+	$tmpl->set_var($var);
+	$tmpl->set_block('login_form','language_select');
+	$tmpl->pfp('loginout','login_form');
+
+	function logout(){		
+		$verified = $GLOBALS['phpgw']->session->verify();
+		if ($verified)
+		{
+			if (file_exists($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']))
+			{
+				$dh = opendir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']);
+				while ($file = readdir($dh))
+				{
+					if ($file != '.' && $file != '..')
+					{
+						unlink($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid'] . SEP . $file);
+					}
+				}
+				rmdir($GLOBALS['phpgw_info']['server']['temp_dir'] . SEP . $GLOBALS['sessionid']);
+			}
+			$GLOBALS['phpgw']->hooks->process('logout');
+			$GLOBALS['phpgw']->session->destroy($GLOBALS['sessionid'],$GLOBALS['kp3']);
+		}
+	}
+?>
Index: tags/mobile/0.1.004/templates/default/form_button_script.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/form_button_script.tpl	(revision 588)
+++ tags/mobile/0.1.004/templates/default/form_button_script.tpl	(revision 588)
@@ -0,0 +1,12 @@
+
+<!-- BEGIN form_button -->
+<nobr>
+<form action="{action_url_button}" method="post" name="{action_text_button}form">
+<div style="padding-top:15px; padding-right: 2px">
+	{action_extra_field} 
+	<input style="font-size:10px" type="submit" value="{action_text_button}" {action_confirm_button}>
+</div>
+</form>
+</nobr>
+
+<!-- END form_button -->
Index: tags/mobile/0.1.004/templates/default/body_email.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/body_email.tpl	(revision 670)
+++ tags/mobile/0.1.004/templates/default/body_email.tpl	(revision 670)
@@ -0,0 +1,33 @@
+<html>
+<head>
+<meta http-equiv="Content-Language" content="en" />
+<meta name="GENERATOR" content="PHPEclipse 1.0" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<title>title</title>
+</head>
+<body bgcolor="#FFFFFF" text="#000000" link="#FF9966" vlink="#FF9966" alink="#FFCC99">
+<!-- BEGIN list -->
+<b><p align='left'>{subject}</p></b>
+<br>
+<table border='0' cellpadding='0' cellspacing='0' width='100%'>
+<tr><td width='30%' valign='top'><b>{var1} ::</b></td><td>{vardata1}</td></tr>	
+<tr><td width='30%' valign='top'><b>{var2} ::</b></td><td>{vardata2}</td></tr>
+<tr><td width='30%' valign='top'><b>{var3} ::</b></td><td>{vardata3}</td></tr>
+<tr><td width='30%' valign='top'><b>{var4} ::</b></td><td>{vardata4}</td></tr>
+<tr><td width='25%' valign='top'><b>{var8} ::</b></td><td>{vardata8}</td></tr>
+<tr><td width='25%' valign='top'><b>{var5} ::</b></td><td>{vardata6}</td></tr>
+</table>
+<br>
+<hr size='1' width='100%'>
+<table border='0' cellpadding='4' cellspacing='4' width='100%'>
+<tr>
+<td width='2%' align='left'>{varbuttom}</td>
+<td width='2%' align='left' valign='top'>{varbuttom1}</td>
+<td width='2%' align='left' valign='top'>{varbuttom2}</td>
+<td width='2%' align='left' valign='top'>{varbuttom3}</td>
+<td width='92%' align='left' valign='top'>{varbuttom4}</td>
+</tr>
+</table>
+<!-- END list -->
+</body>
+</html>
Index: tags/mobile/0.1.004/templates/default/edit.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/edit.tpl	(revision 588)
+++ tags/mobile/0.1.004/templates/default/edit.tpl	(revision 588)
@@ -0,0 +1,64 @@
+<!-- BEGIN edit_entry -->
+<style type="text/css">
+div#tipDiv {
+  position:absolute; visibility:hidden; left:0; top:0; z-index:10000;
+  background-color:#EFEFEF; border:1px solid #337;
+  width:220px; padding:3px;
+  color:#000; font-size:11px; line-height:1.2;
+  cursor: default;
+}
+</style>
+<script language="JavaScript">
+	self.name="first_Window";
+	function accounts_popup()
+	{
+		Window1=window.open('{accounts_link}',"Search","width=800,height=600,toolbar=no,scrollbars=yes,resizable=yes");
+	}
+</script>
+<center>
+<font color="#000000" face="{font}">
+
+<form action="{action_url}" method="post" name="app_form">
+{common_hidden}
+<table border="0" width="100%">
+ <tr>
+  <td colspan="2">
+   <center><font size="+1"><b>{errormsg}</b></font></center>
+  </td>
+ </tr>
+{row}
+<tr>
+<td colspan="2">
+{row_owner}
+</td>
+</tr>
+ <tr>
+  <td>
+  <table><tr valign="top">
+  <td>
+  <div style="padding-top:15px; padding-right: 2px">
+  	<input style="font-size:10px" type="submit" value="{submit_button}"></div></form>
+  </td>
+  <td>{cancel_button}</td>
+  </tr></table>
+  </td>
+  <td align="right">{delete_button}</td>
+ </tr>
+</table>
+</font>
+<a href="index.php?menuaction=mobile.ui_mobilecalendar.add_participants">{lang_add_participants}</a>
+</center>
+<!-- END edit_entry -->
+<!-- BEGIN list -->
+ <tr bgcolor="{tr_color}">
+  <td valign="top" width="40%">&nbsp;<font size='1'><b>{field}:</b></font></td>
+  <td valign="top" width="60%">{data}</td>
+ </tr>
+<!-- END list -->
+<!-- BEGIN hr -->
+ <tr bgcolor="{tr_color}">
+  <td colspan="2">
+   {hr_text}
+  </td>
+ </tr>
+<!-- END hr -->
Index: tags/mobile/0.1.004/templates/default/home.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/home.tpl	(revision 623)
+++ tags/mobile/0.1.004/templates/default/home.tpl	(revision 623)
@@ -0,0 +1,27 @@
+<!-- BEGIN mobile_home -->
+<html>
+<head>
+<meta http-equiv="Content-Language" content="pt-BR" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<LINK href="./templates/css/mobile.css" type=text/css rel=StyleSheet>
+<title>Expresso Mobile {lang_home}</title>
+</head>
+<body style="background-color:white !important">
+<!-- BEGIN mobile_home_content -->
+{content}<br>{footer}
+<!-- END mobile_home_content -->
+<p>&nbsp;&nbsp;<strong>{fullname}: [{account_lid}]</strong></p>
+<hr />
+<!-- TODO: Yep! Deveria ser flexível, não hardcoded do jeito que tá -->
+<!--<p>&nbsp;&nbsp;<strong>:: Expresso Mini</strong> </p>-->
+<p>
+:: <a href="{href_newmail}">{lang_newmail}</a> <br>
+:: <a href="{href_email}">{lang_email}</a> <br>
+:: <a href="{href_calendar}">{lang_calendar}</a> <br>
+:: <a href="{href_cc}">{lang_cc}</a> <br>
+:: <a href="./login.php?cd=1">{lang_logout}</a>
+</p>
+<hr />
+</body>
+</html>
+<!-- END mobile_home -->
Index: tags/mobile/0.1.004/templates/default/login.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/login.tpl	(revision 588)
+++ tags/mobile/0.1.004/templates/default/login.tpl	(revision 588)
@@ -0,0 +1,47 @@
+<HTML>
+<HEAD>
+<!-- <link href="../phpgwapi/templates/celepar/login.css" rel="stylesheet" type="text/css"> -->
+<LINK href="./templates/css/mobile.css" type=text/css rel=StyleSheet> 
+<TITLE>{website_title} - {lang_login}</TITLE>
+</HEAD>
+<body scroll="no"  style="overflow:hidden" bgcolor="#ffffff">
+	<table border="0" height="100%" width="100%">
+		<tr>
+			<td align="center" valign="top">
+				<div align="center" class="msgInicial">{cd}<br>{lang_message}<br>{website_title}<br><br></div>
+		        	<table border="0" bordercolor="#cfcfcf" cellpadding="0" cellspacing="0" width="auto">
+			        	<tbody>
+						<form name="form_login" method="post" action="./login.php" autocomplete=off>
+						<tr>
+							<td align="center" bgcolor="#f7f7f7" style="border:1px solid black">
+								<table border="0" cellpadding="1" cellspacing="0" class="tableLogin">
+									<tr><td width="96" colspan="3">&nbsp;</td></tr>												
+								    <tr><td width="120" class="loginLabel" align="right">{lang_username}:&nbsp;</td>
+										<td width="120"><input name="login" size="15">
+										<script>document.form_login.login.focus();</script></td>
+										<td width="43" rowspan="3" colspan=2>&nbsp;</td>
+									</tr>
+									<tr>
+										<td width="120" class="loginLabel"  align="right">{lang_password}:&nbsp;</td>
+										<td width="35"><input name="passwd" type="password" size="15"></td>
+									</tr>
+									<tr>
+										<td width="120">&nbsp;</td>
+										<td width="135">
+										  <input type="submit" value="{lang_login}" name="submitit" class="button">
+										</td>
+									</tr>
+								</table>              
+							</td>
+						</tr>
+						<input type="hidden" name="passwd_type" value="text">
+						<input type="hidden" name="account type" value="u">
+		              	</form>		          
+						</tbody>
+					</table>      
+				</div>
+			</td>		
+		</tr>
+	</table>
+</body>
+</html>
Index: tags/mobile/0.1.004/templates/default/overlap.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/overlap.tpl	(revision 588)
+++ tags/mobile/0.1.004/templates/default/overlap.tpl	(revision 588)
@@ -0,0 +1,30 @@
+<!-- BEGIN overlap -->
+<center><br />
+<table id="calendar_overlap_table">
+	<tr>
+		<td>
+			{overlap_text}
+		</td>
+	</tr>
+	<tr>
+		<td>
+			<ul>{overlap_list}</ul>
+		</td>
+	</tr>
+	<tr>
+		<td>
+			<table id="calendar_overlap_table2" cellspacing="5">
+				<tr>
+					<td>
+						{resubmit_button}
+					</td>
+					<td>
+						{reedit_button}
+					</td>
+				</tr>
+			</table>
+		</td>
+	</tr>
+</table>
+</center>
+<!-- END overlap -->
Index: tags/mobile/0.1.004/templates/default/add_participants.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/add_participants.tpl	(revision 588)
+++ tags/mobile/0.1.004/templates/default/add_participants.tpl	(revision 588)
@@ -0,0 +1,105 @@
+<!-- BEGIN body -->
+<form action="index.php?menuaction=mobile.ui_mobilecalendar.add_participants" method="post">
+
+<table border="0" width="315">
+			<tr bgcolor="{th_theme}">
+				<td align="center" width="99%">{lang_choose_the_participants}</td>
+			</tr>
+</table>
+<br />
+<table border="0" width="250">
+	<tr>
+		<td width="70">{lang_name}:</td>
+		<td><input type="text" name="name" size="30"/></td>
+	</tr>	
+	<tr>
+		<td width="70">{lang_catalog}:</td>
+		<td>
+			<select name="catalog">
+				{options}
+			</select>
+		</td>
+	</tr>	
+	<tr>
+		<td align="right" colspan="2"><input type="submit" value="{lang_buscar}"/></td>
+	</tr>	
+	
+</table>
+</form>
+<table border="0" width="99%">
+			<tr bgcolor="{th_theme}">
+				{header}
+			</tr>
+			{rows}
+</table>
+<table border="0" width="45%">
+	<tr>
+		<td>
+			{back} {pages}{next}
+		</td>
+	</tr>
+</table>
+
+<br/><br/>
+<form action="index.php">
+	<input type="hidden" name="menuaction" value="mobile.ui_mobilecalendar.add">
+	<input type="submit" value="{lang_continue_scheduling}">
+</form>
+
+<br/>
+
+
+<b>{lang_already_addeds:}</b> {rows_addeds}
+
+<!-- END body -->
+
+<!-- BEGIN people_header -->
+				<td width="60%" align="center">{lang_people_name}</td>
+				<td width="40%" align="center"></td>
+<!-- END people_header -->
+
+
+<!-- BEGIN row -->
+<form id="cc_form" name="cc_form" method="POST" action="{form_action}">
+	<tr bgcolor="{tr_color}">
+		<td width="60%">{row_nome}</td>
+		<td width="40%" align="center"><a href="{form_action}&user={id_contact}&cn={row_nome}">{lang_select}</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 -->
+
+<!-- BEGIN row_group -->
+	<tr bgcolor="{tr_color}">
+		<td>{row_group_name}</td>
+		<td align="center">{row_title}</td>
+	</tr>
+<!-- END row_group -->
+
+<!-- BEGIN row_empty -->
+	<tr>
+		<td align="center"><font color="red"><b>{message}</b></font></td>
+	</tr>
+<!-- END row_empty -->
+
+<!-- BEGIN option -->
+		<option value="{option_value}" {selected}>{option_text}</option>
+<!-- END option -->
+
+<!-- BEGIN page -->
+		<a href="index.php?menuaction=mobile.ui_mobilecalendar.add_participants&page={num_page}">
+		{display_page}
+		</a>&nbsp;
+<!-- END page -->
+<!-- BEGIN page_no_link -->
+		{num_page}&nbsp;
+<!-- END page_no_link -->
+
+<!-- BEGIN row_addeds -->
+	{row_contact_name}{row_separate}&nbsp;
+<!-- END row_addeds -->
Index: tags/mobile/0.1.004/templates/default/calendar.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/calendar.tpl	(revision 588)
+++ tags/mobile/0.1.004/templates/default/calendar.tpl	(revision 588)
@@ -0,0 +1,39 @@
+<!-- BEGIN body -->
+{events}
+<br>
+<a href="index.php?menuaction=mobile.ui_mobilecalendar.init_schedule">{lang_schedule} </a>
+
+<!-- END body -->
+
+<!-- BEGIN view_event -->
+<font color="#2e2626"><b>{header_date}</b></font><br>
+<table bgcolor="#f7f7f7" style="border:1px solid black" border="0" width="20%">
+	<tr bgcolor="#c4bcbc">
+		<td valign="top" width="10%">&nbsp;<b>{title_field}:</b></td>
+		<td  valign="top" nowrap>{title_data}</td>
+	</tr>
+	<tr bgcolor="#e7dede">
+		<td valign="top" width="10%" nowrap>&nbsp;<b>{location_field}:</b></td>
+		<td  valign="top" nowrap>{location_data}</td>
+	</tr>
+	<tr bgcolor="#c4bcbc">
+		<td valign="top" width="10%" nowrap>&nbsp;<b>{startdate_field}:</b></td>
+		<td  valign="top" nowrap>{startdate_data}</td>
+	</tr>
+	<tr bgcolor="#e7dede">
+		<td valign="top" width="10%" nowrap>&nbsp;<b>{enddate_field}:</b></td>
+		<td  valign="top" nowrap>{enddate_data}</td>
+	</tr>
+	<tr bgcolor="#c4bcbc">
+		<td valign="top" width="10%" nowrap>&nbsp;<b>{description_field}:</b></td>
+		<td  valign="top" >{description_data}</td>
+	</tr>
+	<tr style="display: {display};" >
+		<td align="right" valign="top"  ><a href="{accept_data}">{accept_title}</a></td>
+		<td  align="right" valign="top" ><a href="{reject_data}">{reject_title}</a></td>
+	</tr>
+	</table><br>
+<!-- END view_event -->
+<!-- BEGIN no_event -->
+	<br>Na semana de <b>{start_date}</b> à <b>{end_date}</b> você não possui nenhum compromisso agendado.
+<!-- END no_event -->
Index: tags/mobile/0.1.004/templates/default/cc_main.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/cc_main.tpl	(revision 517)
+++ tags/mobile/0.1.004/templates/default/cc_main.tpl	(revision 517)
@@ -0,0 +1,89 @@
+<!-- BEGIN body -->
+<form action="index.php?menuaction=mobile.ui_mobilecc.contacts_list" method="post">
+
+<table border="0" width="250">
+	<tr>
+		<td width="70">{lang_name}:</td>
+		<td><input type="text" name="name" size="30"/></td>
+	</tr>	
+	<tr>
+		<td width="70">{lang_catalog}:</td>
+		<td>
+			<select name="catalog">
+				{options}
+			</select>
+		</td>
+	</tr>	
+	<tr>
+		<td align="right" colspan="2"><input type="submit" value="{lang_buscar}"/></td>
+	</tr>	
+	
+</table>
+</form>
+<table border="0" width="90%">
+			<tr bgcolor="{th_theme}">
+				{header}
+			</tr>
+			{rows}
+</table>
+<table border="0" width="45%">
+	<tr>
+		<td>
+			{back} {pages}{next}
+		</td>
+	</tr>
+</table>
+<!-- END body -->
+
+<!-- BEGIN people_header -->
+				<td width="60%" align="center">{lang_people_name}</td>
+				<td width="20%" align="center">{lang_phone}</td>
+				<td width="20%" align="center">{lang_mail}</td>
+<!-- END people_header -->
+
+<!-- BEGIN group_header -->
+				<td width="60%" align="center">{lang_group_name}</td>
+				<td width="20%" align="center">{lang_title}</td>
+<!-- END group_header -->
+
+<!-- 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"><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 -->
+
+<!-- BEGIN row_group -->
+	<tr bgcolor="{tr_color}">
+		<td>{row_group_name}</td>
+		<td align="center">{row_title}</td>
+	</tr>
+<!-- END row_group -->
+
+<!-- BEGIN row_empty -->
+	<tr>
+		<td align="center"><font color="red"><b>{message}</b></font></td>
+	</tr>
+<!-- END row_empty -->
+
+<!-- BEGIN option -->
+		<option value="{option_value}" {selected}>{option_text}</option>
+<!-- END option -->
+
+<!-- BEGIN page -->
+		<a href="index.php?menuaction=mobile.ui_mobilecc.contacts_list&page={num_page}">
+		{display_page}
+		</a>&nbsp;
+<!-- END page -->
+<!-- BEGIN page_no_link -->
+		{num_page}&nbsp;
+<!-- END page_no_link -->
Index: tags/mobile/0.1.004/templates/default/mobilemail.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/mobilemail.tpl	(revision 623)
+++ tags/mobile/0.1.004/templates/default/mobilemail.tpl	(revision 623)
@@ -0,0 +1,72 @@
+<!-- BEGIN folder_list -->
+<form id="folders_list_form" method="get" action="/naoseiainda.php">
+<!-- Adicionar Label antes e um botão após -->
+	<p>&nbsp;&nbsp;<select id="select_current_folder" name="current_folder" onchange="document.getElementById('folders_list_form').submit();">
+		{folder_items}
+	</select></p>
+</form>
+<hr />
+<!-- END folder_list -->
+
+<!-- BEGIN inbox_folder_list -->
+<p>&nbsp;&nbsp;<strong>{lang_folder}</strong>: {lang_inbox}</p>
+<hr />
+<!-- END inbox_folder_list -->
+
+<!-- BEGIN folder_item -->
+		<option {option_selected} value="{folder_id}">{folder_name} {folder_unseen}</option>
+<!-- END folder_item -->
+
+<!-- BEGIN mail_list -->
+{mail_rows}
+<hr />
+<!-- END mail_list -->
+
+<!-- BEGIN mail_row -->
+<p style="background-color: {unseen_bkg}">&nbsp;&nbsp;<strong>{from_label}</strong>:  {strong_unseen_begin}<a href="index.php?menuaction=mobile.ui_mobilemail.show_msg&msg_number={msg_number}&msg_folder={msg_folder}">{from}<br>
+&nbsp;&nbsp;&nbsp;&nbsp;{subject} - {date}</a>{strong_unseen_end}</p>
+<!-- END mail_row -->
+
+<!-- BEGIN mail_footer -->
+<p>&nbsp;&nbsp;{previous}{space}{pages}{next}</p>
+<!-- END mail_footer -->
+
+<!-- BEGIN space -->
+&nbsp;
+<!-- END space -->
+
+<!-- BEGIN previous -->
+<a href="{previous_href}">&lt; Anteriores</a>
+<!-- END previous -->
+
+<!-- BEGIN next -->
+<a href="{next_href}">Próximas &gt;</a>
+<!-- END next -->
+
+<!-- BEGIN page_item -->
+{begin_strong}{begin_anchor}{page}{end_anchor}{end_strong}{space}
+<!-- END page_item -->
+
+<!-- BEGIN page_item1 -->
+{number_of_pages}{space}
+<!-- END page_item1 -->
+
+<!-- BEGIN end_anchor -->
+</a>
+<!-- END end_anchor -->
+
+<!-- BEGIN begin_anchor -->
+<a href="{begin_anchor_href}">
+<!-- END begin_anchor -->
+
+<!-- BEGIN empty_list -->
+<p>&nbsp;&nbsp;{empty_message}</p>
+<!-- END empty_list -->
+
+<!-- BEGIN begin_strong -->
+<strong>
+<!-- END begin_strong -->
+
+<!-- BEGIN end_strong -->
+</strong>
+<!-- END end_strong -->
Index: tags/mobile/0.1.004/templates/default/link_pict.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/link_pict.tpl	(revision 588)
+++ tags/mobile/0.1.004/templates/default/link_pict.tpl	(revision 588)
@@ -0,0 +1,25 @@
+
+<!-- BEGIN link_pict -->
+{picture}
+<!-- END link_pict -->
+
+<!-- BEGIN link_open -->
+<div id="calendar_event_entry" style="overflow:hidden;">
+<a class="event_entry" href="#" onMouseOver="window.status='{lang_view}'; return true;" onMouseOut="window.status=''; return true;" title="{desc} {location}"><br>
+<!-- END link_open -->
+
+<!-- BEGIN pict -->
+ <img src="{pic_image}" width="{width}" height="{height}" title="{title}" border="0" />
+<!-- END pict -->
+
+<!-- BEGIN link_text_old -->
+<nobr>&nbsp;{time}&nbsp;</nobr> {title}&nbsp;{users_status}: <i>{desc}</i><!--({location})-->
+<!-- END link_text_old -->
+
+<!-- BEGIN link_text -->
+&nbsp;<FONT SIZE=1><span style="color: black">{time}</span> {users_status}<br><b>{title}</b><br><i>{desc}</i> {location}
+<!-- END link_text -->
+
+<!-- BEGIN link_close -->
+</a></div>
+<!-- END link_close -->
Index: tags/mobile/0.1.004/templates/default/keep_add_participants.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/keep_add_participants.tpl	(revision 588)
+++ tags/mobile/0.1.004/templates/default/keep_add_participants.tpl	(revision 588)
@@ -0,0 +1,22 @@
+<!-- BEGIN body -->
+<table>
+<tr>
+<td>
+<form action="index.php">
+	<input type="hidden" name="menuaction" value="mobile.ui_mobilecalendar.add_participants">
+	<input type="submit" value="{lang_add_participants}">
+</form>
+</td>
+<td>
+&nbsp; &nbsp;
+</td>
+<td>
+<form action="index.php">
+	<input type="hidden" name="menuaction" value="mobile.ui_mobilecalendar.add">
+	<input type="submit" value="{lang_continue}">
+</form>
+</td>
+</tr>
+</table>
+<!--a href="index.php?menuaction=mobile.ui_mobilecalendar.add">{lang_continue}</a>
+<!-- END body -->
Index: tags/mobile/0.1.004/templates/default/new_msg.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/new_msg.tpl	(revision 518)
+++ tags/mobile/0.1.004/templates/default/new_msg.tpl	(revision 518)
@@ -0,0 +1,27 @@
+<!-- BEGIN begin_form -->
+<form id="reply_form" method="POST" action="{form_action}">
+<!-- END begin_form -->
+
+<!-- BEGIN msg_header -->
+<p>&nbsp;&nbsp;<strong>{to_label}</strong>: </p>
+<p>&nbsp;&nbsp;<input type="text" size="30" id="input_to" name="input_to" value='{to}' "{read_only}" /></p>
+<p>&nbsp;&nbsp;<strong>{subject_label}</strong>: </p>
+<p>&nbsp;&nbsp;<input type="text" size="30" id="input_subject" name="input_subject" value='{subject}' /></p>
+<!-- END msg_header -->
+
+<!-- BEGIN text -->
+&nbsp;&nbsp;<textarea id="body" wrap="virtual" rows="8" name="body"></textarea>
+<br />
+&nbsp;&nbsp;<input type="submit" id="reply_send" value="{send_label}" />
+<!-- END text -->
+
+<!-- BEGIN hidden_area -->
+<p>&nbsp;&nbsp;<input type="hidden" size="30" id="input_to_mail" name="input_to_mail" value='{to_mail}' /></p>
+<p>&nbsp;&nbsp;<input type="hidden" size="30" id="reply_from" name="reply_from" value='{from}' /></p>
+<p>&nbsp;&nbsp;<input type="hidden" size="30" id="reply_msg_number" name="reply_msg_number" value='{msg_number}' /></p>
+<p>&nbsp;&nbsp;<input type="hidden" size="30" id="folder" name="folder" value='{msg_folder}' /></p>
+<!-- END hidden_area -->
+
+<!-- BEGIN end_form -->
+</form>
+<!-- END end_form -->
Index: tags/mobile/0.1.004/templates/default/sent_msg.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/sent_msg.tpl	(revision 518)
+++ tags/mobile/0.1.004/templates/default/sent_msg.tpl	(revision 518)
@@ -0,0 +1,5 @@
+<!-- BEGIN retorno -->
+<p>&nbsp;&nbsp;&nbsp;{msg}</p>
+<p>&nbsp;&nbsp;&nbsp;{erro}</p>
+<p>&nbsp;&nbsp;&nbsp;<a href="{link}">{link_text}</a></p>
+<!-- END retorno -->
Index: tags/mobile/0.1.004/templates/default/view_msg.tpl
===================================================================
--- tags/mobile/0.1.004/templates/default/view_msg.tpl	(revision 517)
+++ tags/mobile/0.1.004/templates/default/view_msg.tpl	(revision 517)
@@ -0,0 +1,34 @@
+<!-- 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>{subject_label}</strong>: {subject}</p>
+<p>&nbsp;&nbsp;<strong>{date_label}</strong>: {date}</p>
+<br />
+<!-- END mail_header -->
+
+<!-- BEGIN mail_body -->
+<div style="border: solid; border-width: 1px; margin: 5px; padding: 10px; width: 97%;">{body}</div></span>
+<br />
+<br />
+<!-- END mail_body -->
+
+<!-- BEGIN reply_msg -->
+<p>&nbsp;&nbsp;&nbsp;<a href="{reply}">{reply_text}</a></p>
+<!-- END reply_msg -->
+
+<!-- BEGIN mail_footer -->
+<p>&nbsp;&nbsp;{begin_anchor}{link_text}{end_anchor}</p>
+<!-- END mail_footer -->
+
+<!-- BEGIN attachment_list -->
+<p>&nbsp;&nbsp;{attachment_message}</p>
+<br />
+<!-- END attachment_list -->
+
+<!-- BEGIN begin_anchor -->
+<a href="{link}">
+<!-- END begin_anchor -->
+
+<!-- BEGIN end_anchor -->
+</a>
+<!-- END end_anchor -->
Index: tags/mobile/0.1.004/templates/css/mobile.css
===================================================================
--- tags/mobile/0.1.004/templates/css/mobile.css	(revision 623)
+++ tags/mobile/0.1.004/templates/css/mobile.css	(revision 623)
@@ -0,0 +1,441 @@
+.grid_email_class
+{
+	border-bottom:1px solid #cfcfcf;
+}
+
+body
+{
+	/*margin: 0px !important;
+*/
+	/*background-color:#E9E9E9 !important;
+*/
+	font-size: 13px !important;
+	font-family: Verdana, Arial, Helvetica, sans-serif !important;
+	left: 0px;
+	padding: 0px;
+	margin: 0px;
+	/*padding:0px !important;
+*/
+}
+
+img
+{
+	border-width:0px !important;
+	border-style:none !important;
+	/*filter:progid:DXImageTransform.Microsoft.AlphaImageLoader;
+*/
+}
+
+a:link,a:visited
+{
+	cursor:pointer !important;
+	color: #000000 !important;
+	text-decoration: none !important;
+}
+
+a:hover,a:active
+{
+	cursor:pointer !important;
+	color: #ff9933 !important;
+	text-decoration: none !important;
+}
+
+input, button
+{
+	font-size: 11px !important;
+	color: #006699 !important;
+	font-family: Arial, Helvetica, sans-serif !important;
+	border: 1px #000066 solid !important;
+}
+
+input[type=submit],input[type=button],button
+{
+	margin:1px !important;
+	padding:0px 6px 0px 6px !important;
+	cursor: pointer !important;
+	cursor: hand !important;
+}
+
+input[type=image]
+{
+	cursor: pointer !important;
+	cursor: hand !important;
+	border: 1px #bbbbbb none !important;
+}
+select
+{
+	font-size: 11px !important;
+	color: #000066 !important;
+	font-family: Arial, Helvetica, sans-serif !important;
+	border: 1px #bbbbbb solid !important;
+	z-index: -1 !important;
+}
+
+td
+{
+	font-size: 11px !important;
+	/*text-align:left;*/
+	/*	padding-top:1px;
+	padding-bottom:1px;*/
+}
+
+.divLoginbox
+{
+	position:relative;
+	width: 300px;
+	border-right: #9c9c9c 0px solid;
+	border-top: #9c9c9c 1px solid;
+	border-left: #9c9c9c 0px solid;
+	border-bottom: #9c9c9c 1px solid
+}
+
+.divLoginboxHeader
+{
+	text-align:center;
+	background-color:#dddddd;
+	padding-top:2px;
+	font-size:10px;
+	color:#666666;
+}
+.divSidebox
+{
+	position:relative;
+	width: 147px;
+	border-right: #9c9c9c 1px solid;
+	border-top: #9c9c9c 1px solid;
+	border-left: #9c9c9c 1px solid;
+	border-bottom: #9c9c9c 1px solid
+}
+
+.tblHeadApp {
+
+	border-right: #9c9c9c 1px solid;
+	border-top: #9c9c9c 1px solid;
+	border-left: #9c9c9c 1px solid;
+	border-bottom: #9c9c9c 1px solid
+}
+
+.divSideboxHeader
+{
+	text-align:center;
+	background-color:#000066;
+	padding-top:2px;
+	height: 15px;
+	color: #FFFFFF;
+
+}
+
+a.divSideboxEntry, .divSideboxEntry
+{
+	text-align:left;
+	height:16px;
+	background-color:#eeeeee;
+}
+
+a.appTitles,.appTitles
+{
+	font-size: 10px;
+	height:18px;
+	padding-top:2px;
+	padding-bottom:2px;
+
+}
+
+a.textSidebox
+{
+	font-size: 10px;
+	border-top: #aaaaaa 0px none;
+}
+
+.textSidebox
+{
+	font-size: 10px;
+	height:18px;
+	padding-top:2px;
+	padding-bottom:2px;
+	border-top: #aaaaaa 1px solid;
+
+}
+
+.sideboxSpace
+{
+	height:9px;
+}
+
+.greyLine
+{
+	margin:1px;
+	border-top-color:#7e7e7e;
+	border-top-width:1px;
+	border-top-style:solid;
+	height:1px;
+}
+
+.prefSection
+{
+	font-weight:bold;
+	font-size:16px;
+	line-height:40px;
+}
+
+#extraIcons
+{
+/*	position:absolute;
+	z-index:13;
+	right:10px;
+	top:113px;
+	visibility:hidden;*/
+/*	background-image:url(../images/alpha-white.png);*/
+	background-color:#eeeeee;
+	border-width:1px;
+	border-color:#7e7e7e;
+	border-style:solid;
+}
+
+.extraIconsRow
+{
+	border-top-color:#dddddd;
+	border-top-width:1px;
+	border-top-style:solid;
+	padding:2px;
+}
+
+#divMain
+{
+	background-color:white;
+	margin-top: 0px;
+	padding:9px;
+	border-color:#7e7e7e;
+	border-width:1px;
+	border-style:solid;
+}
+
+#divLogo
+{
+	position:absolute;
+	left:20px;
+	top:5px;
+	z-index:51;
+}
+
+#divAppIconBar
+{
+	background-color:white;
+	border-top-color:#9c9c9c;
+	border-top-width:1px;
+	border-top-style:solid;
+	background-image: url(../images/background-icon-bar.png);
+	background-repeat: repeat-x
+}
+
+#divAppTextBar
+{
+	background-color:white;
+}
+
+#divStatusBar
+{
+	background-color:#f7f8fa;
+	height:15px;
+	padding-left:10px;
+	padding-top:0px;
+}
+
+/*#divSubContainer
+{
+}
+*/
+#tdSidebox
+{
+	width:170px;
+	background-color:white;
+	overflow:visible;
+}
+
+
+#tdAppbox
+{
+	background-color:white;
+	width: 100%;
+}
+#divSideboxContainer
+{
+	position:relative;
+	width:150px;
+	top:0px;
+	left:0px;
+	background-color:white;
+	border-width:1px;
+	border-style:solid;
+	z-index:40;
+}
+
+#divAppboxHeader
+{
+	margin-top:2px;
+	margin-left:2px;
+	margin-right:2px;
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 14px;
+	font-weight: bold;
+	color: #000066;
+	text-align: center;
+	padding: 0px;
+	background-image:url(../images/appbox-header-background21.png);
+	background-repeat: repeat-x;
+	height:24px;
+	line-height:24px;
+	border-top-color:#9c9c9c;
+	border-top-width:1px;
+	border-top-style:solid;
+	border-left-color:#9c9c9c;
+	border-left-width:1px;
+	border-left-style:solid;
+	border-right-color:#9c9c9c;
+	border-right-width:1px;
+	border-right-style:solid;
+}
+
+#divAppbox
+{
+	background-color:#f7f7f7;
+	padding-right:1px;
+	padding-top:1px;
+	padding-bottom:1px;
+	padding-left:15px;
+	border-bottom-color:#9c9c9c;
+	border-bottom-width:1px;
+	border-bottom-style:solid;
+	border-left-color:#9c9c9c;
+	border-left-width:1px;
+	border-left-style:solid;
+	border-right-color:#9c9c9c;
+	border-right-width:1px;
+	border-right-style:solid;
+	margin-top:0px;
+	margin-bottom:0px;
+	margin-left:2px;
+	margin-right:2px;
+
+}
+
+#fmStatusBar
+{
+	margin-left:4px;
+	margin-bottom:3px;
+	font-size: 10px;
+/*	font-family: Verdana, Arial, Helvetica, sans-serif;*/
+
+
+}
+
+
+.fmButton
+{
+	background-image:url(../images/buttonbackground.png);
+	width:28px;
+	height:28px;
+	background-repeat: no-repeat;
+}
+
+#fmLocation
+{
+	position:relative;
+	/*background-image:url(../images/buttonbackgroundscaled.png);
+	background-repeat: repeat-x;*/
+	/*margin-left:4px;*/
+	margin-bottom:3px;
+	height:27px;
+
+}
+
+#fmMenu
+{
+	position:relative;
+}
+#fmFileWindow
+{
+	background-color:#ffffff;
+	margin-left:4px;
+	padding:5px;
+	position:relative;
+	border-right: #cccccc 1px solid;
+	border-top: #9c9c9c 2px solid;
+	border-left: #9c9c9c 2px solid;
+	border-bottom: #cccccc 1px solid
+}
+
+#user_info
+{
+padding-left:17px;
+
+}
+
+#admin_info
+{
+	position:relative;
+	text-align:center;
+	margin-right:10px;
+}
+
+#divGenTime
+{
+	bottom:14px;
+	font-size: 9px;
+	color: #ff0000;
+	text-align:center;
+	width:99%;
+}
+
+#divPoweredBy
+{
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 10px;
+	color: #999999;
+	text-decoration: none;
+	padding: 7px;
+	text-align: center;
+	background-color:white;
+}
+
+A.minicalhol
+{
+	padding-left:3px;
+	padding-right:3px;
+	background: #dab0b0;
+	color: #000000;
+	font-size: 10px;
+}
+.loginLabel {
+	font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 10px;
+	color: #000066;
+	padding-left: 0px;
+}
+.tableLogin {
+        padding: 0px;
+        /*width: 274px;*/
+}
+.login {
+        text-align:center;
+        background-color: #F7F7F7;
+        border: 1px solid #CCCCCC;
+        margin: 5px 5px 50px;
+        padding: 5px;
+        height: 116px;
+        width: 300px;
+}
+.button {
+        font-family: Verdana, Arial, Helvetica, sans-serif;
+        font-size: 10px;
+        color: 006699;
+        background-color: #D4D0C8;
+        border: 1px solid #666666;
+}
+.msgInicial {
+        font-family: Verdana, Arial, Helvetica, sans-serif;
+	font-size: 12px;
+	color: #000066;
+	font-weight: bold;
+	padding-top: 1px;
+}
Index: tags/mobile/0.1.004/templates/celepar/home.tpl
===================================================================
--- tags/mobile/0.1.004/templates/celepar/home.tpl	(revision 623)
+++ tags/mobile/0.1.004/templates/celepar/home.tpl	(revision 623)
@@ -0,0 +1,23 @@
+<!-- BEGIN mobile_home -->
+<html>
+<head>
+<meta http-equiv="Content-Language" content="pt-BR" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<LINK href="./templates/css/mobile.css" type=text/css rel=StyleSheet>
+<title>Expresso Mobile {lang_home}</title>
+{js_lang}
+</head>
+<body style="background-color:white !important">
+<p>&nbsp;&nbsp;<strong>{fullname}: [{account_lid}]</strong></p>
+<hr />
+<p>
+<a href="{href_newmail}">{lang_newmail}</a>:<a href="{href_email}">{lang_email}</a>
+:<a href="{href_calendar}">{lang_calendar}</a>
+:<a href="{href_cc}">{lang_cc}</a>
+:<a href="./login.php?cd=1">{lang_logout}</a>
+</p>
+<hr />
+{content}<br>{footer}
+</body>
+</html>
+<!-- END mobile_home -->
