Fix: apercu du background inutile car en visu sur la fiche

This commit is contained in:
Regis Houssin 2009-05-19 17:14:17 +00:00
parent 842d240980
commit 29600cddb9
3 changed files with 10 additions and 41 deletions

View File

@ -333,12 +333,6 @@ if ($_POST["action"] == 'add')
$mil->body = trim($_POST["body"]);
$mil->bgcolor = trim($_POST["bgcolor"]);
$mil->bgimage = trim($_POST["bgimage"]);
if (!empty($mil->bgcolor))
{
$htmlother = new FormOther($db);
$htmlother->CreateIcon($mil->bgcolor,$mil->id);
}
if (! $mil->titre) $message.=($message?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTitle"));
if (! $mil->sujet) $message.=($message?'<br>':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTopic"));
@ -370,12 +364,6 @@ if ($_POST["action"] == 'update')
$mil->bgcolor = $_POST["bgcolor"];
$mil->bgimage = $_POST["bgimage"];
if (!empty($mil->bgcolor))
{
$htmlother = new FormOther($db);
$htmlother->CreateIcon($mil->bgcolor,$mil->id);
}
if ($mil->update())
{
Header("Location: fiche.php?id=".$mil->id);
@ -633,14 +621,6 @@ else
// Subject
print '<tr><td>'.$langs->trans("MailTopic").'</td><td colspan="3">'.$mil->sujet.'</td></tr>';
// Background color
if ($mil->bgcolor)
{
print '<tr><td>'.$langs->trans("BackgroundColor").'</td><td colspan="3">';
print $htmlother->img_icon($langs->trans("BackgroundColor"),$mil->id);
print '</td></tr>';
}
// Message
print '<tr><td valign="top">'.$langs->trans("MailMessage").'</td>';

View File

@ -255,6 +255,8 @@ class Mailing extends CommonObject
$object->titre = $langs->trans("Draft").' '.mktime();
$object->sujet = '';
$object->body = '';
$object->bgcolor = '';
$object->bgimage = '';
$object->email_from = '';
$object->email_replyto = '';

View File

@ -217,23 +217,22 @@ class FormOther
/**
* Creation d'un icone de couleur
* @param color Couleur de l'image
* @param module Nom du module
* @param name Nom de l'image
* @param x Largeur de l'image en pixels
* @param y Hauteur de l'image en pixels
*/
function CreateIcon($color,$name)
function CreateColorIcon($color,$module,$name,$x='12',$y='12')
{
global $conf;
$file = $conf->mailing->dir_temp.'/'.$name.'.png';
$file = $conf->$module->dir_temp.'/'.$name.'.png';
// On cree le repertoire contenant les icones
if (! file_exists($conf->mailing->dir_temp))
if (! file_exists($conf->$module->dir_temp))
{
create_exdir($conf->mailing->dir_temp);
create_exdir($conf->$module->dir_temp);
}
//header("Content-type: image/png");
$x = 12; //largeur de mon image en PIXELS uniquement !
$y = 12; //hauteur de mon image en PIXELS uniquement !
// On cree l'image en vraies couleurs
$image = imagecreatetruecolor($x,$y);
@ -251,19 +250,7 @@ class FormOther
ImagePng($image,$file); //renvoie une image sous format png
ImageDestroy($image);
}
/**
* Affiche logo
* @param alt Texte sur le alt de l'image
* @param name Nom de l'image
* @return string Retourne tag img
*/
function img_icon($alt = "default",$name)
{
global $langs;
if ($alt=="default") $alt=$langs->trans("Icon");
return '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=iconmailing&file='.$name.'.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
}
}