<metal:block use-macro="here/standard_template_macro">
<metal:block fill-slot="body">

<h1 tal:define="site_object_index python:here.getFormsTool()['site_object_index']">
		<metal:block use-macro="site_object_index/macros/icon" />
		<tal:block tal:replace="here/title_or_id" /> -
		<span i18n:translate="">sort items</span>
</h1>

<div class="floated-buttons"><span class="buttons"><a tal:attributes="href here/absolute_url" i18n:translate="">Back to index</a></span></div>

<p i18n:translate="">
	Change the display order of this folder's items.
</p>

<tal:block tal:define="folders here/getSortedFolders; items here/getSortedObjects">
<div tal:condition="python:len(folders)>0" >
<h2 i18n:translate="">Folders</h2>
<form method="post" tal:attributes="action string:${here/absolute_url}/setSortOrder">
	<table class="datatable">
	<thead>
		<tr>
			<th class="scope-col" scope="col" i18n:translate="Type (translate as a noun)">Type</th>
			<th class="scope-col" scope="col" i18n:translate="">Title</th>
			<th class="scope-col" scope="col" i18n:translate="">Sort order</th>
		</tr>
	</thead>
	<tbody>
		<tr tal:repeat="folder folders" tal:attributes="class python:test(path('repeat/folder/odd'), 'zebraodd', 'zebraeven')">
			<td class="center">
				<img tal:define="icon python:here.rstk['get_object_view_info'](folder)['icon']"
				     tal:attributes="src icon/url; title icon/title; alt icon/title" />
			</td>
			<td>
				<a tal:attributes="href folder/absolute_url" tal:content="folder/title_or_id"/>
				<input type="hidden" name="ids" tal:attributes="value folder/id" />
			</td>
			<td class="center"><input type="text" size="2" tal:attributes="name string:${folder/id}__sortorder; value folder/sortorder" /></td>
		</tr>
	</tbody>
	</table>
	<input type="submit" value="Save changes" i18n:attributes="value" />
</form>
</div>

<div tal:condition="python:len(items)>0" >
<h2 i18n:translate="">Items</h2>
<form method="post" tal:attributes="action string:${here/absolute_url}/setSortOrder">
	<table class="datatable">
	<thead>
		<tr>
			<th class="scope-col" scope="col" i18n:translate="Type (translate as a noun)">Type</th>
			<th class="scope-col" scope="col" i18n:translate="">Title</th>
			<th class="scope-col" scope="col" i18n:translate="">Sort order</th>
		</tr>
	</thead>
	<tbody>
		<tr tal:repeat="item items" tal:attributes="class python:test(path('repeat/item/odd'), 'zebraodd', 'zebraeven')">
			<td class="center">
				<img tal:define="icon python:here.rstk['get_object_view_info'](item)['icon']"
				     tal:attributes="src icon/url; title icon/title; alt icon/title" />
			</td>
			<td>
				<a tal:attributes="href item/absolute_url" tal:content="item/title_or_id"/>
				<input type="hidden" name="ids" tal:attributes="value item/id" />
			</td>
			<td class="center"><input type="text" size="2" tal:attributes="name string:${item/id}__sortorder; value item/sortorder" /></td>
		</tr>
	</tbody>
	</table>
<input type="submit" value="Save changes" i18n:attributes="value" />
</form>
</div>
</tal:block>

</metal:block>
</metal:block>
