diff --git a/formulaires/joindre_document.php b/formulaires/joindre_document.php index d3811fc916b5e2706ab371f5333987b15e00b77d..81c4af403ad87ba15899bb05ba62fd0d2a8a2437 100644 --- a/formulaires/joindre_document.php +++ b/formulaires/joindre_document.php @@ -149,16 +149,24 @@ function formulaires_joindre_document_traiter_dist($id_document='new',$id_objet= $ancre = ''; // on joint un document deja dans le site if (_request('joindre_mediatheque')){ - if ($refdoc_joindre = intval(preg_replace(',^(doc|document|img),','',_request('refdoc_joindre')))){ - // lier le parent en plus - $champs = array('ajout_parents' => array("$objet|$id_objet")); - include_spip('action/editer_document'); - document_modifier($refdoc_joindre,$champs); - set_request('refdoc_joindre',''); // vider la saisie - $ancre = $refdoc_joindre; - $sel[] = $refdoc_joindre; - $res['message_ok'] = _T('medias:document_attache_succes'); + $refdoc_joindre = _request('refdoc_joindre'); + $refdoc_joindre = strtr($refdoc_joindre,";,-"," "); + $refdoc_joindre = explode(" ",$refdoc_joindre); + include_spip('action/editer_document'); + foreach($refdoc_joindre as $j){ + if ($j = intval(preg_replace(',^(doc|document|img),','',$j))){ + // lier le parent en plus + $champs = array('ajout_parents' => array("$objet|$id_objet")); + document_modifier($j,$champs); + if (!$ance) + $ancre = $j; + $sel[] = $j; + $res['message_ok'] = _T('medias:document_attache_succes'); + } } + if ($sel) + $res['message_ok'] = singulier_ou_pluriel(count($sel),'medias:document_attache_succes','medias:nb_documents_attache_succes'); + set_request('refdoc_joindre',''); // vider la saisie } // sinon c'est un upload else { @@ -190,18 +198,17 @@ function formulaires_joindre_document_traiter_dist($id_document='new',$id_objet= if (!$ancre) $ancre = $doc; $sel[] = $doc; - $nb_docs++; } } if (count($messages_erreur)) $res['message_erreur'] = implode('<br />',$messages_erreur); - if ($nb_docs){ - $res['message_ok'] = singulier_ou_pluriel($nb_docs,'medias:document_installe_succes','medias:nb_documents_installe_succes'); + if ($sel){ + $res['message_ok'] = singulier_ou_pluriel(count($sel),'medias:document_installe_succes','medias:nb_documents_installe_succes'); } if ($ancre) $res['redirect'] = "#doc$ancre"; } - if ($nb_docs OR isset($res['message_ok'])){ + if (count($sel) OR isset($res['message_ok'])){ $callback = ""; if ($ancre) $callback .= "jQuery('#doc$ancre a.editbox').eq(0).focus();"; diff --git a/lang/medias_fr.php b/lang/medias_fr.php index 3608701ccf9c3b9d1a0c4f09d62f2bcb99936b37..e849ddf11e53c5a14baa489f07104a224bd00b70 100644 --- a/lang/medias_fr.php +++ b/lang/medias_fr.php @@ -136,6 +136,7 @@ $GLOBALS[$GLOBALS['idx_lang']] = array( // N 'nb_documents_installe_succes' => '@nb@ fichiers chargés avec succès', + 'nb_documents_attache_succes' => '@nb@ documents ont bien été ajoutés', // O 'objet_document' => 'Document', diff --git a/paquet.xml b/paquet.xml index acd1a59af3ede11502755c4aa76f7efb2b1d3d3f..1c8b3e78c86d6e89cafe4ad6576027acd7da9f7a 100644 --- a/paquet.xml +++ b/paquet.xml @@ -1,7 +1,7 @@ <paquet prefix="medias" categorie="multimedia" - version="2.2.3" + version="2.3.0" etat="test" compatibilite="[3.0.0-alpha2;[" logo="prive/themes/spip/images/portfolio-32.png"