Activation de l’upload par glisser / déposer que si permission d’ajouter.
authorBenoît Pin <benoit.pin@gmail.com>
Sun, 8 Dec 2013 21:14:39 +0000 (22:14 +0100)
committerBenoît Pin <benoit.pin@gmail.com>
Sun, 8 Dec 2013 21:14:39 +0000 (22:14 +0100)
skins/photo_theme/folder_contents.py
skins/photo_theme/folder_contents_macros.pt

index 2659868..714b8f1 100755 (executable)
@@ -215,7 +215,8 @@ options['form'] = { 'action': target,
                                        'listHiddenVarInfos': tuple(hidden_vars),
                                        'listButtonInfos': tuple(buttons),
                                        'is_orderable': is_orderable,
                                        '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)
 if not ajax and is_orderable :
        deltas = range( 1, min(5, length) ) + range(5, length, 5)
        options['form']['listDeltas'] = tuple(deltas)
index a9d046a..98177ba 100644 (file)
                                addListener(topNavBatchBar, "click", loadListing);
                                addListener(bottomNavBatchBar, "click", loadListing);
                        }
                                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';
                        // 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>
                }());
     </script>
   </body>