Changeset 6882


Ignore:
Timestamp:
07/26/12 11:49:17 (12 years ago)
Author:
marcosw
Message:

Ticket #2897 - Realizado backport da funcionalidade Responder a

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r6877 r6882  
    13551355                $reply_to = $header->reply_to; 
    13561356                $return['reply_to'] = ""; 
     1357                 
    13571358                if (is_object($reply_to[0])) 
    13581359                { 
    13591360                        if ($return['from']['email'] != ($reply_to[0]->mailbox."@".$reply_to[0]->host)) 
    13601361                        { 
    1361                                 if (!empty($reply_to[0]->personal)) 
     1362                                foreach ($reply_to as $tmp_reply_to) 
    13621363                                { 
    1363                                         $personal_reply_to = $this->formatMailObject($tmp_reply_to); 
    1364                                         if(!empty($personal_reply_to[0]->text)) { 
    1365                                                 $return['reply_to'] .= '"' . $personal_reply_to['name']. '"'; 
     1364                                        if (!empty($tmp_reply_to->personal)) 
     1365                                        { 
     1366                                                $personal_tmp_reply_to = $this->formatMailObject($tmp_reply_to); 
     1367                                                $return['reply_to'] .= '"' . $personal_tmp_reply_to['name'] . '"'; 
    13661368                                                $return['reply_to'] .= " "; 
    13671369                                                $return['reply_to'] .= "<"; 
    1368                                                 $return['reply_to'] .= $personal_reply_to['email']; 
     1370                                                $return['reply_to'] .= $personal_tmp_reply_to['email']; 
    13691371                                                $return['reply_to'] .= ">"; 
     1372                                                $return['reply_to'] .= ", "; 
    13701373                                        } 
    1371                                         else { 
    1372                                                 $return['reply_to'] .= $reply_to[0]->mailbox . "@" . $reply_to[0]->host; 
     1374                                        else 
     1375                                        { 
     1376                                                if (isset($tmp_reply_to->host) && $tmp_reply_to->host != 'unspecified-domain') 
     1377                                                        $return['reply_to'] .= $tmp_reply_to->mailbox . "@" . $tmp_reply_to->host; 
     1378                                                else 
     1379                                                        $return['reply_to'] .= $tmp_reply_to->mailbox; 
     1380                                                $return['reply_to'] .= ", "; 
    13731381                                        } 
    13741382                                } 
    1375                                 else 
    1376                                 { 
    1377                                         $return['reply_to'] .= $reply_to[0]->mailbox . "@" . $reply_to[0]->host; 
    1378                                 } 
    1379                         } 
    1380                 } 
    1381                 $return['reply_to'] = $this->decode_string($return['reply_to']); 
     1383                                $return['reply_to'] = $this->del_last_two_caracters($return['reply_to']); 
     1384                        } 
     1385                } 
     1386                else 
     1387                { 
     1388                        $return['reply_to'] = ""; 
     1389                } 
     1390 
    13821391                $return['subject'] = ( isset($header->subject) && trim($header->subject) !== '' ) ?  self::decodeMimeString($header->subject) : $this->functions->getLang('(no subject)   '); 
    13831392 
     
    13981407                }   
    13991408                $return['alarm'] = $alarm; 
    1400          
     1409                 
    14011410                return $return; 
    14021411        } 
     
    25932602            $ccoaddress = preg_replace('/\s+>/', '>', $ccoaddress); 
    25942603 
    2595             $replytoaddress = $params['input_replyto']; 
     2604            $replytoaddress = $params['input_reply_to']; 
    25962605            $subject = $params['input_subject']; 
    25972606            $return_receipt = $params['input_return_receipt']; 
     
    27782787            else 
    27792788                $mailService->setFrom('"' . $_SESSION['phpgw_info']['expressomail']['user']['firstname'] . ' ' . $_SESSION['phpgw_info']['expressomail']['user']['lastname'] . '" <' . $_SESSION['phpgw_info']['expressomail']['user']['email'] . '>'); 
     2789             
     2790            $mailService->addHeaderField('Reply-To', $replytoaddress); 
    27802791 
    27812792            $bol = $this->add_recipients('to', $toaddress, $mailService); 
  • trunk/expressoMail1_2/js/draw_api.js

    r6861 r6882  
    28132813                reply_to_values.type = "HIDDEN"; 
    28142814                reply_to_values.value = info_msg.reply_to; //Veio do IMAP, sem images nem links. 
    2815                 reply_to.innerHTML = draw_plugin_cc(ID, info_msg.reply_to); 
     2815                $.each(break_comma(info_msg.reply_to), function(index, value){ 
     2816                        reply_to.innerHTML += draw_plugin_cc(ID, value);         
     2817                }) 
    28162818                reply_to.className = "header_message_field"; 
    28172819                tr11.appendChild(td11); 
     
    28872889                cc_values.value = info_msg.cc; 
    28882890 
    2889                 ccaddress_array[ID] = info_msg.cc.split(","); 
     2891                ccaddress_array[ID] = break_comma(info_msg.cc); 
    28902892                if (ccaddress_array[ID].length > 1){ 
    28912893                        var div_ccaddress = document.createElement("SPAN"); 
     
    33673369         //window.setTimeout(function() { $("#div_message_scroll_"+ID).focus() },250); 
    33683370         
    3369         /* 
    3370          * @AUTHOR Marcos Luiz Wilhelm 
    3371          * @DATE 2012/07/17 
    3372          * @BRIEF Break out emails only with comma out of quote marks 
    3373          */ 
    3374         function break_comma (originalText){ 
    3375                 var quotesMarks = false; 
    3376                 var completeString = ""; 
    3377                 var brokenEmails = new Array(); 
    3378                 originalText+=","; 
    3379                 for(i=0; i<originalText.length; i++){ 
    3380                         var character = originalText.substr(i,1); 
    3381                         if(character == "\""){ 
    3382                                 quotesMarks = !quotesMarks; 
    3383                         } 
    3384                         if(!quotesMarks){ 
    3385                                 if(character == ","){ 
    3386                                         brokenEmails.push(completeString); 
    3387                                         completeString = ""; 
    3388                                 } 
    3389                                 else 
    3390                                         completeString+=character;       
    3391                         } 
    3392                         else 
    3393                                 completeString+=character; 
    3394                 } 
    3395                 return brokenEmails; 
    3396         } 
    3397  
    33983371        function mailto( link ) 
    33993372        { 
     
    43454318                change_text($(this).find(".ui-button-text"), get_lang("Add CC"), get_lang('Remove CC')); 
    43464319        }) 
     4320    //Botão Responder a 
     4321    .end().filter(".reply-to-button").click(function(){ 
     4322        show_hide(content.find(".reply-to-tr"), $(this)); 
     4323    }); 
    43474324         
    43484325        //BOTAO ENVIAR 
  • trunk/expressoMail1_2/js/main.js

    r6863 r6882  
    18191819        if (document.getElementById("body_" + border_ID)) 
    18201820                data.body = document.getElementById("body_" + border_ID).innerHTML; 
     1821        if (document.getElementById("from_values_" + border_ID)) 
     1822                data.from = document.getElementById("from_values_"+border_ID).value; 
    18211823        if (Element('date_' + border_ID)){ 
    18221824                data.date = Element('date_' + border_ID).innerHTML; 
     
    18421844        var content = $("#content_id_"+new_border_ID); 
    18431845 
    1844          
    18451846switch(type){ 
    18461847                case "reply_without_history": 
     
    18611862                        break; 
    18621863                case "reply_with_history": 
    1863  
    18641864                        RichTextEditor.replyController = true; //Seta o editor como modo reply  
    18651865                        title = "Re: " + html_entities(data.subject); 
     
    18681868                         
    18691869                        draw_reply_boxes_by_field("to", data.to, content); 
    1870                          
    18711870                        content.find('[name="msg_reply_from"]').val($("#msg_number_" + border_ID).val());        
    1872  
    1873                         block_quoted_body = make_body_reply(data.body, data.to, data.date_day, data.date_hour); 
     1871                        block_quoted_body = make_body_reply(data.body, data.from, data.date_day, data.date_hour); 
    18741872                         
    18751873                        useOriginalAttachments(new_border_ID,border_ID); 
     
    19711969                        content.find(".subject").val("Re: " + data.subject); 
    19721970                         
    1973                         block_quoted_body = make_body_reply(data.body, data.to, data.date_day, data.date_hour); 
     1971                        block_quoted_body = make_body_reply(data.body, data.from, data.date_day, data.date_hour); 
    19741972                         
    19751973                        useOriginalAttachments(new_border_ID,border_ID); 
     
    21112109//DESENHA OS RETANGULOS PARA OS E-MAIL NA OPÇÃO REPLY 
    21122110function draw_reply_boxes_by_field(field, value, context){ 
    2113         array = value.split(","); 
     2111        array = break_comma(value); 
    21142112        $.each(array, function(index, value){ 
    21152113                draw_email_box(value, context.find("."+field).filter("input")); 
     
    27082706        //stringEmail = content.find('[name="input_to"]').val(); 
    27092707 
     2708    var stringReply = ""; 
     2709    var array = content.find(".reply-to-tr").find(".box"); 
     2710    $.each(array, function(index, value){ 
     2711        stringReply += $(value).find("input").val() + ","; 
     2712    }); 
     2713    content.find('[name="input_reply_to"]').val(stringReply); 
     2714 
    27102715        var stringEmail = ""; 
    27112716        var stringToEmail = ""; 
     
    28452850   /////////////////////////////////////////// 
    28462851    var content = $("#content_id_"+border_id); 
     2852         
     2853 
     2854    var array = content.find(".reply-to-tr").find(".box"); 
     2855    var stringReplyToEmail = ""; 
     2856    $.each(array, function(index, value){ 
     2857        stringReplyToEmail += $(value).find("input").val() + ","; 
     2858    }); 
     2859    content.find('[name="input_reply_to"]').val(stringReplyToEmail); 
    28472860 
    28482861        var stringEmail = ""; 
     
    42964309} 
    42974310 
     4311/* 
     4312* @author Marcos Luiz Wilhelm (marcoswilhelm@gmail.com) 
     4313* @date 2012/07/17 
     4314* @brief Break out emails only with comma out of quote marks 
     4315*/ 
     4316function break_comma (originalText){ 
     4317        var quotesMarks = false; 
     4318        var completeString = ""; 
     4319        var brokenEmails = new Array(); 
     4320        originalText+=","; 
     4321        for(i=0; i<originalText.length; i++){ 
     4322                var character = originalText.substr(i,1); 
     4323                if(character == "\""){ 
     4324                        quotesMarks = !quotesMarks; 
     4325                } 
     4326                if(!quotesMarks){ 
     4327                        if(character == ","){ 
     4328                                brokenEmails.push(completeString); 
     4329                                completeString = ""; 
     4330                        } 
     4331                        else 
     4332                                completeString+=character;       
     4333                } 
     4334                else 
     4335                        completeString+=character; 
     4336        } 
     4337        return brokenEmails; 
     4338} 
     4339 
    42984340DataLayer.links('message'); 
    42994341DataLayer.poll('message',30); 
  • trunk/prototype/modules/mail/templates/new_message.ejs

    r6650 r6882  
    3838                }        
    3939                %> 
     40                <button class="button small reply-to-button"><%= get_lang("Reply to") %></button> 
    4041                <button class="button small rich-button"><%= (preferences.plain_text_editor == 1 ? get_lang("Rich Text") : get_lang("Simple Text")) %></button> 
    4142        </div> 
     
    9394                                </td> 
    9495                        </tr> 
     96            <tr class="reply-to-tr" style="display:none;"> 
     97                <td class="field" style="width: 6%;"> 
     98                    <%= get_lang("Reply to") %>: 
     99                </td> 
     100                <td class="value" style="width: 100%;"> 
     101                    <div class="email-area ui-corner-all"> 
     102                        <input class="new-message-input reply-to email-text" name="input_aux_reply_to" type="text" value="" autocomplete="off"/>     
     103                    </div> 
     104                    <textarea class="new-message-input reply-to" name="input_reply_to" style="width:99%; resize: none;display : none;"></textarea> 
     105                </td> 
     106            </tr> 
    95107                        <tr class="subject-tr"> 
    96108                                <td class="field"> 
  • trunk/prototype/services/ImapServiceAdapter.php

    r6700 r6882  
    603603                                */ 
    604604                                $mailService->addHeaderField('Message-Id', UUID::generate( UUID::UUID_RANDOM, UUID::FMT_STRING ) . '@Draft'); 
    605  
     605                $mailService->addHeaderField('Reply-To', mb_convert_encoding(($data['input_reply_to']), 'ISO-8859-1', 'UTF-8,ISO-8859-1')); 
    606606                                $mailService->addTo(mb_convert_encoding(($data['input_to']), 'ISO-8859-1', 'UTF-8,ISO-8859-1'));  
    607607                                $mailService->addCc( mb_convert_encoding(($data['input_cc']), 'ISO-8859-1', 'UTF-8,ISO-8859-1'));  
Note: See TracChangeset for help on using the changeset viewer.