{extends file="layout.html"}
{block name=title}LMS: {$layout.pagetitle|striphtml}{/block}
{block name=module_content}
<!--// $Id$ //-->
<H1>{$layout.pagetitle}</H1>
<script type="text/javascript">
	<!--
	function createBackup(gzip)
	{
		var add = "";

		if(gzip)
			add += "&gz=1";

		if(document.statsitem.attachstats.checked)
			add += "&stats=1";

		document.statsitem.action = "?m=dbnew" + add;
		document.statsitem.submit();
	}
	//-->
</script>
<FORM method="post" action="?m=dbnew" name="statsitem">
<p style="display: none;">
<INPUT type="submit" class="hiddenbtn">
</p>
<TABLE class="lmsbox">
	<COLGROUP>
		<COL style="width: 98%;">
		<COL style="width: 1%;">
		<COL style="width: 1%;">
	</COLGROUP>
	<THEAD>
	<TR>
		<TD scope="col" class="nobr">
			<IMG src="img/time.gif" alt=""> {trans("Creation time:")}
		</TD>
		<TD scope="col" class="text-right nobr">
			<IMG src="img/plain.gif" alt=""> {trans("Size:")}
		</TD>
		<TD scope="col" class="text-right nobr">
			<IMG src="img/empty.gif" alt="" height="16" width="1"> {t a=$dblist.total}Total: $a{/t}
		</TD>
	</TR>
	</THEAD>
	<TBODY>
	{cycle values="light,lucid" print=false}
	{section name=dblist loop=$dblist.time}
	<TR class="highlight {cycle}{if $dblist.dbv[dblist] != $layout.dbschversion} blend{/if}"  >
		<TD onClick="return self.location.href='?m=dbview&amp;db={$dblist.name[dblist]}&amp;file=/lms-{$dblist.time[dblist]|date_format:"Ymd-His"}.sql{if $dblist.type[dblist]=="gz"}.gz{elseif $dblist.type[dblist]=="plain"}{/if}';">
			<IMG src="img/time.gif" alt=""> {$dblist.time[dblist]|date_format:"Y/m/d H:i:s"} ({trans($dblist.time[dblist]|date_format:"l")})
		</TD>
		<TD class="text-right nobr" onClick="return self.location.href='?m=dbview&amp;db={$dblist.name[dblist]}&amp;file=/lms-{$dblist.time[dblist]|date_format:"Ymd-His"}.sql{if $dblist.type[dblist]=="gz"}.gz{elseif $dblist.type[dblist]=="plain"}{/if}';">
			{if $dblist.type[dblist]=="gz"}
				<IMG src="img/zipped.gif" alt="">
			{else}
				<IMG src="img/plain.gif" alt="">
			{/if} {$dblist.size[dblist]} {trans("bytes")} ({$dblist.hsize[dblist]})
		</TD>
		<TD class="text-right nobr">
			{if $dblist.dbv[dblist] == $layout.dbschversion}
			<a class="recover-backup" href="?m=dbrecover&db={$dblist.name[dblist]}{if $dblist.type[dblist]=="gz"}&gz=1{elseif $dblist.type[dblist]=="plain"}{/if}"><IMG src="img/recover.gif" alt="{trans("Restore")}" title="{trans("Restore")}"></A>
			{/if}
			<a class="delete-backup" href="?m=dbdel&db={$dblist.name[dblist]}"><IMG src="img/delete.gif" alt="{trans("Delete")}" title="{trans("Delete")}"></A>
			<a href="?m=dbview&amp;db={$dblist.name[dblist]}&amp;file=/lms-{$dblist.time[dblist]|date_format:"Ymd-His"}.sql{if $dblist.type[dblist]=="gz"}.gz{elseif $dblist.type[dblist]=="plain"}{/if}"><img src="img/save.gif" alt="{trans("Save")}" title="{trans("Save")}"></A>
		</TD>
	</TR>
	{sectionelse}
	<tr>
		<td colspan="3" class="empty-table">
			{trans("Database backups currently not found.")}
		</td>
	</tr>
	{/section}
	<TR>
		<TD colspan="3" class="text-right">
			<INPUT type="checkbox" name="attachstats" id="attachstats"> <label for="attachstats">{trans("Attach stats")}</label>&nbsp;
			{trans("Create new")}
			<A href="javascript:createBackup(false);">{trans("uncompressed")} <img src="img/dbnew.gif" alt=""></A> /
			<A href="javascript:createBackup(true);">{trans("compressed")} <img src="img/zipped.gif" alt=""></A>
		</TD>
	</TR>
	</TBODY>
</TABLE>
</FORM>
	<script>
		$('.delete-backup').click(function() {
			confirmDialog($t("Are you sure, you want to delete this database backup?"), this).done(function() {
				location.href = $(this).attr('href');
			});
			return false;
		});
		$('.recover-backup').click(function() {
			confirmDialog($t("Are you sure, you want to restore this database backup?\n\nWARNING!\n\nIt will backup current database content automatically"), this).done(function() {
				location.href = $(this).attr('href') + '&is_sure=1';
			});
			return false;
		});
	</script>
{/block}
