Index: branches/2.2/mobile/setup/phpgw_pt-br.lang
===================================================================
--- branches/2.2/mobile/setup/phpgw_pt-br.lang	(revision 3609)
+++ branches/2.2/mobile/setup/phpgw_pt-br.lang	(revision 3630)
@@ -144,2 +144,10 @@
 view calendar	mobile	pt-br	Calendário
 view week	mobile	pt-br	Semana
+Alias	mobile	pt-br	Apelido
+Family Names	mobile	pt-br	Sobrenome
+use contact	mobile	pt-br	usar contato
+Selecteds	mobile	pt-br	Selecionados
+confirm edit	mobile	pt-br	confirmar edição
+confirm add	mobile	pt-br	confirmar adição
+title edit contact	mobile	pt-br	Editando Contato
+title add contact	mobile	pt-br	Adicionando Contato
Index: branches/2.2/mobile/inc/class.ui_mobilecc.inc.php
===================================================================
--- branches/2.2/mobile/inc/class.ui_mobilecc.inc.php	(revision 3629)
+++ branches/2.2/mobile/inc/class.ui_mobilecc.inc.php	(revision 3630)
@@ -18,5 +18,9 @@
 			'change_letter' => true,
 			'choose_contact' => true,
-			'init_cc' => true
+			'init_cc' => true,
+			'contact_view' => true,
+			'contact_add_edit' => true,
+			'contact_add' => true,
+			'contact_edit' => true
 		);
 		var $template;
