From 4bad110d2687345b9277c20f96a77d2633ac4759 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Benoi=CC=82t=20Pin?= <benoit.pin@gmail.com>
Date: Sun, 8 Dec 2013 22:14:39 +0100
Subject: [PATCH] =?utf8?q?Activation=20de=20l=E2=80=99upload=20par=20gliss?=
 =?utf8?q?er=20/=20d=C3=A9poser=20que=20si=20permission=20d=E2=80=99ajoute?=
 =?utf8?q?r.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 skins/photo_theme/folder_contents.py        | 3 ++-
 skins/photo_theme/folder_contents_macros.pt | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/skins/photo_theme/folder_contents.py b/skins/photo_theme/folder_contents.py
index 2659868..714b8f1 100755
--- a/skins/photo_theme/folder_contents.py
+++ b/skins/photo_theme/folder_contents.py
@@ -215,7 +215,8 @@ options['form'] = { 'action': target,
 					'listHiddenVarInfos': tuple(hidden_vars),
 					'listButtonInfos': tuple(buttons),
 					'is_orderable': is_orderable,
-					'is_sortable': is_sortable }
+					'is_sortable': is_sortable,
+					'items_add_allowed': items_add_allowed }
 if not ajax and is_orderable :
 	deltas = range( 1, min(5, length) ) + range(5, length, 5)
 	options['form']['listDeltas'] = tuple(deltas)
diff --git a/skins/photo_theme/folder_contents_macros.pt b/skins/photo_theme/folder_contents_macros.pt
index a9d046a..98177ba 100644
--- a/skins/photo_theme/folder_contents_macros.pt
+++ b/skins/photo_theme/folder_contents_macros.pt
@@ -95,10 +95,14 @@
 				addListener(topNavBatchBar, "click", loadListing);
 				addListener(bottomNavBatchBar, "click", loadListing);
 			}
+
+		}());
+    </script>
+    <script type="text/javascript" tal:condition="options/form/items_add_allowed">
+		(function(){
 			// upload by drag and drop
 			var uploadUrl = absolute_url() + '/put_upload';
-			new DDFolderUploader(document.getElementById('ForematterCell'), uploadUrl, listing);
-
+			new DDFolderUploader(document.getElementById('ForematterCell'), uploadUrl, document.getElementById("FolderListingBody"));
 		}());
     </script>
   </body>
-- 
2.20.1