From: kink Date: Sat, 10 May 2008 12:27:45 +0000 (+0000) Subject: drop code related to old printer friendly X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=a540f994f3478529b1dc2ac78535cae774ba5af0 drop code related to old printer friendly git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13124 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/mime.php b/functions/mime.php index 32fafaaa..f253bab2 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -342,10 +342,9 @@ function translateText(&$body, $wrap_at, $charset) { * @param string $ent_num (since 1.3.0) message part id * @param integer $id (since 1.3.0) message id * @param string $mailbox (since 1.3.0) imap folder name - * @param boolean $clean (since 1.5.1) Do not output stuff that's irrelevant for the printable version. * @return string html formated message text */ -function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $mailbox='INBOX', $clean=FALSE) { +function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $mailbox='INBOX') { /* This if statement checks for the entity to show as the * primary message. To add more of them, just put them in the * order that is their priority. @@ -401,9 +400,7 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma $body = trim($body); translateText($body, $wrap_at, $body_message->header->getParameter('charset')); - } elseif ($use_iframe && ! $clean) { - // $clean is used to remove iframe in printable view. - + } elseif ($use_iframe) { /** * If we don't add html message between iframe tags, * we must detect unsafe images and modify $has_unsafe_images. @@ -443,11 +440,6 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma $body_message->header->getParameter('charset')); } - // if this is the clean display (i.e. printer friendly), stop here. - if ( $clean ) { - return $body; - } - /* * Previously the links for downloading and unsafe images were printed * under the mail. By putting the links in a global variable we can @@ -503,9 +495,7 @@ function formatBody($imap_stream, $message, $color, $wrap_at, $ent_num, $id, $ma } /** - * Generate attachments array for passing to templates. Separated from - * formatAttachments() below so that the same array can be given to the - * print-friendly version. + * Generate attachments array for passing to templates. * * @since 1.5.2 * @param object $message SquirrelMail message object diff --git a/help/en_US/options.hlp b/help/en_US/options.hlp index 31d6508a..b5b10269 100644 --- a/help/en_US/options.hlp +++ b/help/en_US/options.hlp @@ -163,14 +163,6 @@ the message.

- Enable Subtle Printer Friendly Link
- This determines the way the Printable Version-link will be displayed. -

- - Enable Printer Friendly Clean Display
- This will clean out the message so the print looks nicer. -

