Add: a color picker

Add: define a background color/image in mailing
This commit is contained in:
Regis Houssin 2009-05-19 13:27:44 +00:00
parent 8b0847ba66
commit 91624baceb
12 changed files with 514 additions and 23 deletions

View File

@ -26,7 +26,8 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/mailing.class.php';
require_once(DOL_DOCUMENT_ROOT."/comm/mailing/mailing.class.php");
require_once(DOL_DOCUMENT_ROOT."/html.formother.class.php");
$langs->load("mails");
@ -326,6 +327,14 @@ if ($_POST["action"] == 'add')
$mil->titre = trim($_POST["titre"]);
$mil->sujet = trim($_POST["sujet"]);
$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"));
@ -354,6 +363,14 @@ if ($_POST["action"] == 'update')
$mil->titre = $_POST["titre"];
$mil->sujet = $_POST["sujet"];
$mil->body = $_POST["body"];
$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())
{
@ -459,13 +476,15 @@ llxHeader("","","Fiche Mailing");
$html = new Form($db);
$htmlother = new FormOther($db);
$mil = new Mailing($db);
if ($_GET["action"] == 'create')
{
// EMailing in creation mode
print '<form action="fiche.php" method="post">'."\n";
print '<form name="new_mailing" action="fiche.php" method="post">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
@ -475,10 +494,13 @@ if ($_GET["action"] == 'create')
print '<table class="border" width="100%">';
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value=""></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>';
print '<tr><td colspan="2">&nbsp;</td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td><input class="flat" name="sujet" size="60" value=""></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td><input class="flat" name="sujet" size="60" value="'.$_POST['sujet'].'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("BackgroundColor").'</td><td colspan="3">';
$htmlother->select_color($_POST['bgcolor'],'bgcolor','new_mailing');
print '</td></tr>';
print '<tr><td width="25%" valign="top">'.$langs->trans("MailMessage").'<br>';
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
foreach($substitutionarray as $key => $val)
@ -491,12 +513,12 @@ if ($_GET["action"] == 'create')
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_MAILING)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$doleditor=new DolEditor('body','',320,'dolibarr_mailings','',true,true);
$doleditor=new DolEditor('body',$_POST['body'],320,'dolibarr_mailings','',true,true);
$doleditor->Create();
}
else
{
print '<textarea cols="70" rows="20" name="body"></textarea>';
print '<textarea cols="70" rows="20" name="body" value="'.$_POST['body'].'"></textarea>';
}
print '</td></tr>';
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("CreateMailing").'"></td></tr>';
@ -605,8 +627,16 @@ else
print '<td>'.dol_print_date($mil->date_envoi,"dayhour").'</td></tr>';
}
// Sujet
// 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>';
@ -737,7 +767,8 @@ else
/*
* Mailing en mode edition
*/
print '<form action="fiche.php" method="post">'."\n";
print '<form name="edit_mailing" action="fiche.php" method="post">'."\n";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$mil->id.'">';
@ -747,6 +778,9 @@ else
print '<tr><td width="25%">'.$langs->trans("MailTitle").'</td><td colspan="3"><input class="flat" type="text" size=40 name="titre" value="'.$mil->titre.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailFrom").'</td><td colspan="3"><input class="flat" type="text" size=40 name="from" value="'.$mil->email_from.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat" type="text" size=60 name="sujet" value="'.$mil->sujet.'"></td></tr>';
print '<tr><td width="25%">'.$langs->trans("BackgroundColor").'</td><td colspan="3">';
$htmlother->select_color($mil->bgcolor,'bgcolor','edit_mailing');
print '</td></tr>';
print '<tr><td width="25%" valign="top">'.$langs->trans("MailMessage").'<br>';
print '<br><i>'.$langs->trans("CommonSubstitutions").':<br>';
print '__ID__ = '.$langs->trans("IdRecord").'<br>';

View File

