feat: on peut passer dans le param options : envoi_separe => oui,
cela ajoute un radio (coché oui par defaut) pour jouer l'envoi pour chaque destinataire du pour et non pas 1 seul message pour tous les destinataires
This commit is contained in:
parent
014748da64
commit
35584c2a49
3 changed files with 116 additions and 28 deletions
|
@ -20,14 +20,17 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: 3px 0;
|
margin: 3px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-editor div {
|
.tag-editor div {
|
||||||
float: left;
|
float: left;
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-editor .placeholder {
|
.tag-editor .placeholder {
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-editor .tag-editor-spacer {
|
.tag-editor .tag-editor-spacer {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
|
@ -35,6 +38,7 @@
|
||||||
color: transparent;
|
color: transparent;
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-editor input {
|
.tag-editor input {
|
||||||
vertical-align: inherit;
|
vertical-align: inherit;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
@ -50,15 +54,18 @@
|
||||||
background: none;
|
background: none;
|
||||||
color: #444;
|
color: #444;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hide original input field or textarea visually to allow tab navigation */
|
/* hide original input field or textarea visually to allow tab navigation */
|
||||||
.tag-editor-hidden-src {
|
.tag-editor-hidden-src {
|
||||||
position: absolute !important;
|
position: absolute !important;
|
||||||
left: -99999px;
|
left: -99999px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hide IE10 "clear field" X */
|
/* hide IE10 "clear field" X */
|
||||||
.tag-editor ::-ms-clear {
|
.tag-editor ::-ms-clear {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tag style */
|
/* tag style */
|
||||||
.tag-editor .tag-editor-tag {
|
.tag-editor .tag-editor-tag {
|
||||||
/*padding-left: 5px; color: #46799b; background: #e0eaf1; white-space: nowrap;*/
|
/*padding-left: 5px; color: #46799b; background: #e0eaf1; white-space: nowrap;*/
|
||||||
|
@ -71,6 +78,7 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 4px 0 0 4px;
|
border-radius: 4px 0 0 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* delete icon */
|
/* delete icon */
|
||||||
/*.tag-editor .tag-editor-delete { background: #e0eaf1; cursor: pointer; border-radius: 0 2px 2px 0; padding-left: 3px; padding-right: 4px; }*/
|
/*.tag-editor .tag-editor-delete { background: #e0eaf1; cursor: pointer; border-radius: 0 2px 2px 0; padding-left: 3px; padding-right: 4px; }*/
|
||||||
.tag-editor .tag-editor-delete {
|
.tag-editor .tag-editor-delete {
|
||||||
|
@ -80,10 +88,12 @@
|
||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
padding-right: 4px;
|
padding-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-editor .tag-editor-delete i {
|
.tag-editor .tag-editor-delete i {
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*.tag-editor .tag-editor-delete i:before { font-size: 16px; color: #8ba7ba; content: "×"; font-style: normal; }*/
|
/*.tag-editor .tag-editor-delete i:before { font-size: 16px; color: #8ba7ba; content: "×"; font-style: normal; }*/
|
||||||
.tag-editor .tag-editor-delete i:before {
|
.tag-editor .tag-editor-delete i:before {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
|
@ -91,14 +101,17 @@
|
||||||
content: '×';
|
content: '×';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-editor .tag-editor-delete:hover i:before {
|
.tag-editor .tag-editor-delete:hover i:before {
|
||||||
color: #d65454;
|
color: #d65454;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-editor .tag-editor-tag.active+.tag-editor-delete,
|
.tag-editor .tag-editor-tag.active+.tag-editor-delete,
|
||||||
.tag-editor .tag-editor-tag.active+.tag-editor-delete i {
|
.tag-editor .tag-editor-tag.active+.tag-editor-delete i {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-editor .tag-editor-tag.active {
|
.tag-editor .tag-editor-tag.active {
|
||||||
background: none !important;
|
background: none !important;
|
||||||
}
|
}
|
||||||
|
@ -111,9 +124,11 @@
|
||||||
cursor: default;
|
cursor: default;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-front {
|
.ui-front {
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-menu {
|
.ui-menu {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
|
@ -121,21 +136,26 @@
|
||||||
display: block;
|
display: block;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-menu .ui-menu-item a {
|
.ui-menu .ui-menu-item a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
display: block;
|
display: block;
|
||||||
padding: 2px 0.4em;
|
padding: 2px 0.4em;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
min-height: 0; /* support: IE7 */
|
min-height: 0;
|
||||||
|
/* support: IE7 */
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-widget-content {
|
.ui-widget-content {
|
||||||
border: 1px solid #bbb;
|
border: 1px solid #bbb;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-widget-content a {
|
.ui-widget-content a {
|
||||||
color: #46799b;
|
color: #46799b;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-widget-content .ui-state-hover,
|
.ui-widget-content .ui-state-hover,
|
||||||
.ui-widget-header .ui-state-hover,
|
.ui-widget-header .ui-state-hover,
|
||||||
.ui-state-focus,
|
.ui-state-focus,
|
||||||
|
@ -143,6 +163,7 @@
|
||||||
.ui-widget-header .ui-state-focus {
|
.ui-widget-header .ui-state-focus {
|
||||||
background: #e0eaf1;
|
background: #e0eaf1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-helper-hidden-accessible {
|
.ui-helper-hidden-accessible {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -151,47 +172,65 @@
|
||||||
.formulaire_gamumail {
|
.formulaire_gamumail {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.formulaire_gamumail .editer {
|
.formulaire_gamumail .editer {
|
||||||
padding-top: 0;
|
padding-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editer_pour {
|
.editer_pour {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editer_pour label {
|
.editer_pour label {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.editer_envoi_separe {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.editer_cc {
|
.editer_cc {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editer_cc label {
|
.editer_cc label {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editer_cci {
|
.editer_cci {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editer_cci label {
|
.editer_cci label {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reponse_formulaire {
|
.reponse_formulaire {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 2rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.reponse_formulaire_erreur, .editer .erreur_message {
|
|
||||||
|
.reponse_formulaire_erreur,
|
||||||
|
.editer .erreur_message {
|
||||||
background-color: #f7d1d1;
|
background-color: #f7d1d1;
|
||||||
border: solid 2px #f00;
|
border: solid 2px #f00;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reponse_formulaire_ok {
|
.reponse_formulaire_ok {
|
||||||
background-color: #c4ecd6;
|
background-color: #c4ecd6;
|
||||||
border: solid 2px #080;
|
border: solid 2px #080;
|
||||||
}
|
}
|
||||||
|
|
||||||
.remplacements_slugs {
|
.remplacements_slugs {
|
||||||
margin-top: 3rem;
|
margin-top: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.formulaire_gamumail .boutons {
|
.formulaire_gamumail .boutons {
|
||||||
margin-top: 3rem;
|
margin-top: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.formulaire_gamumail .btn {
|
.formulaire_gamumail .btn {
|
||||||
font-size: 3rem;
|
font-size: 3rem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,25 @@
|
||||||
<input required type="text" class="text tagEditor" name="#GET{name}" id="#GET{name}" value="#ENV{#GET{name}}" >
|
<input required type="text" class="text tagEditor" name="#GET{name}" id="#GET{name}" value="#ENV{#GET{name}}" >
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<BOUCLE_test(CONDITION){si #ENV{envoi_separe}|oui}>
|
||||||
|
<div class="editer_groupe">
|
||||||
|
#SET{name,envoi_separe}
|
||||||
|
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
|
||||||
|
#SET{obli,"obligatoire"}
|
||||||
|
<div class="editer editer_[(#GET{name})][ (#GET{obli})][ (#GET{erreurs}|oui)erreur]">
|
||||||
|
<label> Envoi séparé (1 mail par destinataire)</label>
|
||||||
|
<div class="choix">
|
||||||
|
<input type="radio" class="radio" name="#GET{name}" value="" id="#GET{name}_non"[ (#ENV{#GET{name}}|non|?{checked="checked"})] >
|
||||||
|
<label for="#GET{name}_non">Non</label>
|
||||||
|
</div>
|
||||||
|
<div class="choix">
|
||||||
|
<input type="radio" class="radio" name="#GET{name}" value="oui" id="#GET{name}_oui"[ (#ENV{#GET{name}}|=={oui}|?{checked="checked"})] >
|
||||||
|
<label for="#GET{name}_oui">Oui</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</BOUCLE_test>
|
||||||
|
|
||||||
|
|
||||||
<div class="editer_groupe">
|
<div class="editer_groupe">
|
||||||
#SET{name,cc}
|
#SET{name,cc}
|
||||||
|
|
|
@ -69,12 +69,10 @@ function formulaires_gamumail_charger_dist($slug, $destinataires = 0, $Tclient =
|
||||||
$Tpdf = [$Tpdf];
|
$Tpdf = [$Tpdf];
|
||||||
}
|
}
|
||||||
foreach ($Tpdf as $id => $pdf) {
|
foreach ($Tpdf as $id => $pdf) {
|
||||||
//$TFichierPdf[] = $pdf['fichier'];
|
|
||||||
$TFichierPdf[$id] = $pdf;
|
$TFichierPdf[$id] = $pdf;
|
||||||
//$options[$id] = $pdf;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//var_dump($Tcc);
|
|
||||||
$gamuMail = sql_fetsel('sujet, texte, id_docs', 'spip_gamumails', 'slug='.sql_quote($slug));
|
$gamuMail = sql_fetsel('sujet, texte, id_docs', 'spip_gamumails', 'slug='.sql_quote($slug));
|
||||||
$valeurs = array(
|
$valeurs = array(
|
||||||
"slug" => $slug,
|
"slug" => $slug,
|
||||||
|
@ -87,7 +85,8 @@ function formulaires_gamumail_charger_dist($slug, $destinataires = 0, $Tclient =
|
||||||
'Tpdfs_ok' => [],
|
'Tpdfs_ok' => [],
|
||||||
'docs_spip' => $gamuMail['id_docs'] ?? '',
|
'docs_spip' => $gamuMail['id_docs'] ?? '',
|
||||||
'Tid_fichiers' => [],
|
'Tid_fichiers' => [],
|
||||||
'options' => $options
|
'options' => $options,
|
||||||
|
'envoi_separe' => $options['envoi_separe'] ?? ''
|
||||||
);
|
);
|
||||||
|
|
||||||
// surcharges charger : d'abord les surcharges pour tous les slugs (tous_charge.php) puis les spécifiques par slug (nom_slug_charger.php)
|
// surcharges charger : d'abord les surcharges pour tous les slugs (tous_charge.php) puis les spécifiques par slug (nom_slug_charger.php)
|
||||||
|
@ -201,21 +200,12 @@ function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient =
|
||||||
include_spip('inc/texte');
|
include_spip('inc/texte');
|
||||||
include_spip('classes/facteur');
|
include_spip('classes/facteur');
|
||||||
|
|
||||||
$retour = array();
|
$retour = [];
|
||||||
|
|
||||||
|
$envoi_separe = _request('envoi_separe') ?? '';
|
||||||
|
|
||||||
$pour = _request('pour');
|
$pour = _request('pour');
|
||||||
$cc = _request('cc');
|
|
||||||
$cci = _request('cci');
|
|
||||||
$sujet = _request('sujet');
|
|
||||||
$html = propre(_request('texte'));
|
|
||||||
$docs_spip = _request('docs_spip');
|
|
||||||
$Tpdfs_ok = _request('Tpdfs_ok');
|
|
||||||
$Tid_doc = _request('Tid_doc');
|
|
||||||
$texte = facteur_mail_html2text($html);
|
|
||||||
|
|
||||||
$pour = explode(',', $pour);
|
$pour = explode(',', $pour);
|
||||||
$cc = explode(',', $cc);
|
|
||||||
$cci = explode(',', $cci);
|
|
||||||
|
|
||||||
$destinataires = [];
|
$destinataires = [];
|
||||||
foreach ($pour as $dest) {
|
foreach ($pour as $dest) {
|
||||||
|
@ -223,12 +213,56 @@ function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient =
|
||||||
if ($mail = sql_getfetsel('email', 'spip_auteurs', 'id_auteur='.$dest)) {
|
if ($mail = sql_getfetsel('email', 'spip_auteurs', 'id_auteur='.$dest)) {
|
||||||
$destinataires[] = $mail;
|
$destinataires[] = $mail;
|
||||||
}
|
}
|
||||||
}
|
} elseif (email_valide($dest)) {
|
||||||
elseif (email_valide($dest)) {
|
|
||||||
$destinataires[] = $dest;
|
$destinataires[] = $dest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($envoi_separe)) {
|
||||||
|
gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $redirect, $retour);
|
||||||
|
} else {
|
||||||
|
$ok = true;
|
||||||
|
foreach ($destinataires as $d) {
|
||||||
|
$r = gamuSend($slug, $options, [$d], $Tclient, $Tpdf, $redirect);
|
||||||
|
if (!$r) {
|
||||||
|
$ok = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$ok) {
|
||||||
|
$retour['message_erreur'] = _T("gamumail:erreur_envoi_mail");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$retour['message_ok'] = _T('gamumail:mail_envoye');
|
||||||
|
|
||||||
|
// dans le retour message_ok ajouter que le gamumail est OK
|
||||||
|
$retour['message_ok'] .= '@@gamumail_ok';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($redirect AND $redirect != '') {
|
||||||
|
$retour['redirect'] = $redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $retour;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $redirect, &$retour = []) {
|
||||||
|
|
||||||
|
$cc = _request('cc');
|
||||||
|
$cci = _request('cci');
|
||||||
|
|
||||||
|
$cc = explode(',', $cc);
|
||||||
|
$cci = explode(',', $cci);
|
||||||
|
|
||||||
|
$sujet = _request('sujet');
|
||||||
|
$html = propre(_request('texte'));
|
||||||
|
$docs_spip = _request('docs_spip');
|
||||||
|
$Tpdfs_ok = _request('Tpdfs_ok');
|
||||||
|
$Tid_doc = _request('Tid_doc');
|
||||||
|
$texte = facteur_mail_html2text($html);
|
||||||
|
|
||||||
$pieces_jointes = [];
|
$pieces_jointes = [];
|
||||||
if ($f = charger_fonction('traiter_av_pdf', 'gamumail', true)) {
|
if ($f = charger_fonction('traiter_av_pdf', 'gamumail', true)) {
|
||||||
$options = $f($options, $destinataires, $Tclient, $Tpdf);
|
$options = $f($options, $destinataires, $Tclient, $Tpdf);
|
||||||
|
@ -399,9 +433,5 @@ function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($redirect AND $redirect != '') {
|
return $ok;
|
||||||
$retour['redirect'] = $redirect;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $retour;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue