<span tal:replace="structure here/manage_page_header" />
<span tal:replace="structure here/manage_tabs" />

<p class="page-title">Items</p>

<div class="system-msg" tal:condition="python:request.has_key('save')">
	Saved changes. (<span tal:replace="here/ZopeTime" />)<br />
</div>

<p class="page-description">
	This page presents the list of items.
	Add/Modify/Delete this list using the forms below.
</p>

<tal:block tal:define="record_id python:request.get('id', None); record_data python:here.get_item_data(record_id)">
<form method="post" tal:attributes="action python:test(record_data[0]=='add', 'manage_add_item', 'manage_update_item')">
<table border="0" cellspacing="2" cellpadding="2" width="100%">
	<tr>
		<td class="form-label">Id</td>
		<td>
			<input tal:condition="python:record_data[0]=='add'" type="text" name="id" tal:attributes="value python:record_data[1]" />
			<strong tal:condition="python:record_data[0]=='update'" tal:content="python:record_data[1]" />
			<input tal:condition="python:record_data[0]=='update'" type="hidden" name="id" tal:attributes="value python:record_data[1]" />
		</td>
	</tr>
	<tr>
		<td class="form-label">Title</td>
		<td><input type="text" name="title" size="50" tal:attributes="value python:record_data[2]" /></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" tal:attributes="value python:test(record_data[0]=='add', 'Add', 'Update')" /></td>
	</tr>
</table>
</form>
</tal:block>

<form method="post" action="manage_delete_items">
<table border="0" cellspacing="0" cellpadding="4" width="100%">
	<tr class="row-header">
		<td width="1%"></td>
		<td width="30%" class="cell-header">Id</td>
		<td width="70%" class="cell-header">Title</td>
	</tr>
	<tr tal:repeat="item here/get_list" tal:attributes="class python:test(path('repeat/item/odd'), 'row-odd', 'row-even')">
		<td><input type="checkbox" name="ids" tal:attributes="value item/id" /></td>
		<td><a tal:attributes="href string:manage_items_html?id=${item/id}" tal:content="item/title" /></td>
	</tr>
	<tr>
		<td></td>
		<td colspan="2"><input type="submit" name="delete" value="Delete" /></td>
	</tr>
</table>
</form>

<span tal:replace="structure here/manage_page_footer" />
