Fix: the background color does not appear

This commit is contained in:
Regis Houssin 2009-11-18 15:40:17 +00:00
parent 7a782a28ed
commit 90de66b702

View File

@ -62,7 +62,10 @@ class CMailFile
//CSS //CSS
var $css; var $css;
//! Defined css style for body background
var $styleCSS; var $styleCSS;
//! Defined bacckground directly in body tag
var $bodyCSS;
// Image // Image
var $html; var $html;
@ -191,7 +194,7 @@ class CMailFile
if (!empty($css)) if (!empty($css))
{ {
$this->css = $css; $this->css = $css;
$this->styleCSS = $this->buildCSS(); $this->buildCSS();
} }
$msg = $this->html; $msg = $this->html;
@ -765,7 +768,9 @@ class CMailFile
{ {
$out = "<html><head><title></title>"; $out = "<html><head><title></title>";
if (!empty($this->styleCSS)) $out.= $this->styleCSS; if (!empty($this->styleCSS)) $out.= $this->styleCSS;
$out.= "</head><body>"; $out.= "</head><body";
if (!empty($this->bodyCSS)) $out.= $this->bodyCSS;
$out.= ">";
$out.= $msg; $out.= $msg;
$out.= "</body></html>"; $out.= "</body></html>";
} }
@ -784,27 +789,25 @@ class CMailFile
*/ */
function buildCSS() function buildCSS()
{ {
$out = ''; if (! empty($this->css))
if (!empty($this->css))
{ {
$out.= '<style type="text/css">'; // Style CSS
$out.= 'body {'; $this->styleCSS = '<style type="text/css">';
$this->styleCSS.= 'body {';
if ($this->css['bgcolor']) if ($this->css['bgcolor'])
{ {
$out.= ' background-color: '.$this->css['bgcolor'].';'; $this->styleCSS.= ' background-color: '.$this->css['bgcolor'].';';
$this->bodyCSS.= ' BGCOLOR="'.$this->css['bgcolor'].'"';
} }
if ($this->css['bgimage']) if ($this->css['bgimage'])
{ {
// TODO recuperer cid // TODO recuperer cid
$out.= ' background-image: url("cid:'.$this->css['bgimage_cid'].'");'; $this->styleCSS.= ' background-image: url("cid:'.$this->css['bgimage_cid'].'");';
} }
$out.= '}'; $this->styleCSS.= '}';
$out.= '</style>'; $this->styleCSS.= '</style>';
} }
return $out;
} }
/** /**