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/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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) 
Note: See TracChangeset for help on using the changeset viewer.