Changeset 3600
- Timestamp:
- 12/17/10 08:41:54 (13 years ago)
- Location:
- branches/2.2/mobile
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/mobile/inc/class.ui_home.inc.php
r3596 r3600 91 91 } 92 92 93 $GLOBALS['phpgw_info']['mobiletemplate']->set_error_msg($params["error_message"]); 93 94 $GLOBALS['phpgw_info']['mobiletemplate']->set_success_msg($params["success_message"]); 94 95 $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page')); … … 115 116 } 116 117 117 function search($params) { 118 function search($params) { 119 if($_SERVER["HTTP_REFERER"] && strpos($_SERVER["HTTP_REFERER"], "ui_home.index")) { 120 if(!$params["default_folders"] && 121 !$params["personal_folders"] && 122 !$params["calendar_search"] && 123 !$params["contacts_search"]) { 124 125 header('Location: index.php?menuaction=menuaction=mobile.ui_home.index&error_message='.lang("need choose one option")); 126 } 127 } 128 129 118 130 include_once "class.ui_mobilecc.inc.php"; 119 131 $ui_mobilemail = CreateObject("mobile.ui_mobilemail");//Necessário para lista de emails, que é uma função estática -
branches/2.2/mobile/inc/class.ui_mobilemail.inc.php
r3590 r3600 701 701 switch($type) { 702 702 case "clk": 703 case " cc_mob":703 case "from_mobilecc": 704 704 $this->template->set_var('action_msg', lang("New message")); 705 705 break; 706 706 case "reply_all": 707 $this->template->set_var('action_msg', lang("Reply All")); 708 break; 709 case "user_add": 710 $this->template->set_var('action_msg', lang("Add Recipient")); 707 $this->template->set_var('action_msg', lang("Reply to All")); 711 708 break; 712 709 case "forward": … … 732 729 $this->template->set_var('lang_cancel', strtoupper(lang("cancel"))); 733 730 $this->template->set_var('lang_save_draft', strtoupper(lang("save draft"))); 734 $this->template->set_var('type', $_GET['type']);735 731 $this->template->set_var('lang_to', lang("To")); 736 732 $this->template->set_var('lang_cc', lang("cc")); … … 740 736 $this->template->set_var('lang_add_history', lang("add history")); 741 737 742 743 $this->template->set_var('type', $_REQUEST['type']);744 738 $this->template->parse('add_recipient_box', 'add_recipient_block', true); 745 746 $this->define_action_message($_REQUEST['type']);747 739 748 740 if(isset($params["error_message"])) { 749 $this->template->set_var('to', $_POST['input_to']); 750 $this->template->set_var('to_mail', $_POST['input_to_mail']); 751 $this->template->set_var('cc', $_POST['input_cc']); 752 $this->template->set_var('cc_mail', $_POST['input_cc_mail']); 741 $this->template->set_var('input_to', $_POST['input_to']); 742 $this->template->set_var('input_cc', $_POST['input_cc']); 753 743 $this->template->set_var('subject', $_POST['input_subject']); 754 744 $this->template->set_var('msg_number', $_POST['msg_number']); … … 764 754 $GLOBALS['phpgw_info']['mobiletemplate']->set_error_msg($params["error_message"]); 765 755 } else { 766 if (isset($ _GET['msg_number'])) $msg = $this->imap_functions->get_info_msg(array('msg_number' => $_GET['msg_number'] ) );756 if (isset($params['msg_number'])) $msg = $this->imap_functions->get_info_msg(array('msg_number' => $params['msg_number'] ) ); 767 757 768 if($ _REQUEST['type']=="clk")758 if($params['type']=="clk") 769 759 { 770 $this->template->set_var('to', ""); 771 $this->template->set_var('to_mail', ""); 772 $this->template->set_var('cc', ""); 773 $this->template->set_var('cc_mail', ""); 760 $this->template->set_var('input_to', ""); 761 $this->template->set_var('input_cc', ""); 774 762 $this->template->set_var('subject', ""); 775 763 } 776 else if($ _REQUEST['type']=="cc_mob")764 else if($params['type']=="from_mobilecc") 777 765 { 778 $this->template->set_var('to', $_GET['input_to']); 779 $this->template->set_var('to_mail', $_GET['input_to_mail']); 780 $this->template->set_var('cc', $_GET['input_cc']); 781 $this->template->set_var('cc_mail', $_GET['input_cc_mail']); 782 $this->template->set_var('subject', ""); 783 784 $this->template->set_var('msg_number', $_GET['msg_number']); 785 $this->template->set_var('msg_folder', $_GET['msg_folder']); 786 787 $this->template->set_var('read_only', 'readonly'); 788 } 789 else if($_REQUEST['type']=="reply_all"){ 790 $reply_to_all = $msg['from']['full']; 791 $reply_to_all = $msg['toaddress2'] ? $reply_to_all.','.$msg['toaddress2']:$reply_to_all; 792 $reply_to_all = $msg['cc'] ? $reply_to_all.','.$msg['cc']:$reply_to_all; 793 $reply_to_all = $msg['bcc'] ? $reply_to_all.','.$msg['bcc']:$reply_to_all; 794 $names = implode(',<br/>',explode(',',$reply_to_all)); 766 $this->template->set_var('input_to', $_GET['input_to']); 767 $this->template->set_var('input_cc', $_GET['input_cc']); 768 } 769 else if($params['type']=="reply_all"){ 770 $reply_to_all = $msg['from']['email']; 771 if($msg['toaddress2']) $reply_to_all .= ','.$msg['toaddress2']; 772 if($msg['cc']) $reply_to_all .= ','.$msg['cc']; 773 if($msg['bcc']) $reply_to_all .= ','.$msg['bcc']; 795 774 796 775 $array_emails = explode(',',$reply_to_all); 797 $reply_to_all = '';798 799 foreach ($array_emails as $index => $email) {776 $reply_to_all = ''; 777 778 foreach ($array_emails as $index => $email) { 800 779 $flag = preg_match('/<(.*?)>/',$email,$reply); 801 $reply_to_all .= $flag == 0 ? $email.', ':$reply[1].', '; 780 $email_to_add = $flag == 0 ? $email.',' : $reply[1].','; 781 782 if( strpos($reply_to_all, $email_to_add) === false) 783 $reply_to_all .= $email_to_add; 802 784 } 803 804 $this->template->set_var('to', $reply_to_all); 805 $this->template->set_var('to_mail', $_GET['input_to_mail']); 785 786 $reply_to_all = substr_replace($reply_to_all, "", strrpos($reply_to_all, ","), strlen($reply_to_all)); 787 788 $this->template->set_var('input_to', $reply_to_all); 806 789 $this->template->set_var('subject', "Re:" . $msg['subject']); 807 790 … … 809 792 $this->template->set_var('msg_folder', $_GET['msg_folder']); 810 793 } 811 else if($_REQUEST['type']=="user_add"){ 812 $listMail = implode(',',$_SESSION['mobile_mail']); 813 814 $this->template->set_var('to', $listMail); 815 $this->template->set_var('to_mail', $listMail); 816 $this->template->set_var('subject', $_SESSION['subject_mail']); 817 $this->template->set_var('body_value', $_SESSION['body_mail']); 794 else if($params['type']=="user_add"){ 795 $this->template->set_var('input_to', $params['mobile_add_contact']['mobile_mail']); 796 $this->template->set_var('input_cc', $params['mobile_add_contact']['mobile_mail_cc']); 797 $this->template->set_var('subject', $params['mobile_add_contact']['subject_mail']); 798 $this->template->set_var('body_value', $params['mobile_add_contact']['body_mail']); 818 799 819 $this->template->set_var('msg_number', $_GET['msg_number']); 820 $this->template->set_var('msg_folder', $_GET['msg_folder']); 821 } 822 else if($_REQUEST['type']=="forward"){ 800 $this->template->set_var('check_important', ( ( $params['mobile_add_contact']['check_important'] ) ? "checked" : "" ) ); 801 $this->template->set_var('check_read_confirmation', ( ( $params['mobile_add_contact']['check_read_confirmation'] ) ? "checked" : "" ) ); 802 $this->template->set_var('check_add_history', ( ( $params['mobile_add_contact']['check_add_history'] ) ? "checked" : "" ) ); 803 $this->template->set_var('msg_number', $params['msg_number']); 804 $this->template->set_var('msg_folder', $params['msg_folder']); 805 806 $params["type"] = $params['mobile_add_contact']['type']; 807 } 808 else if($params['type']=="forward"){ 823 809 $this->template->set_var('from', $msg['toaddress2']); 824 825 $mail_to = $msg['from']['full'];826 810 827 811 $this->template->set_var('subject', "Enc:" . $msg['subject']); … … 834 818 else{ 835 819 $this->template->set_var('from', $msg['toaddress2']); 836 837 $mail_to = $msg['from']['full']; 838 $this->template->set_var('to', $msg['from']['name']); 839 $this->template->set_var('to_mail', $msg['from']['email']); 820 $this->template->set_var('input_to', $msg['from']['email']); 840 821 841 822 $this->template->set_var('subject', "Re:" . $msg['subject']); … … 848 829 } 849 830 850 $_SESSION['mobile_mail'] = array(); 851 831 //tem que ser realizado no final, pois o tipo user_add é modificado para o tipo que o originou 832 $this->template->set_var('type', $params['type']); 833 $this->define_action_message($params['type']); 834 835 unset($_SESSION['mobile_add_contact']); 852 836 $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page')); 853 837 } … … 881 865 882 866 //Recebe os dados do form (passados pelo POST) 883 $userName = $_POST['input_to']; //"User Someone"; 884 $userMail = $_POST['input_to_mail']; //"user.someone@mail.com.br"; 885 $ccUserName = $_POST['input_cc']; 886 $ccUserMail = $_POST['input_cc_mail']; 867 $userMail = $_POST['input_to']; 868 $ccUserMail = $_POST['input_cc']; 887 869 $subject = $_POST['input_subject']; //"Mail Subject"; 888 870 $body = $_POST['body']; //"Mail body. Any text."; … … 891 873 $readConfirmation = $_POST['check_read_confirmation']; 892 874 $msgNumber = $_POST['reply_msg_number']; 893 894 if($userMail == "") $userMail = $userName;895 if($ccUserMail == "") $ccUserMail = $ccUserName;896 875 897 876 //Cria objeto … … 983 962 return 0; 984 963 } 985 986 function retorna()987 {988 989 }990 964 991 965 function init_schedule() { 992 if($_POST['input_to'] != '' && !is_null($_POST['input_to'])) 993 array_push($_SESSION['mobile_mail'],$_POST['input_to']); 994 995 $_SESSION['subject_mail'] = $_POST['input_subject']; 996 $_SESSION['body_mail'] = $_POST['body']; 997 $this->add_recipients(); 998 } 999 1000 1001 function add_recipients() { 1002 966 $_SESSION['mobile_add_contact'] = array(); 967 $_SESSION['mobile_add_contact']['mobile_mail'] = $_POST['input_to']; 968 $_SESSION['mobile_add_contact']['mobile_mail_cc'] = $_POST['input_cc']; 969 $_SESSION['mobile_add_contact']['add_to'] = $_POST['add_to']; 970 $_SESSION['mobile_add_contact']['type'] = $_POST['type']; 971 $_SESSION['mobile_add_contact']['msg_number'] = $_POST['reply_msg_number']; 972 $_SESSION['mobile_add_contact']['msg_folder'] = $_POST['folder']; 973 $_SESSION['mobile_add_contact']['subject_mail'] = $_POST['input_subject']; 974 $_SESSION['mobile_add_contact']['body_mail'] = $_POST['body']; 975 $_SESSION['mobile_add_contact']['check_important'] = $_POST['check_important']; 976 $_SESSION['mobile_add_contact']['check_read_confirmation'] = $_POST['check_read_confirmation']; 977 $_SESSION['mobile_add_contact']['check_add_history'] = $_POST['check_add_history']; 978 1003 979 $ui_cc = CreateObject('mobile.ui_mobilecc'); 1004 $ui_cc->c ontacts_list('mobilemail');980 $ui_cc->choose_contact(array("request_from" => "ui_mobilemail.new_msg")); 1005 981 } 1006 982 1007 983 function add_recipient() { 1008 1009 $participants = $_SESSION["mobile_mail"]; 1010 1011 if(!is_array($participants)) 1012 $participants = array(); 1013 1014 $participants[$_GET['cn']] = $_GET['mail']; 1015 1016 $_SESSION["mobile_mail"] = $participants; 1017 $this->add_recipients(); 984 if($_SESSION['mobile_add_contact']['add_to'] == "to") 985 $arr_key_name = "mobile_mail"; 986 else 987 $arr_key_name = "mobile_mail_cc"; 988 989 $arr_mobile_add_contact = $_SESSION['mobile_add_contact']; 990 991 if(strpos($arr_mobile_add_contact[$arr_key_name], $_GET['mail']) === false) 992 $arr_mobile_add_contact[$arr_key_name] .= ( (trim($arr_mobile_add_contact[$arr_key_name]) == "") ? $_GET['mail'] : ",".$_GET['mail']); 993 994 unset($_SESSION['mobile_add_contact']); 995 996 $this->new_msg( array( 997 'mobile_add_contact' => $arr_mobile_add_contact, 998 'type' => 'user_add', 999 'msg_number' => $arr_mobile_add_contact['msg_number'], 1000 'msg_folder' => $arr_mobile_add_contact['msg_folder'])); 1018 1001 } 1019 1002 -
branches/2.2/mobile/templates/default/home_index.tpl
r3590 r3600 1 1 <!-- BEGIN page --> 2 <form method="post" action="index.php?menuaction=mobile.ui_home.search" >2 <form method="post" action="index.php?menuaction=mobile.ui_home.search" id="form_search"> 3 3 <div class="busca"> 4 4 <input type="text" name="name" id="name" /> 5 < input type="submit" id="buscar" class="btn-generico" value="{lang_search}" />5 <button id="buscar" class="btn-generico" onclick="document.getElementById('form_search').submit()">{lang_search}</button> 6 6 </div> 7 7 8 8 <div class="menu-contexto"> 9 9 {lang_new_mail}: 10 < a href="index.php?menuaction=mobile.ui_mobilemail.new_msg&type=clk" style="text-decoration:none;"><button name="email" class="btn-contexto">{lang_context_email}</button></a>11 <button name="contato" class="btn-contexto" >{lang_context_contact}</button>12 <button name="compromisso" class="btn-contexto" >{lang_context_commitment}</button>10 <button name="email" class="btn-contexto" type="button" onclick='window.location="index.php?menuaction=mobile.ui_mobilemail.new_msg&type=clk"'>{lang_context_email}</button> 11 <button name="contato" class="btn-contexto" type="button" >{lang_context_contact}</button> 12 <button name="compromisso" class="btn-contexto" type="button" >{lang_context_commitment}</button> 13 13 </div> 14 14 … … 26 26 <!-- END page --> 27 27 <!-- BEGIN folder_block --> 28 <dd class="{dd_class}">< div class="nome-item"><a href="index.php?menuaction=mobile.ui_mobilemail.change_folder&folder={folder_id}">{folder_name}</a></div> <span class="contagem">[{folder_unseen}/{folder_total_msg}]</span></dd>28 <dd class="{dd_class}"><a href="index.php?menuaction=mobile.ui_mobilemail.change_folder&folder={folder_id}"><div class="nome-item">{folder_name}</div></a> <span class="contagem">[{folder_unseen}/{folder_total_msg}]</span></dd> 29 29 <!-- END folder_block --> 30 30 <!-- BEGIN commitment_block --> -
branches/2.2/mobile/templates/default/new_msg.tpl
r3576 r3600 1 1 <!-- BEGIN page --> 2 3 <script type="text/javascript"> 4 5 function mobile_add_contact(add_to) { 6 var mail_form = document.getElementById('mail_form'); 7 mail_form.action = "index.php?menuaction=mobile.ui_mobilemail.init_schedule"; 8 9 document.getElementById('add_to').value = add_to; 10 11 mail_form.submit(); 12 } 13 14 </script> 15 2 16 <div class="menu-contexto"> 3 17 <span><a href="javascript:history.back()">{lang_back}</a></span> <span class="titulo-secao">{action_msg}</span> … … 5 19 6 20 <form method="POST" action="index.php?menuaction=mobile.ui_mobilemail.send_mail" id="mail_form"> 7 <input type="hidden" id="input_to_mail" name="input_to_mail" value='{to_mail}' />8 <input type="hidden" id="input_cc_mail" name="input_cc_mail" value='{cc_mail}' />9 21 <input type="hidden" id="reply_from" name="reply_from" value='{from}' /> 10 22 <input type="hidden" id="reply_msg_number" name="reply_msg_number" value='{msg_number}' /> 11 23 <input type="hidden" id="folder" name="folder" value='{msg_folder}' /> 12 24 <input type="hidden" name="type" value='{type}' /> 25 <input type="hidden" name="add_to" id="add_to" value='' /> 13 26 14 27 <div class="campos-correspondencia"> 15 28 <div class="posiciona-esquerda"> 16 <p><strong><label>{lang_to}:</label></strong> <input id="input_to" name="input_to" value='{ to}' "{read_only}"></p>17 <p><strong><label>{lang_cc}:</label></strong> <input id="input_cc" name="input_cc" value='{ cc}' "{read_only}"></p>29 <p><strong><label>{lang_to}:</label></strong> <input id="input_to" name="input_to" value='{input_to}' "{read_only}"></p> 30 <p><strong><label>{lang_cc}:</label></strong> <input id="input_cc" name="input_cc" value='{input_cc}' "{read_only}"></p> 18 31 <p><strong><label>{lang_subject}:</label></strong> <input id="input_subject" name="input_subject" value='{subject}'></p> 19 32 </div> … … 35 48 <a href="index.php?menuaction=mobile.ui_home.index"><button id="cancel" class="btn-generico" >{lang_cancel}</button></a> 36 49 <button id="save_draft" class="btn-generico" onclick="document.getElementById('mail_form').action='index.php?menuaction=mobile.ui_mobilemail.save_draft';document.getElementById('mail_form').submit()" >{lang_save_draft}</button></a> 37 < input type="submit" name="action" id="reply_send" value="{lang_send}" class="btn-generico"/>50 <button name="action" id="reply_send" class="btn-generico" onclick="document.getElementById('mail_form').submit()">{lang_send}</button> 38 51 </div> 39 52 … … 41 54 <!-- END page --> 42 55 <!-- BEGIN add_recipient_block --> 43 <p><button name="action" title="Ver agenda" class="btn-contexto">{lang_calendar}</button></p> 56 <p><button name="action" title="Ver agenda" class="btn-contexto" onclick="mobile_add_contact('to');">+</button></p> 57 <p><button name="action" title="Ver agenda" class="btn-contexto" onclick="mobile_add_contact('cc');">+</button></p> 44 58 <p></p> 45 59 <!-- END add_recipient_block -->
Note: See TracChangeset
for help on using the changeset viewer.