From 2ad37738cea6347cc3f7d32b7349427b016aa200 Mon Sep 17 00:00:00 2001 From: kink Date: Thu, 8 May 2008 10:19:18 +0000 Subject: [PATCH] Add preliminary printerfriendly-through-css feature. This adds a new print.css stylesheet that is used when using the browser's print (or print preview) function. A problem is that due to the frames, it won't work if selecting File -> Print because this will print webmail.php instead of read_body. To see it in action, open read_body on its own and use File -> Print Preview. It would be nice if this could replace the printer_friendly function over time, because it's purely css based and thus doesn't require extra code. For that we need to finetune the sheet and most importantly, conquer the frames-problem in some smart way. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13121 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- css/print.css | 7 +++++++ functions/page_header.php | 3 +++ .../default/plugins/listcommands/read_body_header.tpl | 2 +- templates/default/read_headers.tpl | 2 +- templates/default_advanced/read_headers.tpl | 2 +- 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 css/print.css diff --git a/css/print.css b/css/print.css new file mode 100644 index 00000000..3a6acd39 --- /dev/null +++ b/css/print.css @@ -0,0 +1,7 @@ +/* printer friendly style, currently only targeted at read_body */ + +#page_header, .readMenuBar, .spacer, form, #listcommands, .field_Options { display: none; } + + + + diff --git a/functions/page_header.php b/functions/page_header.php index e7cf9733..22413f41 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -96,6 +96,9 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE $header_tags .= $oTemplate->fetch_right_to_left_stylesheet_link(); } + // 5. Printer friendly stylesheet + $header_tags .= create_css_link($base_uri . 'css/print.css', 'printerfriendly', false, 'print'); + if ($squirrelmail_language == 'ja_JP') { /* * force correct detection of charset, when browser does not follow diff --git a/templates/default/plugins/listcommands/read_body_header.tpl b/templates/default/plugins/listcommands/read_body_header.tpl index 9bbcc08f..92eaeabf 100644 --- a/templates/default/plugins/listcommands/read_body_header.tpl +++ b/templates/default/plugins/listcommands/read_body_header.tpl @@ -24,7 +24,7 @@ extract($t); ?> - + : diff --git a/templates/default/read_headers.tpl b/templates/default/read_headers.tpl index 0600e2fa..5a24ccd6 100644 --- a/templates/default/read_headers.tpl +++ b/templates/default/read_headers.tpl @@ -43,7 +43,7 @@ extract($t); continue; } ?> - + : diff --git a/templates/default_advanced/read_headers.tpl b/templates/default_advanced/read_headers.tpl index da573fb2..09af4150 100644 --- a/templates/default_advanced/read_headers.tpl +++ b/templates/default_advanced/read_headers.tpl @@ -92,7 +92,7 @@ extract($t); continue; } ?> - +