From f2272fe2c62c28ba845b5db5b1ed6cc048150ab3 Mon Sep 17 00:00:00 2001 From: tofulm Date: Tue, 27 Sep 2022 21:11:34 +0200 Subject: [PATCH] =?UTF-8?q?On=20gere=20correctement=20l'envoi=20du=20=20js?= =?UTF-8?q?on=20complet=20ou=20seulement=20ce=20qui=20est=20affich=C3=A9,?= =?UTF-8?q?=20attention=20,=20il=20faut=20gerer=20la=20conf=20de=20php=20c?= =?UTF-8?q?orrectement,=20cf=20readme.=20On=20change=20le=20nom=20du=20fic?= =?UTF-8?q?hier,=20plus=20besoin=20qu'il=20soit=20hash=C3=A9=20maintenant,?= =?UTF-8?q?=20car=20un=20job=20le=20supprimera?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 ++++++ action/pdf_gamutable.php | 13 ++++--- js/gamutable.es6.js | 23 ++++++++---- js/gamutable.js | 77 ++++++++++++++++++++++------------------ 4 files changed, 76 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index f2f5e3c..f481151 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,16 @@ Dans cette nouvelle version, on découpe le stockage en 2: ## Configuration Choisir entre la version minifiée de vuejs (sans le debug) ou la version de dev +### PHP dans php.ini +* post_max_size which is directly related to the POST size +* upload_max_filesize which may be unrelated, not sure +* max_input_time, if the POSt takes too long +* max_input_nesting_level if your data is an array with a lot of sublevels +* max_execution_time, but quite sure it’s not that +* memory_limit, as you may reach a size exceding the subprocess allowed memory +* max_input_vars, if your data array has many elements => **le plus important** + + ## Utilisation - charger l'inclure (5 args possibles et facultatifs) ```html diff --git a/action/pdf_gamutable.php b/action/pdf_gamutable.php index 086d2bc..3233d95 100644 --- a/action/pdf_gamutable.php +++ b/action/pdf_gamutable.php @@ -11,9 +11,9 @@ function action_pdf_gamutable_dist() { } $fichierpdf = _request('fichierpdf') ?? ''; - // $namepdf = _request('namepdf') ?? $fichierpdf; + $namepdf = _request('namepdf') ?? $fichierpdf; $header = _request('header') ?? []; - $Tdata = _request('data') ?? []; + $Tdata = _request('Tdata') ?? []; $arg = _request('arg') ?? ''; if (empty($header) or empty($fichierpdf)) { @@ -23,15 +23,14 @@ function action_pdf_gamutable_dist() { $Tcles = []; if (!empty($Tdata)) { foreach ($Tdata as $d) { - $Tcles[] = $d['html']['id']; + $Tcles[] = $d['id']; } } - if (find_in_path('gamutable_pdf/' . $fichierpdf . '.html')) { $set = ['arg' => $arg]; if (!empty($Tcles)) { - $set = array_merge($set, ['Lids' => implode(',', $Tcles)]); + $set = array_merge($set, ['Tids' => $Tcles]); } $fond = recuperer_fond('gamutable_pdf/' . $fichierpdf, $set); @@ -43,10 +42,10 @@ function action_pdf_gamutable_dist() { include_spip('spipdf_options'); include_spip('inc/spipdf'); - $namepdf = 'pdf_' . time(); + $namepdf = date("Y-m-d_H-i") . '_' . $namepdf; $a = spipdf_html2pdf($fond); $dir = sous_repertoire(_DIR_IMG . 'pdfgamutable'); - $chemin = $dir . md5($namepdf) . '.pdf' ; + $chemin = $dir . $namepdf . '.pdf' ; file_put_contents($chemin, $a); $id_job = job_queue_add( diff --git a/js/gamutable.es6.js b/js/gamutable.es6.js index eb3228d..940f902 100644 --- a/js/gamutable.es6.js +++ b/js/gamutable.es6.js @@ -197,9 +197,6 @@ let monTableau = { namecsv: { type: String, }, - namepdf: { - type: String, - }, url_sort_asc: { type: String, }, @@ -710,13 +707,19 @@ let monTableau = { } }, genererPDF(quoi = 'tableau') { + let $tableau = []; + Object.values(this[quoi]).forEach((d) => { + $tableau.push(d.html); + }); + const data = { fichierpdf: this.fichierpdf, namepdf: this.namepdf, header: this.header, - data: this[quoi], arg: this.argpdf, + Tdata: $tableau, }; + let req = $.ajax({ url: this.pdfuri, type: 'POST', @@ -815,18 +818,26 @@ let monTableau = { > + - + diff --git a/js/gamutable.js b/js/gamutable.js index 96a822d..51d4e04 100644 --- a/js/gamutable.js +++ b/js/gamutable.js @@ -1,7 +1,5 @@ "use strict"; -var _props; - function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } @@ -10,8 +8,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } @@ -221,7 +217,7 @@ function trouver_index(table, id) { } var monTableau = { - props: (_props = { + props: { tparpage: { type: Array, default: function _default() { @@ -252,33 +248,42 @@ var monTableau = { }, namecsv: { type: String + }, + url_sort_asc: { + type: String + }, + url_sort_desc: { + type: String + }, + urlvuebloc: { + type: String + }, + vueblocdefaut: { + type: String, + default: 'tableau' + }, + filtrecolmulti: { + type: String + }, + nomblocajaxreload: { + type: String + }, + stockage: { + type: String + }, + includespip: { + type: String + }, + filtrer: { + type: String + }, + _id: { + type: String + }, + filtreselect: { + type: String } - }, _defineProperty(_props, "namepdf", { - type: String - }), _defineProperty(_props, "url_sort_asc", { - type: String - }), _defineProperty(_props, "url_sort_desc", { - type: String - }), _defineProperty(_props, "urlvuebloc", { - type: String - }), _defineProperty(_props, "vueblocdefaut", { - type: String, - default: 'tableau' - }), _defineProperty(_props, "filtrecolmulti", { - type: String - }), _defineProperty(_props, "nomblocajaxreload", { - type: String - }), _defineProperty(_props, "stockage", { - type: String - }), _defineProperty(_props, "includespip", { - type: String - }), _defineProperty(_props, "filtrer", { - type: String - }), _defineProperty(_props, "_id", { - type: String - }), _defineProperty(_props, "filtreselect", { - type: String - }), _props), + }, data: function data() { return { table: [], @@ -808,12 +813,16 @@ var monTableau = { }, genererPDF: function genererPDF() { var quoi = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'tableau'; + var $tableau = []; + Object.values(this[quoi]).forEach(function (d) { + $tableau.push(d.html); + }); var data = { fichierpdf: this.fichierpdf, namepdf: this.namepdf, header: this.header, - data: this[quoi], - arg: this.argpdf + arg: this.argpdf, + Tdata: $tableau }; var req = $.ajax({ url: this.pdfuri, @@ -888,7 +897,7 @@ var monTableau = { } } }, - template: "\n\t
\n\t\t
\n\t\t\t\n\t\t\t\n\n\t\t\t\n\t\t\t\n\n\t\t\t\n\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\tMise \xE0 jour de la base de donn\xE9e\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t{{tableau.length}} / {{table.length}} \xE9l\xE9ments\n\t\t\t \n\t\t
\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
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tX\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t
\n\t\t\t
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