Changeset 3130


Ignore:
Timestamp:
08/04/10 10:10:14 (14 years ago)
Author:
niltonneto
Message:

Ticket #1111 - Corrigido problema ao editar/imprimir mensagens com tags <pre>.

Location:
branches/2.2/expressoMail1_2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php

    r3106 r3130  
    813813                                                $content = $this -> replace_links( $content );  
    814814                                                $content = str_replace( array( ' #$&lt;$# ', ' #$&gt;$# ' ), array( '&lt;', '&gt;' ), $content );  
    815                                                 $content = '<pre style="white-space:pre;word-wrap: break-word;white-space:pre-wrap;white-space:-moz-pre-wrap;font-family: monospace;font-size:12px">' . $content . '</pre>';  
     815                                                $content = '<pre>' . $content . '</pre>';  
    816816 
    817817                                                $return[ 'body' ] = $content;  
     
    866866                                                if(!($file_type == "text/plain" && $msg->fsize[$msg_number][$values] > 102400)) { 
    867867                                                         $content .= htmlentities($this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values]));  
    868                                  $content = '<pre style="white-space:pre;word-wrap: break-word;white-space:pre-wrap;white-space:-moz-pre-wrap;font-family: monospace;font-size:12px">' . $content . '</pre>';     
     868                                 $content = '<pre>' . $content . '</pre>';     
    869869                                                } 
    870870                                        } 
     
    879879                                        $content .= "<hr align='left' width='95%' style='border:1px solid #DCDCDC'>"; 
    880880                                        $content .= $this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values]);  
    881                     $content = '<pre style="white-space:pre;word-wrap: break-word;white-space:pre-wrap;white-space:-moz-pre-wrap;font-family: monospace;font-size:12px">' . $content . '</pre>';  
     881                    $content = '<pre>' . $content . '</pre>';  
    882882                                } 
    883883                                else if($file_type == "message/rfc822" || $file_type == "text/rfc822-headers"){ 
     
    942942                                                                        $body = $this -> replace_links( $body );  
    943943                                                                        $body = str_replace( array( ' #$&lt;$# ', ' #$&gt;$# ' ), array( '&lt;', '&gt;' ), $body );  
    944                                                                         $body = '<pre style="white-space:pre;word-wrap: break-word;white-space:pre-wrap;white-space:-moz-pre-wrap;font-family: monospace;font-size:12px">' . $body . '</pre>';  
     944                                                                        $body = '<pre>' . $body . '</pre>';  
    945945                                                                }  
    946946 
  • branches/2.2/expressoMail1_2/js/main.js

    r3105 r3130  
    13411341                title = title.substring(0, parseInt(resize)*0.08); 
    13421342 
     1343        // Load default style for <PRE> tag, inside RichTextEditor. 
     1344        RichTextEditor.loadStyle("pre","main.css");      
     1345 
    13431346        Element("border_id_" + new_border_ID).innerHTML = "<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td id=font_border_id_" + new_border_ID +" class='font-menu' width=*>" +title + "</td><td width=1px><img onmousedown='javascript:return false' style='cursor:pointer' onclick=delete_border('" + new_border_ID + "','false') src='templates/"+template+"/images/close_button.gif'></td></tr></table>"; 
    13441347        return new_border_ID; //Preciso retornar o ID da nova mensagem. 
     
    20922095        } 
    20932096 
     2097        var current_path = window.location.href.substr(0,window.location.href.lastIndexOf("/")); 
     2098        var window_print_head  = window_print.document.getElementsByTagName("head")[0]; 
     2099        // For IE 
     2100        if(typeof(window_print_head) == 'undefined'){ 
     2101                window_print_head = window_print.document.createElement("head"); 
     2102                window_print.document.appendChild(window_print_head); 
     2103        } 
     2104        var window_print_style = window_print.document.createElement("LINK"); 
     2105        window_print_style.href = current_path+'/templates/default/main.css'; 
     2106        window_print_style.type = "text/css"; 
     2107        window_print_style.rel = "stylesheet"; 
     2108        window_print_head.appendChild(window_print_style);       
     2109 
    20942110        while (1){ 
    20952111                try{ 
    2096                         var html = '<br><br>'; 
    2097                         //html += "<input type='button' value='Imprimir' onclick='javascript:window.print();'>"; 
     2112                        var html ='<body>'; 
    20982113                        html += "<h4>ExpressoLivre - ExpressoMail</h4><hr>"; 
    20992114                        html += '<table><tbody>'; 
     
    21172132                        html += show_attachs; //to show the names of the attachments 
    21182133                        html += "</tbody></table><hr>"; 
    2119                         window_print.document.body.innerHTML = html + '<blockquote><font size="2">' + body.innerHTML + '</font></blockquote>'; 
     2134                        window_print.document.body.innerHTML = html + body.innerHTML; 
    21202135                        if(!is_ie){ 
    21212136                                var tab_tags = window_print.document.getElementsByTagName("IMG"); 
  • branches/2.2/expressoMail1_2/js/rich_text_editor.js

    r1296 r3130  
    6464                parentDiv.appendChild(checkbox); 
    6565                parentDiv.appendChild(text); 
     66} 
     67 
     68cRichTextEditor.prototype.loadStyle = function(tag, css_file) { 
     69        var theRules = new Array(); 
     70        var stylePRE = "";       
     71        for(var s = 0; s < document.styleSheets.length; s++) { 
     72                if(document.styleSheets[s].href != null &&  
     73                                document.styleSheets[s].href.match("templates/"+template+"/"+css_file)){                         
     74                        if (document.styleSheets[s].cssRules) 
     75                                theRules = document.styleSheets[s].cssRules; 
     76                        else if (document.styleSheets[s].rules) 
     77                                theRules = document.styleSheets[s].rules; 
     78                        break; 
     79                } 
     80        } 
     81        for(var s = 0;s < theRules.length; s++){ 
     82                if(theRules[s].selectorText.toLowerCase() == tag.toLowerCase()){                         
     83                        stylePRE = theRules[s].style; 
     84                        break; 
     85                } 
     86        } 
     87        var _body = Element(this.editor); 
     88        var i_doc = (document.all) ? _body.contentWindow.document: _body.contentDocument; 
     89        var hh1 = i_doc.getElementsByTagName('head')[0]; 
     90        // For IE 
     91        if(typeof(hh1) == 'undefined'){ 
     92                hh1 = i_doc.createElement("head"); 
     93                i_doc.appendChild(hh1); 
     94        } 
     95        var ss1 = i_doc.createElement('style');  
     96        ss1.setAttribute("type", "text/css");  
     97        var def = tag.toLowerCase()+' {'+stylePRE.cssText+'}'; 
     98        if (ss1.styleSheet) {  
     99            ss1.styleSheet.cssText = def; 
     100        } else { 
     101            var tt1 = i_doc.createTextNode(def); 
     102            ss1.appendChild(tt1); 
     103        } 
     104        hh1.appendChild(ss1); 
    66105} 
    67106 
  • branches/2.2/expressoMail1_2/templates/default/main.css

    r3026 r3130  
     1pre{ 
     2        white-space: pre-wrap !important; /* css-3 */ 
     3        white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */ 
     4        white-space: -pre-wrap !important; /* Opera 4-6 */ 
     5        white-space: -o-pre-wrap !important; /* Opera 7 */ 
     6        word-wrap: break-word !important; /* Internet Explorer 5.5+ */ 
     7        font-family: monospace !important;       
     8        font-size: 12px !important; 
     9} 
     10 
    111* { 
    212        font-family: Verdana, Arial, Helvetica, sans-serif;      
Note: See TracChangeset for help on using the changeset viewer.