Activation de l'ordonnancement par drag and drop que quand c'est possible (permission...
[Portfolio.git] / skins / photo_layout_macros.pt
index c096822..f68f193 100644 (file)
@@ -9,7 +9,9 @@
     <div metal:define-macro="grid"
          tal:define="slide_size portal_object/slide_size;
                      mayBeDropable exists:dropable;
-                     dropable python:True if mayBeDropable and dropable else False"
+                     dropable python:True if mayBeDropable and dropable else False;
+                     mayBeOrderable exists:orderable;
+                     orderable python:True if mayBeOrderable and orderable else False"
          i18n:domain="portfolio">
       <div id="lightbox" tal:attributes="class python:'lightbox photo-drop-target' if dropable else 'lightbox'">
         <span metal:define-macro="thumbnails" tal:repeat="info infos" tal:omit-tag="">
@@ -19,7 +21,8 @@
                             selected info/selected|nothing"
                 tal:attributes="class info/className;
                                 name info/cmf_uid"
-                metal:define-macro="thumbnail">
+                metal:define-macro="thumbnail"
+                draggable="true">
             <a class="slide" tal:attributes="href info/href; title info/title">
               <img tal:attributes="src info/thumbUrl;
                                    alt info/title;
               tal:content="structure python:'''
               new Lightbox(document.getElementById('lightbox'),
                            document.getElementById('lightbox_toolbar'),
-                           %s);
-                           ''' % ('true' if not batch.next else 'false')">
+                           %(complete)s,
+                           '%(container_type)s');
+                           ''' % {'complete' : 'true' if not batch.next else 'false',
+                                  'container_type' : options.get('container_type', 'portfolio')}">
       </script>
       <script type="text/javascript"
               tal:condition="dropable"
                 var lb = document.getElementById('lightbox');
                 new Lightbox(lb,
                              document.getElementById('lightbox_toolbar'),
-                             %(complete)s);
+                             %(complete)s,
+                             '%(container_type)s',
+                             %(orderable)s);
                 var uploadUrl = '%(putUrl)s';
                 var options = {'slideSize' : %(slideSize)d,
                                'thumbnailSize' : %(thumbnailSize)d};
               ''' % {'putUrl' : '%s/put_upload' % here.absolute_url(),
                      'slideSize' : portal_object.slide_size,
                      'thumbnailSize' : portal_object.thumb_size,
-                     'complete': 'true' if not batch.next else 'false'}">
+                     'complete': 'true' if not batch.next else 'false',
+                     'container_type' : options.get('container_type', 'portfolio'),
+                     'orderable' : 'true' if orderable else 'false'}">
       </script>
     </div>
     <div metal:define-macro="film_bar" tal:omit-tag="">