This commit is contained in:
cy_altern 2023-11-06 16:44:54 +01:00
commit cb1db1aa91
10 changed files with 219 additions and 70 deletions

View file

@ -56,6 +56,7 @@ function gamumail_declarer_tables_objets_sql($tables) {
'statut' => 'varchar(20) DEFAULT "0" NOT NULL', 'statut' => 'varchar(20) DEFAULT "0" NOT NULL',
'public' => 'varchar(20) DEFAULT "oui" NOT NULL', 'public' => 'varchar(20) DEFAULT "oui" NOT NULL',
'editable' => 'varchar(5) DEFAULT "oui" NOT NULL', 'editable' => 'varchar(5) DEFAULT "oui" NOT NULL',
'date' => 'datetime NOT NULL DEFAULT "0000-00-00 00:00:00"',
'maj' => 'TIMESTAMP', 'maj' => 'TIMESTAMP',
'rang' => 'smallint(6) NOT NULL' 'rang' => 'smallint(6) NOT NULL'
), ),
@ -63,10 +64,10 @@ function gamumail_declarer_tables_objets_sql($tables) {
'PRIMARY KEY' => 'id_gamumail', 'PRIMARY KEY' => 'id_gamumail',
'KEY statut' => 'statut', 'KEY statut' => 'statut',
), ),
'titre' => 'slug AS titre, "" AS lang', // 'titre' => 'slug AS titre, "" AS lang',
#'date' => '', #'date' => '',
'champs_editables' => array('slug', 'sujet', 'texte','titre', 'editable'), 'champs_editables' => array('slug', 'sujet', 'texte','titre', 'editable', 'public', 'id_docs', 'rang', 'statut', 'date'),
'champs_versionnes' => array('slug', 'sujet', 'texte','titre', 'editable'), 'champs_versionnes' => array('slug', 'sujet', 'texte','titre', 'editable', 'public', 'id_docs', 'rang', 'statut', 'date'),
'rechercher_champs' => array("slug" => 8), 'rechercher_champs' => array("slug" => 8),
'tables_jointures' => array(), 'tables_jointures' => array(),
'statut'=> array( 'statut'=> array(

View file

@ -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,73 @@
.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;
} }
.editer_repondre_a {
display: flex;
}
.editer_repondre_a label {
width: 120px;
}
.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;
} }

View file

@ -33,6 +33,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_testEnvoiSepare(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_testEnvoiSepare>
<div class="editer_groupe"> <div class="editer_groupe">
#SET{name,cc} #SET{name,cc}
@ -56,6 +75,19 @@
</div> </div>
</div> </div>
<BOUCLE_testRepondreA(CONDITION){si #ENV{repondre_a}}>
<div class="editer_groupe">
#SET{name,repondre_a}
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
#SET{obli,"obligatoire"}
<div class="editer editer_[(#GET{name})][ (#GET{obli})][ (#GET{erreurs}|oui)erreur]">
<label for="#GET{name}">Répondre à</label>
[<span class="erreur_message">(#GET{erreurs})</span>]
<input type="text" class="text mail_repondre_a tagEditor" name="#GET{name}" id="#GET{name}" value="#ENV{#GET{name}}" >
</div>
</div>
</BOUCLE_testRepondreA>
<div class="editer_groupe"> <div class="editer_groupe">
#SET{name,sujet} #SET{name,sujet}
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}} #SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
@ -130,6 +162,13 @@
</div> </div>
</B_doc> </B_doc>
#SET{fichier,all_fichiers}
[(#CHEMIN{gamumail/#GET{fichier}.html}|oui)
#SET{erreurs,#ENV**{erreurs}|table_valeur{Tid_doc}}
[<span class="erreur_message">(#GET{erreurs})</span>]
<INCLURE{fond=gamumail/#GET{fichier},env,slug=#SLUG,options=#ENV{options}}>
]
#SET{fichier,#SLUG|concat{_fichiers}} #SET{fichier,#SLUG|concat{_fichiers}}
[(#CHEMIN{gamumail/#GET{fichier}.html}|oui) [(#CHEMIN{gamumail/#GET{fichier}.html}|oui)
#SET{erreurs,#ENV**{erreurs}|table_valeur{Tid_doc}} #SET{erreurs,#ENV**{erreurs}|table_valeur{Tid_doc}}

View file

@ -27,6 +27,7 @@ function formulaires_gamumail_charger_dist($slug, $destinataires = 0, $Tclient =
$Tcc = lire_config('gamumail/mail_cc') !== '' ? explode(',', lire_config('gamumail/mail_cc', '')) : []; $Tcc = lire_config('gamumail/mail_cc') !== '' ? explode(',', lire_config('gamumail/mail_cc', '')) : [];
$Tcci = lire_config('gamumail/mail_cci') !== '' ? explode(',', lire_config('gamumail/mail_cci', '')) : []; $Tcci = lire_config('gamumail/mail_cci') !== '' ? explode(',', lire_config('gamumail/mail_cci', '')) : [];
$Trepondre_a = lire_config('gamumail/mail_repondre_a') !== '' ? explode(',', lire_config('gamumail/mail_repondre_a', '')) : [];
if (!empty($destinataires) and !is_array($destinataires)) { if (!empty($destinataires) and !is_array($destinataires)) {
$destinataires = explode(',', $destinataires); $destinataires = explode(',', $destinataires);
@ -70,12 +71,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));
$texte = $gamuMail['texte'] ?? ''; $texte = $gamuMail['texte'] ?? '';
$sujet = $gamuMail['sujet'] ?? ''; $sujet = $gamuMail['sujet'] ?? '';
@ -91,11 +90,13 @@ function formulaires_gamumail_charger_dist($slug, $destinataires = 0, $Tclient =
'pour' => implode(',', $Tmails), 'pour' => implode(',', $Tmails),
'cc' => implode(',', $Tcc), 'cc' => implode(',', $Tcc),
'cci' => implode(',', $Tcci), 'cci' => implode(',', $Tcci),
'repondre_a' => implode(',', $Trepondre_a),
'TFichierpdfs' => $TFichierPdf, 'TFichierpdfs' => $TFichierPdf,
'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)
@ -209,21 +210,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) {
@ -231,12 +223,58 @@ 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');
$repondre_a = _request('repondre_a');
$cc = explode(',', $cc);
$cci = explode(',', $cci);
$repondre_a = explode(',', $repondre_a);
$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);
@ -323,6 +361,20 @@ function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient =
]; ];
} }
} }
if ($f = charger_fonction('traiter_pieces_jointes', 'gamumail', true)) {
$pc = $f($slug, $options, $destinataires, $Tclient, $Tpdf);
if (!empty($pc)) {
$pieces_jointes[] = $pc;
}
}
if ($f = charger_fonction($slug . '_traiter_pieces_jointes', 'gamumail', true)) {
$pc = $f($options, $destinataires, $Tclient, $Tpdf);
if (!empty($pc)) {
$pieces_jointes[] = $pc;
}
}
$html_header = ''; $html_header = '';
if (find_in_path('gamumail/'.$slug .'_html_header.html')) { if (find_in_path('gamumail/'.$slug .'_html_header.html')) {
$html_header = recuperer_fond('gamumail/'.$slug . '_html_header', $options); $html_header = recuperer_fond('gamumail/'.$slug . '_html_header', $options);
@ -360,6 +412,10 @@ function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient =
'cci' => $cci, 'cci' => $cci,
'pieces_jointes' => $pieces_jointes 'pieces_jointes' => $pieces_jointes
]; ];
if ($repondre_a) {
$corps['repondre_a'] = $repondre_a;
}
// surcharges de traiter : d'abord les surcharges pour tous les slugs (tous_traiter.php) puis les spécifiques par slug (nom_slug_traiter.php) // surcharges de traiter : d'abord les surcharges pour tous les slugs (tous_traiter.php) puis les spécifiques par slug (nom_slug_traiter.php)
if ($f = charger_fonction('traiter', 'gamumail', true)) { if ($f = charger_fonction('traiter', 'gamumail', true)) {
@ -377,7 +433,8 @@ function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient =
]); ]);
$sujet = $remplacement_generiques($args, $sujet); $sujet = $remplacement_generiques($args, $sujet);
//var_dump($corps);die; $args['corps'] = $corps;
$args['sujet'] = $sujet;
// envoyer ! // envoyer !
$envoyer_mail = charger_fonction('envoyer_mail', 'inc/'); $envoyer_mail = charger_fonction('envoyer_mail', 'inc/');
@ -407,9 +464,5 @@ function formulaires_gamumail_traiter_dist($slug, $destinataires = 0, $Tclient =
} }
} }
if ($redirect AND $redirect != '') { return $ok;
$retour['redirect'] = $redirect;
}
return $retour;
} }

View file

