From 8ba264d69ba67ca70165abfebb05947f5dd8e5b7 Mon Sep 17 00:00:00 2001 From: tofulm Date: Tue, 27 Sep 2022 15:01:52 +0200 Subject: [PATCH] =?UTF-8?q?pour=20les=20pdfs,=20on=20passe=20par=20une=20a?= =?UTF-8?q?ction=20afin=20de=20pouvoir=20avoir=20tous=20les=20cas=20possib?= =?UTF-8?q?les.=20Le=20gros=20probl=C3=A8me=20a=20=C3=A9t=C3=A9=20de=20g?= =?UTF-8?q?=C3=A9rer=20la=20g=C3=A9n=C3=A9ration=20du=20pdf=20et=20surtout?= =?UTF-8?q?=20son=20telechargement.=20la=20solution=20:=20-=20le=20fichier?= =?UTF-8?q?=20action=20cree=20le=20pdf=20et=20le=20place=20dans=20=20=20IM?= =?UTF-8?q?G/gamutable=5Fpdf/xxxxxxxxxx.mdf=20(nom=20du=20fichier=20hash?= =?UTF-8?q?=C3=A9)=20-=20on=20ajoute=20un=20cron=20dans=2020=20secondes=20?= =?UTF-8?q?pour=20supprimer=20ce=20fichier=20-=20TODO,=20mainteannt=20joue?= =?UTF-8?q?r=20avec=20l'action=20!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action/pdf_gamutable.php | 52 +++++++++++++++++ gamutable_autorisations.php | 5 +- gamutable_fonctions.php | 1 + inc/gamutable_clean_pdf.php | 9 +++ inc/toto.txt | 0 inclure/gamutable.html | 8 ++- js/gamutable.es6.js | 40 +++++++++++-- js/gamutable.js | 111 ++++++++++++++++++++++-------------- 8 files changed, 172 insertions(+), 54 deletions(-) create mode 100644 action/pdf_gamutable.php create mode 100644 inc/gamutable_clean_pdf.php create mode 100755 inc/toto.txt diff --git a/action/pdf_gamutable.php b/action/pdf_gamutable.php new file mode 100644 index 0000000..03997be --- /dev/null +++ b/action/pdf_gamutable.php @@ -0,0 +1,52 @@ + implode(',', $Tcles)]); + } + + include_spip('spipdf_options'); + include_spip('inc/spipdf'); + + $a = spipdf_html2pdf($fond); + $dir = sous_repertoire(_DIR_IMG . 'pdfgamutable'); + $chemin = $dir . md5($namepdf) . '.pdf' ; + file_put_contents($chemin, $a); + + $id_job = job_queue_add( + 'gamutable_clean_pdf', + 'Gamutable nettoyer pdf', + [$chemin], + 'inc/gamutable_clean_pdf', + false, + time() + 20 + ); + echo url_absolue($chemin); +} diff --git a/gamutable_autorisations.php b/gamutable_autorisations.php index 59d67cf..1c3b6df 100644 --- a/gamutable_autorisations.php +++ b/gamutable_autorisations.php @@ -24,7 +24,10 @@ function autoriser_gamutable_purger_dist($faire, $type, $id, $qui, $opt) { return autoriser('webmestre'); } +function autoriser_gamutablepdf_generer_dist($faire, $type, $id, $qui, $opt) { + return intval($qui['id_auteur']); +} + function autoriser_gamutable_modifier_dist($faire, $type, $id, $qui, $opt) { return true; } - diff --git a/gamutable_fonctions.php b/gamutable_fonctions.php index 1091d8e..cd4952f 100644 --- a/gamutable_fonctions.php +++ b/gamutable_fonctions.php @@ -13,6 +13,7 @@ if (!defined('_ECRIRE_INC_VERSION')) { return; } + function gamutable_fermer_modalbox($id_objet = 9999999999){ $html = << diff --git a/inc/gamutable_clean_pdf.php b/inc/gamutable_clean_pdf.php new file mode 100644 index 0000000..3f22956 --- /dev/null +++ b/inc/gamutable_clean_pdf.php @@ -0,0 +1,9 @@ + [(#SET{sort_asc,[(#CHEMIN{img/sprite_gamutable.svg})#sort_asc]})] [(#SET{sort_desc,[(#CHEMIN{img/sprite_gamutable.svg})#sort_desc]})] +[(#SET{pdfuri,#VAL{pdf_gamutable}|generer_url_action{"", 1}})]
@@ -11,12 +12,13 @@ [(#ENV{titreGamutableUn})] (#ENV{titreGamutableDeux})]
\n\n\t\t
\n\t\t\t
\n\t\t\t
\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t
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