- la fonction charger_pdf() accepte maintenant un 3e args, les opts
- on ajoute dans l'array des pieces jointes des infos (qui (d'où vient
  se pièce jointe) et quoi (son id))
- on deplace l'affichage des tPDFS dans un inclure :
  gamumail/inc-pdf_envoyes.html qui permet d'etre facilement surchargé
This commit is contained in:
Christophe 2023-11-13 14:09:17 +01:00
parent 4e61ca9ec1
commit a7fe6a811f
4 changed files with 70 additions and 54 deletions

View file

@ -116,31 +116,10 @@
[(#CHEMIN{gamumail/#GET{fichier}.html}|oui)
<INCLURE{fond=gamumail/#GET{fichier},env,lang=#GET{lang_dest}}>
]
#SET{name,Tpdfs_ok}
<B_pdf>
<h2><:gamumail:pdf_envoyes:></h2>
<div class="editer_groupe">
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
#SET{obli,"obligatoire"}
<div class="editer editer_[(#GET{name})][ (#GET{obli})][ (#GET{erreurs}|oui)erreur]">
<BOUCLE_pdf(DATA){source tableau, #ENV{TFichierpdfs}}>
<div class="choix">
<input type="checkbox" class="checkbox" name="#GET{name}[]" value="[(#VALEUR|table_valeur{fichier})]_#CLE" id="#GET{name}_#COMPTEUR_BOUCLE" checked="checked" >
[(#SET{url_pdf, #URL_PAGE{spipdf}
|parametre_url{spipdf, #VALEUR|table_valeur{fichier}}
|parametre_url{lang, #GET{lang_dest}}
})]
<BOUCLE_options(DATA){source tableau, #VALEUR|table_valeur{contexte}}>
[(#SET{url_pdf,[(#GET{url_pdf}|parametre_url{#CLE,#VALEUR})]})]
</BOUCLE_options>
<label for="#GET{name}_#COMPTEUR_BOUCLE">[(#VALEUR|table_valeur{nom}|html_entity_decode)] : <a href="#GET{url_pdf}">voir le PDF</a></label>
</div>
</BOUCLE_pdf>
</div>
</div>
</B_pdf>
<INCLURE{fond=gamumail/inc-pdf_envoyes,env}>
#SET{name,docs_spip}
<div class="documents_attaches">
<h2><:gamumail:documents_attaches:></h2>
<div class="w500p">
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
@ -161,6 +140,7 @@
</B_docs_spip>
</div>
</div>
</div>
#SET{fichier,all_fichiers}
[(#CHEMIN{gamumail/#GET{fichier}.html}|oui)
#SET{erreurs,#ENV**{erreurs}|table_valeur{Tid_doc}}

View file

@ -351,7 +351,9 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $Tfiles, $re
'chemin' => $destination,
'nom' => $nom_fichier,
'encodage' => 'base64',
'mime' => $type_mime
'mime' => $type_mime,
'quoi' => 'docs_spip',
'qui' => $id_document
];
}
}
@ -372,7 +374,9 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $Tfiles, $re
'chemin' => $destination,
'nom' => $nom_fichier,
'encodage' => 'base64',
'mime' => $type_mime
'mime' => $type_mime,
'quoi' => 'docs_spip',
'qui' => $id_doc
];
}
}
@ -384,7 +388,9 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $Tfiles, $re
'chemin' => $fichier['tmp_name'],
'nom' => $fichier['name'],
'encodage' => 'base64',
'mime' => $fichier['type']
'mime' => $fichier['type'],
'quoi' => 'televerser',
'qui' => $fichier['name']
];
}
}
@ -420,7 +426,8 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $Tfiles, $re
], 'data' => $c
]);
$pdf = $recup_pdf($fichier, $c);
$pdf = $recup_pdf($fichier, $c, $args);
if (!empty($pdf)) {
$nom_fichier = $nom.'.pdf';
$destination = _DIR_TMP.basename($nom_fichier);
$Tpdf_del[] = $destination;
@ -429,10 +436,13 @@ function gamuSend($slug, $options, $destinataires, $Tclient, $Tpdf, $Tfiles, $re
'chemin' => $destination,
'nom' => $nom_fichier,
'encodage' => 'base64',
'mime' => 'application/pdf'
'mime' => 'application/pdf',
'quoi' => 'pdf_genere',
'qui' => $fichier
];
}
}
}
if ($f = charger_fonction('traiter_pieces_jointes', 'gamumail', true)) {
$pc = $f($slug, $options, $destinataires, $Tclient, $Tpdf);

View file

@ -0,0 +1,26 @@
#SET{name,Tpdfs_ok}
<div class="pdf_envoyes">
<B_pdf>
<h2><:gamumail:pdf_envoyes:></h2>
<div class="editer_groupe">
#SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}}
#SET{obli,"obligatoire"}
<div class="editer editer_[(#GET{name})][ (#GET{obli})][ (#GET{erreurs}|oui)erreur]">
<BOUCLE_pdf(DATA){source tableau, #ENV{TFichierpdfs}}>
<div class="choix">
<input type="checkbox" class="checkbox" name="#GET{name}[]" value="[(#VALEUR|table_valeur{fichier})]_#CLE" id="#GET{name}_#COMPTEUR_BOUCLE" checked="checked" >
[(#SET{url_pdf, #URL_PAGE{spipdf}
|parametre_url{spipdf, #VALEUR|table_valeur{fichier}}
|parametre_url{lang, #GET{lang_dest}}
})]
<BOUCLE_options(DATA){source tableau, #VALEUR|table_valeur{contexte}}>
[(#SET{url_pdf,[(#GET{url_pdf}|parametre_url{#CLE,#VALEUR})]})]
</BOUCLE_options>
<label for="#GET{name}_#COMPTEUR_BOUCLE">[(#VALEUR|table_valeur{nom}|html_entity_decode)] : <a href="#GET{url_pdf}">voir le PDF</a></label>
</div>
</BOUCLE_pdf>
</div>
</div>
</B_pdf>
</div>

View file

@ -3,7 +3,7 @@ if (!defined('_ECRIRE_INC_VERSION')){
return;
}
function inc_charger_pdf_dist($fichier_pdf, $contexte = []){
function inc_charger_pdf_dist($fichier_pdf, $contexte = [], $args = []){
$login = lire_config('curl_login');
$password = lire_config('curl_mdp');