From 962039e7be4abc32c97971cdb7b9945f0d771a5e Mon Sep 17 00:00:00 2001 From: Ilia Rostovtsev Date: Tue, 18 May 2021 23:44:52 +0300 Subject: [PATCH] Add better mail printing layout --- .../gray-virtual-server-style.css | 44 ++++++++++++++++++- mailboxes/reply_mail.cgi | 10 ----- mailboxes/view_mail.cgi | 2 +- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/gray-theme/unauthenticated/gray-virtual-server-style.css b/gray-theme/unauthenticated/gray-virtual-server-style.css index 10d6c987f..aee8d2175 100644 --- a/gray-theme/unauthenticated/gray-virtual-server-style.css +++ b/gray-theme/unauthenticated/gray-virtual-server-style.css @@ -251,4 +251,46 @@ br[data-x-br] { visibility: visible; opacity: 1; transition-duration: .5s -} \ No newline at end of file +} + +@media print { + body > .header, + body > .header ~ center, + .ui_form ~ a, + .ui_table a[href*=".cgi"], + .ui_form .ui_link, + .ui_form > center, + .ui_form > [name], + .ui_form > .wrapper, + .ui_form > .wrapper ~ .shrinkwrapper, + .ui_table > thead > tr > td:not(:first-child):last-child { + display: none; + } + + .ui_table > thead > tr > td > b { + font-size: 1.33em; + } + + .ui_table > thead >tr > td { + border-bottom: 2px solid #D9D9D9; + text-align: center; + position: relative; + padding: 10px; + } + + body > .header ~ .ui_form[action*=".cgi"]:first-of-type { + margin-top: -50px; + } + + pre { + white-space: pre-wrap; + } + + a { + word-break: break-word; + } + + a[href]:after { + content: none; + } +} diff --git a/mailboxes/reply_mail.cgi b/mailboxes/reply_mail.cgi index 2d7b0ee8d..bda89c2b7 100755 --- a/mailboxes/reply_mail.cgi +++ b/mailboxes/reply_mail.cgi @@ -102,16 +102,6 @@ else { "&dom=$in{'dom'}"); exit; } - elsif ($in{'print'}) { - # Show email for printing - &decode_and_sub(); - &ui_print_header(undef, &decode_mimewords( - $mail->{'header'}->{'subject'})); - &show_mail_printable($mail, $body, $textbody, $htmlbody); - print "\n"; - &ui_print_footer(); - exit; - } elsif ($in{'mark1'} || $in{'mark2'}) { # Just mark the message $mode = $in{'mark1'} ? $in{'mode1'} : $in{'mode2'}; diff --git a/mailboxes/view_mail.cgi b/mailboxes/view_mail.cgi index d12472e51..17414cc92 100755 --- a/mailboxes/view_mail.cgi +++ b/mailboxes/view_mail.cgi @@ -271,7 +271,7 @@ if (&is_user($in{'user'})) { print $spacer; } -print ""; +print ""; print $spacer; if (&is_user($in{'user'})) {