{* Smarty template *}
{assign var="buttonsNumber" value="0"}
{if $allowedViewResource}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $allowedUpdateResource}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{if $allowedDeleteResource}
{math assign="buttonsNumber" equation="a + 1" a=$buttonsNumber}
{/if}
{assign var="columnsNumber" value=4}
{math assign="totalCells" equation="x+y+1" x=$columnsNumber y=$buttonsNumber}
<table border="0" cellpadding="0" cellspacing="0" class="grid" id="resourceList">
<tr class="filter">
<form action="{buildUrl}" method="GET">
{initFilters}
<td></td>
<td>
{textFilter colon='fileName'}
</td>
<td>
{textFilter colon='title'}
</td>
<td></td>
<td>
{*{filterValue colon='resource_active' assign='resource_activeFilter' escape=false}
<select name="{filterName colon='resource_active'}" class="form_filter_short">
{html_options options=$allYesNoList selected=$resource_activeFilter}
</select>*}
</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><a href="{sortLink colon='fileName'}">{message key='resource.form.fileName'}</a></th>
<th><a href="{sortLink colon='title'}">{message key='resource.form.title'}</a></th>
<th><a href="{sortLink colon='size'}">{message key='resource.form.size'}</a></th>
<th>{*<a href="{sortLink colon='resource_active'}">*}{message key='resource.form.active'}{*</a>*}</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='resource.error.nothingSelected'}') && confirmMassDelete('{message escapeSingleQuotes=true key='resource.form.confirmMassDelete'}');">
<input type="hidden" name="action" value="massDeleteResources">
{foreach name="mainLoop" from=$data item=resource}
{cycle name="resources" values="oddRow,evenRow" assign=parity}
<tr class="{$parity}" onMouseOver="onMouseOverRow(this)" onMouseOut="onMouseOutRow(this)">
<td align="center" valign="center"><input type="checkbox" name="checked[{$resource->id}]"></td>
<td>{$resource->file_name|escape}</td>
<td>{$resource->title|escape}</td>
<td>{$resource->size|escape}</td>
<td>{$resource->isActiveYesno()|escape}</td>
{if $allowedViewResource}
<td class="gridIcon">
<a href="{buildUrl action='viewResource' id=$resource->id}" title="{message key='resource.form.view'}">
<img src="images/view.gif" border="0" alt="{message key='resource.form.view'}">
</a>
</td>
{/if}
{if $allowedUpdateResource}
<td class="gridIcon">
<a href="{buildUrl action='callUpdateResource' id=$resource->id}" title="{message key='resource.form.update'}">
<img src="images/edit.gif" border="0" alt="{message key='resource.form.update'}">
</a>
</td>
{/if}
{if $allowedDeleteResource}
<td class="gridIcon">
<a href="{buildUrl action=deleteResource id=$resource->id}" title="{message key='resource.form.delete'}" onClick="return confirm('{message escapeSingleQuotes=true key='resource.form.confirmDelete'}');">
<img src="images/delete.gif" border="0" alt="{message key='resource.form.delete'}">
</a>
</td>
{/if}
</tr>
{/foreach}
{else}
<tr>
<td class="tfoot" colspan="{$totalCells}" align="center">
<em>{message key='resource.message.nothing'}</em>
</td>
</tr>
{/if}
</form>
</table>
{include file="after_grid.tpl"}