Prepare mail display iframe for printing

This commit is contained in:
Hadi Nategh 2015-02-12 09:04:34 +00:00
parent 64b4ca3b5a
commit 70021a9bb8

View File

@ -172,6 +172,12 @@ app.classes.mail = AppJS.extend(
this.mail_callRefreshVacationNotice(); this.mail_callRefreshVacationNotice();
break; break;
case 'mail.display': case 'mail.display':
var self = this;
// Prepare display dialog for printing
// copies iframe content to a DIV, as iframe causes
// trouble for multipage printing
jQuery('#mail-display_mailDisplayBodySrc').on('load', function(){self.mail_prepare_print()});
this.mail_isMainWindow = false; this.mail_isMainWindow = false;
this.mail_display(); this.mail_display();
@ -3940,10 +3946,13 @@ app.classes.mail = AppJS.extend(
}, },
/** /**
* Print a mail from Display * Prepare display dialog for printing
* copies iframe content to a DIV, as iframe causes
* trouble for multipage printing
* *
* @returns {undefined}
*/ */
mail_display_print: function () mail_prepare_print: function()
{ {
var mainIframe = jQuery('#mail-display_mailDisplayBodySrc'); var mainIframe = jQuery('#mail-display_mailDisplayBodySrc');
var tmpPrintDiv = jQuery('#tempPrintDiv'); var tmpPrintDiv = jQuery('#tempPrintDiv');
@ -3964,6 +3973,13 @@ app.classes.mail = AppJS.extend(
if (notAttached) jQuery('#mail-display_mailDisplayBodySrc').after(tmpPrintDiv); if (notAttached) jQuery('#mail-display_mailDisplayBodySrc').after(tmpPrintDiv);
tmpPrintDiv.find('#divAppboxHeader').remove(); tmpPrintDiv.find('#divAppboxHeader').remove();
},
/**
* Print a mail from Display
*/
mail_display_print: function ()
{
this.egw.message('Printing....'); this.egw.message('Printing....');
// Make sure the print happens after the content is loaded. Seems Firefox and IE can't handle timing for print command correctly // Make sure the print happens after the content is loaded. Seems Firefox and IE can't handle timing for print command correctly