Fix: w3c
Fix: possibility to use show_form in ajax
This commit is contained in:
parent
775bcffe6e
commit
4edb72495d
@ -36,6 +36,8 @@ class FormMail
|
|||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
|
||||||
|
var $withform;
|
||||||
|
|
||||||
var $fromname;
|
var $fromname;
|
||||||
var $frommail;
|
var $frommail;
|
||||||
var $replytoname;
|
var $replytoname;
|
||||||
@ -73,6 +75,8 @@ class FormMail
|
|||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
|
|
||||||
|
$this->withform=1;
|
||||||
|
|
||||||
$this->withfrom=1;
|
$this->withfrom=1;
|
||||||
$this->withto=1;
|
$this->withto=1;
|
||||||
$this->withtocc=1;
|
$this->withtocc=1;
|
||||||
@ -186,12 +190,25 @@ class FormMail
|
|||||||
* @param removefileaction Name of action when removing file attachments
|
* @param removefileaction Name of action when removing file attachments
|
||||||
*/
|
*/
|
||||||
function show_form($addfileaction='addfile',$removefileaction='removefile')
|
function show_form($addfileaction='addfile',$removefileaction='removefile')
|
||||||
|
{
|
||||||
|
print $this->get_form($addfileaction,$removefileaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the form to input an email
|
||||||
|
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||||
|
* @param addfileaction Name of action when posting file attachments
|
||||||
|
* @param removefileaction Name of action when removing file attachments
|
||||||
|
*/
|
||||||
|
function get_form($addfileaction='addfile',$removefileaction='removefile')
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
|
|
||||||
|
$out='';
|
||||||
|
|
||||||
// Define list of attached files
|
// Define list of attached files
|
||||||
$listofpaths=array();
|
$listofpaths=array();
|
||||||
$listofnames=array();
|
$listofnames=array();
|
||||||
@ -203,26 +220,29 @@ class FormMail
|
|||||||
|
|
||||||
$form=new Form($DB);
|
$form=new Form($DB);
|
||||||
|
|
||||||
print "\n<!-- Debut form mail -->\n";
|
$out.= "\n<!-- Debut form mail -->\n";
|
||||||
print "<form method=\"POST\" name=\"mailform\" enctype=\"multipart/form-data\" action=\"".$this->param["returnurl"]."\">\n";
|
if ($this->withform)
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
{
|
||||||
|
$out.= '<form method="POST" name="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">'."\n";
|
||||||
|
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
|
||||||
|
}
|
||||||
foreach ($this->param as $key=>$value)
|
foreach ($this->param as $key=>$value)
|
||||||
{
|
{
|
||||||
print "<input type=\"hidden\" name=\"$key\" value=\"$value\">\n";
|
$out.= '<input type="hidden" id="'.$key.'" name="'.$key.'" value="'.$value.'" />'."\n";
|
||||||
}
|
}
|
||||||
print "<table class=\"border\" width=\"100%\">\n";
|
$out.= '<table class="border" width="100%">'."\n";
|
||||||
|
|
||||||
// Substitution array
|
// Substitution array
|
||||||
if ($this->withsubstit)
|
if ($this->withsubstit)
|
||||||
{
|
{
|
||||||
print "<tr><td colspan=\"2\">";
|
$out.= '<tr><td colspan="2">';
|
||||||
$help="";
|
$help="";
|
||||||
foreach($this->substit as $key => $val)
|
foreach($this->substit as $key => $val)
|
||||||
{
|
{
|
||||||
$help.=$key.' -> '.$langs->trans($val).'<br>';
|
$help.=$key.' -> '.$langs->trans($val).'<br>';
|
||||||
}
|
}
|
||||||
print $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help);
|
$out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"),$help);
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// From
|
// From
|
||||||
@ -230,42 +250,42 @@ class FormMail
|
|||||||
{
|
{
|
||||||
if ($this->withfromreadonly)
|
if ($this->withfromreadonly)
|
||||||
{
|
{
|
||||||
print '<input type="hidden" name="fromname" value="'.$this->fromname.'">';
|
$out.= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
|
||||||
print '<input type="hidden" name="frommail" value="'.$this->frommail.'">';
|
$out.= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
|
||||||
print "<tr><td width=\"180\">".$langs->trans("MailFrom")."</td><td>";
|
$out.= '<tr><td width="180">'.$langs->trans("MailFrom").'</td><td>';
|
||||||
if ($this->fromtype == 'user')
|
if ($this->fromtype == 'user')
|
||||||
{
|
{
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
$fuser=new User($this->db);
|
$fuser=new User($this->db);
|
||||||
$fuser->fetch($this->fromid);
|
$fuser->fetch($this->fromid);
|
||||||
print $fuser->getNomUrl(1);
|
$out.= $fuser->getNomUrl(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $this->fromname;
|
$out.= $this->fromname;
|
||||||
}
|
}
|
||||||
if ($this->frommail)
|
if ($this->frommail)
|
||||||
{
|
{
|
||||||
print " <".$this->frommail.">";
|
$out.= " <".$this->frommail.">";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($this->fromtype)
|
if ($this->fromtype)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print '<font class="warning"> <'.$langs->trans("ErrorNoMailDefinedForThisUser").'> </font>';
|
$out.= '<font class="warning"> <'.$langs->trans("ErrorNoMailDefinedForThisUser").'> </font>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr><td>".$langs->trans("MailFrom")."</td><td>";
|
$out.= "<tr><td>".$langs->trans("MailFrom")."</td><td>";
|
||||||
print $langs->trans("Name").':<input type="text" name="fromname" size="32" value="'.$this->fromname.'">';
|
$out.= $langs->trans("Name").':<input type="text" id="fromname" name="fromname" size="32" value="'.$this->fromname.'" />';
|
||||||
print ' ';
|
$out.= ' ';
|
||||||
print $langs->trans("EMail").':<<input type="text" name="frommail" size="32" value="'.$this->frommail.'">>';
|
$out.= $langs->trans("EMail").':<<input type="text" id="frommail" name="frommail" size="32" value="'.$this->frommail.'" />>';
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,10 +294,10 @@ class FormMail
|
|||||||
{
|
{
|
||||||
if ($this->withreplytoreadonly)
|
if ($this->withreplytoreadonly)
|
||||||
{
|
{
|
||||||
print '<input type="hidden" name="replyname" value="'.$this->replytoname.'">';
|
$out.= '<input type="hidden" id="replyname" name="replyname" value="'.$this->replytoname.'" />';
|
||||||
print '<input type="hidden" name="replymail" value="'.$this->replytomail.'">';
|
$out.= '<input type="hidden" id="replymail" name="replymail" value="'.$this->replytomail.'" />';
|
||||||
print "<tr><td>".$langs->trans("MailReply")."</td><td>".$this->replytoname.($this->replytomail?(" <".$this->replytomail.">"):"");
|
$out.= "<tr><td>".$langs->trans("MailReply")."</td><td>".$this->replytoname.($this->replytomail?(" <".$this->replytomail.">"):"");
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,32 +307,32 @@ class FormMail
|
|||||||
//if (! $this->errorstomail) $this->errorstomail=$this->frommail;
|
//if (! $this->errorstomail) $this->errorstomail=$this->frommail;
|
||||||
if ($this->witherrorstoreadonly)
|
if ($this->witherrorstoreadonly)
|
||||||
{
|
{
|
||||||
print '<input type="hidden" name="errorstomail" value="'.$this->errorstomail.'">';
|
$out.= '<input type="hidden" id="errorstomail" name="errorstomail" value="'.$this->errorstomail.'" />';
|
||||||
print "<tr><td>".$langs->trans("MailErrorsTo")."</td><td>";
|
$out.= '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
|
||||||
print $this->errorstomail;
|
$out.= $this->errorstomail;
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<tr><td>".$langs->trans("MailErrorsTo")."</td><td>";
|
$out.= '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
|
||||||
print "<input size=\"30\" name=\"errorstomail\" value=\"".$this->errorstomail."\">";
|
$out.= '<input size="30" id="errorstomail" name="errorstomail" value="'.$this->errorstomail.'" />';
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// To
|
// To
|
||||||
if ($this->withto || is_array($this->withto))
|
if ($this->withto || is_array($this->withto))
|
||||||
{
|
{
|
||||||
print '<tr><td width="180">';
|
$out.= '<tr><td width="180">';
|
||||||
print $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
$out.= $form->textwithpicto($langs->trans("MailTo"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||||
print '</td><td>';
|
$out.= '</td><td>';
|
||||||
if ($this->withtoreadonly)
|
if ($this->withtoreadonly)
|
||||||
{
|
{
|
||||||
print (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
|
$out.= (! is_array($this->withto) && ! is_numeric($this->withto))?$this->withto:"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<input size=\"".(is_array($this->withto)?"30":"60")."\" name=\"sendto\" value=\"".(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"")."\">";
|
$out.= '<input size="'.(is_array($this->withto)?"30":"60").'" id="sendto" name="sendto" value="'.(! is_array($this->withto) && ! is_numeric($this->withto)? (isset($_REQUEST["sendto"])?$_REQUEST["sendto"]:$this->withto) :"").'" />';
|
||||||
if ($this->withtosocid > 0)
|
if ($this->withtosocid > 0)
|
||||||
{
|
{
|
||||||
$liste=array();
|
$liste=array();
|
||||||
@ -323,27 +343,27 @@ class FormMail
|
|||||||
{
|
{
|
||||||
$liste[$key]=$value;
|
$liste[$key]=$value;
|
||||||
}
|
}
|
||||||
print " ".$langs->trans("or")." ";
|
$out.= " ".$langs->trans("or")." ";
|
||||||
//var_dump($_REQUEST);exit;
|
//var_dump($_REQUEST);exit;
|
||||||
print $form->selectarray("receiver", $liste, isset($_REQUEST["receiver"])?$_REQUEST["receiver"]:0);
|
$out.= $form->selectarray("receiver", $liste, isset($_REQUEST["receiver"])?$_REQUEST["receiver"]:0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// CC
|
// CC
|
||||||
if ($this->withtocc || is_array($this->withtocc))
|
if ($this->withtocc || is_array($this->withtocc))
|
||||||
{
|
{
|
||||||
print '<tr><td width="180">';
|
$out.= '<tr><td width="180">';
|
||||||
print $form->textwithpicto($langs->trans("MailCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
$out.= $form->textwithpicto($langs->trans("MailCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||||
print '</td><td>';
|
$out.= '</td><td>';
|
||||||
if ($this->withtoccreadonly)
|
if ($this->withtoccreadonly)
|
||||||
{
|
{
|
||||||
print (! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"";
|
$out.= (! is_array($this->withtocc) && ! is_numeric($this->withtocc))?$this->withtocc:"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<input size=\"".(is_array($this->withtocc)?"30":"60")."\" name=\"sendtocc\" value=\"".((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") )."\">";
|
$out.= '<input size="'.(is_array($this->withtocc)?"30":"60").'" id="sendtocc" name="sendtocc" value="'.((! is_array($this->withtocc) && ! is_numeric($this->withtocc))? (isset($_POST["sendtocc"])?$_POST["sendtocc"]:$this->withtocc) : (isset($_POST["sendtocc"])?$_POST["sendtocc"]:"") ).'" />';
|
||||||
if ($this->withtoccsocid > 0)
|
if ($this->withtoccsocid > 0)
|
||||||
{
|
{
|
||||||
$liste=array();
|
$liste=array();
|
||||||
@ -354,26 +374,26 @@ class FormMail
|
|||||||
{
|
{
|
||||||
$liste[$key]=$value;
|
$liste[$key]=$value;
|
||||||
}
|
}
|
||||||
print " ".$langs->trans("or")." ";
|
$out.= " ".$langs->trans("or")." ";
|
||||||
print $form->selectarray("receivercc", $liste, isset($_REQUEST["receivercc"])?$_REQUEST["receivercc"]:0);
|
$out.= $form->selectarray("receivercc", $liste, isset($_REQUEST["receivercc"])?$_REQUEST["receivercc"]:0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// CCC
|
// CCC
|
||||||
if ($this->withtoccc || is_array($this->withtoccc))
|
if ($this->withtoccc || is_array($this->withtoccc))
|
||||||
{
|
{
|
||||||
print '<tr><td width="180">';
|
$out.= '<tr><td width="180">';
|
||||||
print $form->textwithpicto($langs->trans("MailCCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
$out.= $form->textwithpicto($langs->trans("MailCCC"),$langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||||
print '</td><td>';
|
$out.= '</td><td>';
|
||||||
if ($this->withtocccreadonly)
|
if ($this->withtocccreadonly)
|
||||||
{
|
{
|
||||||
print (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
|
$out.= (! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))?$this->withtoccc:"";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<input size=\"".(is_array($this->withtoccc)?"30":"60")."\" name=\"sendtoccc\" value=\"".((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") )."\">";
|
$out.= '<input size="'.(is_array($this->withtoccc)?"30":"60").'" id="sendtoccc" name="sendtoccc" value="'.((! is_array($this->withtoccc) && ! is_numeric($this->withtoccc))? (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:$this->withtoccc) : (isset($_POST["sendtoccc"])?$_POST["sendtoccc"]:"") ).'" />';
|
||||||
if ($this->withtocccsocid > 0)
|
if ($this->withtocccsocid > 0)
|
||||||
{
|
{
|
||||||
$liste=array();
|
$liste=array();
|
||||||
@ -384,29 +404,29 @@ class FormMail
|
|||||||
{
|
{
|
||||||
$liste[$key]=$value;
|
$liste[$key]=$value;
|
||||||
}
|
}
|
||||||
print " ".$langs->trans("or")." ";
|
$out.= " ".$langs->trans("or")." ";
|
||||||
print $form->selectarray("receiverccc", $liste, isset($_REQUEST["receiverccc"])?$_REQUEST["receiverccc"]:0);
|
$out.= $form->selectarray("receiverccc", $liste, isset($_REQUEST["receiverccc"])?$_REQUEST["receiverccc"]:0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
|
//if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print ' '.info_admin("+ ".$conf->global->MAIN_MAIL_AUTOCOPY_TO,1);
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask delivery receipt
|
// Ask delivery receipt
|
||||||
if ($this->withdeliveryreceipt)
|
if ($this->withdeliveryreceipt)
|
||||||
{
|
{
|
||||||
print '<tr><td width="180">'.$langs->trans("DeliveryReceipt").'</td><td>';
|
$out.= '<tr><td width="180">'.$langs->trans("DeliveryReceipt").'</td><td>';
|
||||||
|
|
||||||
if ($this->withdeliveryreceiptreadonly)
|
if ($this->withdeliveryreceiptreadonly)
|
||||||
{
|
{
|
||||||
print yn($this->withdeliveryreceipt);
|
$out.= yn($this->withdeliveryreceipt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:0) ,1);
|
$out.= $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:0) ,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Topic
|
// Topic
|
||||||
@ -414,50 +434,50 @@ class FormMail
|
|||||||
{
|
{
|
||||||
$this->withtopic=make_substitutions($this->withtopic,$this->substit);
|
$this->withtopic=make_substitutions($this->withtopic,$this->substit);
|
||||||
|
|
||||||
print "<tr>";
|
$out.= '<tr>';
|
||||||
print "<td width=\"180\">".$langs->trans("MailTopic")."</td>";
|
$out.= '<td width="180">'.$langs->trans("MailTopic").'</td>';
|
||||||
print "<td>";
|
$out.= '<td>';
|
||||||
if ($this->withtopicreadonly)
|
if ($this->withtopicreadonly)
|
||||||
{
|
{
|
||||||
print $this->withtopic;
|
$out.= $this->withtopic;
|
||||||
print "<input type=\"hidden\" size=\"60\" name=\"subject\" value=\"".$this->withtopic."\">";
|
$out.= '<input type="hidden" size="60" id="subject" name="subject" value="'.$this->withtopic.'" />';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "<input type=\"text\" size=\"60\" name=\"subject\" value=\"". (isset($_POST["subject"])?$_POST["subject"]:$this->withtopic) ."\">";
|
$out.= '<input type="text" size="60" id="subject" name="subject" value="'. (isset($_POST["subject"])?$_POST["subject"]:$this->withtopic) .'" />';
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attached files
|
// Attached files
|
||||||
if ($this->withfile)
|
if ($this->withfile)
|
||||||
{
|
{
|
||||||
print "<tr>";
|
$out.= '<tr>';
|
||||||
print '<td width="180">'.$langs->trans("MailFile")."</td>";
|
$out.= '<td width="180">'.$langs->trans("MailFile").'</td>';
|
||||||
print "<td>";
|
$out.= '<td>';
|
||||||
//print '<table class="nobordernopadding" width="100%"><tr><td>';
|
//print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
if (sizeof($listofpaths))
|
if (sizeof($listofpaths))
|
||||||
{
|
{
|
||||||
foreach($listofpaths as $key => $val)
|
foreach($listofpaths as $key => $val)
|
||||||
{
|
{
|
||||||
print img_mime($listofnames[$key]).' '.$listofnames[$key];
|
$out.= img_mime($listofnames[$key]).' '.$listofnames[$key];
|
||||||
print ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key+1).'" name="removedfile">';
|
$out.= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key+1).'" id="removedfile" name="removedfile" />';
|
||||||
print '<br>';
|
$out.= '<br>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print $langs->trans("NoAttachedFiles").'<br>';
|
$out.= $langs->trans("NoAttachedFiles").'<br>';
|
||||||
}
|
}
|
||||||
if ($this->withfile == 2) // Can add other files
|
if ($this->withfile == 2) // Can add other files
|
||||||
{
|
{
|
||||||
//print '<td><td align="right">';
|
//print '<td><td align="right">';
|
||||||
print '<input type="file" class="flat" name="addedfile" value="'.$langs->trans("Upload").'"/>';
|
$out.= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
|
||||||
print ' ';
|
$out.= ' ';
|
||||||
print '<input type="submit" class="button" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'">';
|
$out.= '<input type="submit" class="button" id="'.$addfileaction.'" name="'.$addfileaction.'" value="'.$langs->trans("MailingAddFile").'" />';
|
||||||
//print '</td></tr></table>';
|
//print '</td></tr></table>';
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
@ -497,42 +517,48 @@ class FormMail
|
|||||||
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
|
if (isset($_POST["message"])) $defaultmessage=$_POST["message"];
|
||||||
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
|
$defaultmessage=str_replace('\n',"\n",$defaultmessage);
|
||||||
|
|
||||||
print "<tr>";
|
$out.= '<tr>';
|
||||||
print "<td width=\"180\" valign=\"top\">".$langs->trans("MailText")."</td>";
|
$out.= '<td width="180" valign="top">'.$langs->trans("MailText").'</td>';
|
||||||
print "<td>";
|
$out.= '<td>';
|
||||||
if ($this->withbodyreadonly)
|
if ($this->withbodyreadonly)
|
||||||
{
|
{
|
||||||
print nl2br($defaultmessage);
|
$out.= nl2br($defaultmessage);
|
||||||
print '<input type="hidden" name="message" value="'.$defaultmessage.'">';
|
$out.= '<input type="hidden" id="message" name="message" value="'.$defaultmessage.'" />';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Editeur wysiwyg
|
// Editeur wysiwyg
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('message',$defaultmessage,'',280,'dolibarr_notes','In',true,false,$this->withfckeditor,8,72);
|
$doleditor=new DolEditor('message',$defaultmessage,'',280,'dolibarr_notes','In',true,false,$this->withfckeditor,8,72);
|
||||||
$doleditor->Create();
|
$out.= $doleditor->Create(1);
|
||||||
}
|
}
|
||||||
print "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<tr><td align=center colspan=2><center>";
|
if ($this->withform)
|
||||||
print "<input class=\"button\" type=\"submit\" name=\"sendmail\" value=\"".$langs->trans("SendMail")."\"";
|
{
|
||||||
|
$out.= '<tr><td align="center" colspan="2"><center>';
|
||||||
|
$out.= '<input class="button" type="submit" id="sendmail" name="sendmail" value="'.$langs->trans("SendMail").'"';
|
||||||
// Add a javascript test to avoid to forget to submit file before sending email
|
// Add a javascript test to avoid to forget to submit file before sending email
|
||||||
if ($this->withfile == 2 && $conf->use_javascript_ajax)
|
if ($this->withfile == 2 && $conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
print ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
|
$out.= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
|
||||||
}
|
}
|
||||||
print ">";
|
$out.= ' />';
|
||||||
if ($this->withcancel)
|
if ($this->withcancel)
|
||||||
{
|
{
|
||||||
print " ";
|
$out.= ' ';
|
||||||
print "<input class=\"button\" type=\"submit\" name=\"cancel\" value=\"".$langs->trans("Cancel")."\">";
|
$out.= '<input class="button" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'" />';
|
||||||
|
}
|
||||||
|
$out.= '</center></td></tr>'."\n";
|
||||||
}
|
}
|
||||||
print "</center></td></tr>\n";
|
|
||||||
print "</table>\n";
|
|
||||||
|
|
||||||
print "</form>\n";
|
$out.= '</table>'."\n";
|
||||||
print "<!-- Fin form mail -->\n";
|
|
||||||
|
if ($this->withform) $out.= '</form>'."\n";
|
||||||
|
$out.= "<!-- Fin form mail -->\n";
|
||||||
|
|
||||||
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -134,11 +134,12 @@ class DolEditor
|
|||||||
/**
|
/**
|
||||||
* Output edit area inside the HTML stream
|
* Output edit area inside the HTML stream
|
||||||
*/
|
*/
|
||||||
function Create()
|
function Create($noprint=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
$found=0;
|
$found=0;
|
||||||
|
$out='';
|
||||||
|
|
||||||
if ($this->tool == 'fckeditor')
|
if ($this->tool == 'fckeditor')
|
||||||
{
|
{
|
||||||
@ -148,9 +149,9 @@ class DolEditor
|
|||||||
if (in_array($this->tool,array('textarea','ckeditor')))
|
if (in_array($this->tool,array('textarea','ckeditor')))
|
||||||
{
|
{
|
||||||
$found=1;
|
$found=1;
|
||||||
print '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'" cols="'.$this->cols.'" class="flat">';
|
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'" cols="'.$this->cols.'" class="flat">';
|
||||||
print $this->content;
|
$out.= $this->content;
|
||||||
print '</textarea>';
|
$out.= '</textarea>';
|
||||||
|
|
||||||
if ($this->tool == 'ckeditor')
|
if ($this->tool == 'ckeditor')
|
||||||
{
|
{
|
||||||
@ -161,7 +162,7 @@ class DolEditor
|
|||||||
//$skin='v2';
|
//$skin='v2';
|
||||||
$skin='kama';
|
$skin='kama';
|
||||||
|
|
||||||
print '<script type="text/javascript">
|
$out.= '<script type="text/javascript">
|
||||||
jQuery(document).ready(function () {
|
jQuery(document).ready(function () {
|
||||||
CKEDITOR.replace(\''.$this->htmlname.'\',
|
CKEDITOR.replace(\''.$this->htmlname.'\',
|
||||||
{
|
{
|
||||||
@ -188,27 +189,27 @@ class DolEditor
|
|||||||
}';
|
}';
|
||||||
if ($this->uselocalbrowser)
|
if ($this->uselocalbrowser)
|
||||||
{
|
{
|
||||||
print ','."\n";
|
$out.= ','."\n";
|
||||||
// To use filemanager with old fckeditor (GPL)
|
// To use filemanager with old fckeditor (GPL)
|
||||||
print ' filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/browser/default/browser.html?Connector='.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/connector.php\',';
|
$out.= ' filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/browser/default/browser.html?Connector='.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/connector.php\',';
|
||||||
//print ' filebrowserUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=File\',';
|
//$out.= ' filebrowserUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=File\',';
|
||||||
print ' filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/browser/default/browser.html?Type=Image&Connector='.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/connector.php\',';
|
$out.= ' filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/browser/default/browser.html?Type=Image&Connector='.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/connector.php\',';
|
||||||
//print ' filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=Image\',';
|
//print ' filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/fckeditor/editor/filemanagerdol/connectors/php/upload.php?Type=Image\',';
|
||||||
print "\n";
|
$out.= "\n";
|
||||||
// To use filemanager with ckfinder (Non free) and ckfinder directory is inside htdocs/includes
|
// To use filemanager with ckfinder (Non free) and ckfinder directory is inside htdocs/includes
|
||||||
/* print ' filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html\',
|
/* $out.= ' filebrowserBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html\',
|
||||||
filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html?Type=Images\',
|
filebrowserImageBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html?Type=Images\',
|
||||||
filebrowserFlashBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html?Type=Flash\',
|
filebrowserFlashBrowseUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/ckfinder.html?Type=Flash\',
|
||||||
filebrowserUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files\',
|
filebrowserUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files\',
|
||||||
filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images\',
|
filebrowserImageUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images\',
|
||||||
filebrowserFlashUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash\','."\n";
|
filebrowserFlashUploadUrl : \''.DOL_URL_ROOT.'/includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash\','."\n";
|
||||||
*/
|
*/
|
||||||
print ' filebrowserWindowWidth : \'900\',
|
$out.= ' filebrowserWindowWidth : \'900\',
|
||||||
filebrowserWindowHeight : \'500\',
|
filebrowserWindowHeight : \'500\',
|
||||||
filebrowserImageWindowWidth : \'900\',
|
filebrowserImageWindowWidth : \'900\',
|
||||||
filebrowserImageWindowHeight : \'500\'';
|
filebrowserImageWindowHeight : \'500\'';
|
||||||
}
|
}
|
||||||
print '
|
$out.= '
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -218,8 +219,11 @@ class DolEditor
|
|||||||
|
|
||||||
if (empty($found))
|
if (empty($found))
|
||||||
{
|
{
|
||||||
print 'Error, unknown value for tool '.$this->tool.' in DolEditor Create function.';
|
$out.= 'Error, unknown value for tool '.$this->tool.' in DolEditor Create function.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($noprint) return $out;
|
||||||
|
else print $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user