Ignore:
Timestamp:
11/23/12 12:14:25 (11 years ago)
Author:
eduardow
Message:

Ticket #3192 - Possibilitar a visualizacao para impressao de mensagem sem que a mesma seja aberta.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4/expressoMail1_2/js/main.js

    r7557 r7558  
    36253625}  
    36263626  
     3627function newTbody(messages){  
     3628        var tbody = $("<tbody>");  
     3629        $.each(messages,function(index,msg){  
     3630                var newTr = make_tr_message(msg,get_current_folder(),msg.offsetToGMT);  
     3631                if (msg.attachments && msg.attachments.length){  
     3632                        $(newTr).find('td').eq(1).html("<img src ='templates/"+template+"/images/clip.gif'>");  
     3633                }                 
     3634                tbody.append(newTr);  
     3635        });  
     3636        return tbody.html();  
     3637}  
    36273638function print_messages_list(){  
    36283639                 
    3629         var folder= Element('border_id_0').innerHTML; 
    3630         //var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML;  
    3631          
     3640        var print_list = function(tbody,folder){  
     3641            var print_width = screen.width - 200;  
     3642            var x = ((screen.width - print_width) / 2);  
     3643            var y = ((screen.height - 400) / 2) - 35;  
     3644            var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y);  
     3645            seekDot = (is_ie ? /width=24/gi : /width="24"/gi);  
     3646            //thead = thead.replace(seekDot, "style='display:none'");   
     3647            var thead = "<tr class=\"message_header\"> <td width=\"3%\"></td><td width=\"2%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"2%\"></td><td width=\"2%\"></td><td width=\"2%\"></td><td id=\"message_header_SORTFROM_0\" class=\"th_resizable\" align=\"left\" width=\"20%\">De</td><td id=\"message_header_SORTSUBJECT_0\" class=\"th_resizable\" align=\"left\" width=\"*\">Assunto</td><td id=\"message_header_SORTARRIVAL_0\" class=\"th_resizable\" align=\"center\" width=\"11%\"><b>Data</b><img src=\"templates/default/images/arrow_descendant.gif\"></td><td id=\"message_header_SORTSIZE_0\" class=\"th_resizable\" align=\"left\" width=\"11%\">Tamanho</td></tr>";  
     3648            tbody = tbody.replace(seekDot, "style='display:none'");  
     3649            seekDot = (is_ie ? /width=16/gi : /width="16"/gi);  
     3650            //thead = thead.replace(seekDot, "style='display:none'");   
     3651            tbody = tbody.replace(seekDot, "style='display:none'");  
     3652            seekDot = (is_ie ? /width=12/gi : /width="12"/gi);  
     3653            //thead = thead.replace(seekDot, "style='display:none'");   
     3654            tbody = tbody.replace(seekDot, "style='display:none'");  
     3655            while (1){  
     3656                    try{  
     3657                            window_print.document.open();  
     3658                            var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>'  
     3659                            + '<head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>'  
     3660                        + cabecalho + '</h4><hr>'   
     3661                            + '<h2>'+$('#border_id_0').html()+'</h2><hr/><blockquote><font size="2">'  
     3662                            + '<table width="100%" cellpadding="0" cellspacing="0">'  
     3663                            + '<thead>' + thead + '</thead><tbody>' + tbody + '</tbody>'  
     3664                            + '</table></font></blockquote></body></html>';  
     3665                            window_print.document.write(html);  
     3666                            window_print.document.close();  
     3667                            break;  
     3668                    }  
     3669                    catch(e){  
     3670                            //alert(e.message);  
     3671                    }  
     3672            }  
     3673            window_print.document.close();  
     3674            window_print.print();  
     3675    }    
    36323676        msgs_number = get_selected_messages(); 
    36333677        if(msgs_number == false){ 
    3634                 var tbody = Element('divScrollMain_'+numBox).firstChild.firstChild.innerHTML; 
     3678                var tbody = Element('divScrollMain_0').firstChild.firstChild.innerHTML;  
     3679            print_list(tbody); 
    36353680        }else{ 
    3636                 msgs_number = msgs_number.split(","); 
    3637                 var tbody = ""; 
    3638                 for(var i = 0; i < msgs_number.length; i++){ 
    3639                         tbody += "<tr id="+msgs_number[i]+" class=\"tr_msg_unread tr_msg_read2\">"+$("#"+msgs_number[i]).clone().find(".checkbox").remove().end().html()+"</tr>"; 
    3640                 }        
    3641         } 
    3642         var print_width = screen.width - 200; 
    3643         var x = ((screen.width - print_width) / 2); 
    3644         var y = ((screen.height - 400) / 2) - 35; 
    3645         var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y); 
    3646         seekDot = (is_ie ? /width=24/gi : /width="24"/gi); 
    3647         //thead = thead.replace(seekDot, "style='display:none'");  
    3648         var thead = "<tr class=\"message_header\"> <td width=\"3%\"></td><td width=\"2%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"1%\"></td><td width=\"2%\"></td><td width=\"2%\"></td><td width=\"2%\"></td><td id=\"message_header_SORTFROM_0\" class=\"th_resizable\" align=\"left\" width=\"20%\">De</td><td id=\"message_header_SORTSUBJECT_0\" class=\"th_resizable\" align=\"left\" width=\"*\">Assunto</td><td id=\"message_header_SORTARRIVAL_0\" class=\"th_resizable\" align=\"center\" width=\"11%\"><b>Data</b><img src=\"templates/default/images/arrow_descendant.gif\"></td><td id=\"message_header_SORTSIZE_0\" class=\"th_resizable\" align=\"left\" width=\"11%\">Tamanho</td></tr>"; 
    3649         tbody = tbody.replace(seekDot, "style='display:none'"); 
    3650         seekDot = (is_ie ? /width=16/gi : /width="16"/gi); 
    3651         //thead = thead.replace(seekDot, "style='display:none'");  
    3652         tbody = tbody.replace(seekDot, "style='display:none'"); 
    3653         seekDot = (is_ie ? /width=12/gi : /width="12"/gi); 
    3654         //thead = thead.replace(seekDot, "style='display:none'");  
    3655         tbody = tbody.replace(seekDot, "style='display:none'"); 
    3656         while (1){ 
    3657                 try{ 
    3658                         window_print.document.open(); 
    3659                         var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>' 
    3660                         + '<head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>' 
    3661                     + cabecalho + '</h4><hr>'  
    3662                         + '<h2>'+folder+'</h2><hr/><blockquote><font size="2">' 
    3663                         + '<table width="100%" cellpadding="0" cellspacing="0">' 
    3664                         + '<thead>' + thead + '</thead><tbody>' + tbody + '</tbody>' 
    3665                         + '</table></font></blockquote></body></html>'; 
    3666                         window_print.document.write(html); 
    3667                         window_print.document.close(); 
    3668                         break; 
    3669                 } 
    3670                 catch(e){ 
    3671                         //alert(e.message); 
    3672                 } 
    3673         } 
    3674         window_print.document.close(); 
    3675         window_print.print(); 
     3681                        var messages = {};  
     3682                messages[get_current_folder()] = msgs_number.split(',');  
     3683                $.ajax({                          
     3684                url: "controller.php?" + $.param( {action: "$this.imap_functions.getMessages",  
     3685            details : "all",  
     3686            messages : messages,  
     3687                        }),  
     3688                success: function(data){  
     3689                        data = connector.unserialize(data);  
     3690                        if(data){  
     3691                                data = data[get_current_folder()];  
     3692                print_list(newTbody(data));  
     3693                        }  
     3694                },  
     3695                beforeSend: function( jqXHR, settings ){  
     3696                        connector.showProgressBar();  
     3697                },  
     3698                complete: function( jqXHR, settings ){  
     3699                        connector.hideProgressBar();  
     3700                }  
     3701        });       
     3702        }  
    36763703} 
    36773704 
Note: See TracChangeset for help on using the changeset viewer.