Changeset 4301


Ignore:
Timestamp:
05/10/11 10:31:11 (13 years ago)
Author:
airton
Message:

Ticket #1820 - Corrige local do opcao do envio de email em texto puro - r4258

Location:
sandbox/2.2.0.2/expressoMail1_2/js
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.2.0.2/expressoMail1_2/js/draw_api.js

    r4298 r4301  
    26162616        tr_menu_new_message.appendChild(td_menu_new_message); 
    26172617         
    2618         if ( ! expresso_offline ) 
    2619         { 
    2620                 var text_plain = td_menu_new_message.appendChild( 
    2621                         document.createElement( 'span' ) 
    2622                 ).appendChild( 
    2623                         document.createTextNode( ' | ' ) 
    2624                 ).parentNode.appendChild( 
    2625                         document.createTextNode( get_lang('Send this mail as text plain') + '.')  
    2626                 ); 
    2627                                 // changed to work in ie  
    2628                                 input_checkbox = document.createElement('input');  
    2629                     input_checkbox.setAttribute('class', 'checkbox');  
    2630                     input_checkbox.setAttribute('type', 'checkbox');  
    2631                     input_checkbox.setAttribute('tabIndex', '-1');  
    2632                     input_checkbox.setAttribute('id', 'textplain_rt_checkbox_' + ID);  
    2633                  
    2634                                  
    2635                                 input_checkbox.onclick = function () 
    2636                 { 
    2637                         RichTextEditor.plain( ( ! this.checked ) ? this.checked : mobile_device || ( this.checked = confirm( 'The text format will be lost.' ) ) ); 
    2638                         document.getElementById( 'viewsource_rt_checkbox_' + ID ).parentNode.style.display = ( this.checked ) ? 'none' : ''; 
    2639                 }; 
    2640                                 text_plain.parentNode.appendChild(input_checkbox);  
    2641         } 
    26422618         
    26432619        tbody_menu_new_message.appendChild(tr_menu_new_message); 
     
    31683144        tr5.appendChild(td5); 
    31693145        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         
     3168         
    31703169        tbody_message.appendChild(tr5); 
    31713170        if (parseInt(preferences.use_important_flag)) 
  • sandbox/2.2.0.2/expressoMail1_2/js/main.js

    r4291 r4301  
    16741674        body = document.getElementById("body_"+ID); 
    16751675 
    1676         textArea.value += ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
     1676        textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
    16771677         
    16781678        var input_folder = document.createElement("INPUT"); 
     
    19201920                withImage = false; 
    19211921 
    1922         var rt_checkbox = Element('viewsource_rt_checkbox_' + ID); 
     1922        var rt_checkbox = Element('viewsource_rt_checkbox_' + border_id); 
    19231923        if (rt_checkbox == null) 
    19241924                return false; 
     
    19471947        var handler_save_msg = function(data){ return_save(data,this.tmp_border_id,this.tmp_folder_name,this.tmp_folder_id,this.message_id); } 
    19481948 
     1949        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + border_id );  
     1950        mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false; 
     1951         
    19491952        var textArea = document.createElement("TEXTAREA"); 
    19501953        textArea.style.display='none'; 
     
    19531956        if (! body) 
    19541957                return; 
    1955         textArea.value += '<body>\r\n'; 
    1956         textArea.value += body.contentWindow.document.body.innerHTML; 
    1957         textArea.value += '\r\n</body>'; 
     1958         
     1959        textArea.value = ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
     1960         
    19581961        var input_folder = document.createElement("INPUT"); 
    19591962        input_folder.style.display='none'; 
     
    19821985        form.appendChild(input_insertImg); 
    19831986 
     1987        var mail_type = form.appendChild( document.createElement( 'input' ) );  
     1988        mail_type.name = 'type';  
     1989        mail_type.type = 'hidden';  
     1990        mail_type.value = ( mail_as_plain ) ? 'plain' : 'html';  
     1991         
    19841992        cExecuteForm ("$this.imap_functions.save_msg", form, handler_save_msg,border_id); 
    19851993} 
  • sandbox/2.2.0.2/expressoMail1_2/js/rich_text_editor.js

    r4291 r4301  
    2525                parentDiv.appendChild(this.table); 
    2626 
    27                 var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + this.id );  
    28             this.table.style.visibility = ( mail_as_plain && mail_as_plain.checked ) ? 'hidden' : 'visible';  
     27        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + this.id );  
     28        this.table.style.visibility = ( mail_as_plain && mail_as_plain.checked ) ? 'hidden' : 'visible';  
    2929        if(!Element(this.editor)) 
    3030        { 
     
    168168                } 
    169169                else{ 
    170                         html = document.createTextNode( editor.contentWindow.document.body.innerHTML ); 
    171                         this.table.style.visibility="hidden"; 
     170                        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + this.id ); 
     171                                                html = document.createTextNode( editor.contentWindow.document.body.innerHTML ); 
     172                         
     173                                                html = html.nodeValue.replace( /<br\s*\/?>/mg, "\n" ).replace( /(<([^>]+)>)/ig, '' ).replace( /^[\n ]+|[\n ]+$/g, '' );  
     174                  
     175                                if ( ! mobile_device && html != '' && ! ( mail_as_plain.checked = confirm( 'The text format will be lost.' ) ) )  
     176                                   return false;  
     177                                                 
     178                                                this.table.style.visibility="hidden"; 
    172179                        editor.contentWindow.document.body.innerHTML = ''; 
    173180 
     
    176183                        textarea.style.height = '300px'; 
    177184                        textarea.style.fontSize = '12pt'; 
    178                         textarea.innerHTML = html.nodeValue.replace( /<br\s*\/?>/mg, "\n" ).replace( /(<([^>]+)>)/ig, '' ); 
     185                        textarea.innerHTML = html; 
    179186 
    180187                        editor.style.width = '0px'; 
     
    201208                        editor.style.visibility = 'visible'; 
    202209                                                this.loadEditor( this.id ); 
     210                                                 
     211                                                setTimeout( function( ) { editor.contentWindow.focus( ); }, 100 ); 
    203212                                        } 
    204213                                } 
Note: See TracChangeset for help on using the changeset viewer.