- Allow database based preferences to read in default settings from the
default_pref file next to hardcoding them into the DB class, thanks
Thierry Godefroy.
+ - Reimplement printer friendly to make use of CSS.
Version 1.5.1 (branched on 2006-02-12)
--------------------------------------
}
# $encode_header_key
-sub command114{
+sub command114 {
print "Encryption key allows to hide SquirrelMail Received: headers\n";
print "in outbound messages. Interface uses encryption key to encode\n";
print "username, remote address and proxied address, then stores encoded\n";
/* printer friendly style, currently only targeted at read_body */
-#page_header, .readMenuBar, .spacer, form, #listcommands, .field_Options { display: none; }
-
-
+/* Drop any irrelevant stuff that's normally on the read_body page */
+#page_header, .readMenuBar, .spacer, form, #printMessageBox,
+ #listcommands, .field_Options, .attachActions { display: none; }
+/* Display attachment list a bit better */
+.header5 { font-size: larger; }
+.readAttachments td, .fieldName { padding-right: 1em; }
function formatToolbar($mailbox, $passed_id, $passed_ent_id, $message, $color) {
global $base_uri, $where, $what, $show_html_default,
- $oTemplate, $download_href,
+ $oTemplate, $download_href, $PHP_SELF,
$unsafe_image_toggle_href, $unsafe_image_toggle_text;
$urlMailbox = urlencode($mailbox);
}
$url = $base_uri.'src/view_header.php?'.$query_string;
-
- // Build the printer friend link
- /* hackydiehack */
-
- // Pull "view_unsafe_images" from the URL to find out if the unsafe images
- // should be displayed. The default is not to display unsafe images.
- if( !sqgetGlobalVar('view_unsafe_images', $view_unsafe_images, SQ_GET) ) {
- // If "view_unsafe_images" isn't part of the URL, default to not
- // displaying unsafe images.
- $view_unsafe_images = false;
+ if ( checkForJavaScript() ) {
+ $pf_params = 'javascript:printThis();';
} else {
- // If "view_unsafe_images" is part of the URL, display unsafe images
- // regardless of the value of the URL variable.
- // FIXME: Do we really want to display the unsafe images regardless of the value in URL variable?
- $view_unsafe_images = true;
+ $pf_params = set_url_var($PHP_SELF, 'print', '1');
}
- $pf_params = '?passed_ent_id=' . $urlPassed_ent_id .
- '&mailbox=' . $urlMailbox .
- '&passed_id=' . $urlPassed_id .
- '&view_unsafe_images='. (bool) $view_unsafe_images .
- '&show_html_default=' . $show_html_default;
-
$links = array();
$links[] = array (
'URL' => $url,
);
$links[] = array (
'URL' => $pf_params,
- 'Text' => _("View Printable Version")
+ 'Text' => _("Print"),
+ 'Target' => '_blank'
);
$links[] = array (
'URL' => $download_href,
$oTemplate->assign('message_list_href', get_message_list_uri($aMailbox['NAME'], $startMessage, $what));
displayPageHeader($color, $mailbox,'','');
-formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message,false);
+
+/* this is the non-javascript version of printer friendly */
+if ( sqgetGlobalVar('print', $print, SQ_GET) ) {
+ $oTemplate->display('read_message_print.tpl');
+} else {
+ formatMenubar($aMailbox, $passed_id, $passed_ent_id, $message,false);
+}
formatEnvheader($aMailbox, $passed_id, $passed_ent_id, $message, $color, $FirstTimeSee);
$oTemplate->assign('message_body', $messagebody);
background-color: #DCDCDC /* __COLOR0__ */;
}
-
+#printMessageBox {
+ background-color: #fffff0;
+ border: 1px solid #f2e93a;
+ margin: 1em;
+ padding: 1em;
+ font-size: x-large;
+}
}
}
}
+
+function printThis()
+{
+ parent.frames['right'].focus();
+ parent.frames['right'].print();
+}
--- /dev/null
+<?php
+/**
+ * read_message_print.tpl
+ *
+ * Let a non-JavaScript user know that they can print this page.
+ *
+ * @copyright © 2008 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id: read_menubar_nav.tpl 12415 2007-05-18 11:05:23Z pdontthink $
+ * @package squirrelmail
+ * @subpackage templates
+ */
+?>
+
+<div id="printMessageBox">
+<?php echo _("Use your web browser's Print button or File -> Print menu option to print this email. Afterwards, you can close this browser window again to return to SquirrelMail."); ?>
+</div>
* following elements:
* $link['URL'] - URL needed to access the action
* $link['Text'] - Text to be displayed for the action.
+ * $link['Target'] - Optional link target
*
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
if (empty($link['Text']))
continue;
- # Printer firendly link must be handled a little differently
- if ($link['Text'] == _("View Printable Version")) {
- if ($javascript_on) {
- ?>
- <script type="text/javascript">
- <!--
- function printFormat () {
- var print_win = window.open("../src/printer_friendly_main.php<?php echo $link['URL']; ?>", "Print", "width=800; height=600");
- print_win.focus();
- }
- // -->
- </script>
- <a href="javascript:printFormat()"><?php echo $link['Text']; ?></a>
- <?php
- } else {
- # everything else follows this format...
- ?>
- <a href="../src/printer_friendly_bottom.php<?php echo $link['URL']; ?>" target="_blank"><?php echo $link['Text']; ?></a>
- <?php
- }
- } else {
?>
- <a href="<?php echo $link['URL']; ?>"><?php echo $link['Text']; ?></a>
+ <a href="<?php echo $link['URL']; ?>"<?php echo (empty($link['Target'])?'':' target="' . $link['Target'] . '"')?>><?php echo $link['Text']; ?></a>
<?php
- }
# Spit out a divider between each element
if ($count < count($links)-1) {
background: #EEEEEE url(../images/grippie.png) no-repeat center 2px;
}
+#printMessageBox {
+ background-color: #fffff0;
+ border: 1px solid #f2e93a;
+ margin: 1em;
+ padding: 1em;
+ font-size: x-large;
+}
--- /dev/null
+<?php
+/**
+ * read_message_print.tpl
+ *
+ * Let a non-JavaScript user know that they can print this page.
+ *
+ * @copyright © 2008 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id: read_menubar_nav.tpl 12415 2007-05-18 11:05:23Z pdontthink $
+ * @package squirrelmail
+ * @subpackage templates
+ */
+?>
+
+<div id="printMessageBox">
+<?php echo _("Use your web browser's Print button or File -> Print menu option to print this email. Afterwards, you can close this browser window again to return to SquirrelMail."); ?>
+</div>