@@ -250,6 +254,10 @@
 			if(!empty($contacts)) {
 				foreach($contacts as $id => $contact) {
-					
+
 					$p->set_var('show_check',$show_checkbox?"inline":"none");
+					$p->set_var('bg',$bg=="par"?$bg="reset-dt":$bg="par");
+										
+					if($contact["catalog"]!=="bo_group_manager") {	//Contatos		
+						$id=strpos($contact["catalog"],"ldap")===false?$contact["id_contact"]:$id;
                     $p->set_var('bg',$bg=="par"?$bg="reset-dt":$bg="par");
                                        
@@ -284,4 +292,32 @@
 							continue;
 
+						$p->set_var('show_tel',$vtel);
+						$p->set_var('email',$mail);
+						$p->set_var('tel',$tel);
+						$p->set_var('contact_id',$id);
+						$p->set_var('lang_tel',lang("tel"));
+						$p->set_var('contact_name',$functions->strach_string($cn,17));
+
+						$block = "row_contacts";
+					}
+					else { //Grupos
+						$id=$contact["id_group"];
+						$mail = $cn = $contact["title"];
+						$p->set_var('group_id',$contact["id_group"]);
+						$p->set_var('group_name',$contact["title"]);
+						$block = "row_groups";
+					}
+					
+					if($request_from==null) {
+						$p->set_var('lang_see_details',strtoupper(lang("see details")));
+						$cat_encode = urlencode($contact["catalog"]);
+						$p->set_var('href_details',"ui_mobilecc.contact_view&id=$id&catalog=".urlencode($contact["catalog"]));
+					}
+					else {
+						$p->set_var('lang_see_details',strtoupper(lang("select")));
+						$p->set_var("href_details","ui_mobilemail.add_recipient&mail=$mail&cn=$cn");
+					}
+					
+					$p->fp('rows',$block,True);
                         $p->set_var('show_tel',$vtel);
                         $p->set_var('email',$mail);
@@ -321,9 +357,365 @@
 			return $p->fp('out','rows_contacts');
 		}
+
+		/**
+		 * Show details from contact selected
+		 * 
+		 * @param $id int
+		 * @param $catalog String
+		 * @return $contact
+		 */
+		function contact_view($params) { // bo_people_catalog, bo_global_ldap_catalog
+
+			if ( empty($params['id']) || empty($params['catalog']) ){
+				header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.init_cc');
+			}
+			
+			$this->template->set_file(
+				Array(
+					'cc_v' => 'contact_view.tpl'
+				)
+			);
+
+			$this->template->set_block('cc_v','body');
+			$this->template->set_block('cc_v','people');
+			$this->template->set_block('cc_v','people_ldap');
+			$this->template->set_block('cc_v','group');
+			$this->template->set_block('cc_v','group_row');
+			$this->template->set_block('cc_v','buttom');
+
+			switch ($params['catalog']){
+
+				case 'bo_shared_people_manager';
+				case 'bo_people_catalog':
+
+								$this->bo->set_catalog($params['catalog']);
+
+								$result = $this->bo->bo->get_single_entry($params['id'], array("given_names"=>true,"names_ordered"=>true,"alias"=>true,"family_names"=>true,"companies"=>true,"relations"=>true,"connections"=>true));
+
+								asort($result['connections']);
+
+								$this->template->set_var('photo', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_photo&id='.$id);
+								$this->template->set_var('id',$params['id']);
+								$this->template->set_var('catalog',$params['catalog']);
+					
+								$this->template->set_var('cc_name',$result['names_ordered']);
+								$this->template->set_var('lang_title_alias',lang("Alias"));
+								$this->template->set_var('lang_alias',$result['alias']);
+								
+								$this->template->set_var('lang_title_name',lang("Name"));
+								$this->template->set_var('lang_name',$result['given_names']);
+								
+								$this->template->set_var('lang_title_lastname',lang("Family Names"));
+								$this->template->set_var('lang_lastname',$result['family_names']);
+								
+								$email_to = "";
+								$var_phone = "";
+								$var_email = "";
+								foreach($result['connections'] as $conn):
+									if ( $conn['id_type'] == 1 ){
+										if ( !empty($var_email) )
+											$var_email .= ' | ';
+										$var_email .= $conn['connection_value'];
+										
+										if ( empty($email_to) )
+											$email_to = $var_email;
+										
+									}else if ($conn['id_type'] == 2){
+										if ( !empty($var_phone))
+											$var_phone .= ' | ';
+										$var_phone .= $conn['connection_value'];
+									}
+								endforeach;
+					
+								$this->template->set_var('email_to', $email_to);
+								
+								$this->template->set_var('lang_title_email',lang("Email"));
+								$this->template->set_var('lang_email',$var_email);
+								
+								$this->template->set_var('lang_title_phone',lang("Phone"));
+								$this->template->set_var('lang_phone',$var_phone);
+				
+								$this->template->set_var('lang_edit',lang("edit"));
+								
+								$this->template->parse("row_body","people");
+								
+								if ($params['catalog'] == 'bo_people_catalog')
+									$this->template->parse("buttom_editar","buttom");
+									
+							break;
+							
+				case 'bo_group_manager':
+
+								$this->bo->set_catalog($params['catalog']);
+								$result = $this->bo->bo->get_single_entry($params['id'], array("id_group"=>true,"title"=>true,"short_name"=>true));
+								$data   = $this->bo->bo->get_contacts_by_group($params['id']);
+								
+								$this->template->set_var('gr_name', $result['title']);
+								$this->template->set_var('email_to', '<'.$result['short_name'].'>');
+
+								$this->template->set_var('lang_title_name',lang("Name"));
+								$this->template->set_var('lang_title_email',lang("Email"));
+								
+								foreach($data as $dados){
+									$this->template->set_var('lang_name', $dados['names_ordered']);
+									$this->template->set_var('lang_email', $dados['connection_value']);
+									
+									$this->template->fp('group_rows','group_row',True);
+								}
+								
+								$this->template->parse("row_body","group");
+							break;
+						
+				default:		
+
+								if(strpos($params['catalog'],'bo_global_ldap_catalog')==false){
+
+									$this->bo->set_catalog($params['catalog']);
+
+									$fields = $this->bo->bo->get_fields(true);
+									$result = $this->bo->bo->get_single_entry($params['id'], $fields);
+
+									$this->template->set_var('photo', '../index.php?menuaction=contactcenter.ui_data.data_manager&method=get_photo&id='.$id);
+
+									$this->template->set_var('cc_name',$result['names_ordered'][0]);
+
+									$this->template->set_var('lang_title_name',lang("Name"));
+									$this->template->set_var('lang_name',$result['given_names'][0]);
+									
+									$this->template->set_var('lang_title_lastname',lang("Family Names"));
+									$this->template->set_var('lang_lastname',$result['family_names'][0]);
+									
+									$email_to = "";
+									$var_phone = "";
+									$var_email = "";
+									foreach($result['connections'] as $conn):
+										if ( $conn['id_type'] == 1 ){
+											if ( !empty($var_email) )
+												$var_email .= ' | ';
+											$var_email .= $conn['connection_value'];
+											
+											if ( empty($email_to) )
+												$email_to = $var_email;
+											
+										}else if ($conn['id_type'] == 2){
+											if ( !empty($var_phone))
+												$var_phone .= ' | ';
+											$var_phone .= $conn['connection_value'];
+										}
+									endforeach;
+						
+									$this->template->set_var('email_to', $email_to);
+									
+									$this->template->set_var('lang_title_email',lang("Email"));
+									$this->template->set_var('lang_email',$var_email);
+									
+									$this->template->set_var('lang_title_phone',lang("Phone"));
+									$this->template->set_var('lang_phone',$var_phone);
+
+									$this->template->parse("row_body","people_ldap");
+
+								}else{
+									header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.init_cc');
+								}
+
+							break;
+			}
+
+			$this->template->set_var('lang_contact_title',lang("context contact"));
+			$this->template->set_var('lang_back',lang("back"));
+			$this->template->set_var('lang_use_contact',lang("use contact"));
+			$this->template->set_var('lang_selecteds',lang("selecteds"));
+
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out','body'));
+		}
+
+		/**
+		 * View Add/Edit contact
+		 * 
+		 * @param $id int
+		 * @param $catalog String
+		 * @return $contact
+		 */
+		function contact_add_edit($params) {
+
+			$this->template->set_file(
+				Array(
+					'cc_e' => 'contact_add_edit.tpl'
+				)
+			);
+
+			$this->template->set_block('cc_e','body');
+
+			if ( empty($params['id']) ){
+				$title_contact = "title add contact";
+				$form_action = "index.php?menuaction=mobile.ui_mobilecc.contact_add";
+				$confirm = lang("confirm add");
+				$params['catalog'] = 'bo_people_catalog';
+			}else{
+				$title_contact = "title edit contact";
+				$form_action = "index.php?menuaction=mobile.ui_mobilecc.contact_edit";
+				$confirm = lang("confirm edit");
+				
+				$this->bo->set_catalog($params['catalog']);
+				$result = $this->bo->bo->get_single_entry($params['id'], array("given_names"=>true,"names_ordered"=>true,"alias"=>true,"family_names"=>true,"companies"=>true,"relations"=>true,"connections"=>true));
+
+				$this->template->set_var('lang_alias',$result['alias']);
+				$this->template->set_var('lang_name',$result['given_names']);
+				$this->template->set_var('lang_lastname',$result['family_names']);
+	
+				$var_phone = "";
+				$var_email = "";
+				foreach($result['connections'] as $conn):
+					if ( $conn['id_type'] == 1 ){
+						if ( (empty($var_email)) && ($conn['connection_is_default']) ){
+							$var_email = $conn['connection_value'];
+							$var_connection_email = $conn['id_connection'];
+						}
+					}else if ($conn['id_type'] == 2){
+						if ( (empty($var_phone)) &&  ($conn['connection_is_default'])){
+							$var_phone = $conn['connection_value'];
+							$var_connection_phone = $conn['id_connection'];
+						}
+					}
+				endforeach;
+
+				$this->template->set_var('var_connection_email', $var_connection_email);
+				$this->template->set_var('lang_email',$var_email);
+				
+				$this->template->set_var('var_connection_phone', $var_connection_phone);
+				$this->template->set_var('lang_phone',$var_phone);
+								
+			}
+			
+			$this->template->set_var('cc_name',$result['names_ordered']);
+			$this->template->set_var('lang_title_alias',lang("Alias"));
+			$this->template->set_var('lang_title_name',lang("Name"));
+			$this->template->set_var('lang_title_lastname',lang("Family Names"));
+			$this->template->set_var('lang_title_email',lang("Email"));
+			$this->template->set_var('lang_title_phone',lang("Phone"));
+
+			$this->template->set_var('catalog', $params['catalog']);
+				
+			$this->template->set_var('lang_title_add_edit',lang($title_contact));
+			$this->template->set_var('form_action', $form_action);
+			
+			$this->template->set_var('lang_contact_title',lang("context contact"));
+			$this->template->set_var('lang_back',lang("back"));
+			$this->template->set_var('lang_cancel',lang("cancel"));
+			$this->template->set_var('lang_confirm', $confirm);
+			$this->template->set_var('lang_selecteds',lang("selecteds"));
+			$this->template->set_var('id',$params['id']);
+			
+			$GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out','body'));
+		}
+		
+		/**
+		 * Add contact
+		 * 
+		 * @param $id int
+		 * @param $catalog String
+		 * @return $contact
+		 */
+		function contact_add($params) {
+			
+			$data['alias'] = $params['alias'];
+			$data['given_names'] = $params['given_names'];
+			$data['family_names'] = $params['family_names'];
+			$data['names_ordered'] = $data['given_names'] . ' ' . $data['family_names'];
+			$data['is_quick_add'] = true;
+
+			$this->bo->set_catalog($params['catalog']);
+
+			if ( !empty($params['email']) ){
+				$data['connections']['default_email']['connection_value'] = $params['email'];
+			}
+			
+			if ( !empty($params['phone']) ){
+				$data['connections']['default_phone']['connection_value'] = $params['phone'];
+			}
+
+			$this->bo->set_catalog($params['catalog']);
+			$contact_id = $this->bo->bo->quick_add($data);
+
+			header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.contact_view&id='.$contact_id.'&catalog='.$params['catalog']);
+		}
+		
+		/**
+		 * Edit contact
+		 * 
+		 * @param $id int
+		 * @param $catalog String
+		 * @return $contact
+		 */
+		function contact_edit($params) {
+			
+			$data['alias'] = $params['alias'];
+			$data['given_names'] = $params['given_names'];
+			$data['family_names'] = $params['family_names'];
+			$data['names_ordered'] = $data['given_names'] . ' ' . $data['family_names'];
+			
+			$cont = 0;
+
+			$this->bo->set_catalog($params['catalog']);
+			$types = $this->bo->bo->get_all_connections_types();
+
+			if ( !empty($params['email']) || !empty($params['id_connection_email']) ){
+				$cont++;
+			
+				if (empty($params['id_connection_email'])){
+					$data['connections']['connection' . $cont]['connection_is_default'] = true;
+					$data['connections']['connection' . $cont]['connection_name'] = $types[1];
+				}
+
+				$data['connections']['connection' . $cont]['id_connection'] = $params['id_connection_email'];
+				$data['connections']['connection' . $cont]['id_typeof_connection'] = 1;
+				$data['connections']['connection' . $cont]['connection_value'] = $params['email'];
+
+			}
+
+			if ( !empty($params['phone']) || !empty($params['id_connection_phone']) ){
+				$cont++;
+
+				if (empty($params['id_connection_phone'])){
+					$data['connections']['connection' . $cont]['connection_is_default'] = true;
+					$data['connections']['connection' . $cont]['connection_name'] = $types[2];
+				}
+
+				$data['connections']['connection' . $cont]['id_connection'] = $params['id_connection_phone'];
+				$data['connections']['connection' . $cont]['id_typeof_connection'] = 2;
+				$data['connections']['connection' . $cont]['connection_value'] = $params['phone'];
+
+			}
+
+			$contact_id = $this->bo->bo->update_single_info($params['id'], $data);
+
+			header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.contact_view&id='.$contact_id.'&catalog='.$params['catalog']);
+			
+		}
+
+		/**
+		 * Verify if the data is valid
+		 * 
+		 * @param $type String
+		 * @param $data String
+		 * @return Boolean
+		 */
+		static function validateData($type,$data){ 
+			
+			switch($type){
+				case 'phone' :  "/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i";
+						break;
+				
+				case 'email' : $pattern = "/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/i";
+						break;
+			}
+			
+			return preg_match($pattern, $data) ? true : false;
+			
+		}
+
 		
 	}
 	
 	
-	
-	
 ?>
Index: branches/2.2/mobile/templates/default/contact_view.tpl
===================================================================
--- branches/2.2/mobile/templates/default/contact_view.tpl	(revision 3630)
+++ branches/2.2/mobile/templates/default/contact_view.tpl	(revision 3630)
@@ -0,0 +1,60 @@
+<!-- BEGIN body -->
+
+<div class="menu-contexto">
+	<span><a href="../mobile/index.php?menuaction=mobile.ui_mobilecc.init_cc">{lang_back}</a></span><span class="titulo-secao">{lang_contact_title}</span>
+</div>
+
+<div id="corpo_mensagem">
+	{row_body}
+</div>
+
+<div class="menu-contexto"></div>
+
+<div id="operacao_lista">
+	{lang_selecteds}:
+	<button id="remover" class="btn-generico" onclick="location.href=('../mobile/index.php?menuaction=mobile.ui_mobilemail.new_msg&type=from_mobilecc&input_to={email_to}')" >{lang_use_contact}</button>
+	{buttom_editar}
+</div>
+
+<form name="formedit" action="../mobile/index.php?menuaction=mobile.ui_mobilecc.contact_add_edit" method="post">
+	<input type="hidden" name="id" value="{id}">
+	<input type="hidden" name="catalog" value="{catalog}">
+</form>
+
+<!-- END body -->
+
+<!-- BEGIN buttom -->
+<button id="adicionar_contato" class="btn-generico" onclick="javascript:document.formedit.submit();">{lang_edit}</button>
+<!-- END buttom -->
+
+<!-- BEGIN people -->
+<img src="{photo}" height="70" width="52" /><br><br>
+<p><strong>{cc_name}</strong></p>
+
+<p><strong>{lang_title_alias}:		</strong>{lang_alias}</p>
+<p><strong>{lang_title_name}:		</strong>{lang_name}</p>
+<p><strong>{lang_title_lastname}:	</strong>{lang_lastname}</p>
+<p><strong>{lang_title_email}:		</strong>{lang_email}</p> 
+<p><strong>{lang_title_phone}:		</strong>{lang_phone}</p>
+<!-- END people -->
+
+<!-- BEGIN people_ldap -->
+<img src="{photo}" height="70" width="52" /><br><br>
+<p><strong>{cc_name}</strong></p>
+
+<p><strong>{lang_title_name}:		</strong>{lang_name}</p>
+<p><strong>{lang_title_lastname}:	</strong>{lang_lastname}</p>
+<p><strong>{lang_title_email}:		</strong>{lang_email}</p> 
+<p><strong>{lang_title_phone}:		</strong>{lang_phone}</p>
+<!-- END people_ldap -->
+
+<!-- BEGIN group -->
+<p><strong>{gr_name}</strong></p>
+<br>
+{group_rows}
+<!-- END group -->
+
+<!-- BEGIN group_row -->
+<p><strong>{lang_title_name}:		</strong>{lang_name}</p>
+<p><strong>{lang_title_email}:		</strong>{lang_email}</p> <br><br>
+<!-- END group_row -->
Index: branches/2.2/mobile/templates/default/contact_add_edit.tpl
===================================================================
--- branches/2.2/mobile/templates/default/contact_add_edit.tpl	(revision 3630)
+++ branches/2.2/mobile/templates/default/contact_add_edit.tpl	(revision 3630)
@@ -0,0 +1,31 @@
+<!-- BEGIN body -->
+
+<div class="menu-contexto">
+	<span><a href="javascript:history.go(-1);">{lang_back}</a></span><span class="titulo-secao">{lang_contact_title}</span>
+</div>
+
+<p class="titulo-sdt">{lang_title_add_edit}</p>
+
+<form name="formcontact" method="post" action="{form_action}">
+<input type="hidden" name="id" value="{id}">
+<input type="hidden" name="catalog" value="{catalog}">
+<input type="hidden" name="id_connection_email" value="{var_connection_email}">
+<input type="hidden" name="id_connection_phone" value="{var_connection_phone}">
+<div id="corpo_mensagem">
+		<p><strong>{lang_title_alias}:		</strong><input type="text" name="alias" value="{lang_alias}">	</p>
+		<p><strong>{lang_title_name}:		</strong><input type="text" name="given_names" value="{lang_name}">	</p>
+		<p><strong>{lang_title_lastname}:	</strong><input type="text" name="family_names" value="{lang_lastname}"></p>
+		<p><strong>{lang_title_email}:		</strong><input type="text" name="email" value="{lang_email}">	</p> 
+		<p><strong>{lang_title_phone}:		</strong><input type="text" name="phone" value="{lang_phone}">	</p>
+</div>
+</form>
+
+<div class="menu-contexto"></div>
+
+<div id="operacao_lista">
+	{lang_selecteds}:
+	<button id="cancelar" class="btn-generico" onclick="javascript:history.go(-1);" >{lang_cancel}</button>
+	<button id="confirmar_edicao" class="btn-generico" onclick="javascript:document.formcontact.submit();">{lang_confirm}</button>
+</div>
+
+<!-- END body -->
