{folders_list}
".lang("This message has the follow attachments:")."
";
+ foreach($msg['attachments'] as $key => $attach) {
+ if(is_array($attach)) {
+ //$attachs.=$attach['name']." ";
+ $attachs.="".
+ lang('Download').": ".$attach['name']."
";
+ }
+ }
+
+ $this->template->parse('attachment_alert_box','attachment_alert_block', true);
+ $this->template->set_var('attachment_message', $attachs);
+ }
+ else
+ {
+ $this->template->set_var('attachment_message', lang('This message don\'t have attachment(s)'));
+ }
+
+ $GLOBALS['phpgw_info']['mobiletemplate']->set_error_msg($params["error_message"]);
+ $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page'));
+ }
+
+ /*
+ * @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
".lang("error") . $return["append"];
+ $this->new_msg( $params );
+ }else {
+ header('Location: index.php?menuaction=menuaction=mobile.ui_home.index&success_message='.lang("draft saved").'&ignore_trace_url=true');
+ }
+ }
+
+ /*
+ * @function send_mail()
+ * @abstract Função que realiza o envio de e-mails.
+ * @author Rommel de Brito Cysne
$body
";
+ //Important message
+ if($isImportant) $mail->isImportant();
+ //add history
+ if($addHistory && $msgNumber) {
+ $msg = $this->imap_functions->get_info_msg(array('msg_number' => $msgNumber ) );
+ $mail->Body .= "
".$msg['body']."
";
+ }
+ //read confirmation
+ if ($readConfirmation) $mail->ConfirmReadingTo = $_SESSION['phpgw_info']['expressomail']['user']['email'];
+
+ $imap_functions = new imap_functions();
+ if (count($attachments)>0) //Attachment
+ {
+
+ $total_uploaded_size = 0;
+ $upload_max_filesize = str_replace("M","",$_SESSION['phpgw_info']['user']['preferences']['expressoMail']['max_attachment_size']) * 1024 * 1024;
+
+ foreach ($attachments as $attach)
+ {
+ $mail->AddAttachment($attach['tmp_name'], $attach['name'], "base64", $imap_functions->get_file_type($attach['name'])); // optional name
+ $total_uploaded_size = $total_uploaded_size + $attach['size'];
+ }
+ if( $total_uploaded_size > $upload_max_filesize){
+
+ return $imap_functions->parse_error("message file too big");
+ }
+ }
+ if (count($forwarding_attachments) > 0) { //forward attachment
+ foreach($forwarding_attachments as $forwarding_attachment)
+ {
+ $file_description = unserialize(rawurldecode($forwarding_attachment));
+ $fileContent = $imap_functions->get_forwarding_attachment(
+ $file_description[0],
+ $file_description[1],
+ $file_description[3],
+ $file_description[4]);
+ $fileName = $file_description[2];
+ $mail->AddStringAttachment($fileContent,html_entity_decode(rawurldecode($fileName)), $file_description[4], $imap_functions->get_file_type($file_description[2]));
+ }
+ }
+
+ if(!$mail->Send()) {
+ $params["error_message"] = lang("Message not sent")."
".lang("error") . $mail->ErrorInfo;
+ $this->new_msg( $params );
+ }else {
+ if($GLOBALS['phpgw']->session->appsession('mobile.layout','mobile')=="mini_desktop") {
+ header('Location: index.php?menuaction=mobile.ui_mobilemail.index&success_message='.lang("Message sent successfully").'&ignore_trace_url=true');
+ } else {
+ header('Location: index.php?menuaction=mobile.ui_home.index&success_message='.lang("Message sent successfully").'&ignore_trace_url=true');
+ }
+ }
+ }
+
+ function delete_msg($params)
+ {
+
+ if ( !isset($params['msgs']) && !isset($params['msg_number']) ) {
+ header("Location: index.php?menuaction=mobile.ui_mobilemail.index&error_message=".lang("please select one e-mail"));
+ } else {
+ $params_messages = array(
+ 'msgs_number' => isset($params['msgs'])?implode(",",$params['msgs']):$params['msg_number'],
+ 'folder' => $this->folders[$this->current_folder]['folder_name'],
+ 'new_folder_name' => 'Trash',
+ 'new_folder' => 'INBOX/Trash'
+ );
+
+ $this->imap_functions->move_messages($params_messages);
+ header("Location: index.php?menuaction=mobile.ui_mobilemail.index&success_message=".lang("The messages were moved to trash").'&ignore_trace_url=true');
+ }
+ }
+
+ function get_folder_number($folder_name){
+ foreach($this->folders as $folderNumber => $folder){
+ if($folder['folder_id'] == $folder_name){
+ return $folderNumber;
+ }
+ }
+ return 0;
+ }
+
+ function init_schedule() {
+ $_SESSION['mobile_add_contact'] = array();
+ $_SESSION['mobile_add_contact']['mobile_mail'] = $_POST['input_to'];
+ $_SESSION['mobile_add_contact']['mobile_mail_cc'] = $_POST['input_cc'];
+ $_SESSION['mobile_add_contact']['add_to'] = $_POST['add_to'];
+ $_SESSION['mobile_add_contact']['type'] = $_POST['type'];
+ $_SESSION['mobile_add_contact']['msg_number'] = $_POST['reply_msg_number'];
+ $_SESSION['mobile_add_contact']['msg_folder'] = $_POST['folder'];
+ $_SESSION['mobile_add_contact']['subject_mail'] = $_POST['input_subject'];
+ $_SESSION['mobile_add_contact']['body_mail'] = $_POST['body'];
+ $_SESSION['mobile_add_contact']['check_important'] = $_POST['check_important'];
+ $_SESSION['mobile_add_contact']['check_read_confirmation'] = $_POST['check_read_confirmation'];
+ $_SESSION['mobile_add_contact']['check_add_history'] = $_POST['check_add_history'];
+
+ $ui_cc = CreateObject('mobile.ui_mobilecc');
+ $ui_cc->choose_contact(array("request_from" => "ui_mobilemail.new_msg"));
+ }
+
+ function add_recipient() {
+ if($_SESSION['mobile_add_contact']['add_to'] == "to")
+ $arr_key_name = "mobile_mail";
+ else
+ $arr_key_name = "mobile_mail_cc";
+
+ $arr_mobile_add_contact = $_SESSION['mobile_add_contact'];
+
+ if(strpos($arr_mobile_add_contact[$arr_key_name], $_GET['mail']) === false)
+ $arr_mobile_add_contact[$arr_key_name] .= ( (trim($arr_mobile_add_contact[$arr_key_name]) == "") ? $_GET['mail'] : ",".$_GET['mail']);
+
+ unset($_SESSION['mobile_add_contact']);
+
+ $this->new_msg( array(
+ 'mobile_add_contact' => $arr_mobile_add_contact,
+ 'type' => 'user_add',
+ 'msg_number' => $arr_mobile_add_contact['msg_number'],
+ 'msg_folder' => $arr_mobile_add_contact['msg_folder']));
+ }
+
+ function list_folders(){
+ //Define o template para mensagens de retorno da funcao
+ $this->template->set_file(array('folders_t' => 'folders.tpl'));
+ $this->template->set_block('folders_t','retorno');
+
+ $folders_list = '';
+ $array_folders = Array();
+ $this->folders = $this->imap_functions->get_folders_list(array('noSharedFolders' => true));
+
+ foreach($this->folders as $id => $folder)
+ {
+ if((strpos($folder['folder_id'],'user')===true && !is_array($folder)) || !is_numeric($id))
+ continue;
+ $array_folders[$folder['folder_id']]['id'] = $id;
+ $array_folders[$folder['folder_id']]['folder_name'] = $folder['folder_name'];
+ }
+
+ foreach($array_folders as $folder_id => $folder)
+ {
+ if(($folder_id != $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['save_in_folder']) && ($folder['id'] != 0)){
+ $folder_name = str_replace('*','',lang($folder['folder_name']));
+ $folder_link = "index.php?menuaction=mobile.ui_mobilemail.mail_list&folder=".$folder['id'];
+ $folders_list .= "
:: ".$folder_name."";
+ }
+ }
+ $this->template->set_var('folders_list', $folders_list);
+ $this->template->pfp('out','retorno');
+
+ }
+
+ }
+?>
Index: /branches/2.2.0.1/mobile/inc/class.bo_mobilemail.inc.php
===================================================================
--- /branches/2.2.0.1/mobile/inc/class.bo_mobilemail.inc.php (revision 4246)
+++ /branches/2.2.0.1/mobile/inc/class.bo_mobilemail.inc.php (revision 4246)
@@ -0,0 +1,23 @@
+
Index: /branches/2.2.0.1/mobile/inc/class.ui_mobilecc.inc.php
===================================================================
--- /branches/2.2.0.1/mobile/inc/class.ui_mobilecc.inc.php (revision 4246)
+++ /branches/2.2.0.1/mobile/inc/class.ui_mobilecc.inc.php (revision 4246)
@@ -0,0 +1,857 @@
+ false,
+ 'actual_letter' => null,
+ 'actual_max_contacts' => null,
+ 'request_from' => null
+ );
+
+ var $public_functions = array(
+ 'index' => true,
+ 'change_max_results' => true,
+ 'change_catalog' => true,
+ 'delete_contacts' => true,
+ 'change_letter' => true,
+ 'choose_contact' => true,
+ 'init_cc' => true,
+ 'contact_view' => true,
+ 'contact_add_edit' => true,
+ 'contact_add' => true,
+ 'contact_edit' => true
+ );
+ var $template;
+
+ /**
+ * Construtor...
+ *
+ */
+ public function ui_mobilecc() {
+ $this->template = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+ $this->bo = CreateObject('mobile.bo_mobilecc');
+ $page_info = $GLOBALS['phpgw']->session->appsession('mobilecc.page_info','mobile');
+
+ if($page_info) {
+ $this->page_info = $page_info;
+ }
+ else {
+ $this->set_page_info_to_default();
+ }
+
+ //if()
+
+ }
+
+ private function set_page_info_to_default() { //Valores default para iniciar o módulo de contatos
+ $this->page_info['actual_catalog'] = 'bo_people_catalog';
+ $this->page_info['actual_letter'] = 'a';
+ $this->page_info['actual_max_contacts'] = 10;
+ $this->page_info['request_from'] = null;
+ }
+
+ private function save_session() {
+ $GLOBALS['phpgw']->session->appsession('mobilecc.page_info','mobile',$this->page_info);
+ }
+
+ public function index($params) {
+ $GLOBALS['phpgw_info']['mobiletemplate']->set_error_msg($params["error_message"]);
+ $GLOBALS['phpgw_info']['mobiletemplate']->set_success_msg($params["success_message"]);
+ $this->contacts_list();
+ }
+
+ public function change_max_results($params) {
+ $this->page_info['actual_max_contacts'] = $params['results'];
+ $this->contacts_list();
+ $this->save_session();
+ }
+
+ public function change_letter($params) {
+ $this->page_info['actual_letter'] = $params['letter'];
+ $this->page_info['actual_max_contacts'] = 10;
+ $this->contacts_list();
+ $this->save_session();
+ }
+
+ public function change_catalog($params) {
+
+ if( $params['catalog'] ) $this->page_info['actual_catalog'] = $params['catalog'];
+ $this->page_info['actual_max_contacts'] = 10;
+ $this->page_info['actual_letter'] = 'a';
+
+ $this->contacts_list($params);
+
+ $this->save_session();
+ }
+
+ /**
+ * Função de inicio do módulo para escolha de um contato para outro módulo.
+ *
+ * @return
+ * @param $params Object
+ */
+ public function choose_contact($params) {
+ $this->set_page_info_to_default();
+ $this->page_info['request_from'] = $params['request_from']; //Para escolher contato vindo de outro modulo, mudo apenas o request_from
+ $this->contacts_list();
+ $this->save_session();
+ }
+
+ /**
+ * Função de inicio do módulo de cc
+ *
+ * @return
+ * @param $params Object
+ */
+ public function init_cc($params) {
+ $this->set_page_info_to_default();
+ $this->contacts_list($params);
+ $this->save_session();
+ }
+
+ /**
+ * 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($params) {
+
+ $this->template->set_file(
+ Array(
+ 'contacts_list' => 'cc_main.tpl',
+ 'home_search_bar' => 'search_bar.tpl'
+ )
+ );
+ $this->template->set_block("contacts_list","catalog_row");
+ $this->template->set_block("contacts_list","main_body");
+ $this->template->set_block("contacts_list","pagging_block");
+ $this->template->set_block('home_search_bar','search_bar');
+
+ //Langs gerais da página
+ $this->template->set_var("lang_back",lang("back"));
+ $this->template->set_var('href_back',$GLOBALS['phpgw_info']['mobiletemplate']->get_back_link());
+ $this->template->set_var("selecteds",ucfirst(lang("selecteds")));
+ $this->template->set_var("lang_more",lang("more"));
+ $this->template->set_var("lang_search",lang("search"));
+ $this->template->set_var("lang_contacts",ucfirst(lang("contacts")));
+ $this->template->set_var("actual_catalog",$this->page_info["actual_catalog"]);
+ $this->template->set_var("next_max_results",$this->page_info["actual_max_contacts"]+10);
+
+ $show_checkbox = true;
+ if(strpos($this->page_info["actual_catalog"],"ldap")===false) {
+ $this->template->set_var("show_actions", "block");
+ } else {
+ $this->template->set_var("show_actions", "none");
+ $show_checkbox = false;
+ }
+
+ $this->template->set_var("show_add_button",$this->page_info["actual_catalog"] == "bo_group_manager" ? "none" : "");
+
+ $this->template->set_var("contacts_request_from",
+ $this->page_info["request_from"]==null?
+ "none":$this->page_info["request_from"]);
+
+ if($GLOBALS['phpgw']->session->appsession('mobile.layout','mobile')!="mini_desktop")
+ $this->template->set_var('search',$this->template->fp('out','search_bar'));
+
+ //Combo de catálogos
+ $catalogs = $this->bo->get_all_catalogs();
+ foreach($catalogs as $catalog) {
+ $this->template->set_var("catalog_value",$catalog["catalog"]);
+ $this->template->set_var("catalog_name",$catalog["label"]);
+ if($this->page_info['actual_catalog']==$catalog['catalog'])
+ $this->template->set_var("selected","selected");
+ else
+ $this->template->set_var("selected"," ");
+ $this->template->fp("catalogs","catalog_row",true);
+ }
+ $this->bo->set_catalog($this->page_info["actual_catalog"]);
+ $contacts = $this->bo->search($this->page_info["actual_letter"]."%",
+ $this->page_info["actual_max_contacts"]);
+
+
+ //Letras da paginação
+ $max_letters = 5;
+ if ( in_array($this->page_info['actual_letter'],
+ range("a","c"))){ //Letras de A à C iniciam sempre com A
+
+ $this->template->set_var('show_back','none');
+ $this->template->set_var('show_next','inline');
+ $first_letter = "a";
+ $this->template->set_var('href_next',"index.php?menuaction=mobile.".
+ "ui_mobilecc.change_letter&letter=f");
+ }
+ else if ( in_array($this->page_info['actual_letter'],
+ range("x","z"))) { //Letras de X à Z terminam sempre no Z
+ $this->template->set_var('show_back','inline');
+ $this->template->set_var('show_next','none');
+ $first_letter = "v";
+ $this->template->set_var('href_back',"index.php?menuaction=mobile.".
+ "ui_mobilecc.change_letter&letter=u");
+ }
+ else { //Letras do meio
+ $this->template->set_var('show_back','inline');
+ $this->template->set_var('show_next','inline');
+
+ $first_letter = chr(ord($this->page_info["actual_letter"])-3);//Inicio 3 letras antes
+ $last_letter = chr(ord($first_letter)+($max_letters+1));//A ultima é a máxima quantidade de letras mais 1 do next_letter
+
+ $this->template->set_var('href_back',"index.php?menuaction=mobile.".
+ "ui_mobilecc.change_letter&letter=".$first_letter);
+ $this->template->set_var('href_next',"index.php?menuaction=mobile.".
+ "ui_mobilecc.change_letter&letter=".$last_letter);
+ $first_letter++;
+ }
+
+ for($i=1;$i<=$max_letters;$i++) { //Roda as letras
+ $this->template->set_var("href","index.php?menuaction=mobile.".
+ "ui_mobilecc.change_letter&letter=".$first_letter);
+ $this->template->set_var("letter",strtoupper($first_letter));
+ if($first_letter===$this->page_info["actual_letter"])
+ $this->template->set_var("class_button","letter-contact-selected");
+ else
+ $this->template->set_var("class_button","btn_off");
+ $this->template->set_var("letter",strtoupper($first_letter));
+ $this->template->fp("pagging_letters","pagging_block",true);
+ $first_letter++;
+ }
+
+
+ if($contacts['has_more'])
+ $this->template->set_var("show_more","block");
+ else
+ $this->template->set_var("show_more","none");
+ unset($contacts['has_more']);
+
+ $this->template->set_var("contacts",$this->print_contacts($contacts,$show_checkbox,$this->page_info['request_from']));
+
+
+ $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out','main_body'));
+ }
+
+ /**
+ * Remove os contatos selecionados
+ *
+ * @return
+ * @param $contacts Object
+ * @param $show_checkbox Object[optional]
+ */
+
+ function delete_contacts($params) {
+ $this->bo->set_catalog($params['catalog']);
+
+ if (!is_array($params['contacts']) ){
+ header("Location: index.php?menuaction=mobile.ui_mobilecc.index&error_message=".lang("please select one contact"));
+ }else{
+
+ $status = $this->bo->remove_multiple_entries($params['contacts']);
+
+ $type = $this->page_info['actual_catalog']!=='bo_group_manager'?"contacts":"groups";
+
+ if($status['success'])
+ header("Location: index.php?menuaction=mobile.ui_mobilecc.index&success_message=".lang("selected $type were removed successfully"));
+ else
+ header("Location: index.php?menuaction=mobile.ui_mobilecc.index&error_message=".lang("one or more $type couldnt be removed"));
+ }
+ }
+
+ static function print_contacts($contacts,$show_checkbox=false,$request_from = null) {
+ $functions = CreateObject('mobile.common_functions');
+ $p = CreateObject('phpgwapi.Template', PHPGW_SERVER_ROOT . '/mobile/templates/'.$GLOBALS['phpgw_info']['server']['template_set']);
+ $p->set_file(
+ Array(
+ 'cc_t' => 'contacts_list.tpl'
+ )
+ );
+ $p->set_block('cc_t', 'rows_contacts');
+ $p->set_block('cc_t', 'row_contacts');
+ $p->set_block('cc_t', 'row_groups');
+ $p->set_block('cc_t', 'no_contacts');
+
+ $bg = "bg-azul";
+ if(!empty($contacts)) {
+ foreach($contacts as $id => $contact) {
+
+ $p->set_var('show_check',$show_checkbox?"inline":"none");
+ $p->set_var('bg',$bg=="bg-azul"?$bg="bg-branco":$bg="bg-azul");
+ if($show_checkbox)
+ $p->set_var("details","email-corpo");
+ else
+ $p->set_var("details","limpar_div margin-geral");
+ if($contact["catalog"]!=="bo_group_manager") { //Contatos
+ $id=strpos($contact["catalog"],"ldap")===false?$contact["id_contact"]:$id;
+
+ $mail = ' '; $tel = ' ';
+ foreach($contact['connections'] as $key => $conn) {
+
+ $test = false;
+ if ($conn['connection_is_default']) {
+ $test = true;
+ }
+
+ if (is_array($conn)){
+ $test = true;
+ }else{
+ $test = false;
+ }
+ if ( $test) {
+ if ( ($conn['id_type'] == 1) )
+ $mail = $conn['connection_value'];
+ else if ( ($conn['id_type'] == 2) )
+ $tel = $conn['connection_value'];
+
+ if (($conn['id_type'] == null) || ($conn['id_type'] == '_NONE_')){
+ if ( ($conn['type'] == 'email') )
+ $mail = $conn['connection_value'];
+ else if ( ($conn['type'] == 'phone') )
+ $tel = $conn['connection_value'];
+
+ }
+ }
+ }
+
+
+
+ $cn = is_array($contact["names_ordered"])?$contact["names_ordered"][0]:$contact["names_ordered"];
+ $vtel = ($tel==null || $tel==' ')?"none":"inline";
+
+ if(($mail==' ' || $mail==null) && isset($request_from))//Se vier de outro módulo e não possuir e-mail, não mostre.
+ 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',lang("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',lang("select"));
+ $p->set_var("href_details","ui_mobilemail.add_recipient&mail=$mail&cn=$cn");
+ }
+
+ $p->fp('rows',$block,True);
+
+ }
+
+ }
+ else {
+ $p->set_var("lang_no_results",lang("no results found"));
+ $p->parse("rows","no_contacts");
+ }
+ return $p->fp('out','rows_contacts');
+ }
+
+ /**
+ * Show details from contact selected
+ *
+ * @param $id int
+ * @param $catalog String
+ * @return $contact
+ */
+ function contact_view($params) {
+
+ 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'
+ )
+ );
+
+ if ( isset($params['success'])){
+ $GLOBALS['phpgw_info']['mobiletemplate']->set_success_msg(lang('contact save successfully'));
+ }
+
+ $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');
+ $this->template->set_block('cc_v','buttom_use_contact');
+ $this->template->set_block('cc_v','row_view_operacao');
+
+ $this->template->set_var('title_view_contact',lang("title view contact"));
+ $email_to = "";
+
+ switch ($params['catalog']){
+
+ case 'bo_shared_people_manager';
+ case 'bo_people_catalog':
+
+ $this->template->set_var('lang_contact_title',lang("context contact"));
+ $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='.$params['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']);
+
+ $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'];
+ }
+
+ if (($conn['id_type'] == null) || ($conn['id_type'] == '_NONE_')){
+ if ( $conn['type'] == 'email' ){
+ if ( !empty($var_email) )
+ $var_email .= ' | ';
+ $var_email .= $conn['connection_value'];
+
+ if ( empty($email_to) )
+ $email_to = $var_email;
+
+ }else if ($conn['type'] == 'phone'){
+ if ( !empty($var_phone))
+ $var_phone .= ' | ';
+ $var_phone .= $conn['connection_value'];
+ }
+ }
+ endforeach;
+
+ $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->template->set_var('lang_contact_title',lang("context group"));
+ $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']);
+
+ $email_to = '<'.$result['short_name'].'>';
+
+ $this->template->set_var('title_view_contact', $result['title']);
+ $this->template->set_var('email_to', $email_to);
+
+ $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->set_var('bg',$bg=="bg-azul"?$bg="bg-branco":$bg="bg-azul");
+
+ $this->template->set_var('href_details',"ui_mobilecc.contact_view&id=".$dados['id_contact']."&catalog=bo_people_catalog");
+
+ $this->template->fp('group_rows','group_row',True);
+ }
+
+ $this->template->set_var('email_to', $email_to);
+ $this->template->parse("buttom_use","buttom_use_contact");
+
+ $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='.$params["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]);
+
+ $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'];
+ }
+
+ if (($conn['id_type'] == null) || ($conn['id_type'] == '_NONE_')){
+ if ( $conn['type'] == 'email' ){
+ if ( !empty($var_email) )
+ $var_email .= ' | ';
+ $var_email .= $conn['connection_value'];
+
+ if ( empty($email_to) )
+ $email_to = $var_email;
+
+ }else if ($conn['type'] == 'phone'){
+ 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;
+ }
+
+ if ( !empty($email_to)){
+ $this->template->set_var('email_to', $email_to);
+ $this->template->parse("buttom_use","buttom_use_contact");
+ $this->template->parse("row_operacao","row_view_operacao");
+ }else if ($params['catalog'] == 'bo_people_catalog'){
+ $this->template->parse("row_operacao","row_view_operacao");
+ }
+
+ $this->template->set_var('lang_back',lang("back"));
+ $this->template->set_var('href_back',$GLOBALS['phpgw_info']['mobiletemplate']->get_back_link());
+ $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');
+
+ $view = false;
+ if ( isset($params['erro'])){
+ $GLOBALS['phpgw_info']['mobiletemplate']->set_error_msg($params['erro']);
+
+ $result['alias'] = $params['alias'];
+ $result['given_names'] = $params['given_names'];
+ $result['family_names'] = $params['family_names'];
+ $result['names_ordered'] = $params['names_ordered'];
+ $var_phone = $params['phone'];
+ $var_email = $params['email'];
+ $var_connection_email = $params['id_connection_email'];
+ $var_connection_phone = $params['id_connection_phone'];
+ $view = true;
+
+ }
+
+ 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");
+
+ $view = true;
+
+ if ( !isset($params['erro'])){
+ $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));
+
+ $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;
+ }
+
+
+ }
+
+ if ($view){
+ $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']);
+
+ $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('href_back',$GLOBALS['phpgw_info']['mobiletemplate']->get_back_link());
+ $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;
+
+ $answer = $this->verifyData($params);
+
+ if (!empty($answer)){
+ $retorno = 'alias='.$data['alias'] . '&given_names='.$data['given_names'] . '&family_names='.$data['family_names'] . '&names_ordered='.$data['given_names'] . ' ' . $data['family_names'];
+ $retorno .= '&id_connection_email='.$params['id_connection_email'] . '&id_connection_phone='.$params['id_connection_phone'];
+ $retorno .= '&email='.$params['email'] . '&phone='.$params['phone'];
+ header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.contact_add_edit&erro='.$answer.'&'.$retorno);
+ }
+ else
+ {
+ $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'] . '&success=1');
+ }
+ }
+
+ /**
+ * 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;
+
+ $answer = $this->verifyData($params);
+
+ if (!empty($answer)){
+ $retorno = '&catalog=' . $params['catalog'] . '&id='. $params['id'] .'&alias='.$data['alias'] . '&given_names='.$data['given_names'] . '&family_names='.$data['family_names'] . '&names_ordered='.$data['given_names'] . ' ' . $data['family_names'];
+ $retorno .= '&id_connection_email='.$params['id_connection_email'] . '&id_connection_phone='.$params['id_connection_phone'];
+ $retorno .= '&email='.$params['email'] . '&phone='.$params['phone'];
+ header('Location: ../mobile/index.php?menuaction=mobile.ui_mobilecc.contact_add_edit&erro='.$answer.'&'.$retorno);
+ }
+ else
+ {
+
+ $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'].'&success=1');
+
+ }
+
+ }
+
+ /**
+ * Validate data when register contact
+ * Validate E-mail, Phone and Name(NotEmpty)
+ *
+ * @param $data Array
+ * @return Boolean
+ */
+ static function verifyData($data){
+
+ $valid = '';
+ $field = false;
+
+ // Verify if phone is valid
+ if ( !empty($data['phone']) && empty($valid) ){
+
+ $field = true;
+
+ $pattern = "#^(?:(?:\(?\+?(?P
+
+
+
+ Mostrando suas pastas, emails, compromissos e contatos.
+
+
+
+
+
+
+
+
+
+
+ Adicione este link em seu Bookmark ( Favorito ), clicando no botão Add ( Adicionar).
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Volte na Área de Trabalho do android, e crie um Shortcus( Atalho )
+
+
+
+
+
+ Selecione o ítem Bookmark ( Favorito ), em Select Shortcut( Selecione o Atalho ).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Em seguida, toque no [+], na barra inferior.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {field}:
+ {data}
+
+
+
Index: /branches/2.2.0.1/mobile/templates/default/search_bar.tpl
===================================================================
--- /branches/2.2.0.1/mobile/templates/default/search_bar.tpl (revision 4246)
+++ /branches/2.2.0.1/mobile/templates/default/search_bar.tpl (revision 4246)
@@ -0,0 +1,10 @@
+
+
+ {hr_text}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {global_title}
+ {lang_logout}
+