Avancement sur l’upload par glisser / déposer dans les dossiers. On affiche le fragme...
authorBenoît Pin <pin@cri.ensmp.fr>
Wed, 4 Dec 2013 13:32:48 +0000 (14:32 +0100)
committerBenoît Pin <pin@cri.ensmp.fr>
Wed, 4 Dec 2013 13:32:48 +0000 (14:32 +0100)
profiles/default/types.xml [changed mode: 0755->0644]
profiles/default/types/CMF_Site.xml
profiles/default/types/Huge_Plinn_Folder.xml
profiles/default/types/Photo.xml
profiles/photo/types/Huge_Plinn_Folder.xml
profiles/photo/types/Photo.xml
skins/ajax_scripts/folder_contents_script.js
skins/photo_theme/folder_contents_macros.pt
skins/photo_theme/folder_jsupload_snippet.py [new file with mode: 0644]
skins/photo_theme/folder_jsupload_snippet_template.pt [new file with mode: 0644]

old mode 100755 (executable)
new mode 100644 (file)
index d36c06c..b530b34 100644 (file)
@@ -18,9 +18,7 @@
   <element value="File"/>
   <element value="Huge Plinn Folder"/>
   <element value="News Item"/>
   <element value="File"/>
   <element value="Huge Plinn Folder"/>
   <element value="News Item"/>
-  <element value="Order Folder"/>
   <element value="Plinn Document"/>
   <element value="Plinn Document"/>
-  <element value="Huge Plinn Folder"/>
   <element value="Portfolio"/>
   <element value="Topic"/>
  </property>
   <element value="Portfolio"/>
   <element value="Topic"/>
  </property>
index 38799ea..b589b21 100644 (file)
   <element value="Calendar"/>
   <element value="Document"/>
   <element value="File"/>
   <element value="Calendar"/>
   <element value="Document"/>
   <element value="File"/>
-  <element value="Link"/>
-  <element value="Mosaic Document"/>
+  <element value="Huge Plinn Folder"/>
   <element value="News Item"/>
   <element value="Plinn Document"/>
   <element value="News Item"/>
   <element value="Plinn Document"/>
-  <element value="Huge Plinn Folder"/>
-  <element value="Huge Plinn Folder"/>
   <element value="Portfolio"/>
   <element value="Topic"/>
  </property>
  <property name="allow_discussion">False</property>
  <alias from="(Default)" to="folder_contents"/>
   <element value="Portfolio"/>
   <element value="Topic"/>
  </property>
  <property name="allow_discussion">False</property>
  <alias from="(Default)" to="folder_contents"/>
+ <alias from="jsupload_snippet" to="folder_jsupload_snippet"/>
  <alias from="mkdir" to="createHugePlinnFolder"/>
  <alias from="view" to="folder_contents"/>
  <action title="View" action_id="view" category="object" condition_expr=""
  <alias from="mkdir" to="createHugePlinnFolder"/>
  <alias from="view" to="folder_contents"/>
  <action title="View" action_id="view" category="object" condition_expr=""
index 9ab28d1..99bd4bc 100644 (file)
@@ -16,6 +16,7 @@
  <property name="allow_discussion">False</property>
  <alias from="(Default)" to="photo_view"/>
  <alias from="info" to="photo_info"/>
  <property name="allow_discussion">False</property>
  <alias from="(Default)" to="photo_view"/>
  <alias from="info" to="photo_info"/>
+ <alias from="jsupload_snippet" to="photo_gridthumbnail"/>
  <alias from="view" to="photo_view"/>
  <action title="View" action_id="view" category="object" condition_expr=""
     icon_expr="" link_target="" url_expr="string:${object_url}/photo_view"
  <alias from="view" to="photo_view"/>
  <action title="View" action_id="view" category="object" condition_expr=""
     icon_expr="" link_target="" url_expr="string:${object_url}/photo_view"
index 79b48ac..b589b21 100644 (file)
@@ -25,6 +25,7 @@
  </property>
  <property name="allow_discussion">False</property>
  <alias from="(Default)" to="folder_contents"/>
  </property>
  <property name="allow_discussion">False</property>
  <alias from="(Default)" to="folder_contents"/>
+ <alias from="jsupload_snippet" to="folder_jsupload_snippet"/>
  <alias from="mkdir" to="createHugePlinnFolder"/>
  <alias from="view" to="folder_contents"/>
  <action title="View" action_id="view" category="object" condition_expr=""
  <alias from="mkdir" to="createHugePlinnFolder"/>
  <alias from="view" to="folder_contents"/>
  <action title="View" action_id="view" category="object" condition_expr=""
index 9ab28d1..99bd4bc 100644 (file)
@@ -16,6 +16,7 @@
  <property name="allow_discussion">False</property>
  <alias from="(Default)" to="photo_view"/>
  <alias from="info" to="photo_info"/>
  <property name="allow_discussion">False</property>
  <alias from="(Default)" to="photo_view"/>
  <alias from="info" to="photo_info"/>