@ -9,8 +9,11 @@
<h3 class="spip"><:gamumail:remplacements_disponibles:></h3> <h3 class="spip"><:gamumail:remplacements_disponibles:></h3>
<ul class=""> <ul class="">
<BOUCLE_remplace(DATA){source tableau, #VAL|afficher_remplacements}> <BOUCLE_remplace(DATA){source tableau, #VAL|afficher_remplacements}>
<li><strong>[(#CLE)]</strong> : [(#VALEUR)]</li> <li><span class="toClip pointer" data-clipboard-text="#CLE"><strong>[(#CLE)]</strong> </span>: [(#VALEUR)]</li>
</BOUCLE_remplace> </BOUCLE_remplace>
</ul> </ul>
<em><:gamumail:avertissement_remplacements:></em> <em><:gamumail:avertissement_remplacements:></em>
</div> </div>
<script src="[(#CHEMIN{javascript/spip_barre.js}|timestamp)]" type="text/javascript"></script>
<script src="[(#CHEMIN{js/toClip.js}|timestamp)]" type="text/javascript"></script>

View file

@ -36,7 +36,7 @@ function gamumail_upgrade($nom_meta_base_version, $version_cible) {
$maj['1.0.11'] = array( array('maj_tables', array('spip_gamumails'))); $maj['1.0.11'] = array( array('maj_tables', array('spip_gamumails')));
$maj['1.0.12'] = array(array('creer_compte_curl')); $maj['1.0.12'] = array(array('creer_compte_curl'));
$maj['1.0.14'] = array(array('maj_tables', array('spip_gamumails'))); $maj['1.0.14'] = array(array('maj_tables', array('spip_gamumails')));
$maj['1.0.15'] = array(array('maj_tables', array('spip_gamumails'))); $maj['1.0.16'] = array(array('maj_tables', array('spip_gamumails')));
include_spip('base/upgrade'); include_spip('base/upgrade');
@ -55,7 +55,9 @@ function creer_compte_curl(){
'statut' => '1comite' 'statut' => '1comite'
]; ];
$id_auteur = sql_insertq('spip_auteurs', $set); include_spip('action/editer_auteur');
$id_auteur = auteur_inserer(null, $set);
if ($id_auteur) { if ($id_auteur) {
include_spip('inc/config'); include_spip('inc/config');
ecrire_config('curl_login', $set['login']); ecrire_config('curl_login', $set['login']);

View file

@ -7,19 +7,9 @@ function inc_charger_pdf_dist($fichier_pdf, $contexte = []){
$login = lire_config('curl_login'); $login = lire_config('curl_login');
$password = lire_config('curl_mdp'); $password = lire_config('curl_mdp');
$url = $GLOBALS['meta']['adresse_site'].'/spip.php?page=spipdf&spipdf='.$fichier_pdf;
if (is_array($contexte) and count($contexte)) { $contexte['spipdf'] = $contexte['spipdf'] ?? $fichier_pdf ;
foreach ($contexte as $champ => $val) { $url = generer_url_public('spipdf', $contexte, true, false);
/* if (intval($val) === $val) {
// if (intval($val)) {
$val = intval($val);
} else {
$val = "$val";
}
*/
$url .= "&$champ=$val";
}
}
$CurlConnect = curl_init(); $CurlConnect = curl_init();
// pour une connexion https locale avec certificat auto-signé // pour une connexion https locale avec certificat auto-signé

View file

@ -14,22 +14,21 @@ if (!defined('_ECRIRE_INC_VERSION')) {
**/ **/
function inc_gamumail_remplacements_dist($args, $html) { function inc_gamumail_remplacements_dist($args, $html) {
/** /**
* @@nom@@ => Prenom Nom | Nom (gère la présence/absence du champ prenom dans spip_auteurs) * @@nom@@ => $nom ou un espace pour vider le champ @@nom@@
**/ **/
$nom = sql_getfetsel('nom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0])); $nom = sql_getfetsel('nom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0])) ?? ' ';
$prenom = $nom; $html = gamumail_remplacer_modele('nom', ucwords($nom), $html);
/**
* @@prenom@@ => $prenom ou un espace pour vider le champ @@prenom@@
**/
$prenom = ' ';
$trouver_table = charger_fonction('trouver_table', 'base'); $trouver_table = charger_fonction('trouver_table', 'base');
$desc = $trouver_table('spip_auteurs'); $desc = $trouver_table('spip_auteurs');
if (array_key_exists('prenom', $desc['field']) if (array_key_exists('prenom', $desc['field'])) {
and $prenom = sql_getfetsel('prenom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0]))) { $prenom = sql_getfetsel('prenom', 'spip_auteurs', 'email='.sql_quote($args['destinataires'][0])) ?? ' ';
$nom = $prenom.' '.$nom;
} }
if ($nom) {
$html = gamumail_remplacer_modele('nom', ucwords($nom), $html);
}
if ($prenom) {
$html = gamumail_remplacer_modele('prenom', ucwords($prenom), $html); $html = gamumail_remplacer_modele('prenom', ucwords($prenom), $html);
}
/** /**
* @@url_site@@ => URL du site * @@url_site@@ => URL du site

15
js/toClip.js Normal file
View file

@ -0,0 +1,15 @@
jQuery(function ($) {
$('.toClip').on('mousedown', function (e) {
e.preventDefault();
const t = $(this).data('clipboard-text') ?? $(this).text();
navigator.clipboard.writeText(t).then(() => {
barre_inserer(t);
const html = `<span class="copierOk verte"><strong>&#x2714; copié</strong></span>`;
$(this).append(html);
setTimeout(() => {
$(this).children('.copierOk').remove();
}, 1000);
});
});
});

View file

@ -1,12 +1,12 @@
<paquet <paquet
prefix="gamumail" prefix="gamumail"
categorie="communication" categorie="communication"
version="1.1.0" version="1.2.0"
etat="dev" etat="dev"
compatibilite="[3.2.0;4.2.*]" compatibilite="[3.2.0;4.2.*]"
logo="prive/themes/spip/images/gamumail-64.png" logo="prive/themes/spip/images/gamumail-64.png"
documentation="" documentation=""
schema="1.0.15" schema="1.0.16"
> >
<nom>GamuMail</nom> <nom>GamuMail</nom>