Resolves Ticket #8708.
* DEFAULT: 650 px
* 'menu' - (boolean) Show the browser menu in the popup window?
* DEFAULT: false
+ * 'onload' - (string) A JS function to call after the popup window is
+ * fully loaded.
+ * DEFAULT: None
* 'params' - (array) Additional parameters to pass to the URL.
* DEFAULT: None
- * 'urlencode' - (boolean) URL encode the json string
+ * 'urlencode' - (boolean) URL encode the json string?
* DEFAULT: No
* 'width' - (integer) The width of the popup window.
* DEFAULT: 700 px
if (!empty($options['height'])) {
$params->height = $options['height'];
}
- if (!empty($options['width'])) {
- $params->width = $options['width'];
+ if (!empty($options['menu'])) {
+ $params->menu = 1;
+ }
+ if (!empty($options['onload'])) {
+ $params->onload = $options['onload'];
}
if (!empty($options['params'])) {
$params->params = http_build_query(array_map('rawurlencode', $options['params']));
}
- if (!empty($options['menu'])) {
- $params->menu = 1;
+ if (!empty($options['width'])) {
+ $params->width = $options['width'];
}
return 'Horde.popup(' . self::escapeJson($params, array('urlencode' => !empty($options['urlencode']))) . ');';
* @param object $opts The following params:
* 'height' - The height of the popup window. (Default: 650 px)
* 'menu' - Show the browser menu in the popup? (Default: no)
+ * 'onload' - A function to call when the window is loaded. (Default: none)
* 'params' - Any additional params to pass to the script. (Default: no args)
* 'width' - The width of the popup window. (Default: 700 px)
* 'url' - The URL to open in the popup window.
params.set('uniq', name);
win = window.open(url + '?' + params.toQueryString(), name, 'menubar=' + menu + ',toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height + ',left=0,top=0');
+
if (!win) {
alert(Horde.popup_block_text);
} else {
+ if (opts.onload) {
+ opts.onload = eval(opts.onload);
+ win.onload = opts.onload.curry(win);
+ }
if (Object.isUndefined(win.name)) {
win.name = name;
}
<case name="false" desc="No" />
</configswitch>
</configsection>
-
- <configsection name="print">
- <configheader>Print Options</configheader>
- <configboolean name="add_printedby" desc="Should we add a "Printed
- By" header to the top of all printed messages?">false</configboolean>
- </configsection>
</configtab>
<configtab name="compose" desc="Compose">
id = elt.readAttribute('id');
switch (id) {
- case 'msg_print':
- window.print();
- break;
-
case 'largeaddrspan_active':
tmp = elt.down();
if (!tmp.next().visible() ||
}
};
+ IMP.printWindow = function(win)
+ {
+ win.print();
+ win.close();
+ };
+
// If menu is present, attach event handlers to folder switcher.
var tmp = $('openfoldericon');
if (tmp) {
this.submit('spam_report');
} else if (elt.hasClassName('notspamAction')) {
this.submit('notspam_report');
- } else if (elt.hasClassName('printAction')) {
- window.print();
}
} else if (elt.hasClassName('unblockImageLink')) {
IMP.unblockImages(e);
const SUMMARY_DOWNLOAD_NOJS = 128;
const SUMMARY_DOWNLOAD_ZIP = 256;
const SUMMARY_IMAGE_SAVE = 512;
- const SUMMARY_STRIP_LINK = 1024;
+ const SUMMARY_PRINT = 1024;
+ const SUMMARY_STRIP_LINK = 2048;
/* Rendering mask entries. */
const RENDER_FULL = 1;
* IMP_Contents::SUMMARY_IMAGE_SAVE
* Output: parts = 'img_save'
*
+ * IMP_Contents::SUMMARY_PRINT
+ * Output: parts = 'print'
+ *
* IMP_Contents::SUMMARY_STRIP_LINK
* Output: parts = 'strip'
* </pre>
$part['img_save'] = Horde::link('#', _("Save Image in Gallery"), 'saveImgAtc', null, Horde::popupJs(Horde::applicationUrl('saveimage.php'), array('params' => array('uid' => ($this->_uid . IMP::IDX_SEP . $this->_mailbox), 'id' => $id), 'height' => 200, 'width' => 450)) . 'return false;') . '</a>';
}
+ /* Add print link? */
+ if ($mask && self::SUMMARY_PRINT) {
+ $part['print'] = $this->linkViewJS($mime_part, 'view_attach', '', array('css' => 'printAtc', 'onload' => 'IMP.printWindow', 'jstext' => _("Print"), 'params' => $param_array));
+ }
+
/* Strip Attachment? Allow stripping of base parts other than the
* base multipart and the base text (body) part. */
if (($mask & self::SUMMARY_STRIP_LINK) &&
* <pre>
* 'css' - (string) The CSS class to use.
* 'jstext' - (string) The javascript link text.
+ * 'onload' - (string) A JS function to run when popup window is
+ * fully loaded.
* 'params' - (array) A list of any additional parameters that need to be
* passed to view.php. (key = name)
* 'widget' - (boolean) If true use Horde::widget() to generate,
$options['jstext'] = sprintf(_("View %s"), $mime_part->getDescription(true));
}
- $url = Horde::popupJs(Horde::applicationUrl('view.php'), array('menu' => true, 'params' => $this->_urlViewParams($mime_part, $actionID, isset($options['params']) ? $options['params'] : array()), 'urlencode' => true)) . 'return false;';
+ $url = Horde::popupJs(Horde::applicationUrl('view.php'), array('menu' => true, 'onload' => empty($options['onload']) ? '' : $options['onload'], 'params' => $this->_urlViewParams($mime_part, $actionID, isset($options['params']) ? $options['params'] : array()), 'urlencode' => true)) . 'return false;';
return empty($options['widget'])
? Horde::link('#', $options['jstext'], empty($options['css']) ? null : $options['css'], null, $url) . $text . '</a>'
IMP_Contents::SUMMARY_ICON |
IMP_Contents::SUMMARY_DESCRIP_LINK |
IMP_Contents::SUMMARY_DOWNLOAD |
- IMP_Contents::SUMMARY_DOWNLOAD_ZIP;
+ IMP_Contents::SUMMARY_DOWNLOAD_ZIP |
+ IMP_Contents::SUMMARY_PRINT;
- $part_info = $part_info_display = array('icon', 'description', 'size', 'download', 'download_zip');
+ $part_info = $part_info_display = array('icon', 'description', 'size', 'download', 'download_zip', 'print');
/* Do MDN processing now. */
if ($imp_ui->MDNCheck($mailbox, $uid, $mime_headers)) {
$scripts = array(
array('ContextSensitive.js', 'horde'),
- array('fullmessage-dimp.js', 'imp')
+ array('fullmessage-dimp.js', 'imp'),
+ array('imp.js', 'imp')
);
$js_onload = $js_out = array();
$imp_params = IMP::getIMPMboxParameters($imp_mbox['mailbox'], $uid, $mailbox_name);
$a_template->set('save_as', Horde::widget(Horde::downloadUrl($subject, array_merge(array('actionID' => 'save_message'), $imp_params)), _("Save as"), 'widget', '', '', _("Sa_ve as"), 2));
-$a_template->set('print', Horde::widget('#', _("Print"), 'widget printAction', '', '', _("_Print"), true));
-
if ($conf['spam']['reporting'] &&
($conf['spam']['spamfolder'] ||
($mailbox_name != IMP::folderPref($prefs->getValue('spam_folder'), true)))) {
/* Determine the fields that will appear in the MIME info entries. */
$part_info = $part_info_display = array('icon', 'description', 'size');
-$part_info_action = array('download', 'download_zip', 'img_save', 'strip');
+$part_info_action = array('download', 'download_zip', 'img_save', 'strip', 'print');
$show_parts = Horde_Util::getFormData('show_parts', $prefs->getValue('parts_display'));
$strip_atc = $prefs->getValue('strip_attachments');
IMP_Contents::SUMMARY_DESCRIP_LINK |
IMP_Contents::SUMMARY_DOWNLOAD |
IMP_Contents::SUMMARY_DOWNLOAD_ZIP |
- IMP_Contents::SUMMARY_IMAGE_SAVE;
+ IMP_Contents::SUMMARY_IMAGE_SAVE |
+ IMP_Contents::SUMMARY_PRINT;
if (!$readonly && $strip_atc) {
$contents_mask |= IMP_Contents::SUMMARY_STRIP_LINK;
}
);
}
-if (!empty($conf['print']['add_printedby'])) {
- $hdrs[] = array(
- 'class' => 'printedby',
- 'name' => _("Printed By"),
- 'val' => $user_identity->getFullname() ? $user_identity->getFullname() : Horde_Auth::getAuth(),
- 'i' => (++$i % 2)
- );
-}
-
$m_template->set('headers', $hdrs);
$m_template->set('msgtext', $mdntext . $inlineout['msgtext']);
<div class="msgHeaders">
<div id="msgHeaders">
<div class="dimpOptions">
- <div>
- <span id="msg_print">
- <span class="iconImg"></span>
- <a><?php echo _("Print") ?></a>
- </span>
- </div>
<?php if (!empty($conf['user']['allow_view_source'])): ?>
<div>
<span id="msg_view_source">
<a><?php echo _("Open in new window") ?></a>
</span>
</div>
- <div>
- <span id="msg_print">
- <span class="iconImg"></span>
- <a><?php echo _("Print") ?></a>
- </span>
- </div>
<?php if (!empty($conf['user']['allow_view_source'])): ?>
<div>
<span id="msg_view_source">
<if:view_source><li><tag:view_source /></li></if:view_source>
<if:resume><li><tag:resume /></li></if:resume>
<li><tag:save_as /></li>
- <li><tag:print /></li>
<if:readonly><else:readonly>
<if:spam><li><tag:spam /></li></if:spam>
<if:notspam><li><tag:notspam /></li></if:notspam>
margin-left: 4px;
margin-right: 0;
}
-#msg_print span.iconImg {
- background-image: url("graphics/print.png");
-}
#quota span.iconImg {
background-image: url("graphics/quotauncover.gif");
width: 0;
#Growler div.imp-forward, div.imp-redirect, span.imp-forward, span.imp-redirect {
background-image: url("graphics/mail_forwarded.png");
}
-
-
-/* Print CSS rules. */
-@media print {
- #dimpmain {
- position: relative;
- left: 0 !important;
- margin-left: 0;
- top: 0;
- }
-
- #previewPane {
- overflow: visible !important;
- }
-
- #msgSplitPane {
- border: 0;
- }
-
- #msgHeaders, .dispaddrlist {
- display: block !important;
- }
-
- #sidebar, #dimpmain_folder_top, #msgSplitPane .msglist, div.sbdiv, .splitBarVertSidebar, .splitBarHoriz, #toggleHeaders, #Growler, #GrowlerLog, #writemsg, .dimpActions, .dimpOptions {
- display: none !important;
- }
-
- a.address {
- padding: 0 !important;
- }
-}
margin-left: 3px;
}
-/* Message view styling. */
-#msgheaders tr.printedby {
- display: none;
-}
-
/* Newmail alerts. */
#newmail {
padding: 1em;
border-color: #ffd0af;
}
-.downloadAtc, .downloadZipAtc, .saveImgAtc, .closeImg, .deleteImg, .foldersImg, .searchuiImg, .reloadImg {
+.downloadAtc, .downloadZipAtc, .saveImgAtc, .printAtc, .closeImg, .deleteImg, .foldersImg, .searchuiImg, .reloadImg {
display: -moz-inline-stack;
display: inline-block;
height: 16px;
.downloadZipAtc {
background-image: url("graphics/mime/compressed.png");
}
+.printAtc {
+ background-image: url("graphics/print.png");
+}
.saveImgAtc {
background-image: url("graphics/gallery.png");
}
#itipconflicts tr.itipnearcollision {
background-color: #ee0;
}
-
-
-/* Print CSS rules. */
-@media print {
- body {
- background: #fff;
- }
-
- a, a:visited {
- color: #000;
- }
-
- #msgheaders tr.printedby {
- display: table-row !important;
- }
-
- .label {
- min-width: 60px;
- text-align: right;
- font-weight: bold;
- }
-
- #msgHeadersColl, .context, .address img, .mimeStatusMessage, .largeaddrlist, #msgAtc, table.msgActionTable, #messages h1.header, table.navbaractions, td.msgheader img, tr.msgheaderParts, .downloadAtc, .downloadZipAtc {
- display: none !important;
- }
-}
#msg_newwin span.iconImg, #msg_newwin_options span.iconImg {
background-image: url("graphics/newwin.png");
}
-#msg_print span.iconImg {
- background-image: url("graphics/print.png");
-}
#qsearch_icon {
background-image: url("graphics/search.png");
.reloadImg {
background-image: url("graphics/reload.png");
}
+
+.printAtc {
+ background-image: url("graphics/print.png");
+}