Changeset 4374


Ignore:
Timestamp:
05/12/11 15:48:07 (13 years ago)
Author:
niltonneto
Message:

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

Location:
trunk/expressoMail1_2/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/draw_api.js

    r4368 r4374  
    22672267 
    22682268        tr_menu_new_message.appendChild(td_menu_new_message); 
    2269  
    2270         if ( ! expresso_offline ) 
    2271         { 
    2272                 var text_plain = td_menu_new_message.appendChild( 
    2273                         document.createElement( 'span' ) 
    2274                 ).appendChild( 
    2275                         document.createTextNode( ' | ' ) 
    2276                 ).parentNode.appendChild( 
    2277                         document.createElement( 'input' ) 
    2278                 ).parentNode.appendChild( 
    2279                         document.createTextNode( get_lang('Send this mail as text plain') + '.') 
    2280                 ).previousSibling; 
    2281                 text_plain.setAttribute( 'tabIndex', '-1' ); 
    2282                 text_plain.id = 'textplain_rt_checkbox_' + ID ; 
    2283                 text_plain.type = "checkbox"; 
    2284                 text_plain.onclick = function () 
    2285                 { 
    2286                         RichTextEditor.plain( ( ! this.checked ) ? this.checked : mobile_device || ( this.checked = confirm( 'The text format will be lost.' ) ) ); 
    2287                         document.getElementById( 'viewsource_rt_checkbox_' + ID ).parentNode.style.display = ( this.checked ) ? 'none' : ''; 
    2288                 }; 
    2289         } 
    22902269 
    22912270        tbody_menu_new_message.appendChild(tr_menu_new_message); 
     
    28062785        tr5.appendChild(td5); 
    28072786        tr5.appendChild(td_return_receipt); 
     2787 
     2788        if ( ! expresso_offline ) 
     2789        { 
     2790                var text_plain = td_return_receipt.appendChild( 
     2791                        document.createElement( 'span' ) 
     2792                ).appendChild( 
     2793                        document.createTextNode( ' | ' ) 
     2794                ).parentNode.appendChild( 
     2795                        document.createTextNode( get_lang('Send this mail as text plain') + '.') 
     2796                ).parentNode.appendChild( 
     2797                        document.createElement( 'input' ) 
     2798                ); 
     2799                text_plain.setAttribute( 'tabIndex', '-1' ); 
     2800                text_plain.id = 'textplain_rt_checkbox_' + ID ; 
     2801                text_plain.type = "checkbox"; 
     2802                text_plain.onclick = function () 
     2803                { 
     2804                        RichTextEditor.plain( this.checked ); 
     2805                        document.getElementById( 'viewsource_rt_checkbox_' + ID ).parentNode.style.display = ( this.checked ) ? 'none' : ''; 
     2806                }; 
     2807        } 
     2808 
    28082809        tbody_message.appendChild(tr5); 
    28092810        if (parseInt(preferences.use_important_flag)) 
  • trunk/expressoMail1_2/js/main.js

    r4366 r4374  
    16691669        textArea.name = "body"; 
    16701670        body = document.getElementById("body_"+ID); 
    1671         textArea.value += ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
     1671        textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
    16721672        var input_folder = document.createElement("INPUT"); 
    16731673        input_folder.style.display='none'; 
     
    19131913                withImage = false; 
    19141914 
    1915         var rt_checkbox = Element('viewsource_rt_checkbox_' + ID); 
     1915        var rt_checkbox = Element('viewsource_rt_checkbox_' + border_id); 
    19161916        if (rt_checkbox == null) 
    19171917                return false; 
     
    19401940        var handler_save_msg = function(data){ return_save(data,this.tmp_border_id,this.tmp_folder_name,this.tmp_folder_id,this.message_id); } 
    19411941 
     1942        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + border_id ); 
     1943        mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; 
     1944 
    19421945        var textArea = document.createElement("TEXTAREA"); 
    19431946        textArea.style.display='none'; 
     
    19461949        if (! body) 
    19471950                return; 
    1948         textArea.value += '<body>\r\n'; 
    1949         textArea.value += body.contentWindow.document.body.innerHTML; 
    1950         textArea.value += '\r\n</body>'; 
     1951        textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
    19511952        var input_folder = document.createElement("INPUT"); 
    19521953        input_folder.style.display='none'; 
     
    19741975        form.appendChild(input_msgid); 
    19751976        form.appendChild(input_insertImg); 
     1977 
     1978        var mail_type = form.appendChild( document.createElement( 'input' ) ); 
     1979        mail_type.name = 'type'; 
     1980        mail_type.type = 'hidden'; 
     1981        mail_type.value = ( mail_as_plain ) ? 'plain' : 'html'; 
    19761982 
    19771983        cExecuteForm ("$this.imap_functions.save_msg", form, handler_save_msg,border_id); 
  • trunk/expressoMail1_2/js/rich_text_editor.js

    r4366 r4374  
    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.