Changeset 3131


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

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

Location:
trunk/expressoMail1_2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r3111 r3131  
    837837                                        $content = $this -> replace_links( $content ); 
    838838                                        $content = str_replace( array( ' #$&lt;$# ', ' #$&gt;$# ' ), array( '&lt;', '&gt;' ), $content ); 
    839                                         $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>'; 
     839                                        $content = '<pre>' . $content . '</pre>'; 
    840840 
    841841                                        $return[ 'body' ] = $content; 
     
    889889                                                if(!($file_type == "text/plain" && $msg->fsize[$msg_number][$values] > 102400)) { 
    890890                                                        $content .= htmlentities($this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values])); 
    891                                                         $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>';                                                     
     891                                                        $content = '<pre>' . $content . '</pre>';                                                        
    892892                                                } 
    893893                                        } 
     
    903903                                        $content .= "<hr align='left' width='95%' style='border:1px solid #DCDCDC'>"; 
    904904                                        $content .= $this->decodeBody(imap_fetchbody($this->mbox, $msg_number, $msg_part, FT_UID), $msg->encoding[$msg_number][$values], $msg->charset[$msg_number][$values]); 
    905                                         $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>'; 
     905                                        $content = '<pre>' . $content . '</pre>'; 
    906906 
    907907                                } 
     
    967967                                                                        $body = $this -> replace_links( $body ); 
    968968                                                                        $body = str_replace( array( ' #$&lt;$# ', ' #$&gt;$# ' ), array( '&lt;', '&gt;' ), $body ); 
    969                                                                         $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>'; 
     969                                                                        $body = '<pre>' . $body . '</pre>'; 
    970970                                                                } 
    971971 
  • trunk/expressoMail1_2/js/base/main.js

    r3117 r3131  
    14221422                title = title.substring(0, parseInt(resize)*0.08); 
    14231423 
     1424        // Load default style for <PRE> tag, inside RichTextEditor. 
     1425        RichTextEditor.loadStyle("pre","main.css");      
    14241426        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='"+URL_SERVER+"expressoMail1_2/templates/"+template+"/images/close_button.png'></td></tr></table>"; 
    14251427        expresso.connector.loadScript('wfolders'); 
     
    21592161                show_attachs = ""; 
    21602162        } 
     2163        var current_path = window.location.href.substr(0,window.location.href.lastIndexOf("/")); 
     2164        var window_print_head  = window_print.document.getElementsByTagName("head")[0]; 
     2165        // For IE 
     2166        if(typeof(window_print_head) == 'undefined'){ 
     2167                window_print_head = window_print.document.createElement("head"); 
     2168                window_print.document.appendChild(window_print_head); 
     2169        } 
     2170        var window_print_style = window_print.document.createElement("LINK"); 
     2171        window_print_style.href = current_path+'/templates/default/main.css'; 
     2172        window_print_style.type = "text/css"; 
     2173        window_print_style.rel = "stylesheet"; 
     2174        window_print_head.appendChild(window_print_style); 
    21612175         
    21622176        while (1){ 
    21632177                try{ 
    2164                         var html = '<br><br>'; 
    2165                         //html += "<input type='button' value='Imprimir' onclick='javascript:window.print();'>"; 
     2178                        var html ='<body>'; 
    21662179                        html += "<h4>ExpressoLivre - ExpressoMail</h4><hr>"; 
    21672180                        html += '<table><tbody>'; 
     
    21852198                        html += show_attachs; //to show the names of the attachments 
    21862199                        html += "</tbody></table><hr>"; 
    2187                         window_print.document.body.innerHTML = html + '<blockquote><font size="2">' + body.innerHTML + '</font></blockquote>'; 
     2200                        window_print.document.body.innerHTML = html + body.innerHTML; 
    21882201                        if(!is_ie){ 
    21892202                                var tab_tags = window_print.document.getElementsByTagName("IMG");                        
  • trunk/expressoMail1_2/js/jscode/rich_text_editor.js

    r2630 r3131  
    3737        document.getElementById('fontsize').selectedIndex = 0; 
    3838}; 
     39 
     40cRichTextEditor.prototype.loadStyle = function(tag, css_file) { 
     41        var theRules = new Array(); 
     42        var stylePRE = "";       
     43        for(var s = 0; s < document.styleSheets.length; s++) { 
     44                if(document.styleSheets[s].href != null &&  
     45                                document.styleSheets[s].href.match("templates/"+template+"/"+css_file)){                         
     46                        if (document.styleSheets[s].cssRules) 
     47                                theRules = document.styleSheets[s].cssRules; 
     48                        else if (document.styleSheets[s].rules) 
     49                                theRules = document.styleSheets[s].rules; 
     50                        break; 
     51                } 
     52        } 
     53        for(var s = 0;s < theRules.length; s++){ 
     54                if(theRules[s].selectorText.toLowerCase() == tag.toLowerCase()){                         
     55                        stylePRE = theRules[s].style; 
     56                        break; 
     57                } 
     58        } 
     59        var _body = Element(this.editor); 
     60        var i_doc = (document.all) ? _body.contentWindow.document: _body.contentDocument; 
     61        var hh1 = i_doc.getElementsByTagName('head')[0]; 
     62        // For IE 
     63        if(typeof(hh1) == 'undefined'){ 
     64                hh1 = i_doc.createElement("head"); 
     65                i_doc.appendChild(hh1); 
     66        } 
     67        var ss1 = i_doc.createElement('style');  
     68        ss1.setAttribute("type", "text/css");  
     69        var def = tag.toLowerCase()+' {'+stylePRE.cssText+'}'; 
     70        if (ss1.styleSheet) {  
     71            ss1.styleSheet.cssText = def; 
     72        } else { 
     73            var tt1 = i_doc.createTextNode(def); 
     74            ss1.appendChild(tt1); 
     75        } 
     76        hh1.appendChild(ss1); 
     77} 
    3978 
    4079cRichTextEditor.prototype.createElementEditor = function(pObj) 
  • trunk/expressoMail1_2/templates/default/main.css

    r2989 r3131  
     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.