@ -45,6 +45,8 @@ class Mailing extends CommonObject
var $sujet;
var $body;
var $nbemail;
var $bgcolor;
var $bgimage;
var $email_from;
var $email_replyto;
@ -139,9 +141,11 @@ class Mailing extends CommonObject
{
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
$sql .= " SET titre = '".addslashes($this->titre)."'";
$sql .= " , sujet = '".addslashes($this->sujet)."'";
$sql .= " , body = '".addslashes($this->body)."'";
$sql .= " , email_from = '".$this->email_from."'";
$sql .= ", sujet = '".addslashes($this->sujet)."'";
$sql .= ", body = '".addslashes($this->body)."'";
$sql .= ", email_from = '".$this->email_from."'";
$sql .= ", bgcolor = '".($this->bgcolor?$this->bgcolor:null)."'";
$sql .= ", bgimage = '".($this->bgimage?$this->bgimage:null)."'";
$sql .= " WHERE rowid = ".$this->id;
dol_syslog("Mailing::Update sql=".$sql);
@ -165,7 +169,7 @@ class Mailing extends CommonObject
*/
function fetch($rowid)
{
$sql = "SELECT m.rowid, m.titre, m.sujet, m.body";
$sql = "SELECT m.rowid, m.titre, m.sujet, m.body, m.bgcolor, m.bgimage";
$sql .= ", m.email_from, m.email_replyto, m.email_errorsto";
$sql .= ", m.statut, m.nbemail";
$sql .= ", m.fk_user_creat, m.fk_user_valid";
@ -190,6 +194,8 @@ class Mailing extends CommonObject
$this->titre = $obj->titre;
$this->sujet = $obj->sujet;
$this->body = $obj->body;
$this->bgcolor = $obj->bgcolor;
$this->bgimage = $obj->bgimage;
$this->email_from = $obj->email_from;
$this->email_replyto = $obj->email_replyto;

View File

@ -185,6 +185,85 @@ class FormOther
print '<div class="warning">'.$langs->trans("NoProject").'</div>';
}
}
/**
* Affiche zone de selection de couleur
* @param set_color Couleur de pré-sélection
* @param prefix Prefix pour nom champ
* @param form_name Nom du formulaire de provenance.
*/
function select_color($set_color='', $prefix='f_color', $form_name='objForm')
{
print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.'/theme/common/colorpicker.css" />'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_colorpicker.js"></script>'."\n";
print '<script type="text/javascript">
window.onload = function()
{
fctLoad();
}
window.onscroll = function()
{
fctShow();
}
window.onresize = function()
{
fctShow();
}
</script>'."\n";
print '<input type="text" size="10" name="'.$prefix.'" value="'.$set_color.'" maxlength="7" style="font-family:Tahoma;font-size:x-small;">'."\n";
print '<img src="'.DOL_URL_ROOT.'/theme/common/colorpicker.png" width="21" height="20" border="0" align="absmiddle" onClick="fctShow(document.'.$form_name.'.'.$prefix.');" style="cursor:pointer;">'."\n";
}
/**
* Creation d'un icone de couleur
* @param color Couleur de l'image
* @param name Nom de l'image
*/
function CreateIcon($color,$name)
{
global $conf;
$file = $conf->mailing->dir_temp.'/'.$name.'.png';
// On cree le repertoire contenant les icones
if (! file_exists($conf->mailing->dir_temp))
{
create_exdir($conf->mailing->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);
$color = substr($color,1,6);
$rouge = hexdec(substr($color,0,2)); //conversion du canal rouge
$vert = hexdec(substr($color,2,2)); //conversion du canal vert
$bleu = hexdec(substr($color,4,2)); //conversion du canal bleu
$couleur = imagecolorallocate($image,$rouge,$vert,$bleu);
//print $rouge.$vert.$bleu;
imagefill($image,0,0,$couleur); //on remplit l'image
// On cree la couleur et on l'attribue à une variable pour ne pas la perdre
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.'">';
}
}

View File

