From: Michael M Slusarz Date: Fri, 7 May 2010 21:51:55 +0000 (-0600) Subject: Don't use onclick to print in DIMP X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a0cfa639ea8d383320cc01be3d781aebfed42bb7;p=horde.git Don't use onclick to print in DIMP --- diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index 7d4dcb48a..58ef96fc3 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -2086,6 +2086,10 @@ var DimpBase = { this._closeRedBox(); e.stop(); return; + } else if (elt.hasClassName('printAtc')) { + DimpCore.popupWindow(DimpCore.addURLParam(DIMP.conf.URI_VIEW, { uid: this.pp.imapuid, mailbox: this.pp.view, actionID: 'print_attach', id: elt.getAttribute('mimeid') }, true), this.pp.imapuid + '|' + this.pp.view + '|print', IMP.printWindow); + e.stop(); + return; } } diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index 432215d39..d0ea2a45b 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -25,7 +25,8 @@ class IMP_Contents const SUMMARY_DOWNLOAD_ZIP = 256; const SUMMARY_IMAGE_SAVE = 512; const SUMMARY_PRINT = 1024; - const SUMMARY_STRIP_LINK = 2048; + const SUMMARY_PRINT_STUB = 2048; + const SUMMARY_STRIP_LINK = 4096; /* Rendering mask entries. */ const RENDER_FULL = 1; @@ -569,6 +570,7 @@ class IMP_Contents * Output: parts = 'img_save' * * IMP_Contents::SUMMARY_PRINT + * IMP_Contents::SUMMARY_PRINT_STUB * Output: parts = 'print' * * IMP_Contents::SUMMARY_STRIP_LINK @@ -660,16 +662,19 @@ class IMP_Contents /* Display the image save link if the required registry calls are * present. */ - if (($mask && self::SUMMARY_IMAGE_SAVE) && + if (($mask & self::SUMMARY_IMAGE_SAVE) && $GLOBALS['registry']->hasMethod('images/selectGalleries') && ($mime_part->getPrimaryType() == 'image')) { $part['img_save'] = Horde::link('#', _("Save Image in Gallery"), 'saveImgAtc', null, Horde::popupJs(Horde::applicationUrl('saveimage.php'), array('params' => array('mbox' => $this->_mailbox, 'uid' => $this->_uid, 'id' => $id), 'height' => 200, 'width' => 450)) . 'return false;') . ''; } /* Add print link? */ - if (($mask && self::SUMMARY_PRINT) && + if ((($mask & self::SUMMARY_PRINT) || + ($mask & self::SUMMARY_PRINT_STUB)) && $this->canDisplay($id, self::RENDER_FULL)) { - $part['print'] = $this->linkViewJS($mime_part, 'print_attach', '', array('css' => 'printAtc', 'jstext' => _("Print"), 'onload' => 'IMP.printWindow', 'params' => $param_array)); + $part['print'] = ($mask & self::SUMMARY_PRINT) + ? $this->linkViewJS($mime_part, 'print_attach', '', array('css' => 'printAtc', 'jstext' => _("Print"), 'onload' => 'IMP.printWindow', 'params' => $param_array)) + : Horde::link('#', _("Print"), 'printAtc', null, null, null, null, array('mimeid' => $id)) . ''; } /* Strip Attachment? Allow stripping of base parts other than the diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index 7bf07edc3..9866e0b95 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -97,7 +97,7 @@ class IMP_Views_ShowMessage $result = array( 'js' => array(), 'mailbox' => $mailbox, - 'uid' => $uid + 'uid' => intval($uid) ); /* Set the current time zone. */