From f1aeba78bce0888de483a29111d5d915614f03bb Mon Sep 17 00:00:00 2001
From: =?utf8?q?Benoi=CC=82t=20Pin?= <benoit.pin@gmail.com>
Date: Mon, 9 Dec 2013 18:09:02 +0100
Subject: [PATCH] =?utf8?q?R=C3=A9unification=20du=20listing=20des=20dossie?=
 =?utf8?q?r=20entre=20le=20th=C3=A8me=20par=20d=C3=A9faut=20et=20le=20th?=
 =?utf8?q?=C3=A8me=20photo.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 skins/custom_generic/folder_contents.py     |  65 ++----
 skins/generic/folder_contents_macros.pt     | 141 ++++++-------
 skins/photo_theme/folder_contents.py        | 217 --------------------
 skins/photo_theme/folder_contents_macros.pt | 106 ----------
 4 files changed, 84 insertions(+), 445 deletions(-)
 mode change 100644 => 100755 skins/custom_generic/folder_contents.py
 delete mode 100755 skins/photo_theme/folder_contents.py
 delete mode 100644 skins/photo_theme/folder_contents_macros.pt

diff --git a/skins/custom_generic/folder_contents.py b/skins/custom_generic/folder_contents.py
old mode 100644
new mode 100755
index 26fa044..b63159f
--- a/skins/custom_generic/folder_contents.py
+++ b/skins/custom_generic/folder_contents.py
@@ -1,4 +1,4 @@
-##parameters=b_start=0, key='', reverse=0, ids=(), items_copy='', items_cut='', items_delete='', items_new='', items_paste='', items_rename='', items_up='', items_down='', items_top='', items_bottom='', items_sort='', template='', macro='', ajax='',**others
+##parameters=b_start=0, key='', reverse=0, ids=(), items_copy='', items_cut='', items_delete='', items_new='', items_paste='', items_rename='', items_up='', items_down='', items_top='', items_bottom='', items_sort='', template='', macro='', ajax=''
 ##
 from Products.Plinn.PloneMisc import Batch
 from DateTime import DateTime
@@ -15,6 +15,7 @@ from Products.CMFDefault.utils import html_marshal
 
 mtool = getToolByName(script, 'portal_membership')
 checkPermission = mtool.checkPermission
+isAnon = mtool.isAnonymousUser()
 utool = getToolByName(script, 'portal_url')
 portal_url = utool()
 
@@ -84,21 +85,6 @@ items_add_allowed = checkPermission(AddPortalContent, context)
 upitems_list_allowed = checkPermission(ListFolderContents, context, 'aq_parent')
 manage_props_allowed = checkPermission(ManageProperties, context)
 
-# information pour remonter au dossier parent
-up_info = {}
-if upitems_list_allowed:
-	up_obj = context.aq_parent
-	if hasattr(up_obj, 'portal_url'):
-		up_url = up_obj.getActionInfo('object/folderContents')['url']
-		up_info = { 'icon': '%s/UpFolder_icon.gif' % portal_url,
-					'id': up_obj.getId(),
-					'url': up_url }
-	else:
-		up_info = { 'icon': '',
-					'id': 'Root',
-					'url': '' }
-options['up_info'] = up_info
-
 target = context.getActionInfo(default_target)['url']
 
 if not key:
@@ -109,15 +95,11 @@ elif (key, reverse) == context.getDefaultSorting():
 else:
 	is_default = 0
 
