From 356f70aab50be36ead783725a56e24e5214ecd62 Mon Sep 17 00:00:00 2001 From: tofulm Date: Mon, 9 Dec 2019 11:37:31 +0100 Subject: [PATCH] on ajoute un input hidden avec le nom du fichier pour pouvoir recreer proprement l'ordre du files --- inc/bigform.php | 14 ++++++++++++-- js/bigform.js.html | 4 +++- paquet.xml | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/inc/bigform.php b/inc/bigform.php index ba60442..e2788e3 100644 --- a/inc/bigform.php +++ b/inc/bigform.php @@ -14,18 +14,28 @@ if (!defined('_ECRIRE_INC_VERSION')){ function inc_bigform_dist($id_objet,$objet = 'article',$mode='auto') { include_spip('inc/joindre_document'); set_request('joindre_upload','ok'); + $files = joindre_trouver_fichier_envoye(); + $html_titre = _request('html_titre'); + $html_ordre = _request('html_ordre'); + + // calcul ordre des titres des files uploades + $lesTitres = []; + foreach ($files as $i => $t) { + $index = array_search($t['name'], $html_ordre); + $lesTitres[] = $html_titre[$index]; + } + $Tid_doc = []; if (is_array($files) and count($files)) { $ajouter_document = charger_fonction('ajouter_documents', 'action'); $Tid_doc = $ajouter_document('new', $files, $objet, $id_objet,$mode); } - $html_titre = _request('html_titre'); if (!empty($html_titre) and count($Tid_doc)) { foreach ($Tid_doc as $i => $id_doc) { - $titre = $html_titre[$i]; + $titre = $lesTitres[$i]; if ($titre) { sql_updateq('spip_documents', array("titre" => $titre), 'id_document='.intval($id_doc)); } diff --git a/js/bigform.js.html b/js/bigform.js.html index eaa648b..235ef5b 100644 --- a/js/bigform.js.html +++ b/js/bigform.js.html @@ -6,7 +6,9 @@ function bigform() { $('input.bigup').bigup({}, { fileSuccess: function (a, b) { - var html_titre = ''; + var html_ordre = ''; + var html_titre = '
'; + $(html_ordre).insertAfter($(b.emplacement[0]).children().children('.infos')); $(html_titre).insertAfter($(b.emplacement[0]).children().children('.infos')); } }); diff --git a/paquet.xml b/paquet.xml index 0dad0f0..a440da8 100644 --- a/paquet.xml +++ b/paquet.xml @@ -1,7 +1,7 @@