Changeset 4291


Ignore:
Timestamp:
05/09/11 17:55:51 (13 years ago)
Author:
airton
Message:

Ticket #1820 - Permitindo o envio de email em texto puro - r4252

Location:
sandbox/2.2.0.2
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • sandbox/2.2.0.2/expressoMail1_2/inc/class.imap_functions.inc.php

    r4169 r4291  
    20682068                { 
    20692069                    if($certificado->dados['EXPIRADO']) $erros_acumulados .='Certificado expirado.'; 
    2070                     if($certificado->dados['CPF'] != $this->username) $erros_acumulados .=' CPF no certificado diferente do logado no expresso.'; 
     2070                    $this->cpf = isset($GLOBALS['phpgw_info']['server']['certificado_atributo_cpf'])&&$GLOBALS['phpgw_info']['server']['certificado_atributo_cpf']!=''?$_SESSION['phpgw_info']['expressomail']['user'][$GLOBALS['phpgw_info']['server']['certificado_atributo_cpf']]:$this->username; 
     2071                    if($certificado->dados['CPF'] != $this->cpf) $erros_acumulados .=' CPF no certificado diferente do logado no expresso.'; 
    20712072                    if(!($certificado->dados['KEYUSAGE']['digitalSignature'] && $certificado->dados['EXTKEYUSAGE']['emailProtection'])) $erros_acumulados .=' Certificado nao permite assinar mensagens.'; 
    20722073                } 
     
    21392140                $mail->AddReplyTo($replytoaddress); 
    21402141                $mail->Subject = $subject; 
    2141                 $mail->IsHTML($params['type'] != 'textplain'); 
     2142                $mail->IsHTML( ( array_key_exists( 'type', $params ) && in_array( strtolower( $params[ 'type' ] ), array( 'html', 'plain' ) ) ) ? strtolower( $params[ 'type' ] ) != 'plain' : true ); 
    21422143                $mail->Body = $body; 
    21432144 
  • sandbox/2.2.0.2/expressoMail1_2/js/abas.js

    r4139 r4291  
    5656                                try 
    5757                                { 
    58                                         if (Element('viewsource_rt_checkbox').checked) 
     58                                        if (Element('viewsource_rt_checkbox_' + ID).checked) 
    5959                                        {   
    6060                                                connector.loadScript("rich_text_editor"); 
  • sandbox/2.2.0.2/expressoMail1_2/js/color_palette.js

    r320 r4291  
    2424cColorPalette.prototype.repos = function (intElemScrollTop) 
    2525{ 
    26         var new_pos = findPosY(Element("forecolor")) - intElemScrollTop + 20; 
    27         this.div.style.top = new_pos; 
     26    if ( Element("forecolor") ) 
     27    { 
     28        var new_pos = findPosY(Element("forecolor")) - intElemScrollTop + 20; 
     29        this.div.style.top = new_pos; 
     30    } 
    2831} 
    2932 
  • sandbox/2.2.0.2/expressoMail1_2/js/draw_api.js

    r4283 r4291  
    26152615 
    26162616        tr_menu_new_message.appendChild(td_menu_new_message); 
     2617         
     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.createElement( 'input' ) 
     2626                ).parentNode.appendChild( 
     2627                        document.createTextNode( get_lang('Send this mail as text plain') + '.') 
     2628                ).previousSibling; 
     2629                text_plain.setAttribute( 'tabIndex', '-1' ); 
     2630                text_plain.id = 'textplain_rt_checkbox_' + ID ; 
     2631                text_plain.type = "checkbox"; 
     2632                text_plain.onclick = function () 
     2633                { 
     2634                        RichTextEditor.plain( ( ! this.checked ) ? this.checked : mobile_device || ( this.checked = confirm( 'The text format will be lost.' ) ) ); 
     2635                        document.getElementById( 'viewsource_rt_checkbox_' + ID ).parentNode.style.display = ( this.checked ) ? 'none' : ''; 
     2636                }; 
     2637        } 
     2638         
    26172639        tbody_menu_new_message.appendChild(tr_menu_new_message); 
    26182640        table_menu_new_message.appendChild(tbody_menu_new_message); 
     
    32213243                draw_from_field(sel_from,tr1_1); 
    32223244        resizeWindow(); 
     3245         
     3246        if ( ! expresso_offline ) 
     3247        { 
     3248                if ( mobile_device ) 
     3249                { 
     3250                        text_plain.click( ); 
     3251                        text_plain.parentNode.style.display = 'none'; 
     3252                } 
     3253        } 
     3254         
     3255         
    32233256        return ID; 
    32243257} 
  • sandbox/2.2.0.2/expressoMail1_2/js/globals.js

    r3384 r4291  
    4545var divStatusBar = document.getElementById("divStatusBar"); 
    4646var denyFileExtensions = new Array('exe','com','reg','chm','cnf','hta','ins','jse','job','lnk','pif','src','scf','sct','shb','vbe','vbs','wsc','wsf','wsh','cer','its','mau','','mda','mar','mdz','prf','pst'); 
     47var mobile_device = false; 
    4748 
  • sandbox/2.2.0.2/expressoMail1_2/js/main.js

    r4283 r4291  
    9090 
    9191        cExecute ("$this.functions.get_preferences", save_preferences); 
     92        cExecute ("phpgwapi.browser.isMobile", function( data )  
     93        {  
     94            mobile_device = ( ( data.constructor == Boolean ) ? data : ( data === 'true' ) );  
     95        } ); 
     96         
    9297        setTimeout('auto_refresh()', time_refresh); 
    9398 
     
    16481653        } 
    16491654 
    1650         if ( document.getElementById('viewsource_rt_checkbox').checked == true ) 
    1651                 document.getElementById('viewsource_rt_checkbox').click(); 
     1655        if ( document.getElementById('viewsource_rt_checkbox_' + ID).checked == true ) 
     1656                document.getElementById('viewsource_rt_checkbox_' + ID).click(); 
    16521657 
    16531658        var save_link = Element("save_message_options_"+ID); 
     
    16611666        }; 
    16621667 
     1668        var mail_as_plain = document.getElementById( 'textplain_rt_checkbox_' + ID );  
     1669        mail_as_plain = ( mail_as_plain ) ? mail_as_plain.checked : false;  
     1670         
    16631671        var textArea = document.createElement("TEXTAREA"); 
    16641672        textArea.style.display='none'; 
    16651673        textArea.name = "body"; 
    16661674        body = document.getElementById("body_"+ID); 
    1667         textArea.value += '<body>\r\n'; 
    1668         textArea.value += body.contentWindow.document.body.innerHTML; 
    1669         textArea.value += '\r\n</body>'; 
     1675 
     1676        textArea.value += ( ( mail_as_plain ) ? body.previousSibling.value : ( '<body>\r\n' + body.contentWindow.document.body.innerHTML + '\r\n</body>' ) ); 
     1677         
    16701678        var input_folder = document.createElement("INPUT"); 
    16711679        input_folder.style.display='none'; 
     
    17021710        form.appendChild(msg_id); 
    17031711 
     1712        var mail_type = form.appendChild( document.createElement( 'input' ) );  
     1713        mail_type.name = 'type';  
     1714        mail_type.type = 'hidden';  
     1715        mail_type.value = ( mail_as_plain ) ? 'plain' : 'html'; 
     1716         
     1717         
    17041718        var _subject = trim(Element("subject_"+ID).value); 
    17051719        if((_subject.length == 0) && !confirm(get_lang("Send this message without a subject?"))) { 
     
    19061920                withImage = false; 
    19071921 
    1908         var rt_checkbox = Element('viewsource_rt_checkbox'); 
     1922        var rt_checkbox = Element('viewsource_rt_checkbox_' + ID); 
    19091923        if (rt_checkbox == null) 
    19101924                return false; 
  • sandbox/2.2.0.2/expressoMail1_2/js/rich_text_editor.js

    r4283 r4291  
    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';  
    2729        if(!Element(this.editor)) 
    2830        { 
     
    3133        else 
    3234        { 
    33                 Element("viewsource_rt_checkbox").checked=false; 
     35                Element("viewsource_rt_checkbox_" + this.id).checked=false; 
    3436        } 
    3537 
     
    5052                config_events( iframe, 'onload', function( ) 
    5153                { 
    52                         iframe.contentWindow.document.designMode = "on"; 
     54                        if ( iframe.contentWindow.document.body && iframe.contentWindow.document.body.contentEditable )  
     55                    iframe.contentWindow.document.body.contentEditable = true;  
     56                         
    5357                        if ( iframe.contentWindow.document.documentElement ){ 
    5458                                iframe.contentWindow.document.documentElement.style.background = '#fff'; 
     
    5761                }); 
    5862 
    59                 var checkbox = document.createElement("INPUT"); 
    60                 checkbox.id = 'viewsource_rt_checkbox'; 
    61                 checkbox.type = "checkbox"; 
    62                 checkbox.setAttribute("tabIndex","-1"); 
    63                 checkbox.onclick = function () {RichTextEditor.viewsource(this.checked)}; 
    64                 var text = document.createTextNode(get_lang('View HTML source') + '.'); 
     63 
    6564                parentDiv.appendChild(iframe); 
    66                 parentDiv.appendChild(checkbox); 
    67                 parentDiv.appendChild(text); 
     65 
     66                var source = document.createElement( 'input' ); 
     67                source.id = 'viewsource_rt_checkbox_' + this.id; 
     68                source.type = "checkbox"; 
     69                source.setAttribute("tabIndex","-1"); 
     70                source.onclick = function( ) 
     71                { 
     72                        RichTextEditor.viewsource(this.checked); 
     73                }; 
     74                source = parentDiv.appendChild( 
     75                        document.createElement( 'span' ).appendChild( source ).parentNode 
     76                ).appendChild( 
     77                        document.createTextNode( get_lang( 'View HTML source' ) + '.' ) 
     78                ).parentNode; 
     79                 
    6880} 
    6981 
     
    141153        } 
    142154} 
     155 
     156 
     157cRichTextEditor.prototype.plain = function(source) { 
     158        var html; 
     159        var editor = document.getElementById( this.editor ); 
     160 
     161        if (source) { 
     162                if (is_ie){ 
     163                        connector.loadScript('html2xhtml'); 
     164                        html = frames[this.editor].document.body; 
     165                        var xhtml = get_xhtml(html, 'en', 'iso-8859-1'); 
     166                        frames[this.editor].document.body.innerText = xhtml; 
     167                        document.getElementById("table_richtext_toolbar").style.visibility="hidden"; 
     168                } 
     169                else{ 
     170                        html = document.createTextNode( editor.contentWindow.document.body.innerHTML ); 
     171                        this.table.style.visibility="hidden"; 
     172                        editor.contentWindow.document.body.innerHTML = ''; 
     173 
     174                        var textarea = document.createElement( 'textarea' ); 
     175                        textarea.style.width = '99%'; 
     176                        textarea.style.height = '300px'; 
     177                        textarea.style.fontSize = '12pt'; 
     178                        textarea.innerHTML = html.nodeValue.replace( /<br\s*\/?>/mg, "\n" ).replace( /(<([^>]+)>)/ig, '' ); 
     179 
     180                        editor.style.width = '0px'; 
     181                        editor.style.height = '0px'; 
     182                        editor.style.visibility = 'hidden'; 
     183 
     184                        editor.parentNode.insertBefore( textarea, editor ); 
     185                        textarea.focus( ); 
     186                } 
     187        } else { 
     188                if (is_ie){ 
     189                        var output = escape(frames[this.editor].document.body.innerText); 
     190                        output = output.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E"); 
     191                        output = output.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E"); 
     192                        frames[this.editor].document.body.innerHTML = unescape(output); 
     193                        document.getElementById("table_richtext_toolbar").style.visibility="visible"; 
     194                } 
     195                else{ 
     196                        editor.contentWindow.document.body.innerHTML = editor.previousSibling.value.replace( /\n/g, '<br/>' ); 
     197                        editor.parentNode.removeChild( editor.previousSibling ); 
     198 
     199                        editor.style.width = '99%'; 
     200                        editor.style.height = '300px'; 
     201                        editor.style.visibility = 'visible'; 
     202                                                this.loadEditor( this.id ); 
     203                                        } 
     204                                } 
     205}                         
     206 
     207 
     208 
    143209 
    144210cRichTextEditor.prototype.buildEditor = function() { 
  • sandbox/2.2.0.2/phpgwapi/inc/class.browser.inc.php

    r3621 r4291  
    199199                } 
    200200 
     201                function isMobile( ) 
     202                { 
     203                        return $this -> is_ipad( ) 
     204                                || $this -> is_iphone( ) 
     205                                || $this -> is_nokia( ) 
     206                                || $this -> is_ipod( ) 
     207                                || $this -> is_blackberry( ) 
     208                                || $this -> is_android( ); 
     209                } 
     210 
    201211                function is_beos() 
    202212                { 
Note: See TracChangeset for help on using the changeset viewer.