Changeset 7523 for trunk


Ignore:
Timestamp:
11/14/12 16:03:42 (11 years ago)
Author:
angelo
Message:

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

Location:
trunk/expressoMail1_2/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/expressoMail1_2/js/draw_api.js

    r7494 r7523  
    18971897 
    18981898                td_element2 = createTDElement(0,1,"td_msg"); 
    1899                 if (headers_msgs.attachment == 1 || headers_msgs.attachment.number_attachments> 0) 
     1899                if (headers_msgs.attachment && (headers_msgs.attachment == 1 || headers_msgs.attachment.number_attachments> 0)) 
    19001900                        td_element2.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' >"; 
    19011901 
  • trunk/expressoMail1_2/js/main.js

    r7522 r7523  
    38943894} 
    38953895 
     3896function newTbody(messages){ 
     3897        var tbody = $("<tbody>"); 
     3898        $.each(messages,function(index,msg){ 
     3899                var newTr = make_tr_message(msg,get_current_folder(),msg.offsetToGMT); 
     3900                if (msg.attachments && msg.attachments.length){ 
     3901                        $(newTr).find('td').eq(1).html("<img src ='templates/"+template+"/images/clip.gif'>"); 
     3902                }                
     3903                tbody.append(newTr); 
     3904        }); 
     3905        return tbody.html(); 
     3906} 
     3907 
    38963908function print_messages_list(){ 
    3897         var folder= Element('border_id_0').innerHTML; 
    3898         //var thead = Element('divScrollHead_'+numBox).firstChild.firstChild.innerHTML;  
    3899          
     3909        var print_list = function(tbody,folder){ 
     3910                var print_width = screen.width - 200; 
     3911                var x = ((screen.width - print_width) / 2); 
     3912                var y = ((screen.height - 400) / 2) - 35; 
     3913                var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y); 
     3914                seekDot = (is_ie ? /width=24/gi : /width="24"/gi); 
     3915                //thead = thead.replace(seekDot, "style='display:none'");  
     3916                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>"; 
     3917                tbody = tbody.replace(seekDot, "style='display:none'"); 
     3918                seekDot = (is_ie ? /width=16/gi : /width="16"/gi); 
     3919                //thead = thead.replace(seekDot, "style='display:none'");  
     3920                tbody = tbody.replace(seekDot, "style='display:none'"); 
     3921                seekDot = (is_ie ? /width=12/gi : /width="12"/gi); 
     3922                //thead = thead.replace(seekDot, "style='display:none'");  
     3923                tbody = tbody.replace(seekDot, "style='display:none'"); 
     3924                while (1){ 
     3925                        try{ 
     3926                                window_print.document.open(); 
     3927                                var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>' 
     3928                                + '<head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>' 
     3929                            + cabecalho + '</h4><hr>'  
     3930                                + '<h2>'+$('#border_id_0').html()+'</h2><hr/><blockquote><font size="2">' 
     3931                                + '<table width="100%" cellpadding="0" cellspacing="0">' 
     3932                                + '<thead>' + thead + '</thead><tbody>' + tbody + '</tbody>' 
     3933                                + '</table></font></blockquote></body></html>'; 
     3934                                window_print.document.write(html); 
     3935                                window_print.document.close(); 
     3936                                break; 
     3937                        } 
     3938                        catch(e){ 
     3939                                //alert(e.message); 
     3940                        } 
     3941                } 
     3942                window_print.document.close(); 
     3943                window_print.print(); 
     3944        } 
    39003945        msgs_number = get_selected_messages(); 
    39013946        if(msgs_number == false){ 
    3902                 var tbody = Element('divScrollMain_'+numBox).firstChild.firstChild.innerHTML; 
     3947                var tbody = Element('divScrollMain_0').firstChild.firstChild.innerHTML; 
     3948                print_list(tbody); 
    39033949        }else{ 
    3904                 msgs_number = msgs_number.split(","); 
    3905                 var tbody = ""; 
    3906                 for(var i = 0; i < msgs_number.length; i++){ 
    3907                         tbody += "<tr id="+msgs_number[i]+" class=\"tr_msg_unread tr_msg_read2\">"+$("#"+msgs_number[i]).clone().find(".checkbox").remove().end().html()+"</tr>"; 
    3908                 }        
    3909         } 
    3910         var print_width = screen.width - 200; 
    3911         var x = ((screen.width - print_width) / 2); 
    3912         var y = ((screen.height - 400) / 2) - 35; 
    3913         var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y); 
    3914         seekDot = (is_ie ? /width=24/gi : /width="24"/gi); 
    3915         //thead = thead.replace(seekDot, "style='display:none'");  
    3916         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>"; 
    3917         tbody = tbody.replace(seekDot, "style='display:none'"); 
    3918         seekDot = (is_ie ? /width=16/gi : /width="16"/gi); 
    3919         //thead = thead.replace(seekDot, "style='display:none'");  
    3920         tbody = tbody.replace(seekDot, "style='display:none'"); 
    3921         seekDot = (is_ie ? /width=12/gi : /width="12"/gi); 
    3922         //thead = thead.replace(seekDot, "style='display:none'");  
    3923         tbody = tbody.replace(seekDot, "style='display:none'"); 
    3924         while (1){ 
    3925                 try{ 
    3926                         window_print.document.open(); 
    3927                         var html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html>' 
    3928                         + '<head><link rel="stylesheet" type="text/css" href="templates/'+template+'/print.css"></head>' 
    3929                     + cabecalho + '</h4><hr>'  
    3930                         + '<h2>'+folder+'</h2><hr/><blockquote><font size="2">' 
    3931                         + '<table width="100%" cellpadding="0" cellspacing="0">' 
    3932                         + '<thead>' + thead + '</thead><tbody>' + tbody + '</tbody>' 
    3933                         + '</table></font></blockquote></body></html>'; 
    3934                         window_print.document.write(html); 
    3935                         window_print.document.close(); 
    3936                         break; 
    3937                 } 
    3938                 catch(e){ 
    3939                         //alert(e.message); 
    3940                 } 
    3941         } 
    3942         window_print.document.close(); 
    3943         window_print.print(); 
     3950                var messages = {}; 
     3951                messages[get_current_folder()] = msgs_number.split(','); 
     3952                $.ajax({                         
     3953                url: "controller.php?" + $.param( {action: "$this.imap_functions.getMessages", 
     3954            details : "all", 
     3955            messages : messages, 
     3956                        }), 
     3957                success: function(data){ 
     3958                        data = connector.unserialize(data); 
     3959                        if(data){ 
     3960                                data = data[get_current_folder()]; 
     3961                print_list(newTbody(data)); 
     3962                        } 
     3963                }, 
     3964                beforeSend: function( jqXHR, settings ){ 
     3965                        connector.showProgressBar(); 
     3966                }, 
     3967                complete: function( jqXHR, settings ){ 
     3968                        connector.hideProgressBar(); 
     3969                } 
     3970        });      
     3971        } 
    39443972} 
    39453973 
Note: See TracChangeset for help on using the changeset viewer.