{extends file="layout.html"}
{block name=title}LMS: {$layout.pagetitle|striphtml}{/block}
{block name=module_content}
<H1>{$layout.pagetitle}</H1>
<TABLE class="lmsbox lms-ui-background-cycle">
    <THEAD>
	<TR>
		<TD width="46%" NOWRAP>{trans("Host:")}</TD>
		<TD width="2%" NOWRAP align="right">{trans("TTL")}:</TD>
		<TD width="2%" NOWRAP>{trans("Type")}:</TD>
		<TD width="2%" NOWRAP>{trans("Priority:")}</TD>
		<TD width="46%" NOWRAP>{trans("Content")}:</TD>
		<TD width="2%" align="right" NOWRAP><B>{t a=$listdata.total}Total: $a{/t}</B>&nbsp;</TD>
	</TR>
	<TR>
		<TD colspan="6">
			<TABLE cellpadding="0" cellspacing="0" width="100%">
			    <TR>
                    		<TD width="1%" NOWRAP class="nobr">
				<FORM method="GET" action="?m={$layout.module}" name="filter">
				    <input type="hidden" name="m" value="{$layout.module}">
				    {trans("Domain:")}
				    <SELECT size="1" name="d" OnChange="document.filter.submit();">
					{section name=domainlist loop=$domainlist}
					    <OPTION value="{$domainlist[domainlist].id}"{if $domainlist[domainlist].id == $listdata.domain} SELECTED{/if}>{$domainlist[domainlist].name}</OPTION>
					{/section}
				    </SELECT>
				</FORM>
			    </TD>
			    <TD width="99%" align="right" nowrap>
                        	<A href="?m=recordadd&d={$listdata.domain}">{trans("New Record")} <IMG src="img/save.gif" alt=""></A>
            		    </TD>
			</TR>
		    </TABLE>
		</TD>
	</TR>
	{if $listdata.total != 0}
	<TR>
		<TD class="lms-ui-pagination" COLSPAN="6">
			{include file="scroller.html" loop=$recordslist adlink=$suffix}
		</TD>
	</TR>
	{/if}
    </THEAD>
    <TBODY>
	{section name=recordslist loop=$recordslist start=$start max=$pagelimit}
	<TR class="highlight" data-name="{$recordslist[recordslist].name}">
		<TD NOWRAP onclick="return location.href='?m=recordedit&id={$recordslist[recordslist].id}'">{$recordslist[recordslist].name}</TD>
		<TD align="center">{$recordslist[recordslist].ttl}</TD>
		<TD align="center" NOWRAP>{$recordslist[recordslist].type}</TD>
		<TD align="center" NOWRAP>{$recordslist[recordslist].prio}</TD>
		<TD align="left" NOWRAP onclick="return location.href='?m=recordedit&id={$recordslist[recordslist].id}'">{$recordslist[recordslist].content}</TD>
		<TD class="nobr text-right">
			{if $showaddedit}
			<A href="?m=recordedit&id={$recordslist[recordslist].id}"><IMG src="img/edit.gif" alt="{trans("Edit")}" title="{trans("Edit")}"></A>
			{if $recordslist[recordslist].type != "SOA"}
			<A class="delete-record" href="?m=recorddel&id={$recordslist[recordslist].id}"><IMG src="img/delete.gif" title="{trans("Delete")}" alt="{trans("Delete")}"></A>
			{/if}
			{/if}
		</TD>
	</TR>
	{sectionelse}
	<tr>
		<td colspan="6" class="empty-table">
			{trans("No such records in database.")}
		</td>
	</tr>
	{/section}
    </TBODY>
    <TFOOT>
	{if $listdata.total != 0}
	<TR>
		<TD class="lms-ui-pagination" COLSPAN="6">
			{include file="scroller.html" loop=$recordslist adlink=$suffix}
		</TD>
	</TR>
	{/if}
	<TR>
        	<TD colspan="3" align="right" valign="top"></TD>
		<TD colspan="3" align="right">
		{if $showaddedit}
			<A href="?m=recordadd&d={$listdata.domain}">{trans("New Record")} <IMG src="img/save.gif" alt=""></A>
		{/if}
		</TD>
	</TR>
    </TFOOT>
</TABLE>
	<script>
		$('.delete-record').click(function() {
			var name = $(this).closest('tr').attr('data-name');
			confirmDialog($t("Are you sure you want to delete this record '$a'?", name), this).done(function() {
				location.href = $(this).attr('href');
			});
			return false;
		});
	</script>
{/block}
