New: Ajout bouton annuler sur formulaire envoi mail

This commit is contained in:
Laurent Destailleur 2006-08-06 13:35:19 +00:00
parent 9fe3f06928
commit 053f12ded1

View File

@ -1,5 +1,5 @@
<?PHP <?PHP
/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -59,16 +59,18 @@ class FormMail
var $withtoccreadonly; var $withtoccreadonly;
var $withtopicreadonly; var $withtopicreadonly;
var $withdeliveryreceipt; var $withdeliveryreceipt;
var $withcancel;
var $substit=array(); var $substit=array();
var $param=array(); var $param=array();
var $errorstr; var $errorstr;
/** \brief Constructeur
/**
\brief Constructeur
\param DB handler d'accès base de donnée \param DB handler d'accès base de donnée
*/ */
function FormMail($DB) function FormMail($DB)
{ {
$this->db = $DB; $this->db = $DB;
@ -109,7 +111,8 @@ class FormMail
/* /*
* \brief Affiche la partie de formulaire pour saisie d'un mail en fonction des propriétés * \brief Affiche la partie de formulaire pour saisie d'un mail en fonction des propriétés
*/ */
function show_form() { function show_form()
{
global $conf, $langs, $user; global $conf, $langs, $user;
$langs->load("other"); $langs->load("other");
@ -119,7 +122,8 @@ class FormMail
print "\n<!-- Debut form mail -->\n"; print "\n<!-- Debut form mail -->\n";
print "<form method=\"post\" ENCTYPE=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n"; print "<form method=\"post\" ENCTYPE=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
foreach ($this->param as $key=>$value) { foreach ($this->param as $key=>$value)
{
print "<input type=\"hidden\" name=\"$key\" value=\"$value\">\n"; print "<input type=\"hidden\" name=\"$key\" value=\"$value\">\n";
} }
print "<table class=\"border\" width=\"100%\">\n"; print "<table class=\"border\" width=\"100%\">\n";
@ -127,7 +131,8 @@ class FormMail
// From // From
if ($this->withfrom) if ($this->withfrom)
{ {
if ($this->withfromreadonly) { if ($this->withfromreadonly)
{
print '<input type="hidden" name="fromname" value="'.$this->fromname.'">'; print '<input type="hidden" name="fromname" value="'.$this->fromname.'">';
print '<input type="hidden" name="frommail" value="'.$this->frommail.'">'; print '<input type="hidden" name="frommail" value="'.$this->frommail.'">';
print "<tr><td width=\"180\">".$langs->trans("MailFrom")."</td><td>".$this->fromname.($this->frommail?(" &lt;".$this->frommail."&gt;"):"")."</td></tr>\n"; print "<tr><td width=\"180\">".$langs->trans("MailFrom")."</td><td>".$this->fromname.($this->frommail?(" &lt;".$this->frommail."&gt;"):"")."</td></tr>\n";
@ -138,7 +143,8 @@ class FormMail
// Replyto // Replyto
if ($this->withreplyto) if ($this->withreplyto)
{ {
if ($this->withreplytoreadonly) { if ($this->withreplytoreadonly)
{
print '<input type="hidden" name="replyname" value="'.$this->replytoname.'">'; print '<input type="hidden" name="replyname" value="'.$this->replytoname.'">';
print '<input type="hidden" name="replymail" value="'.$this->replytomail.'">'; print '<input type="hidden" name="replymail" value="'.$this->replytomail.'">';
print "<tr><td>".$langs->trans("MailReply")."</td><td>".$this->replytoname.($this->replytomail?(" &lt;".$this->replytomail."&gt;"):""); print "<tr><td>".$langs->trans("MailReply")."</td><td>".$this->replytoname.($this->replytomail?(" &lt;".$this->replytomail."&gt;"):"");
@ -147,11 +153,15 @@ class FormMail
} }
// To // To
if ($this->withto || is_array($this->withto)) { if ($this->withto || is_array($this->withto))
{
print '<tr><td width="180">'.$langs->trans("MailTo").'</td><td>'; print '<tr><td width="180">'.$langs->trans("MailTo").'</td><td>';
if ($this->withtoreadonly) { if ($this->withtoreadonly)
{
print (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:""; print (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
} else { }
else
{
print "<input size=\"30\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)?$this->withto:"")."\">"; print "<input size=\"30\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)?$this->withto:"")."\">";
if (is_array($this->withto)) if (is_array($this->withto))
{ {
@ -166,9 +176,12 @@ class FormMail
if ($this->withcc) if ($this->withcc)
{ {
print '<tr><td width="180">'.$langs->trans("MailCC").'</td><td>'; print '<tr><td width="180">'.$langs->trans("MailCC").'</td><td>';
if ($this->withtoccreadonly) { if ($this->withtoccreadonly)
{
print (! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:""; print (! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"";
} else { }
else
{
print "<input size=\"30\" name=\"sendtocc\" value=\"".((! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"")."\">"; print "<input size=\"30\" name=\"sendtocc\" value=\"".((! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"")."\">";
if (is_array($this->withtocc)) if (is_array($this->withtocc))
{ {
@ -184,7 +197,8 @@ class FormMail
{ {
print '<tr><td width="180">'.$langs->trans("DeliveryReceipt").'</td><td>'; print '<tr><td width="180">'.$langs->trans("DeliveryReceipt").'</td><td>';
if ($this->withdeliveryreceiptreadonly) { if ($this->withdeliveryreceiptreadonly)
{
print yn($this->withdeliveryreceipt); print yn($this->withdeliveryreceipt);
} }
else else
@ -203,7 +217,8 @@ class FormMail
print "<tr>"; print "<tr>";
print "<td width=\"180\">".$langs->trans("MailTopic")."</td>"; print "<td width=\"180\">".$langs->trans("MailTopic")."</td>";
print "<td>"; print "<td>";
if ($this->withtopicreadonly) { if ($this->withtopicreadonly)
{
print $this->withtopic; print $this->withtopic;
print "<input type=\"hidden\" size=\"60\" name=\"subject\" value=\"".$this->withtopic."\">"; print "<input type=\"hidden\" size=\"60\" name=\"subject\" value=\"".$this->withtopic."\">";
} }
@ -255,7 +270,14 @@ class FormMail
print "</td></tr>\n"; print "</td></tr>\n";
} }
print "<tr><td align=center colspan=2><center><input class=\"button\" type=\"submit\" value=\"".$langs->trans("SendMail")."\"></center></td></tr>\n"; print "<tr><td align=center colspan=2><center>";
print "<input class=\"button\" type=\"submit\" name=\"sendmail\" value=\"".$langs->trans("SendMail")."\">";
if ($this->withcancel)
{
print " &nbsp; &nbsp; ";
print "<input class=\"button\" type=\"submit\" name=\"cancel\" value=\"".$langs->trans("Cancel")."\">";
}
print "</center></td></tr>\n";
print "</table>\n"; print "</table>\n";
print "</form>\n"; print "</form>\n";