Changeset 4258 for branches/2.2.0.1


Ignore:
Timestamp:
05/06/11 17:01:31 (13 years ago)
Author:
rafaelraymundo
Message:

Ticket #1726 - Corrige local do opcao do envio de e-mail em texto puro. r4218

Location:
branches/2.2.0.1/expressoMail1_2/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.0.1/expressoMail1_2/js/draw_api.js

    r4253 r4258  
    26162616 
    26172617        tr_menu_new_message.appendChild(td_menu_new_message); 
    2618  
    2619         if ( ! expresso_offline ) 
    2620         { 
    2621                 var text_plain = td_menu_new_message.appendChild( 
    2622                         document.createElement( 'span' ) 
    2623                 ).appendChild( 
    2624                         document.createTextNode( ' | ' ) 
    2625                 ).parentNode.appendChild( 
    2626                         document.createElement( 'input' ) 
    2627                 ).parentNode.appendChild( 
    2628                         document.createTextNode( get_lang('Send this mail as text plain') + '.') 
    2629                 ).previousSibling; 
    2630                 text_plain.setAttribute( 'tabIndex', '-1' ); 
    2631                 text_plain.id = 'textplain_rt_checkbox_' + ID ; 
    2632                 text_plain.type = "checkbox"; 
    2633                 text_plain.onclick = function () 
    2634                 { 
    2635                         RichTextEditor.plain( ( ! this.checked ) ? this.checked : mobile_device || ( this.checked = confirm( 'The text format will be lost.' ) ) ); 
    2636                         document.getElementById( 'viewsource_rt_checkbox_' + ID ).parentNode.style.display = ( this.checked ) ? 'none' : ''; 
    2637                 }; 
    2638         } 
    26392618 
    26402619        tbody_menu_new_message.appendChild(tr_menu_new_message); 
     
    31653144        tr5.appendChild(td5); 
    31663145        tr5.appendChild(td_return_receipt); 
     3146 
     3147        if ( ! expresso_offline ) 
     3148        { 
     3149                var text_plain = td_return_receipt.appendChild( 
     3150                        document.createElement( 'span' ) 
     3151                ).appendChild( 
     3152                        document.createTextNode( ' | ' ) 
     3153                ).parentNode.appendChild( 
     3154                        document.createTextNode( get_lang('Send this mail as text plain') + '.') 
     3155                ).parentNode.appendChild( 
     3156                        document.createElement( 'input' ) 
     3157                ); 
     3158                text_plain.setAttribute( 'tabIndex', '-1' ); 
     3159                text_plain.id = 'textplain_rt_checkbox_' + ID ; 
     3160                text_plain.type = "checkbox"; 
     3161                text_plain.onclick = function () 
     3162                { 
     3163                        RichTextEditor.plain( this.checked ); 
     3164                        document.getElementById( 'viewsource_rt_checkbox_' + ID ).parentNode.style.display = ( this.checked ) ? 'none' : ''; 
     3165                }; 
     3166        } 
     3167 
    31673168        tbody_message.appendChild(tr5); 
    31683169        if (parseInt(preferences.use_important_flag)) 
  • branches/2.2.0.1/expressoMail1_2/js/main.js

    r4252 r4258  
    16591659        textArea.name = "body"; 
    16601660        body = document.getElementById("body_"+ID); 
    1661         textArea.value += ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
     1661        textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
    16621662        var input_folder = document.createElement("INPUT"); 
    16631663        input_folder.style.display='none'; 
     
    19031903                withImage = false; 
    19041904 
    1905         var rt_checkbox = Element('viewsource_rt_checkbox_' + ID); 
     1905        var rt_checkbox = Element('viewsource_rt_checkbox_' + border_id); 
    19061906        if (rt_checkbox == null) 
    19071907                return false; 
     
    19301930        var handler_save_msg = function(data){ return_save(data,this.tmp_border_id,this.tmp_folder_name,this.tmp_folder_id,this.message_id); } 
    19311931 
     1932        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + border_id ); 
     1933        mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; 
     1934 
    19321935        var textArea = document.createElement("TEXTAREA"); 
    19331936        textArea.style.display='none'; 
     
    19361939        if (! body) 
    19371940                return; 
    1938         textArea.value += '<body>\r\n'; 
    1939         textArea.value += body.contentWindow.document.body.innerHTML; 
    1940         textArea.value += '\r\n</body>'; 
     1941        textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
    19411942        var input_folder = document.createElement("INPUT"); 
    19421943        input_folder.style.display='none'; 
     
    19641965        form.appendChild(input_msgid); 
    19651966        form.appendChild(input_insertImg); 
     1967 
     1968        var mail_type = form.appendChild( document.createElement( 'input' ) ); 
     1969        mail_type.name = 'type'; 
     1970        mail_type.type = 'hidden'; 
     1971        mail_type.value = ( mail_as_plain ) ? 'plain' : 'html'; 
    19661972 
    19671973        cExecuteForm ("$this.imap_functions.save_msg", form, handler_save_msg,border_id); 
  • branches/2.2.0.1/expressoMail1_2/js/rich_text_editor.js

    r4252 r4258  
    166166                } 
    167167                else{ 
     168                        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + this.id ); 
     169 
    168170                        html = document.createTextNode( editor.contentWindow.document.body.innerHTML ); 
     171                        html = html.nodeValue.replace( /<br\s*\/?>/mg, "\n" ).replace( /(<([^>]+)>)/ig, '' ).replace( /^[\n ]+|[\n ]+$/g, '' ); 
     172 
     173                        if ( ! mobile_device && html != '' && ! ( mail_as_plain.checked = confirm( 'The text format will be lost.' ) ) ) 
     174                                return false; 
     175 
    169176                        this.table.style.visibility="hidden"; 
    170177                        editor.contentWindow.document.body.innerHTML = ''; 
     
    174181                        textarea.style.height = '300px'; 
    175182                        textarea.style.fontSize = '12pt'; 
    176                         textarea.innerHTML = html.nodeValue.replace( /<br\s*\/?>/mg, "\n" ).replace( /(<([^>]+)>)/ig, '' ); 
     183                        textarea.innerHTML = html; 
    177184 
    178185                        editor.style.width = '0px'; 
Note: See TracChangeset for help on using the changeset viewer.