<extend name="Public/base"/>

<block name="body">
    <div class="main-place">
        <span class="main-placetitle">位置</span>
        <ul class="main-placeul">
            <li><a href="{:U('Model/index')}">系统</a></li>
            <li><a href="{:U('Database/index',array('type'=>'export'))}">数据备份</a></li>
            <li><a href="#">{$meta_title}</a></li>
        </ul>
    </div>

    <!-- 应用列表 -->
    <div class="data_list box_mt">
        <table>
            <thead>
                <tr>
                    <th width="200">备份名称</th>
                    <th width="80">卷数</th>
                    <th width="80">压缩</th>
                    <th width="80">数据大小</th>
                    <th width="200">备份时间</th>
                    <th>状态</th>
                    <th width="120">操作</th>
                </tr>
            </thead>
            <tbody>
            <empty name="list" >
			       <tr>
			       <td colspan="7" class="text-center">aOh! 暂时还没有内容!</td>
			       </tr>
			       <else />
                <volist name="list" id="data">
                    <tr>
                        <td>{$data.time|date='Ymd-His',###}</td>
                        <td>{$data.part}</td>
                        <td>{$data.compress}</td>
                        <td>{$data.size|format_bytes}</td>
                        <td>{$key}</td>
                        <td>-</td>
                        <td class="action">
                            <a class="db-import" href="{:U('import?time='.$data['time'])}">还原</a>&nbsp;
                            <a class="ajax-get confirm" href="{:U('del?time='.$data['time'])}">删除</a>
                        </td>
                    </tr>
                </volist>
                </empty>
            </tbody>
        </table>
    </div>
    <!-- /应用列表 -->
		
		<div class="common_settings">
			<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
			<form class="addShortcutIcon">
				<input type="hidden" name="title" value="{$m_title}">
				<input type="hidden" name="url" value="{$m_url}">
			</form>
			<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
		</div>
		
</block>

<block name="script">
    <script type="text/javascript">

        highlight_subnav("{:U('Database/index/type/import')}");

        $(".db-import").click(function(){
            var self = this, status = ".";
            $.get(self.href, success, "json");
            window.onbeforeunload = function(){ return "正在还原数据库,请不要关闭!" }
            return false;
        
            function success(data){
                if(data.status){
                    if(data.gz){
                        data.info += status;
                        if(status.length === 5){
                            status = ".";
                        } else {
                            status += ".";
                        }
                    }
                    $(self).parent().prev().text(data.info);
                    if(data.part){
                        $.get(self.href, 
                            {"part" : data.part, "start" : data.start}, 
                            success, 
                            "json"
                        );
                    }  else {
                        window.onbeforeunload = function(){ return null; }
                    }
                } else {
                    updateAlert(data.info,'alert-error');
                }
            }
        });
    </script>
</block>