Better position of the substitution tooltip for emails
This commit is contained in:
parent
1319bb35fb
commit
85d4f7115b
@ -745,7 +745,7 @@ else
|
||||
{
|
||||
if (function_exists('fsockopen') && $port && $server)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect#formmailbeforetitle">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -753,11 +753,11 @@ else
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init">'.$langs->trans("DoTestSend").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSend").'</a>';
|
||||
|
||||
if (! empty($conf->fckeditor->enabled))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&mode=init#formmailbeforetitle">'.$langs->trans("DoTestSendHTML").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
@ -834,7 +834,7 @@ else
|
||||
$formmail->fromalsorobot=1;
|
||||
$formmail->fromtype=(GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
|
||||
$formmail->withfromreadonly=1;
|
||||
$formmail->withsubstit=0;
|
||||
$formmail->withsubstit=1;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->witherrorsto=1;
|
||||
$formmail->withto=(! empty($_POST['sendto'])?$_POST['sendto']:($user->email?$user->email:1));
|
||||
|
||||
@ -776,6 +776,7 @@ if ($resql)
|
||||
}
|
||||
if ($tmpfieldlist == 'content')
|
||||
{
|
||||
print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist) . '<br>';
|
||||
$okforextended = true;
|
||||
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended = false;
|
||||
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
||||
|
||||
@ -240,13 +240,13 @@ class FormMail extends Form
|
||||
* Get the form to input an email
|
||||
* this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||
* this->withfile
|
||||
* this->param: Contains more parameteres like email templates info
|
||||
* this->param: Contains more parameters like email templates info
|
||||
*
|
||||
* @param string $addfileaction Name of action when posting file attachments
|
||||
* @param string $removefileaction Name of action when removing file attachments
|
||||
* @return string Form to show
|
||||
*/
|
||||
function get_form($addfileaction='addfile',$removefileaction='removefile')
|
||||
function get_form($addfileaction='addfile', $removefileaction='removefile')
|
||||
{
|
||||
global $conf, $langs, $user, $hookmanager, $form;
|
||||
|
||||
@ -409,18 +409,19 @@ class FormMail extends Form
|
||||
|
||||
$out.= '<table class="tableforemailform boxtablenotop" width="100%">'."\n";
|
||||
|
||||
// Substitution array
|
||||
// Substitution array/string
|
||||
$helpforsubstitution='';
|
||||
if (is_array($this->substit) && count($this->substit)) $helpforsubstitution.=$langs->trans('AvailableVariables').' :<br>'."\n";
|
||||
foreach($this->substit as $key => $val)
|
||||
{
|
||||
$helpforsubstitution.=$key.' -> '.$langs->trans(dol_string_nohtmltag($val)).'<br>';
|
||||
}
|
||||
if (! empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this.
|
||||
{
|
||||
$out.= '<tr><td colspan="2" align="right">';
|
||||
//$out.='<div class="floatright">';
|
||||
$help="";
|
||||
foreach($this->substit as $key => $val)
|
||||
{
|
||||
$help.=$key.' -> '.$langs->trans(dol_string_nohtmltag($val)).'<br>';
|
||||
}
|
||||
if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $help, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
|
||||
else $out.= $form->textwithpicto($langs->trans('AvailableVariables'), $help, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
|
||||
if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
|
||||
else $out.= $form->textwithpicto($langs->trans('AvailableVariables'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
|
||||
$out.= "</td></tr>\n";
|
||||
//$out.='</div>';
|
||||
}
|
||||
@ -773,7 +774,9 @@ class FormMail extends Form
|
||||
$defaulttopic=make_substitutions($defaulttopic,$this->substit);
|
||||
|
||||
$out.= '<tr>';
|
||||
$out.= '<td class="fieldrequired">'.$langs->trans("MailTopic").'</td>';
|
||||
$out.= '<td class="fieldrequired">';
|
||||
$out.=$form->textwithpicto($langs->trans('MailTopic'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfromtopic');
|
||||
$out.='</td>';
|
||||
$out.= '<td>';
|
||||
if ($this->withtopicreadonly)
|
||||
{
|
||||
@ -917,7 +920,9 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
$out.= '<tr>';
|
||||
$out.= '<td valign="top">'.$langs->trans("MailText").'</td>';
|
||||
$out.= '<td valign="top">';
|
||||
$out.=$form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody');
|
||||
$out.='</td>';
|
||||
$out.= '<td>';
|
||||
if ($this->withbodyreadonly)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2017-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -23,6 +23,7 @@
|
||||
* $modelmail
|
||||
* $defaulttopic
|
||||
* $diroutput
|
||||
* $arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...);
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
@ -144,8 +145,11 @@ if ($action == 'presend')
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
$liste[$key] = $value;
|
||||
if (is_object($object->thirdparty))
|
||||
{
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) {
|
||||
$liste[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,8 +162,11 @@ if ($action == 'presend')
|
||||
$formmail->withdeliveryreceipt = 1;
|
||||
$formmail->withcancel = 1;
|
||||
|
||||
//$arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...);
|
||||
if (! isset($arrayoffamiliestoexclude)) $arrayoffamiliestoexclude=null;
|
||||
|
||||
// Make substitution in email content
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
|
||||
$substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="' . DOL_MAIN_URL_ROOT . '/public/emailing/mailing-read.php?tag=' . $object->thirdparty->tag . '&securitykey=' . urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY) . '" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
|
||||
$substitutionarray['__PERSONALIZED__'] = ''; // deprecated
|
||||
$substitutionarray['__CONTACTCIVNAME__'] = '';
|
||||
@ -179,8 +186,6 @@ if ($action == 'presend')
|
||||
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
|
||||
$formmail->param['fileinit'] = array($file);
|
||||
|
||||
$formmail->withsubstit = 1;
|
||||
|
||||
// Show form
|
||||
print $formmail->get_form();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user