From c1b4dc38636c71475c44624d69bf4e845be1c014 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Wed, 19 Aug 2009 16:39:08 +0000
Subject: [PATCH] New: Can add parameter &optioncss=print on url to have a page
 ready to print (menu removed)

---
 htdocs/lib/usergroups.lib.php              | 2 +-
 htdocs/theme/auguria/auguria.css.php       | 4 ++++
 htdocs/theme/bluelagoon/bluelagoon.css.php | 6 +++++-
 htdocs/theme/eldy/eldy.css.php             | 5 ++++-
 htdocs/theme/freelug/freelug.css.php       | 7 +++++--
 htdocs/theme/rodolphe/rodolphe.css.php     | 6 +++++-
 htdocs/theme/yellow/yellow.css.php         | 6 +++++-
 7 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/htdocs/lib/usergroups.lib.php b/htdocs/lib/usergroups.lib.php
index c3e49045f9a..3410d47e928 100644
--- a/htdocs/lib/usergroups.lib.php
+++ b/htdocs/lib/usergroups.lib.php
@@ -173,7 +173,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
             $file=$dirtheme."/".$subdir."/thumb.png";
             if (! file_exists($file)) $file=$dirtheme."/common/nophoto.jpg";
             print '<table><tr><td>';
-			print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
+			print '<a href="'.$_SERVER["PHP_SELF"].($edit?'?action=edit&theme=':'?theme=').$subdir.(! empty($_GET["optioncss"])?'&optioncss='.$_GET["optioncss"]:'').($fuser?'&id='.$fuser->id:'').'" style="font-weight: normal;" alt="'.$langs->trans("Preview").'">';
 			if ($subdir == $conf->global->MAIN_THEME) $title=$langs->trans("ThemeCurrentlyActive");
 			else $title=$langs->trans("ShowPreview");
             print '<img src="'.$file.'" border="0" width="80" height="60" alt="'.$title.'" title="'.$title.'">';
diff --git a/htdocs/theme/auguria/auguria.css.php b/htdocs/theme/auguria/auguria.css.php
index 22c8790f509..aace2a21c44 100644
--- a/htdocs/theme/auguria/auguria.css.php
+++ b/htdocs/theme/auguria/auguria.css.php
@@ -44,7 +44,11 @@ $left=($langs->direction=='rtl'?'right':'left');
 /* ============================================================================== */
 
 body {
+<?php if (! empty($_GET["optioncss"]) && $_GET["optioncss"] == 'print') {  ?>
+	background-color: #FFFFFF;
+<?php } else { ?>
     background-color: #FFFFFF;
+<?php } ?>
 	color: #101010;
 	font-size: 12px;
     font-family: arial, sans-serif, verdana, helvetica;
diff --git a/htdocs/theme/bluelagoon/bluelagoon.css.php b/htdocs/theme/bluelagoon/bluelagoon.css.php
index 940146295c5..3cda1f28a99 100644
--- a/htdocs/theme/bluelagoon/bluelagoon.css.php
+++ b/htdocs/theme/bluelagoon/bluelagoon.css.php
@@ -43,7 +43,11 @@ $left=($langs->direction=='rtl'?'right':'left');
 
 /***** Style du fond *****/
 body {
-	background: #e0ebeb;
+<?php if (! empty($_GET["optioncss"]) && $_GET["optioncss"] == 'print') {  ?>
+	background-color: #FFFFFF;
+<?php } else { ?>
+	background-color: #e0ebeb;
+<?php } ?>
 	margin: 0px;
 	font: 12px helvetica, verdana, arial, sans-serif;
 }
diff --git a/htdocs/theme/eldy/eldy.css.php b/htdocs/theme/eldy/eldy.css.php
index 86cab91efd7..e1e7917e1f7 100644
--- a/htdocs/theme/eldy/eldy.css.php
+++ b/htdocs/theme/eldy/eldy.css.php
@@ -46,8 +46,11 @@ $left=($langs->direction=='rtl'?'right':'left');
 /* ============================================================================== */
 
 body {
-    background-color: #F4F4F4;
+<?php if (! empty($_GET["optioncss"]) && $_GET["optioncss"] == 'print') {  ?>
+	background-color: #FFFFFF;
+<?php } else { ?>
 	background: #f9f9f9 url(<?php echo DOL_URL_ROOT.'/theme/eldy/img/headbg.jpg' ?>) 0 0 no-repeat;
+<?php } ?>
 	color: #101010;
 	font-size: 12px;
     font-family: arial,tahoma,verdana,helvetica;
diff --git a/htdocs/theme/freelug/freelug.css.php b/htdocs/theme/freelug/freelug.css.php
index fe573a72047..d6d51d5e82b 100644
--- a/htdocs/theme/freelug/freelug.css.php
+++ b/htdocs/theme/freelug/freelug.css.php
@@ -44,8 +44,11 @@ $left=($langs->direction=='rtl'?'right':'left');
 /* ============================================================================== */
 
 body {
-	background-color: #F8F8F8;
-	background-image: url(<?php echo DOL_URL_ROOT.'/theme/freelug/img/background.png' ?>);
+<?php if (! empty($_GET["optioncss"]) && $_GET["optioncss"] == 'print') {  ?>
+	background-color: #FFFFFF;
+<?php } else { ?>
+	background: #F8F8F8 url(<?php echo DOL_URL_ROOT.'/theme/freelug/img/background.png' ?>);
+<?php } ?>
 	text-decoration: none ;
 	color: #101010;
 	font-size: 12px;
diff --git a/htdocs/theme/rodolphe/rodolphe.css.php b/htdocs/theme/rodolphe/rodolphe.css.php
index 5b5a225a980..1ea24597b10 100644
--- a/htdocs/theme/rodolphe/rodolphe.css.php
+++ b/htdocs/theme/rodolphe/rodolphe.css.php
@@ -43,7 +43,11 @@ $left=($langs->direction=='rtl'?'right':'left');
 
 /***** Style du fond *****/
 body {
-  background: #AAA5A0;
+<?php if (! empty($_GET["optioncss"]) && $_GET["optioncss"] == 'print') {  ?>
+	background-color: #FFFFFF;
+<?php } else { ?>
+	background-color: #AAA5A0;
+<?php } ?>
   font-size: 12px;
   font-family: helvetica, verdana, arial, sans-serif;
   margin-top: 0;
diff --git a/htdocs/theme/yellow/yellow.css.php b/htdocs/theme/yellow/yellow.css.php
index a09749d4417..29f9848baba 100644
--- a/htdocs/theme/yellow/yellow.css.php
+++ b/htdocs/theme/yellow/yellow.css.php
@@ -44,7 +44,11 @@ $left=($langs->direction=='rtl'?'right':'left');
 /* ============================================================================== */
 
 body {
-  background: #ebebe0;
+<?php if (! empty($_GET["optioncss"]) && $_GET["optioncss"] == 'print') {  ?>
+	background-color: #FFFFFF;
+<?php } else { ?>
+	background-color: #ebebe0;
+<?php } ?>
   font-size: 12px;
   font-family: helvetica, verdana, arial, sans-serif;
   margin-top: 0;
-- 
GitLab