on ajoute un input hidden avec le nom du fichier pour pouvoir recreer proprement l'ordre du files
This commit is contained in:
parent
431dc0bb8c
commit
356f70aab5
3 changed files with 16 additions and 4 deletions
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
function bigform() {
|
||||
$('input.bigup').bigup({}, {
|
||||
fileSuccess: function (a, b) {
|
||||
var html_titre = '<label><:bigform:html_titre:> <input type="text" value="" name="html_titre\[\]"/></label>';
|
||||
var html_ordre = '<input type="hidden" value="'+b.file.name+'" name="html_ordre\[\]"/>';
|
||||
var html_titre = '<div class="html_titre"><label><:bigform:html_titre:> <input type="text" value="" name="html_titre\[\]"/></label></div>';
|
||||
$(html_ordre).insertAfter($(b.emplacement[0]).children().children('.infos'));
|
||||
$(html_titre).insertAfter($(b.emplacement[0]).children().children('.infos'));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<paquet
|
||||
prefix="bigform"
|
||||
categorie="edition"
|
||||
version="1.0.0"
|
||||
version="1.0.1"
|
||||
etat="dev"
|
||||
compatibilite="[3.2.6-dev;3.3.*]"
|
||||
logo="prive/themes/spip/images/bigform-64.png"
|
||||
|
|
Loading…
Add table
Reference in a new issue