- Other Options
Depending on the configuration of your SquirrelMail installation, some more options might be displayed here. They hopefully should be self-explanatory. diff --git a/src/printer_friendly_bottom.php b/src/printer_friendly_bottom.php deleted file mode 100644 index 9b5e6c0d..00000000 --- a/src/printer_friendly_bottom.php +++ /dev/null @@ -1,173 +0,0 @@ -getEntity($passed_ent_id); -} - -/* --start display setup-- */ - -$rfc822_header = $message->rfc822_header; -/* From and Date are usually fine as they are... */ -$from = $rfc822_header->getAddr_s('from'); -$date = getLongDateString($rfc822_header->date, $rfc822_header->date_unparsed); -$subject = trim($rfc822_header->subject); - -/* we can clean these up if the list is too long... */ -$cc = $rfc822_header->getAddr_s('cc'); -$to = $rfc822_header->getAddr_s('to'); - -if ($show_html_default == 1) { - $ent_ar = $message->findDisplayEntity(array()); -} else { - $ent_ar = $message->findDisplayEntity(array(), array('text/plain')); -} -$body = ''; -if ($ent_ar[0] != '') { - for ($i = 0; $i < count($ent_ar); $i++) { - $body .= formatBody($imapConnection, $message, $color, $wrap_at, $ent_ar[$i], $passed_id, $mailbox, TRUE); - if ($i < count($ent_ar)-1) { - $body .= '
'; - } - } - /* Note that $body is passed to this hook (and modified) by reference as of 1.5.2 */ - do_hook('message_body', $body); -} else { - $body = _("Message not printable"); -} - -/* now we clean up the display a bit... */ - -$num_leading_spaces = 9; // nine leading spaces for indentation - -// sometimes I see ',,' instead of ',' separating addresses *shrug* -$cc = pf_clean_string(str_replace(',,', ',', $cc), $num_leading_spaces); -$to = pf_clean_string(str_replace(',,', ',', $to), $num_leading_spaces); - -// clean up everything else... -$subject = pf_clean_string($subject, $num_leading_spaces); -$from = pf_clean_string($from, $num_leading_spaces); -$date = pf_clean_string($date, $num_leading_spaces); - -// end cleanup - -$to = decodeHeader($to); -$cc = decodeHeader($cc); -$from = decodeHeader($from); -$subject = decodeHeader($subject); - -// --end display setup-- - - -/* --start browser output-- */ -displayHtmlHeader($subject); - -$aHeaders = array(); -$aHeaders[ _("From") ] = $from; -$aHeaders[ _("Subject") ] = $subject; -$aHeaders[ _("Date") ] = htmlspecialchars($date); -$aHeaders[ _("To") ] = $to; -$aHeaders[ _("Cc") ] = $cc; - -$attachments_ar = buildAttachmentArray($message, $ent_ar, $mailbox, $passed_id); - -$oTemplate->assign('headers', $aHeaders); -$oTemplate->assign('message_body', $body); -$oTemplate->assign('attachments', $attachments_ar); - -$oTemplate->display('printer_friendly_bottom.tpl'); -$oTemplate->display('footer.tpl'); - -/* --end browser output-- */ - - -/* --start pf-specific functions-- */ - -/** - * Function should clean layout of printed messages when user - * enables "Printer Friendly Clean Display" option. - * For example: $string = pf_clean_string($string, 9); - * - * @param string unclean_string - * @param integer num_leading_spaces - * @return string - * @access private - */ -function pf_clean_string ( $unclean_string, $num_leading_spaces ) { - global $data_dir, $username; - $unclean_string = str_replace(' ',' ',$unclean_string); - $wrap_at = getPref($data_dir, $username, 'wrap_at', 86); - $wrap_at = $wrap_at - $num_leading_spaces; /* header stuff */ - - $leading_spaces = ''; - while ( strlen($leading_spaces) < $num_leading_spaces ) - $leading_spaces .= ' '; - - $clean_string = ''; - while ( strlen($unclean_string) > $wrap_at ) - { - $this_line = substr($unclean_string, 0, $wrap_at); - if ( strrpos( $this_line, "\n" ) ) /* this should NEVER happen with anything but the $body */ - { - $clean_string .= substr( $this_line, 0, strrpos( $this_line, "\n" )); - $clean_string .= $leading_spaces; - $unclean_string = substr($unclean_string, strrpos( $this_line, "\n" )); - } - else - { - $i = strrpos( $this_line, ' '); - $clean_string .= substr( $this_line, 0, $i); - $clean_string .= "\n" . $leading_spaces; - $unclean_string = substr($unclean_string, 1+$i); - } - } - $clean_string .= $unclean_string; - - return $clean_string; -} /* end pf_clean_string() function */ diff --git a/src/printer_friendly_main.php b/src/printer_friendly_main.php deleted file mode 100644 index 8c0c03d6..00000000 --- a/src/printer_friendly_main.php +++ /dev/null @@ -1,45 +0,0 @@ -setDelayedErrors(true); - - $url = 'printer_friendly_bottom.php?passed_ent_id=' . - urlencode($passed_ent_id) . '&mailbox=' . urlencode($mailbox) . - '&passed_id=' . $passed_id . - '&view_unsafe_images='.$view_unsafe_images . - '&show_html_default='.$show_html_default; - - $oTemplate->assign('printer_friendly_url', $url); - - $oTemplate->display('printer_friendly_main.tpl'); - -} diff --git a/src/printer_friendly_top.php b/src/printer_friendly_top.php deleted file mode 100644 index 2473f1a5..00000000 --- a/src/printer_friendly_top.php +++ /dev/null @@ -1,28 +0,0 @@ -setDelayedErrors(true); - -$oTemplate->display('printer_friendly_top.tpl'); - -$oTemplate->display('footer.tpl'); diff --git a/templates/default/css/default.css b/templates/default/css/default.css index 38161ae0..caffe3a7 100644 --- a/templates/default/css/default.css +++ b/templates/default/css/default.css @@ -1022,35 +1022,6 @@ div.readInlineImages td.image { padding:10px; } -div.printerFriendlyTop table { - width:100%; -} - -div.printerFriendlyTop td { - text-align: right; -} - -div.printerFriendly table.attach { - width: 100%; - margin-top:5px; - margin-bottom:5px; -} - -div.printerFriendly td.attachField { - width: 30%; - font-weight: bold; - text-align: right; -} - -div.printerFriendly td.attachFieldValue { - text-align: left; - empty-cells: show; -} - -div.printerFriendly td.attachName { - font-weight: bold; -} - div.viewHeader table.table1 { width: 100%; } diff --git a/templates/default/printer_friendly_bottom.tpl b/templates/default/printer_friendly_bottom.tpl deleted file mode 100644 index 14433544..00000000 --- a/templates/default/printer_friendly_bottom.tpl +++ /dev/null @@ -1,111 +0,0 @@ - -
- - $value) { - # If the value is empty, skip the entry. - if (empty($value)) - continue; - ?> - - - - - -
- : - - -
-
- - 0) { - ?> -
- - - - - - - - - - - - - - - - - - -
- -
- : - - -
- - - -
- - - -
- -
diff --git a/templates/default/printer_friendly_main.tpl b/templates/default/printer_friendly_main.tpl deleted file mode 100644 index 9d201050..00000000 --- a/templates/default/printer_friendly_main.tpl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - diff --git a/templates/default/printer_friendly_top.tpl b/templates/default/printer_friendly_top.tpl deleted file mode 100644 index cc70774d..00000000 --- a/templates/default/printer_friendly_top.tpl +++ /dev/null @@ -1,41 +0,0 @@ - - -
- - - - -
- " onclick="printPopup()" /> - " onclick="window.parent.close()" /> -
-
\ No newline at end of file