diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 4f4b7c7d02a..673656454b0 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -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?'
':'').$langs->trans("ErrorFieldRequired",$langs->trans("MailTitle")); if (! $mil->sujet) $message.=($message?'
':'').$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 ''.$langs->trans("MailTopic").''.$mil->sujet.''; - - // Background color - if ($mil->bgcolor) - { - print ''.$langs->trans("BackgroundColor").''; - print $htmlother->img_icon($langs->trans("BackgroundColor"),$mil->id); - print ''; - } // Message print ''.$langs->trans("MailMessage").''; diff --git a/htdocs/comm/mailing/mailing.class.php b/htdocs/comm/mailing/mailing.class.php index 3e38769662a..fbad26ffc4b 100644 --- a/htdocs/comm/mailing/mailing.class.php +++ b/htdocs/comm/mailing/mailing.class.php @@ -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 = ''; diff --git a/htdocs/html.formother.class.php b/htdocs/html.formother.class.php index 288a22ba812..4e393e3907c 100644 --- a/htdocs/html.formother.class.php +++ b/htdocs/html.formother.class.php @@ -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 ''.$alt.''; - } + }