<!--#include file="Data_Fun.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="<%=sitepath%>css/bootstrap.min.css" rel="stylesheet">
<link href="<%=sitepath%>css/font-awesome.min.css" rel="stylesheet">
<link href="<%=sitepath%>plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="<%=sitepath%>css/animate.min.css" rel="stylesheet">
<link href="<%=sitepath%>css/style.min.css" rel="stylesheet">
<link href="<%=sitepath&adminPath%>css/adminstyle.css" rel="stylesheet">
<script src="<%=sitepath%>js/jquery.min.js"></script>
<!--[if lte IE 9]>
<script src="<%=sitepath%>js/respond.min.js"></script>
<script src="<%=sitepath%>js/html5.js"></script>
<![endif]-->
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
  <div class="ibox float-e-margins">
<div class="row row-lg">
<div class="col-md-6">
							<div class="panel">
								<div class="panel-heading">
									<h3 class="panel-title">数据库备份</h3>
									<div class="panel-aj">
										<button type="button" class="btn-toggle-collapse"><i class="fa fa-chevron-down"></i></button>
										<button type="button" class="btn-remove"><i class="fa fa-times"></i></button>
									</div>
								</div>
<div class="panel-body">
<div class="panel-body no-padding">		
<div class="ibox-content">
<div class="col-sm-12">
          <div class="col-sm-7">
           <button id="add" class="btn  btn-primary" type="button" onClick="bakup()"><i class="fa fa-plus">　</i>马上备份</button>
            <% if dbType=0 then%> <button id="add" class="btn  btn-success" type="button" onClick="compress()"><i class="fa fa-plus">　</i>压缩数据库</button><%end if%>
              <button onClick="location.reload()" class="btn btn-primary1" type="button"><i class="fa fa-refresh"></i> 刷新</button>
             <!--<button onClick="closetab()" class="btn" type="button"><i class="fa fa-reply">　</i>关闭</button>-->
			 </div>
            <table id="table"
           data-toggle="table"
           data-pagination="true"
           data-search="true"          
           data-show-toggle="true"
           data-show-columns="true"
           data-id-field="id"       
           data-id-table="advancedTable"
           data-page-size="10"
           data-page-list="[20,50,100]" >              
            <thead>
              <tr>
             <th class="tablename" data-field="dataName" data-sortable="true">数据库</th>
                <th class="tablename" data-field="username" data-sortable="true">文件名称</th>
				<th class="tablename" data-field="ip" data-sortable="true">大小</th>
                <th class="tablename" data-field="addtime" data-sortable="true">备份时间</th>
                <th class="tablename" data-field="content">操作记录</th>
              </tr>
               </thead>
              <%	
	dim dataList,datas,datai,i,rs,backdbname
if dbType=0 then
	path=sitepath&dbPath&"backup/"
	if not isFolder(path) then NewFolder path
	dataList= getFileList(path)
	datas = ubound(dataList)
	if ifstrin(dataList(0),",") then	
		for  i = 0 to datas
		datai=split(dataList(i),",")
		echo "<tr>"&vbcrlf& _	
		"<td>"&datai(0)&"</td>"&vbcrlf& _		
		"<td>"&datai(1)&"</td>"&vbcrlf& _	
		"<td>"&datai(2)&"</td>"&vbcrlf& _	
		"<td>"&datai(3)&"</td>"&vbcrlf& _		
		"<td><button on type='button' onclick=""restore('"&datai(4)&"')""  class='btn btn-danger dim'><i class='fa fa-recycle'></i></button>　"&vbcrlf& _			
		"<button type='button'  onclick=""delback('"&datai(4)&"')""  class='btn btn-danger dim'><i class='fa fa-times'></i></button></td>"&vbcrlf			
		next
	else
		echo ""
	end if
elseif dbType=1 then
	on error resume next
	datai=conn.exec("SELECT top 100 b.database_name,b.backup_finish_date,b.backup_size,a.physical_device_name FROM msdb.dbo.backupmediafamily as a INNER JOIN msdb.dbo.backupset as b ON a.media_set_id=b.media_set_id where b.database_name='"&dataName&"' and b.type='d' and CHARINDEX('.dat',a.physical_device_name)>0 ORDER BY b.backup_finish_date desc","arr")
		if ubound(datai)>=0 then
			for  i = 0 to ubound(datai,2)
			if 	ifstrin(datai(3,i),"Backup") then
			 backdbname=split(datai(3,i),"Backup\")(1)			 
			echo "<tr>"&vbcrlf& _	
			"<td>"&datai(0,i)&"</td>"&vbcrlf& _	
			"<td>"&backdbname&"</td>"&vbcrlf& _	
			"<td>"&datai(2,i)&"</td>"&vbcrlf& _	
			"<td>"&datai(1,i)&"</td>"
			if ifstrin(dataName,dataUser) then
			echo "<td><button on type='button' disabled  onclick=""restore('"&backdbname&"')"" class='btn btn-warning dim' title='虚拟空间：不支持恢复数据库的'><i class='fa fa-recycle'></i></button></td>"
			else
			echo "<td><button on type='button' onclick=""restore('"&backdbname&"')""  class='btn btn-warning dim' title='虚拟空间：不支持恢复数据库的'><i class='fa fa-recycle'></i></button></td>"
			end if			
			end if
			next
		end if
end if
		%>           
            </table>
         
        </div>
</div>
</div>
</div>

							</div>
						</div>
</div>
  </div>
</div>
<!-- End Panel Other -->
<script src="<%=sitepath&adminPath%>js/adminjs.js"></script>
<script src="<%=sitepath%>js/bootstrap.min.js"></script> 
<script src="<%=sitepath%>plugins/bootstrap-table/bootstrap-table.min.js"></script> 
<script src="<%=sitepath%>plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script> 
<script src="<%=sitepath%>plugins/layer/layer.min.js"></script>
</body>
</html>
