{* Smarty template *}
{assign var="buttonsNumber" value="0"}
{if $allowedUpdateCategory}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $allowedViewCategory}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $allowedUpdateCategory}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $allowedDeleteCategory}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $ancestorsNumber > 0}
<div class="ancestors">
{message assign=prev key='breadCrumbs.top'}
{foreach from=$ancestors item=ancestor name=ancestors}
{if !$smarty.foreach.ancestors.first}>{/if}
<a href="{buildUrl action=$gridAction parentId=$ancestor->parent_id}" class="ancestorLink">{$prev|escape}</a>
{assign var=prev value=$ancestor->title}
{/foreach}
>
<span class="ancestorNoLink">{$prev|escape}</span>
</div>
{/if}
{assign var="columnsNumber" value=1}
{math assign="totalCells" equation="x+y+1" x=$columnsNumber y=$buttonsNumber}
<table border="0" cellpadding="0" cellspacing="0" class="grid" id="categoryList">
<tr class="filter">
<form action="{buildUrl}" method="GET">
{initFilters}
<td></td>
<td>
{textFilter colon='title'}
</td>
<td align="center" colspan="{$buttonsNumber}"><input type="submit" value="{message key='common.button.filter'}" class="form_filter_button noTopBottomMargin"></td>
</form>
</tr>
<tr>
<th class="selectAllButtonCell"><input type="button" value="{message key='common.button.selectAll'}" onClick="checkAll(document.forms['massDeleteForm']);" class="form_button noTopBottomMargin"></th>
<th>{message key='category.form.title'}</th>
<th colspan="{$buttonsNumber}"></th>
</tr>
{if !$dataIsEmpty}
<form name="massDeleteForm" action="index.php" method="GET" onSubmit="return validateMassDelete(document.forms['massDeleteForm'], '{message escapeSingleQuotes=true key='category.error.nothingSelected'}') && confirmMassDelete('{message escapeSingleQuotes=true key='category.form.confirmMassDelete'}');">
<input type="hidden" name="action" value="massDeleteCategories">
{foreach name="mainLoop" from=$data item=category}
{cycle name="categories" values="oddRow,evenRow" assign=parity}
<tr class="{$parity}" onMouseOver="onMouseOverRow(this)" onMouseOut="onMouseOutRow(this)">
<td align="center" valign="center"><input type="checkbox" name="checked[{$category->id}]"></td>
<td><a href="{buildUrl action=$gridAction parentId=$category->id}">{$category->title|escape}</a></td>
{if $allowedUpdateCategory}
<td class="gridIcon">
{if !$smarty.foreach.mainLoop.first || $offset > 0}
<a href="{buildUrl action='liftCategory' id=$category->id}" title="{message key='category.form.lift'}">
<img src="images/up.gif" border="0" alt="{message key='category.form.lift'}">
</a>
{else}
<img src="images/upDisabled.gif" border="0" alt="{message key='category.form.lift'}">
{/if}
{if !$smarty.foreach.mainLoop.last || !$isLastPage}
<a href="{buildUrl action='lowerCategory' id=$category->id}" title="{message key='category.form.lower'}">
<img src="images/down.gif" border="0" alt="{message key='category.form.lower'}">
</a>
{else}
<img src="images/downDisabled.gif" border="0" alt="{message key='category.form.lower'}">
{/if}
</td>
{/if}
{if $allowedViewCategory}
<td class="gridIcon">
<a href="{buildUrl action='viewCategory' categoryId=$category->id}" title="{message key='category.form.view'}">
<img src="images/view.gif" border="0" alt="{message key='category.form.view'}">
</a>
</td>
{/if}
{if $allowedUpdateCategory}
<td class="gridIcon">
<a href="{buildUrl action='callUpdateCategory' id=$category->id}" title="{message key='category.form.update'}">
<img src="images/edit.gif" border="0" alt="{message key='category.form.update'}">
</a>
</td>
{/if}
{if $allowedDeleteCategory}
<td class="gridIcon">
<a href="{buildUrl action=deleteCategory id=$category->id}" title="{message key='category.form.delete'}" onClick="return confirm('{message escapeSingleQuotes=true key='category.form.confirmDelete'}');">
<img src="images/delete.gif" border="0" alt="{message key='category.form.delete'}">
</a>
</td>
{/if}
</tr>
{/foreach}
{else}
<tr>
<td class="tfoot" colspan="{$totalCells}" align="center">
<em>{message key='category.message.nothing'}</em>
</td>
</tr>
{/if}
</form>
</table>
{include file="after_grid.tpl"}