-columns = ( {'key': 'Lock',
-			 'title': '',
-			 'width': '16',
-			 'colspan': None}
-			, {'key': 'Type',
+columns = ( {'key': 'Type',
 			 'title': 'Type',
 			 'width': None,
 			 'colspan': '2'}
-			, {'key': 'title_or_id',
+			, {'key': 'id',
 			 'title': 'Name',
 			 'width': None,
 			 'colspan': None}
@@ -125,10 +107,6 @@ columns = ( {'key': 'Lock',
 			 'title': 'Last Modified',
 			 'width': None,
 			 'colspan': None}
-			, {'key': 'position',
-			 'title': 'Position',
-			 'width': None,
-			 'colspan': None }
 			)
 
 for column in columns:	
@@ -170,37 +148,29 @@ for column in columns:
 context.filterCookie()
 folderfilter = context.REQUEST.get('folderfilter', '')
 filter = context.decodeFolderFilter(folderfilter)
-items = context.listNearestFolderContents(contentFilter=filter)
+items = context.listCatalogedContents(contentFilter=filter)
 sort_dir = reverse and 'desc' or 'asc'
-sortFunc = key in ['Type', 'title_or_id'] and 'nocase' or 'cmp'
+sortFunc = key in ['Type'] and 'nocase' or 'cmp'
 items = sequence.sort( items, ((key, sortFunc, sort_dir),) )
 batch_obj = Batch(items, context.default_batch_size, b_start, orphan=0, quantumleap=1)
 items = []
-i = 1
-display_delete_button = False
+display_delete_button = not isAnon # TODO : à revoir
 for item in batch_obj:
-	item_icon = item.getIcon(1)
-	item_id = item.getId()
-	item_position = key == 'position' and str(b_start + i) or '...'
-	i += 1
-	item_url = item.absolute_url()
-	try : item_delete_allowed = context.objectIdCanBeDeleted(item_id)
-	except : item_delete_allowed = checkPermission(DeleteObjects, context) # std zope perm
-	if not display_delete_button :
-		display_delete_button = item_delete_allowed
+	item_icon = item.getIcon
+	item_id = item.getId
+	item_url = item.getURL()
 	items.append(
-		{'lock' : not checkPermission(ModifyPortalContent, item),
-		 'checkbox': item_delete_allowed and ('cb_%s' % item_id) or '',
+		{'checkbox': not isAnon,
 		 'icon': item_icon and ( '%s/%s' % (portal_url, item_icon) ) or '',
 		 'id': item_id,
-		 'modified': item.modified().strftime(locale_date_fmt),
-		 'position': item_position,
-		 'title_or_id': item.title_or_id(),
-		 'type': item.Type() or None,
+		 'modified': item.modified.strftime(locale_date_fmt),
+		 'title_or_id': item.Title or item_id,
+		 'type': item.Type or None,
 		 'url': item_url } )
 
 options['batch'] = { 'listColumnInfos': tuple(columns),
 					 'listItemInfos': tuple(items),
+					 'firstItemPos' : b_start + 1,
 					 'sort_key' : key,
 					 'sort_dir' : sort_dir,
 					 'batch_obj': batch_obj }
@@ -233,7 +203,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)
@@ -243,6 +214,4 @@ if template and macro :
 	options['macro'] = macro
 	return context.use_macro(**options)
 else :
-	options.update(others)
 	return context.folder_contents_template(**options)
-
diff --git a/skins/generic/folder_contents_macros.pt b/skins/generic/folder_contents_macros.pt
index e8e84fe..2cb5b03 100644
--- a/skins/generic/folder_contents_macros.pt
+++ b/skins/generic/folder_contents_macros.pt
@@ -8,106 +8,99 @@
   </head>
 
   <body i18n:domain="cmf_default" metal:define-macro="FolderListing"
-	 			tal:define="batch_dict options/batch;
-				 						batch batch_dict/batch_obj;
-				 						listColumnInfos batch_dict/listColumnInfos;
-				 						listItemInfos batch_dict/listItemInfos;"
-				tal:omit-tag="">
+        tal:define="batch_dict options/batch;
+                    batch batch_dict/batch_obj;
+                    listColumnInfos batch_dict/listColumnInfos;
+                    listItemInfos batch_dict/listItemInfos;"
+        tal:omit-tag="">
     <div style="display:none">
       <span id="FolderUrl" tal:content="here/absolute_url" >Folder url for script</span>
       <span tal:condition="options/form/is_orderable" tal:omit-tag="">
-	      <span id="FirstItemPos" tal:content="python:listItemInfos[0]['position']">first batch item position</span>
-	      <span id="BatchNavigationSize" tal:content="batch/size"></span>
-	    </span>
+        <span id="FirstItemPos" tal:content="batch_dict/firstItemPos">first batch item position</span>
+        <span id="BatchNavigationSize" tal:content="batch/size"></span>
+      </span>
     </div>
-   	<!-- batch navigation -->
+    <!-- batch navigation -->
     <div tal:define="navBatchBarId string:topNavBatchBar" tal:omit-tag="">
       <span metal:use-macro="here/batch_macros/macros/navigation">batch navigation</span>
     </div>
     <table class="listing" cellspacing="0">
-			<thead id="FolderListingHeader">
-				<tr>
-					<th tal:attributes="width column_info/width; colspan column_info/colspan" tal:repeat="column_info listColumnInfos" nowrap="nowrap" >
-						<a href="." tal:attributes="href column_info/url" tal:content="column_info/title" i18n:translate="">Type</a>
-						<span  tal:repeat="img column_info/images" tal:omit-tag="">
-							<a tal:omit-tag="python:not img.has_key('href')"
-								 tal:attributes="href img/href|nothing ; title img/alt" i18n:attributes="title"
-								 ><img tal:attributes="src img/src ; alt img/alt ; id img/id|nothing" border="0" i18n:attributes="alt" /></a>
-						</span>
-					</th>
-					<td colspan="5" tal:replace="nothing"></td>
-				</tr>
-			</thead>
-			<tbody id="FolderListingBody">
-<tbody tal:repeat="item_info listItemInfos" tal:omit-tag="">
-		    <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']"
-		               tal:attributes="src here/lock.gif/absolute_url"
-		               i18n:attributes="alt" /></td>
-		      <td>
-		        <input id="" type="checkbox" name="ids:list" value=""
-		               tal:attributes="value item_info/id; id item_info/checkbox" tal:condition="item_info/checkbox" />
-		      </td>
-		      <td>
-		        <a href="." tal:attributes="href item_info/url" tal:condition="item_info/icon">
-		          <img src="." alt="" tal:attributes="src item_info/icon; alt item_info/type" border="0" i18n:attributes="alt" />
-		        </a>
-		      </td>
-		      <td>
-		        <a href="." tal:attributes="href item_info/url" tal:content="item_info/title_or_id">title or id</a>
-		      </td>
-		      <td>
-		        <span tal:replace="item_info/modified">2001</span>
-		      </td>
-		      <td>
-		        <span tal:replace="item_info/position">1</span>
-		      </td>
-		    </tr>
+      <thead id="FolderListingHeader">
+        <tr>
+          <th tal:attributes="width column_info/width; colspan column_info/colspan" tal:repeat="column_info listColumnInfos" nowrap="nowrap" >
+            <a href="." tal:attributes="href column_info/url" tal:content="column_info/title" i18n:translate="">Type</a>
+            <span  tal:repeat="img column_info/images" tal:omit-tag="">
+              <a tal:omit-tag="python:not img.has_key('href')"
+                 tal:attributes="href img/href|nothing ; title img/alt" i18n:attributes="title"
+                 ><img tal:attributes="src img/src ; alt img/alt ; id img/id|nothing" border="0" i18n:attributes="alt" /></a>
+            </span>
+          </th>
+          <td colspan="5" tal:replace="nothing"></td>
+        </tr>
+      </thead>
+      <tbody id="FolderListingBody">
+<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>
+            <input id="" type="checkbox" name="ids:list" value=""
+                   tal:attributes="value item_info/id; id item_info/checkbox" tal:condition="item_info/checkbox" />
+          </td>
+          <td>
+            <a href="." tal:attributes="href item_info/url" tal:condition="item_info/icon">
+              <img src="." alt="" tal:attributes="src item_info/icon; alt item_info/type" border="0" i18n:attributes="alt" />
+            </a>
+          </td>
+          <td>
+            <a href="." tal:attributes="href item_info/url" tal:define="tod item_info/title_or_id; id item_info/id">
+              <span tal:replace="id">id</span>
+              <span tal:condition="python:tod != id">
+                • <span tal:replace="tod">title</span>
+              </span>
+            </a>
+          </td>
+          <td>
+            <span tal:replace="item_info/modified">2001</span>
+          </td>
+        </tr>
 </tbody>
-	   	</tbody>
+      </tbody>
     </table>
     <!-- batch navigation -->
     <div tal:define="navBatchBarId string:bottomNavBatchBar" tal:omit-tag="">
       <span metal:use-macro="here/batch_macros/macros/navigation">batch navigation</span>
     </div>
-		<script type="text/javascript">
-		//<!--
-			// variables for drag-and-drop ordered support
-			var ddEnabled = false
-			try {
-				var firstItemPos = parseInt(document.getElementById("FirstItemPos").innerHTML);
-				ddEnabled = true;
-			}
-			catch (e) {}
-
-			var topNavBatchBar		= document.getElementById("topNavBatchBar");
-			var bottomNavBatchBar	= document.getElementById("bottomNavBatchBar");
+    <script type="text/javascript">
+		(function(){
+			// ordering / selecting
+			var firsItemPosElement = document.getElementById('FirstItemPos');
 			var listing = document.getElementById("FolderListingBody");
-
-			if (ddEnabled) {
-				var rows = listing.getElementsByTagName("TR")
-				for ( var i = 0 ; i < rows.length ; i++ )
-					rows[i].pos = i + firstItemPos;
-
-				var fDDcontroler = new FolderDDropControler(listing);
-				var topNavBatchBar		= document.getElementById("topNavBatchBar");
-				var bottomNavBatchBar	= document.getElementById("bottomNavBatchBar");
+			var orderable = firsItemPosElement ? true : false;
+			var firstItemPos = orderable ? parseInt(firsItemPosElement.innerHTML, 10) : 1;
+			var fDDcontroler = new FolderDDropControler(listing, orderable, firstItemPos);
+			var topNavBatchBar, bottomNavBatchBar;
+			if (orderable) {
+				topNavBatchBar = document.getElementById("topNavBatchBar");
+				bottomNavBatchBar = document.getElementById("bottomNavBatchBar");
 				if (topNavBatchBar && bottomNavBatchBar) {
 					new DropTarget(topNavBatchBar, fDDcontroler);
 					new DropTarget(bottomNavBatchBar, fDDcontroler);
 				}
 			}
-
-
 			addListener(document.getElementById("FolderListingHeader"), "click", loadListing);
 			if (topNavBatchBar && bottomNavBatchBar) {
 				addListener(topNavBatchBar, "click", loadListing);
 				addListener(bottomNavBatchBar, "click", loadListing);
 			}
 
-		//-->
-		</script>
+		}());
+    </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, document.getElementById("FolderListingBody"));
+		}());
+    </script>
   </body>
 
 </html>
\ No newline at end of file
diff --git a/skins/photo_theme/folder_contents.py b/skins/photo_theme/folder_contents.py
deleted file mode 100755
index b63159f..0000000
--- a/skins/photo_theme/folder_contents.py
+++ /dev/null
@@ -1,217 +0,0 @@
-##parameters=b_start=0, key='', reverse=0, ids=(), items_copy='', items_cut='', items_delete='', items_new='', items_paste='', items_rename='', items_up='', items_down='', items_top='', items_bottom='', items_sort='', template='', macro='', ajax=''
-##
-from Products.Plinn.PloneMisc import Batch
-from DateTime import DateTime
-locale_date_fmt = context.locale_date_fmt()
-from ZTUtils import make_query
-from Products.CMFCore.utils import getToolByName
-from Products.CMFDefault.permissions import AddPortalContent
-from Products.CMFDefault.permissions import DeleteObjects
-from Products.CMFDefault.permissions import ListFolderContents
-from Products.CMFDefault.permissions import ManageProperties
-from Products.CMFDefault.permissions import ViewManagementScreens
-from Products.CMFDefault.permissions import ModifyPortalContent
-from Products.CMFDefault.utils import html_marshal
-
-mtool = getToolByName(script, 'portal_membership')
-checkPermission = mtool.checkPermission
-isAnon = mtool.isAnonymousUser()
-utool = getToolByName(script, 'portal_url')
-portal_url = utool()
-
-
-form = context.REQUEST.form
-default_target = 'object/folderContents'
-default_kw = {'b_start': b_start, 'key': key, 'reverse': reverse, 'ajax' : ajax}
-if items_copy :
-	if ajax : default_kw['syncFragments']=['rightCell']
-	if context.validateItemIds(**form) and \
-			context.folder_copy_control(**form) and \
-			context.setRedirect(context, default_target, **default_kw):
-		return
-elif items_cut :
-	if ajax : default_kw['syncFragments']=['rightCell']
-	if context.validateItemIds(**form) and \
-			context.folder_cut_control(**form) and \
-			context.setRedirect(context, default_target, **default_kw):
-			return
-elif items_delete and \
-		context.validateItemIds(**form) and \
-		context.folder_delete_control(**form) and \
-		context.setRedirect(context, default_target, **default_kw):
-	return
-elif items_new and \
-		context.setRedirect(context, 'object/new', **default_kw):
-	return
-elif items_paste :
-	if ajax : default_kw['syncFragments']=['rightCell']
-	if context.folder_paste_control(**form) and \
-			context.setRedirect(context, default_target, **default_kw):
-			return
-elif items_rename and \
-		context.validateItemIds(**form) and \
-		context.setRedirect(context, 'object/rename_items', ids=ids,
-							**default_kw):
-	return
-elif items_sort and \
-		context.folder_sort_control(**form) and \
-		context.setRedirect(context, default_target, b_start=b_start):
-	return
-elif items_up and \
-		context.validateItemIds(**form) and \
-		context.folder_up_control(**form) and \
-		context.setRedirect(context, default_target, **default_kw):
-	return
-elif items_down and \
-		context.validateItemIds(**form) and \
-		context.folder_down_control(**form) and \
-		context.setRedirect(context, default_target, **default_kw):
-	return
-elif items_top and \
-		context.validateItemIds(**form) and \
-		context.folder_top_control(**form) and \
-		context.setRedirect(context, default_target, **default_kw):
-	return
-elif items_bottom and \
-		context.validateItemIds(**form) and \
-		context.folder_bottom_control(**form) and \
-		context.setRedirect(context, default_target, **default_kw):
-	return
-	
-
-options = {}
-
-items_add_allowed = checkPermission(AddPortalContent, context)
-upitems_list_allowed = checkPermission(ListFolderContents, context, 'aq_parent')
-manage_props_allowed = checkPermission(ManageProperties, context)
-
-target = context.getActionInfo(default_target)['url']
-
-if not key:
-	(key, reverse) = context.getDefaultSorting()
-	is_default = 1
-elif (key, reverse) == context.getDefaultSorting():
-	is_default = 1
-else:
-	is_default = 0
-
-columns = ( {'key': 'Type',
-			 'title': 'Type',
-			 'width': None,
-			 'colspan': '2'}
-			, {'key': 'id',
-			 'title': 'Name',
-			 'width': None,
-			 'colspan': None}
-			, {'key': 'modified',
-			 'title': 'Last Modified',
-			 'width': None,
-			 'colspan': None}
-			)
-
-for column in columns:	
-	images = []
-	if key == column['key'] :
-		if not is_default and manage_props_allowed :
-			images.append( {'src' : getattr(context, 'set_default_sorting.gif').absolute_url(),
-							'alt' : 'Set Sorting as Default',
-							'id'	 : 'SetSortingAsDefault',
-							'href': '%s?%s' % (target, make_query(items_sort=True,
-																  key=key,
-																  reverse= (key != 'position' and [reverse] or [False])[0] )
-												  )
-							 }
-							 )
-
-		if key != 'position' :
-			if reverse :
-				toggleImg = getattr(context, 'arrowDown.gif')
-				alt = 'descending sort'
-			else :
-				toggleImg = getattr(context, 'arrowUp.gif')
-				alt = 'ascending sort'
-			query = make_query(key=column['key'], reverse = not reverse)
-		else :	
-			toggleImg = getattr(context, 'arrowUp.gif')
-			alt = 'ascending sort'
-			query = make_query(key=column['key'])
-		images.append( {'src' : toggleImg.absolute_url(), 'alt' : alt} )
-	else :
-		if key != 'position' :
-			query = make_query(key=column['key'], reverse = reverse)
-		else :
-			query = make_query(key=column['key'])
-	
-	column['url'] = '%s?%s' % (target, query)
-	column['images'] = images
-
-context.filterCookie()
-folderfilter = context.REQUEST.get('folderfilter', '')
-filter = context.decodeFolderFilter(folderfilter)
-items = context.listCatalogedContents(contentFilter=filter)
-sort_dir = reverse and 'desc' or 'asc'
-sortFunc = key in ['Type'] and 'nocase' or 'cmp'
-items = sequence.sort( items, ((key, sortFunc, sort_dir),) )
-batch_obj = Batch(items, context.default_batch_size, b_start, orphan=0, quantumleap=1)
-items = []
-display_delete_button = not isAnon # TODO : à revoir
-for item in batch_obj:
-	item_icon = item.getIcon
-	item_id = item.getId
-	item_url = item.getURL()
-	items.append(
-		{'checkbox': not isAnon,
-		 'icon': item_icon and ( '%s/%s' % (portal_url, item_icon) ) or '',
-		 'id': item_id,
-		 'modified': item.modified.strftime(locale_date_fmt),
-		 'title_or_id': item.Title or item_id,
-		 'type': item.Type or None,
-		 'url': item_url } )
-
-options['batch'] = { 'listColumnInfos': tuple(columns),
-					 'listItemInfos': tuple(items),
-					 'firstItemPos' : b_start + 1,
-					 'sort_key' : key,
-					 'sort_dir' : sort_dir,
-					 'batch_obj': batch_obj }
-
-hidden_vars = []
-for name, value in html_marshal(**default_kw):
-	hidden_vars.append( {'name': name, 'value': value} )
-	
-# buttons
-buttons = []
-if items_add_allowed and context.allowedContentTypes():
-	buttons.append( {'name': 'items_new', 'value': 'New...'} )
-	if items:
-		buttons.append( {'name': 'items_rename', 'value': 'Rename'} )
-		
-if checkPermission(ViewManagementScreens, context) and items:
-	buttons.append( {'name': 'items_cut', 'value': 'Cut'} )
-	buttons.append( {'name': 'items_copy', 'value': 'Copy'} )
-	
-if items_add_allowed and context.cb_dataValid():
-	buttons.append( {'name': 'items_paste', 'value': 'Paste'} )
-	
-if display_delete_button and items:
-	buttons.append( {'name': 'items_delete', 'value': 'Delete'} )
-
-length = batch_obj.sequence_length
-is_orderable = manage_props_allowed and (key == 'position') and length > 1
-is_sortable = manage_props_allowed and not is_default
-options['form'] = { 'action': target,
-					'listHiddenVarInfos': tuple(hidden_vars),
-					'listButtonInfos': tuple(buttons),
-					'is_orderable': is_orderable,
-					'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 template and macro :
-	options['template'] = template
-	options['macro'] = macro
-	return context.use_macro(**options)
-else :
-	return context.folder_contents_template(**options)
diff --git a/skins/photo_theme/folder_contents_macros.pt b/skins/photo_theme/folder_contents_macros.pt
deleted file mode 100644
index 2cb5b03..0000000
--- a/skins/photo_theme/folder_contents_macros.pt
+++ /dev/null
@@ -1,106 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-  <head>
-    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
-    <title>folder contents macros</title>
-  </head>
-
-  <body i18n:domain="cmf_default" metal:define-macro="FolderListing"
-        tal:define="batch_dict options/batch;
-                    batch batch_dict/batch_obj;
-                    listColumnInfos batch_dict/listColumnInfos;
-                    listItemInfos batch_dict/listItemInfos;"
-        tal:omit-tag="">
-    <div style="display:none">
-      <span id="FolderUrl" tal:content="here/absolute_url" >Folder url for script</span>
-      <span tal:condition="options/form/is_orderable" tal:omit-tag="">
-        <span id="FirstItemPos" tal:content="batch_dict/firstItemPos">first batch item position</span>
-        <span id="BatchNavigationSize" tal:content="batch/size"></span>
-      </span>
-    </div>
-    <!-- batch navigation -->
-    <div tal:define="navBatchBarId string:topNavBatchBar" tal:omit-tag="">
-      <span metal:use-macro="here/batch_macros/macros/navigation">batch navigation</span>
-    </div>
-    <table class="listing" cellspacing="0">
-      <thead id="FolderListingHeader">
-        <tr>
-          <th tal:attributes="width column_info/width; colspan column_info/colspan" tal:repeat="column_info listColumnInfos" nowrap="nowrap" >
-            <a href="." tal:attributes="href column_info/url" tal:content="column_info/title" i18n:translate="">Type</a>
-            <span  tal:repeat="img column_info/images" tal:omit-tag="">
-              <a tal:omit-tag="python:not img.has_key('href')"
-                 tal:attributes="href img/href|nothing ; title img/alt" i18n:attributes="title"
-                 ><img tal:attributes="src img/src ; alt img/alt ; id img/id|nothing" border="0" i18n:attributes="alt" /></a>
-            </span>
-          </th>
-          <td colspan="5" tal:replace="nothing"></td>
-        </tr>
-      </thead>
-      <tbody id="FolderListingBody">
-<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>
-            <input id="" type="checkbox" name="ids:list" value=""
-                   tal:attributes="value item_info/id; id item_info/checkbox" tal:condition="item_info/checkbox" />
-          </td>
-          <td>
-            <a href="." tal:attributes="href item_info/url" tal:condition="item_info/icon">
-              <img src="." alt="" tal:attributes="src item_info/icon; alt item_info/type" border="0" i18n:attributes="alt" />
-            </a>
-          </td>
-          <td>
-            <a href="." tal:attributes="href item_info/url" tal:define="tod item_info/title_or_id; id item_info/id">
-              <span tal:replace="id">id</span>
-              <span tal:condition="python:tod != id">
-                • <span tal:replace="tod">title</span>
-              </span>
-            </a>
-          </td>
-          <td>
-            <span tal:replace="item_info/modified">2001</span>
-          </td>
-        </tr>
-</tbody>
-      </tbody>
-    </table>
-    <!-- batch navigation -->
-    <div tal:define="navBatchBarId string:bottomNavBatchBar" tal:omit-tag="">
-      <span metal:use-macro="here/batch_macros/macros/navigation">batch navigation</span>
-    </div>
-    <script type="text/javascript">
-		(function(){
-			// ordering / selecting
-			var firsItemPosElement = document.getElementById('FirstItemPos');
-			var listing = document.getElementById("FolderListingBody");
-			var orderable = firsItemPosElement ? true : false;
-			var firstItemPos = orderable ? parseInt(firsItemPosElement.innerHTML, 10) : 1;
-			var fDDcontroler = new FolderDDropControler(listing, orderable, firstItemPos);
-			var topNavBatchBar, bottomNavBatchBar;
-			if (orderable) {
-				topNavBatchBar = document.getElementById("topNavBatchBar");
-				bottomNavBatchBar = document.getElementById("bottomNavBatchBar");
-				if (topNavBatchBar && bottomNavBatchBar) {
-					new DropTarget(topNavBatchBar, fDDcontroler);
-					new DropTarget(bottomNavBatchBar, fDDcontroler);
-				}
-			}
-			addListener(document.getElementById("FolderListingHeader"), "click", loadListing);
-			if (topNavBatchBar && bottomNavBatchBar) {
-				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, document.getElementById("FolderListingBody"));
-		}());
-    </script>
-  </body>
-
-</html>
\ No newline at end of file
-- 
2.20.1