<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="cf top_nav_list"> <div class="fl button_list"> <a id="export" class="" href="javascript:;" autocomplete="off"><span class="button_icon button_icon1"></span>立即备份</a> <a id="optimize" class="" href="{:U('optimize')}"><span class="button_icon button_icon22"></span>优化表</a> <a id="repair" class="" href="{:U('repair')}"><span class="button_icon button_icon21"></span>修复表</a> </div> </div> <!-- 应用列表 --> <div class="data_list"> <form id="export-form" method="post" action="{:U('export')}"> <table> <thead> <tr> <th width="48"><input class="check-all" checked="chedked" type="checkbox" value=""></th> <th>表名</th> <th width="120">数据量</th> <th width="120">数据大小</th> <th width="160">创建时间</th> <th width="160">备份状态</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="table"> <tr> <td class="num"> <input class="ids" checked="chedked" type="checkbox" name="tables[]" value="{$table.name}"> </td> <td>{$table.name}</td> <td>{$table.rows}</td> <td>{$table.data_length|format_bytes}</td> <td>{$table.create_time}</td> <td class="info">未备份</td> <td class="action"> <a class="ajax-get no-refresh" href="{:U('optimize?tables='.$table['name'])}">优化表</a> <a class="ajax-get no-refresh" href="{:U('repair?tables='.$table['name'])}">修复表</a> </td> </tr> </volist> </empty> </tbody> </table> </form> </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/export')}"); (function($){ var $form = $("#export-form"), $export = $("#export"), tables $optimize = $("#optimize"), $repair = $("#repair"); $optimize.add($repair).click(function(){ $.post(this.href, $form.serialize(), function(data){ if(data.status){ updateAlert(data.info,'alert-success'); } else { updateAlert(data.info,'alert-error'); } setTimeout(function(){ $('#top-alert').find('button').click(); $(that).removeClass('disabled').prop('disabled',false); },1500); }, "json"); return false; }); $export.click(function(){ $export.parent().children().addClass("disabled"); updateAlert("正在发送备份请求..."); $.post( $form.attr("action"), $form.serialize(), function(data){ if(data.status){ tables = data.tables; updateAlert(data.info + "开始备份,请不要关闭本页面!"); backup(data.tab); window.onbeforeunload = function(){ return "正在备份数据库,请不要关闭!" } } else { updateAlert(data.info,'alert-error'); $export.parent().children().removeClass("disabled"); setTimeout(function(){ $('#tip').find('.tipclose').click(); $export.removeClass('disabled').prop('disabled',false); },1500); } }, "json" ); return false; }); function backup(tab, status){ status && showmsg(tab.id, "开始备份...(0%)"); $.get($form.attr("action"), tab, function(data){ if(data.status){ showmsg(tab.id, data.info); if(!$.isPlainObject(data.tab)){ $export.parent().children().removeClass("disabled"); updateAlert("备份完成,点击重新备份",'alert-success'); window.onbeforeunload = function(){ return null } setTimeout(function(){ $('#tip').find('.tipclose').click(); $export.parent().children().removeClass("disabled"); },1500); return; } backup(data.tab, tab.id != data.tab.id); } else { updateAlert(data.info,'alert-error'); $export.parent().children().removeClass("disabled"); setTimeout(function(){ $('#tip').find('.tipclose').click(); $export.removeClass('disabled').prop('disabled',false); },1500); } }, "json"); } function showmsg(id, msg){ $form.find("input[value=" + tables[id] + "]").closest("tr").find(".info").html(msg); } })(jQuery); </script> </block>