Index: /branches/2.4/expressoMail1_2/js/main.js
===================================================================
--- /branches/2.4/expressoMail1_2/js/main.js (revision 7510)
+++ /branches/2.4/expressoMail1_2/js/main.js (revision 7554)
@@ -3509,11 +3509,91 @@
}
-function print_all(){
- if (openTab.type[currentTab] == 2)
- return print_msg(current_folder,currentTab.substr(0,currentTab.indexOf("_r")),currentTab);
-
- if (currentTab != 0 && currentTab.indexOf("search_") >= 0){
- return print_search_msg();
- }
+/*PERMITE A IMPRESSÃO DE UMA LISTA DE MENSAGENS E SEU CONTEÃDO*/
+function print_messages_bodies(){
+ var messages = {};
+ messages[get_current_folder()] = get_selected_messages().split(',');
+
+ var print_bodies = function (data){
+ data = data[get_current_folder()];
+ var print_width = screen.width - 200;
+ var x = ((screen.width - print_width) / 2);
+ var y = ((screen.height - 400) / 2) - 35;
+ var window_print = window.open('','ExpressoMail','width='+print_width+',height=400,resizable=yes,scrollbars=yes,left='+x+',top='+y);
+ if(window_print == null) {
+ alert(get_lang("The Anti Pop-Up is enabled. Allow this site (%1) for print.",document.location.hostname));
+ return;
+ }
+ var header = ''
+ + '
';
+ window_print.document.write(header);
+ var printData ='' + cabecalho + '
';
+ window_print.document.write(printData);
+ var newRow = function(label,data){
+ return ""+label+" | "+data+" |
";
+ }
+ /*INSERE AS MENSAGENS NO DOCUMENTO DE IMPRESSÃO*/
+ $.each(data,function(index,message){
+ var html = "";
+ if(message.sender)
+ for(var i=0; i';
+ var atts = "";
+ $.each(message.attachments,function(index,attach){
+ atts += " | " + attach.name + "("+ formatBytes(attach.fsize) +") " + img + " | ";
+ });
+ html += newRow(get_lang('Attachments: '),atts);
+ }
+ html += '
';
+ if (message.body){
+ html += "
" + message.body;
+ }
+ html += "
";
+ window_print.document.write(html);
+ });
+ window_print.document.close();
+ window_print.print();
+ }
+ $.ajax({
+ url: "controller.php?" + $.param( {action: "$this.imap_functions.getMessages",
+ details: "all",
+ messages : messages,
+ }),
+ success: function(data){
+ data = connector.unserialize(data);
+ if(data){
+ print_bodies(data);
+ }
+ },
+ beforeSend: function( jqXHR, settings ){
+ connector.showProgressBar();
+ },
+ complete: function( jqXHR, settings ){
+ connector.hideProgressBar();
+ }
+ });
+}
+
+function print_messages_list(){
var folder= Element('border_id_0').innerHTML;
@@ -3522,5 +3602,5 @@
msgs_number = get_selected_messages();
if(msgs_number == false){
- var tbody = Element('divScrollMain_'+numBox).firstChild.firstChild.innerHTML;
+ var tbody = Element('divScrollMain_'+numBox).firstChild.firstChild.innerHTML;
}else{
msgs_number = msgs_number.split(",");
@@ -3566,4 +3646,33 @@
}
+function print_all(){
+ if(typeof (currentTab) == "string" && currentTab.indexOf("local") != -1){
+ alert("ImpossÃvel manipular mensagens locais a partir de uma busca. Isso é permitido apenas para mensagens não locais.");
+ return true;
+ }
+ if (openTab.type[currentTab] == 2)
+ return print_msg(current_folder,currentTab.substr(0,currentTab.indexOf("_r")),currentTab);
+
+ if (currentTab != 0 && currentTab.indexOf("search_") >= 0){
+ return print_search_msg();
+ }
+ if (get_selected_messages() == false){
+ return print_messages_list();
+ }
+ var msg = 'Algumas mensagens foram selecionadas para impressão. Deseja imprimir o conteúdo de cada uma delas? Caso contrário, apenas uma lista das mensagens selecionadas será impressa.';
+ $.Zebra_Dialog(msg, {
+ 'type': 'question',
+ 'buttons': ['Sim','Não'],
+ 'overlay_opacity': '0.5',
+ 'onClose': function(caption) {
+ if(caption == 'Sim'){
+ return print_messages_bodies();
+ }
+ else{
+ return print_messages_list();
+ }
+ }
+ });
+}
function print_msg(msg_folder, msg_number, border_ID){