Changeset 3600


Ignore:
Timestamp:
12/17/10 08:41:54 (13 years ago)
Author:
eduardoalex
Message:

Ticket #1408 - Ajustada a tela de enviar email do expresso mini.

Location:
branches/2.2/mobile
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/mobile/inc/class.ui_home.inc.php

    r3596 r3600  
    9191                        } 
    9292                         
     93                        $GLOBALS['phpgw_info']['mobiletemplate']->set_error_msg($params["error_message"]); 
    9394                        $GLOBALS['phpgw_info']['mobiletemplate']->set_success_msg($params["success_message"]); 
    9495                        $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page')); 
     
    115116                } 
    116117                 
    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                                 
    118130                        include_once "class.ui_mobilecc.inc.php"; 
    119131                        $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  
    701701                        switch($type) { 
    702702                                case "clk": 
    703                                 case "cc_mob": 
     703                                case "from_mobilecc": 
    704704                                        $this->template->set_var('action_msg', lang("New message")); 
    705705                                        break; 
    706706                                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")); 
    711708                                        break; 
    712709                                case "forward": 
     
    732729                        $this->template->set_var('lang_cancel', strtoupper(lang("cancel"))); 
    733730                        $this->template->set_var('lang_save_draft', strtoupper(lang("save draft"))); 
    734                         $this->template->set_var('type', $_GET['type']); 
    735731                        $this->template->set_var('lang_to', lang("To")); 
    736732                        $this->template->set_var('lang_cc', lang("cc")); 
     
    740736                        $this->template->set_var('lang_add_history', lang("add history")); 
    741737                         
    742                          
    743                         $this->template->set_var('type', $_REQUEST['type']); 
    744738                        $this->template->parse('add_recipient_box', 'add_recipient_block', true); 
    745  
    746                         $this->define_action_message($_REQUEST['type']); 
    747739                         
    748740                        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']); 
    753743                                $this->template->set_var('subject', $_POST['input_subject']); 
    754744                                $this->template->set_var('msg_number', $_POST['msg_number']); 
     
    764754                                $GLOBALS['phpgw_info']['mobiletemplate']->set_error_msg($params["error_message"]); 
    765755                        } 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'] ) ); 
    767757                                 
    768                                 if($_REQUEST['type']=="clk") 
     758                                if($params['type']=="clk") 
    769759                                { 
    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', ""); 
    774762                                        $this->template->set_var('subject', ""); 
    775763                                } 
    776                                 else if($_REQUEST['type']=="cc_mob") 
     764                                else if($params['type']=="from_mobilecc") 
    777765                                { 
    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'];                                                                                                
    795774                                         
    796775                                        $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) { 
    800779                                                $flag = preg_match('/&lt;(.*?)&gt;/',$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; 
    802784                                        } 
    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); 
    806789                                        $this->template->set_var('subject', "Re:" . $msg['subject']); 
    807790         
     
    809792                                        $this->template->set_var('msg_folder', $_GET['msg_folder']); 
    810793                                } 
    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']); 
    818799         
    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"){ 
    823809                                        $this->template->set_var('from', $msg['toaddress2']); 
    824          
    825                                         $mail_to = $msg['from']['full']; 
    826810         
    827811                                        $this->template->set_var('subject', "Enc:" . $msg['subject']); 
     
    834818                                else{ 
    835819                                        $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']); 
    840821         
    841822                                        $this->template->set_var('subject', "Re:" . $msg['subject']); 
     
    848829                        } 
    849830                         
    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']); 
    852836                        $GLOBALS['phpgw_info']['mobiletemplate']->set_content($this->template->fp('out', 'page')); 
    853837                } 
     
    881865 
    882866                        //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']; 
    887869                        $subject = $_POST['input_subject']; //"Mail Subject"; 
    888870                        $body = $_POST['body']; //"Mail body. Any text."; 
     
    891873                        $readConfirmation = $_POST['check_read_confirmation']; 
    892874                        $msgNumber = $_POST['reply_msg_number']; 
    893  
    894                         if($userMail == "") $userMail = $userName; 
    895                         if($ccUserMail == "") $ccUserMail = $ccUserName; 
    896875 
    897876                        //Cria objeto 
     
    983962                        return 0; 
    984963                } 
    985  
    986                 function retorna() 
    987                 { 
    988                          
    989                 } 
    990964                 
    991965                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 
    1003979                        $ui_cc = CreateObject('mobile.ui_mobilecc'); 
    1004                         $ui_cc->contacts_list('mobilemail'); 
     980                        $ui_cc->choose_contact(array("request_from" => "ui_mobilemail.new_msg")); 
    1005981                } 
    1006982                 
    1007983                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'])); 
    10181001                } 
    10191002                 
  • branches/2.2/mobile/templates/default/home_index.tpl

    r3590 r3600  
    11<!-- 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"> 
    33        <div class="busca">  
    44                <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> 
    66        </div> 
    77         
    88        <div class="menu-contexto"> 
    99                {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> 
    1313        </div> 
    1414         
     
    2626<!-- END page --> 
    2727<!-- 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>  
    2929<!-- END folder_block --> 
    3030<!-- BEGIN commitment_block --> 
  • branches/2.2/mobile/templates/default/new_msg.tpl

    r3576 r3600  
    11<!-- BEGIN page --> 
     2 
     3<script type="text/javascript"> 
     4 
     5function 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 
    216<div class="menu-contexto"> 
    317        <span><a href="javascript:history.back()">{lang_back}</a></span> <span class="titulo-secao">{action_msg}</span> 
     
    519 
    620<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}' /> 
    921        <input type="hidden" id="reply_from" name="reply_from" value='{from}' /> 
    1022        <input type="hidden" id="reply_msg_number" name="reply_msg_number" value='{msg_number}' /> 
    1123        <input type="hidden" id="folder" name="folder" value='{msg_folder}' /> 
    1224        <input type="hidden" name="type" value='{type}' /> 
     25        <input type="hidden" name="add_to" id="add_to" value='' /> 
    1326         
    1427        <div class="campos-correspondencia"> 
    1528                <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> 
    1831                        <p><strong><label>{lang_subject}:</label></strong> <input id="input_subject" name="input_subject" value='{subject}'></p> 
    1932                </div> 
     
    3548                <a href="index.php?menuaction=mobile.ui_home.index"><button id="cancel" class="btn-generico" >{lang_cancel}</button></a> 
    3649                <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>  
    3851        </div> 
    3952 
     
    4154<!-- END page --> 
    4255<!-- 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> 
    4458<p></p> 
    4559<!-- END add_recipient_block --> 
Note: See TracChangeset for help on using the changeset viewer.