@ -82,7 +82,7 @@ class modMailing extends DolibarrModules
$this->rights[1][0] = 221; // id de la permission
$this->rights[1][1] = 'Consulter les mailings'; // libelle de la permission
$this->rights[1][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[1][3] = 1; // La permission est-elle une permission par d<EFBFBD>faut
$this->rights[1][3] = 1; // La permission est-elle une permission par defaut
$this->rights[1][4] = 'lire';
$this->rights[2][0] = 222;

View File

@ -695,19 +695,12 @@ class CMailFile
* @param unknown_type $msg
* @return unknown
*/
function checkIfHTML($msg,$bg='')
function checkIfHTML($msg,$css='')
{
if (!eregi('^[ \t]*<html',$msg))
{
$out = "<html><head><title></title>";
if (!empty($bg))
{
$out.= '<style type="text/css">'
. 'body {'
. ' background-image: url("cid:'.$bg.'");'
. '}'
. '</style>';
}
if (!empty($css)) $out.= $css;
$out.= "</head><body>";
$out.= $msg;
$out.= "</body></html>";
@ -719,6 +712,24 @@ class CMailFile
return $out;
}
/**
* Build a css style
*
* @param $value
* @return css
*/
function buildCSS($value)
{
// Todo: finir la construction
$out = '<style type="text/css">'
. 'body {'
. ' background-image: url("cid:'.$bg.'");'
. '}'
. '</style>';
return $out;
}
/**
\brief Permet d'attacher un fichier

View File

@ -0,0 +1,260 @@
StringBuilder = function()
{
this.arrStr = new Array();
this.Append = function( inVAL )
{
this.arrStr[this.arrStr.length] = inVAL;
}
this.toString = function()
{
return this.arrStr.join('');
}
this.Init = function()
{
this.arrStr = null;
this.arrStr = new Array();
}
}
var objSB = new StringBuilder();
var arrGray = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
var arrSafe = new Array('00','33','66','99','CC','FF');
var arrSys = [['D4D0C8', 'ActiveBorder'],['0A246A', 'ActiveCaption'],['808080', 'AppWorkspace'],['3A6EA5', 'Background'],['D4D0C8', 'ButtonFace'],['FFFFFF', 'ButtonHighlight'],['808080', 'ButtonShadow'],['000000', 'ButtonText'],['FFFFFF', 'CaptionText'],['808080', 'GrayText'],['0A246A', 'Highlight'],['FFFFFF', 'HighlightText'],['D4D0C8', 'InactiveBorder'],['0A246A', 'InactiveCaption'],['D4D0C8', 'InactiveCaptionText'],['FFFFE1', 'InfoBackground'],['000000', 'InfoText'],['D4D0C8', 'Menu'],['000000', 'MenuText'],['D4D0C8', 'Scrollbar'],['404040', 'ThreedDarkShadow'],['D4D0C8', 'ThreedFace'],['FFFFFF', 'ThreedHighlight'],['D4D0C8', 'ThreedLightShadow'],['808080', 'ThreedShadow'],['FFFFFF', 'Window'],['000000', 'WindowFrame'],['000000', 'WindowText']];
var arrName = [['FF0000', 'red'],['FFFF00', 'yellow'],['00FF00', 'lime'],['00FFFF', 'cyan'],['0000FF', 'blue'],['FF00FF', 'magenta'],['FFFFFF', 'white'],['F5F5F5', 'whitesmoke'],['DCDCDC', 'gainsboro'],['D3D3D3', 'lightgrey'],['C0C0C0', 'silver'],['A9A9A9', 'darkgray'],['808080', 'gray'],['696969', 'dimgray'],['000000', 'black'],['2F4F4F', 'darkslategray'],['708090', 'slategray'],['778899', 'lightslategray'],['4682B4', 'steelblue'],['4169E1', 'royalblue'],['6495ED', 'cornflowerblue'],['B0C4DE', 'lightsteelblue'],['7B68EE', 'mediumslateblue'],['6A5ACD', 'slateblue'],['483D8B', 'darkslateblue'],['191970', 'midnightblue'],['000080', 'navy'],['00008B', 'darkblue'],['0000CD', 'mediumblue'],['1E90FF', 'dodgerblue'],['00BFFF', 'deepskyblue'],['87CEFA', 'lightskyblue'],['87CEEB', 'skyblue'],['ADD8E6', 'lightblue'],['B0E0E6', 'powderblue'],['F0FFFF', 'azure'],['E0FFFF', 'lightcyan'],['AFEEEE', 'paleturquoise'],['48D1CC', 'mediumturquoise'],['20B2AA', 'lightseagreen'],['008B8B', 'darkcyan'],['008080', 'teal'],['5F9EA0', 'cadetblue'],['00CED1', 'darkturquoise'],['00FFFF', 'aqua'],['40E0D0', 'turquoise'],['7FFFD4', 'aquamarine'],['66CDAA', 'mediumaquamarine'],['8FBC8F', 'darkseagreen'],['3CB371', 'mediumseagreen'],['2E8B57', 'seagreen'],['006400', 'darkgreen'],['008000', 'green'],['228B22', 'forestgreen'],['32CD32', 'limegreen'],['00FF00', 'lime'],['7FFF00', 'chartreuse'],['7CFC00', 'lawngreen'],['ADFF2F', 'greenyellow'],['98FB98', 'palegreen'],['90EE90', 'lightgreen'],['00FF7F', 'springgreen'],['00FA9A', 'mediumspringgreen'],['556B2F', 'darkolivegreen'],['6B8E23', 'olivedrab'],['808000', 'olive'],['BDB76B', 'darkkhaki'],['B8860B', 'darkgoldenrod'],['DAA520', 'goldenrod'],['FFD700', 'gold'],['F0E68C', 'khaki'],['EEE8AA', 'palegoldenrod'],['FFEBCD', 'blanchedalmond'],['FFE4B5', 'moccasin'],['F5DEB3', 'wheat'],['FFDEAD', 'navajowhite'],['DEB887', 'burlywood'],['D2B48C', 'tan'],['BC8F8F', 'rosybrown'],['A0522D', 'sienna'],['8B4513', 'saddlebrown'],['D2691E', 'chocolate'],['CD853F', 'peru'],['F4A460', 'sandybrown'],['8B0000', 'darkred'],['800000', 'maroon'],['A52A2A', 'brown'],['B22222', 'firebrick'],['CD5C5C', 'indianred'],['F08080', 'lightcoral'],['FA8072', 'salmon'],['E9967A', 'darksalmon'],['FFA07A', 'lightsalmon'],['FF7F50', 'coral'],['FF6347', 'tomato'],['FF8C00', 'darkorange'],['FFA500', 'orange'],['FF4500', 'orangered'],['DC143C', 'crimson'],['FF0000', 'red'],['FF1493', 'deeppink'],['FF00FF', 'fuchsia'],['FF69B4', 'hotpink'],['FFB6C1', 'lightpink'],['FFC0CB', 'pink'],['DB7093', 'palevioletred'],['C71585', 'mediumvioletred'],['800080', 'purple'],['8B008B', 'darkmagenta'],['9370DB', 'mediumpurple'],['8A2BE2', 'blueviolet'],['4B0082', 'indigo'],['9400D3', 'darkviolet'],['9932CC', 'darkorchid'],['BA55D3', 'mediumorchid'],['DA70D6', 'orchid'],['EE82EE', 'violet'],['DDA0DD', 'plum'],['D8BFD8', 'thistle'],['E6E6FA', 'lavender'],['F8F8FF', 'ghostwhite'],['F0F8FF', 'aliceblue'],['F5FFFA', 'mintcream'],['F0FFF0', 'honeydew'],['FAFAD2', 'lightgoldenrodyellow'],['FFFACD', 'lemonchiffon'],['FFF8DC', 'cornsilk'],['FFFFE0', 'lightyellow'],['FFFFF0', 'ivory'],['FFFAF0', 'floralwhite'],['FAF0E6', 'linen'],['FDF5E6', 'oldlace'],['FAEBD7', 'antiquewhite'],['FFE4C4', 'bisque'],['FFDAB9', 'peachpuff'],['FFEFD5', 'papayawhip'],['FFF5EE', 'seashell'],['FFF0F5', 'lavenderblush'],['FFE4E1', 'mistyrose'],['FFFAFA', 'snow']];
var intTdDisp = intTblDisp = 0;
var i = j = k = 0;
var objCurrent = objGray = objSafe = objSys = objName = objLegend = objPreview = objSelected = objPreviewTxt = objSelectedTxt = objGlobal = null;
var strColor = '', strColorTxt = '', strCurrent = '';
fctTblFeed = function()
{
if (intTdDisp != 16) {
for (i = intTdDisp; i < 16; i++) {
objSB.Append('<td class="tdColor"><a class="none" href="#">&nbsp;</a></td>');
intTblDisp++;
}
}
if (intTblDisp != 256) {
for (i = intTblDisp; i < 256; i++) {
if (i % 16 == 0) {objSB.Append('</tr><tr>');}
objSB.Append('<td class="tdColor"><a class="none" href="#">&nbsp;</a></td>');
}
}
}
fctIsInSys = function(strColor)
{
var strOut = '';
for (ii = 0; ii < arrSys.length; ii++) {
if (arrSys[ii][0] == strColor) {strOut = arrSys[ii][1]; break;}
}
return strOut;
}
fctIsInName = function(strColor)
{
var strOut = '';
for (ii = 0; ii < arrName.length; ii++) {
if (arrName[ii][0] == strColor) {strOut = arrName[ii][1]; break;}
}
return strOut;
}
fctOver = function(strColor, strTxt)
{
objPreview.style.backgroundColor = strColor;
objPreviewTxt.innerHTML = strColor + '<br>' + strTxt;
}
fctOut = function()
{
objPreview.style.backgroundColor = '';
objPreviewTxt.innerHTML = '';
}
fctSetColor = function(strColor, strTxt)
{
strCurrent = strColor;
objSelected.style.backgroundColor = strColor;
objSelectedTxt.innerHTML = strColor + '<br>' + strTxt;
}
fctSelect = function(strArr, strTxt)
{
objLegend.innerHTML = '&nbsp;' + strTxt + '&nbsp;';
objGray.style.display = (strArr == 'Gray') ? 'block' : 'none';
objSafe.style.display = (strArr == 'Safe') ? 'block' : 'none';
objSys.style.display = (strArr == 'Sys') ? 'block' : 'none';
objName.style.display = (strArr == 'Name') ? 'block' : 'none';
}
fctHide = function()
{
fctReset();
objGlobal.style.display = 'none';
objCurrent = null;
}
fctReset = function()
{
objSelected.style.backgroundColor = '';
objSelectedTxt.innerHTML = '';
strCurrent = '';
}
fctOk = function()
{
objCurrent.value = strCurrent.toUpperCase();
fctHide();
}
fctShow = function(objForm)
{
if (objForm) {
objCurrent = objForm;
if (objForm.value + '' != '') {
strColor = objForm.value.replace('#', '');
strColorTxt = '' + fctIsInName(strColor);
if (strColorTxt == '') {strColorTxt = '' + fctIsInSys(strColor);}
fctSetColor('#' + strColor, strColorTxt)
} else {
fctReset();
}
fctSelect('Name', 'Named');
}
if (objCurrent) {
var w = h = t = l = 0;
if (self.innerHeight) {
w = self.innerWidth;
h = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
} else if (document.body) {
w = document.body.clientWidth;
h = document.body.clientHeight;
}
if (self.pageYOffset) {
l = self.pageXOffset;
t = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop) {
l = document.documentElement.scrollLeft;
t = document.documentElement.scrollTop;
} else if (document.body) {
l = document.body.scrollLeft;
t = document.body.scrollTop;
}
if (objGlobal.style.display != 'block') {objGlobal.style.display = 'block';}
objGlobal.style.top = parseInt(((h - objGlobal.offsetHeight) / 2) + t, 10) + 'px';
objGlobal.style.left = parseInt(((w - objGlobal.offsetWidth) / 2) + l, 10) + 'px';
}
}
fctLoad = function()
{
var objDiv = document.createElement('DIV');
objDiv.id = 'objCP';
objDiv.style.display = 'inline';
document.body.appendChild(objDiv);
objDiv.innerHTML = objSB.toString();
objPreview = document.getElementById('objPreview');
objSelected = document.getElementById('objSelected');
objPreviewTxt = document.getElementById('objPreviewTxt');
objSelectedTxt = document.getElementById('objSelectedTxt');
objGlobal = document.getElementById('tblGlobal');
objGray = document.getElementById('tblGray');
objSafe = document.getElementById('tblSafe');
objSys = document.getElementById('tblSys');
objName = document.getElementById('tblName');
objLegend = document.getElementById('objLegend');
fctSelect('Name', 'Named');
}
objSB.Append('<table id="tblGlobal" class="tblGlobal" border="0" cellpadding="0" cellspacing="0"><tr><td class="tdContainer"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>');
objSB.Append('<td width="24%" align="center"><input type="button" value="Named" class="btnPalette" onClick="fctSelect(\'Name\', \'Named\');"></td>');
objSB.Append('<td width="23%" align="center"><input type="button" value="Safety" class="btnPalette" onClick="fctSelect(\'Safe\', \'Safety\');"></td>');
objSB.Append('<td width="23%" align="center"><input type="button" value="System" class="btnPalette" onClick="fctSelect(\'Sys\', \'System\');"></td>');
objSB.Append('<td width="30%" align="center"><input type="button" value="Grayscale" class="btnPalette" onClick="fctSelect(\'Gray\', \'Grayscale\');"></td>');
objSB.Append('</tr></table></td></tr><tr><td class="tdContainer"><fieldset><legend align="top" id="objLegend"></legend><table id="tblContainer" class="tblContainer" border="0" cellpadding="0" cellspacing="0"><tr><td class="tdContainer">');
objSB.Append('<table id="tblGray" class="tblColor" border="0" cellpadding="0" cellspacing="0"><tr>');
for (i = 0; i < arrGray.length; i++) {
for (j = 0; j < arrGray.length; j++) {
strColor = '' + arrGray[i] + arrGray[j] + arrGray[i] + arrGray[j] + arrGray[i] + arrGray[j];
strColorTxt = '' + fctIsInName(strColor);
if (strColorTxt == '') {strColorTxt = '' + fctIsInSys(strColor);}
objSB.Append('<td class="tdColor"><a class="color" href="javascript:fctSetColor(\'#' + strColor + '\', \'' + strColorTxt + '\');" style="background-color:#' + strColor + ';" onMouseOver="fctOver(\'#' + strColor + '\', \'' + strColorTxt + '\');" onMouseOut="fctOut();">&nbsp;</a></td>');
intTdDisp++;
intTblDisp++;
}
if (i < arrGray.length - 1) {
objSB.Append('</tr><tr>');
intTdDisp = 0;
}
}
fctTblFeed();
objSB.Append('</tr></table>');
intTdDisp = intTblDisp = 0;
objSB.Append('<table id="tblSafe" class="tblColor" border="0" cellpadding="0" cellspacing="0"><tr>');
for (i = 0; i < arrSafe.length; i++) {
for (j = 0; j < arrSafe.length; j++) {
for (k = 0; k < arrSafe.length; k++) {
if (intTblDisp % 16 == 0 && intTdDisp != 0) {
objSB.Append('</tr><tr>');
intTdDisp = 0;
}
strColor = '' + arrSafe[i] + arrSafe[j] + arrSafe[k];
strColorTxt = '' + fctIsInName(strColor);
if (strColorTxt == '') {strColorTxt = '' + fctIsInSys(strColor);}
objSB.Append('<td class="tdColor"><a class="color" href="javascript:fctSetColor(\'#' + strColor + '\', \'' + strColorTxt + '\');" style="background-color:#' + strColor + ';" onMouseOver="fctOver(\'#' + strColor + '\', \'' + strColorTxt + '\');" onMouseOut="fctOut();">&nbsp;</a></td>');
intTdDisp++;
intTblDisp++;
}
}
}
fctTblFeed();
objSB.Append('</tr></table>');
intTdDisp = intTblDisp = 0;
objSB.Append('<table id="tblSys" class="tblColor" border="0" cellpadding="0" cellspacing="0"><tr>');
for (i = 0; i < arrSys.length; i++) {
if (intTblDisp % 16 == 0 && intTdDisp != 0) {
objSB.Append('</tr><tr>');
intTdDisp = 0;
}
strColor = '' + arrSys[i][0];
strColorTxt = '' + arrSys[i][1];
objSB.Append('<td class="tdColor"><a class="color" href="javascript:fctSetColor(\'#' + strColor + '\', \'' + strColorTxt + '\');" style="background-color:#' + strColor + ';" onMouseOver="fctOver(\'#' + strColor + '\', \'' + strColorTxt + '\');" onMouseOut="fctOut();">&nbsp;</a></td>');
intTdDisp++;
intTblDisp++;
}
fctTblFeed();
objSB.Append('</tr></table>');
intTdDisp = intTblDisp = 0;
objSB.Append('<table id="tblName" class="tblColor" border="0" cellpadding="0" cellspacing="0"><tr>');
for (i = 0; i < arrName.length; i++) {
if (intTblDisp % 16 == 0 && intTdDisp != 0) {
objSB.Append('</tr><tr>');
intTdDisp = 0;
}
strColor = '' + arrName[i][0];
strColorTxt = '' + arrName[i][1];
objSB.Append('<td class="tdColor"><a class="color" href="javascript:fctSetColor(\'#' + strColor + '\', \'' + strColorTxt + '\');" style="background-color:#' + strColor + ';" onMouseOver="fctOver(\'#' + strColor + '\', \'' + strColorTxt + '\');" onMouseOut="fctOut();">&nbsp;</a></td>');
intTdDisp++;
intTblDisp++;
}
fctTblFeed();
objSB.Append('</tr></table></td></tr></table></fieldset></td></tr><tr><td class="tdContainer">');
objSB.Append('<table border="0" cellpadding="0" cellspacing="0" width="100%">');
objSB.Append('<tr><td class="tdDisplay" id="objPreview">&nbsp;</td><td class="tdDisplay" id="objSelected">&nbsp;</td></tr>');
objSB.Append('<tr><td class="tdDisplayTxt" id="objPreviewTxt" valign="top">&nbsp;</td><td class="tdDisplayTxt" id="objSelectedTxt" valign="top">&nbsp;</td></tr>');
objSB.Append('</table></td></tr><tr><td class="tdContainer">');
objSB.Append('<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>');
objSB.Append('<td width="33%" align="center"><input type="button" value="Cancel" class="btnColor" onClick="fctHide();"></td>');
objSB.Append('<td width="34%" align="center"><input type="button" value="Reset" class="btnColor" onClick="fctReset();"></td>');
objSB.Append('<td width="33%" align="center"><input type="button" value="Ok" class="btnColor" onClick="fctOk();"></td>');
objSB.Append('</tr></table></td></tr></table>');

View File

@ -753,7 +753,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<!-- Includes for Prototype (Used by Scriptaculous and PWC) -->'."\n";
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/includes/scriptaculous/lib/prototype.js"></script>'."\n";
}
// This one is required fox boxes
// This one is required for boxes
if (! defined('DISABLE_SCRIPTACULOUS'))
{
print '<!-- Includes for Scriptaculous (Used by Drag and drop and PWC) -->'."\n";

View File

@ -0,0 +1,90 @@
TABLE, THEAD, TBODY, TFOOT, TH, TR, TD {
margin : 0px;
padding : 0px;
border-spacing : 0px;
}
FIELDSET {
padding : 0px;
margin : 0px;
color : black;
}
LEGEND {
font-family : Tahoma;
font-size : 10pt;
color : black;
}
A.color, A.color:active, A.color:visited {
position : relative;
display : block;
text-decoration : none;
width : 10px;
height : 10px;
line-height : 10px;
margin : 0px;
padding : 0px;
border : 1px inset white;
}
A.color:hover {
border : 1px outset white;
}
A.none, A.none:active, A.none:visited, A.none:hover {
position : relative;
display : block;
text-decoration : none;
width : 10px;
height : 10px;
line-height : 10px;
margin : 0px;
padding : 0px;
cursor : default;
border : 1px solid threedface;
}
.tblColor {
display : none;
}
.tdColor {
padding : 1px;
}
.tblContainer {
background-color : threedface;
}
.tblGlobal {
position : absolute;
top : 0px;
left : 0px;
display : none;
background-color : threedface;
border : 2px outset;
}
.tdContainer {
padding : 5px;
}
.tdDisplay {
width : 50%;
height : 20px;
line-height : 20px;
border : 1px outset white;
}
.tdDisplayTxt {
width : 50%;
height : 24px;
line-height : 12px;
font-family : Tahoma;
font-size : 8pt;
color : black;
text-align : center;
}
.btnColor {
width : 100%;
font-family : Tahoma;
font-size : 10pt;
padding : 0px;
margin : 0px;
}
.btnPalette {
width : 100%;
font-family : Tahoma;
font-size : 8pt;
padding : 0px;
margin : 0px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

View File

@ -297,6 +297,13 @@ if ($modulepart)
//$original_file=$conf->barcode->dir_temp.'/'.$original_file;
$original_file='';
}
// Wrapping pour les icones de background des mailings
elseif ($modulepart == 'iconmailing')
{
$accessallowed=1;
$original_file=$conf->mailing->dir_temp.'/'.$original_file;
}
// Wrapping generique (allows any module to open a file if file is in directory
// called DOL_DATA_ROOT/modulepart).

View File

@ -142,3 +142,5 @@ ALTER TABLE llx_dolibarr_modules ADD PRIMARY KEY pk_dolibarr_modules (numero, en
alter table llx_commande_fournisseur add column ref_supplier varchar(30) after entity;
alter table llx_mailing add column bgcolor varchar(8) after body;
alter table llx_mailing add column bgimage varchar(255) after bgcolor;

View File

@ -33,6 +33,8 @@ create table llx_mailing
entity integer DEFAULT 1 NOT NULL, -- multi company id
sujet varchar(60), -- Sujet of mailing
body text,
bgcolor varchar(8), -- Backgroud color of mailing
bgimage varchar(255), -- Backgroud image of mailing
cible varchar(60),
nbemail integer,
email_from varchar(160), -- Email address of sender