From f7ffc39e4a5598be7be9fcc9c00285fd1db426bf Mon Sep 17 00:00:00 2001
From: "d.ferrera@free.fr" <>
Date: Tue, 9 May 2017 17:19:56 +0000
Subject: [PATCH] =?UTF-8?q?permettre=20de=20garder=20le=20focus=20sur=20la?=
 =?UTF-8?q?=20m=C3=A9thode=20d'upload=20apr=C3=A8s=20l'envoi=20du=20formul?=
 =?UTF-8?q?aire=20joindre=5Fdocument.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 formulaires/inc-upload_document.html | 3 ++-
 formulaires/joindre_document.php     | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/formulaires/inc-upload_document.html b/formulaires/inc-upload_document.html
index 656cdb4d..9b0856a6 100644
--- a/formulaires/inc-upload_document.html
+++ b/formulaires/inc-upload_document.html
@@ -5,8 +5,9 @@
 [(#ENV{joindre_ftp}|oui)#SET{methode,ftp}]
 
 #SET{methodes_upload,#ENV**|medias_lister_methodes_upload}
+[(#ENV{methode_upload_focus}|et{#GET{methodes_upload}|is_array}|et{#ENV{methode_upload_focus}|array_key_exists{#GET{methodes_upload}}}|oui)#SET{methode,#ENV{methode_upload_focus}}]
 
-<div id="defaultsubmit#GET{domid}" class="none">DEFAULT</div>
+<div id="defaultsubmit#GET{domid}" class="none"></div>
 <BOUCLE_methodes(DATA){source tableau,#GET{methodes_upload}}>
 	#SET{methode_upload,#CLE}
 	<div class='joindre_mode#GET{domid}[(#GET{methode}|=={#CLE}|non)none-js]' id='joindre_#CLE#GET{domid}'>
diff --git a/formulaires/joindre_document.php b/formulaires/joindre_document.php
index caa48cac..c8ec77f4 100644
--- a/formulaires/joindre_document.php
+++ b/formulaires/joindre_document.php
@@ -91,6 +91,9 @@ function formulaires_joindre_document_charger_dist(
 	$valeurs['fichier_upload'] = $valeurs['_options_upload_ftp'] = $valeurs['_dir_upload_ftp'] = '';
 	$valeurs['joindre_upload'] = $valeurs['joindre_distant'] =
 	$valeurs['joindre_ftp'] = $valeurs['joindre_mediatheque'] = '';
+	
+	// gérer le focus de la méthode d'upload lorsque le formulaire est envoyé
+	$valeurs['methode_upload_focus'] = _request('methode_upload_focus');
 
 	$valeurs['editable'] = ' ';
 	if (intval($id_document)) {
-- 
GitLab