+ <alias from="jsupload_snippet" to="photo_gridthumbnail"/>
  <alias from="view" to="photo_view"/>
  <action title="View" action_id="view" category="object" condition_expr=""
     icon_expr="" link_target="" url_expr="string:${object_url}/photo_view"
  <alias from="view" to="photo_view"/>
  <action title="View" action_id="view" category="object" condition_expr=""
     icon_expr="" link_target="" url_expr="string:${object_url}/photo_view"
index dc31b4c..7204a4e 100644 (file)
@@ -290,11 +290,23 @@ DDFolderUploader.prototype.handleFiles = function(files) {
 };
 
 DDFolderUploader.prototype.beforeUpload = function(item) {
 };
 
 DDFolderUploader.prototype.beforeUpload = function(item) {
+  this.uploadedItem = item;
        // To be implemented by decendant.
 };
 
 DDFolderUploader.prototype.uploadCompleteHandlerCB = function(req) {
        // To be implemented by decendant.
 };
 
 DDFolderUploader.prototype.uploadCompleteHandlerCB = function(req) {
-       // To be implemented by descendant.
+       var item = this.uploadedItem;
+       var row = getCopyOfNode(req.responseXML.documentElement.firstChild);
+  row.className = item.className;
+
+       if (req.status === 200) {
+               // update
+    console.log('todo');
+       }
+       else if(req.status === 201) {
+               // creation
+               this.listing.replaceChild(row, item);
+       }
 };
 
 DDFolderUploader.prototype.progressHandlerCB = function(progress) {
 };
 
 DDFolderUploader.prototype.progressHandlerCB = function(progress) {
index bd8e7f5..7d25a02 100644 (file)
@@ -39,7 +39,7 @@
                                </tr>
                        </thead>
                        <tbody id="FolderListingBody">
                                </tr>
                        </thead>
                        <tbody id="FolderListingBody">
-<tbody tal:repeat="item_info listItemInfos" tal:omit-tag="">
+<tbody tal:repeat="item_info listItemInfos" tal:omit-tag="" metal:define-macro="itemListing">
                    <tr class="" tal:attributes="class python: (even and 'even') or 'odd'" tal:define="even repeat/item_info/even">
                      <td><img src="." alt="lock" height="16" width="16" border="0"
                               tal:condition="python:not isAnon and item_info['lock']"
                    <tr class="" tal:attributes="class python: (even and 'even') or 'odd'" tal:define="even repeat/item_info/even">
                      <td><img src="." alt="lock" height="16" width="16" border="0"
                               tal:condition="python:not isAnon and item_info['lock']"
                        }
                        
                        var uploadUrl = absolute_url() + '/put_upload';
                        }
                        
                        var uploadUrl = absolute_url() + '/put_upload';
-      // new DDFolderUploader(document.getElementById('ForematterCell'), uploadUrl, listing);
+      new DDFolderUploader(document.getElementById('ForematterCell'), uploadUrl, listing);
 
                }());
                </script>
 
                }());
                </script>
diff --git a/skins/photo_theme/folder_jsupload_snippet.py b/skins/photo_theme/folder_jsupload_snippet.py
new file mode 100644 (file)
index 0000000..f932675
--- /dev/null
@@ -0,0 +1,15 @@
+##parameters=ob
+from Products.CMFCore.utils import getUtilityByInterfaceName
+utool = getUtilityByInterfaceName('Products.CMFCore.interfaces.IURLTool')
+locale_date_fmt = context.locale_date_fmt()
+infos = {'checkbox' : True,
+         'url' : ob.absolute_url(),
+         'lock' : False,
+         'modified' : ob.modified().strftime(locale_date_fmt),
+         'title_or_id' : ob.title_or_id(),
+         'position' : context.getObjectPosition(ob.getId()),
+         'type' : ob.Type() or None,
+         'id' : ob.getId(),
+         'icon': '%s/%s' % (utool(), ob.getIcon())}
+
+return context.folder_jsupload_snippet_template(listItemInfos=[infos])
\ No newline at end of file
diff --git a/skins/photo_theme/folder_jsupload_snippet_template.pt b/skins/photo_theme/folder_jsupload_snippet_template.pt
new file mode 100644 (file)
index 0000000..8b1e813
--- /dev/null
@@ -0,0 +1,5 @@
+<metal:block metal:use-macro="here/main_template_macros/macros/global_defines"/>
+<tal:block tal:define="listItemInfos options/listItemInfos">
+  <div metal:use-macro="here/folder_contents_macros/macros/itemListing"/>
+</tal:block>
+<tal:block tal:define="global dummy python:request.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8')" />
\ No newline at end of file