<!--#include file="../fy.Function.asp"-->
<!--#include file="../../fy_inc/cls_pageview.asp"-->
<!doctype html>
<html>
<head>
<meta charset="gb2312">
<title>fycms上传文件管理</title>
<link rel="stylesheet" type="text/css" href="../css/base.css">
<link rel="stylesheet" type="text/css" href="../css/content.css">
</head>
<body>
<div class="content"> 
	<div class="breadnav">当前位置：<a href="#">后台首页</a> >> 模型管理</div>
 
<% If Not fycms.ChkAdmin() Then  Call fycms.Alert("对不起，您没有操作权限！","")
	    Dim sql, sqlCount,Sqls,intPageSize, strPageInfo,arrinfo, i,pages,intPageNow,strLocalUrl,Action
	    Action=Request("Action")
	    IF Request.QueryString("Action") = "del" Then
		Dim ID,Rs:ID = Request("ID")
		IF ID = "" Then
			Call fycms.ActErr("请指定要删除的","","1")
 			Response.End 
		End If
		ID = Split(ID,",")
		For I = LBound(ID) To UBound(ID)
			Set Rs=fycms.ACTEXE("Select UpfileDir from Upload_fy where ID="&ID(I)&"")
			If Not Rs.eof Then 
				fycms.DeleteFile(Rs("UpfileDir"))
			End If 
			fycms.ACTEXE("delete from Upload_fy where ID="&ID(I)&"")
		Next 
		Call fycms.ActErr("删除成功","include/fy.Upfile.asp","")
 		Response.end
	  Else
		Call  main()
	  End IF
	  
	Sub   main()
	 Dim ACT_TypeDiY,TypeDiY,Manage
	strLocalUrl = request.ServerVariables("SCRIPT_NAME")
	intPageNow = request.QueryString("page")
	intPageSize =20
	sql = "SELECT [ID],[AID],[UpfileDir],[Extension],[addtime],[ModeID]" & _
		" FROM [Upload_fy]" & _
		" ORDER BY [ID] DESC"
	sqlCount = "SELECT Count([ID])" & _
			" FROM [Upload_fy]"
		Dim clsRecordInfo
		Set clsRecordInfo = New Cls_PageView
			clsRecordInfo.intRecordCount = 2816
			clsRecordInfo.strSqlCount = sqlCount
			clsRecordInfo.strSql = sql
			clsRecordInfo.intPageSize = intPageSize
			clsRecordInfo.intPageNow = intPageNow
			clsRecordInfo.strPageUrl = strLocalUrl
			clsRecordInfo.strPageVar = "page"
		clsRecordInfo.objConn = Conn		
		arrinfo = clsRecordInfo.arrinfo
		strPageInfo = clsRecordInfo.strPageInfo
		Set clsRecordInfo = nothing
	 %>
   <form name="Article" method="post" action="?Action="> <tr>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <thead>
      <tr>
      <th>选中</th>
	  <th>ID</th>
	  <th>所属文章</th>
	  <th>路径</th>
	  <th>上传时间</th>
	  <th>扩展名</th>
	  </tr>
    </thead>
   <%
 		If IsArray(arrinfo) Then
			For i = 0 to UBound(arrinfo, 2)
	%>  <tr  >
      <td><input type="checkbox" name="ID" value="<%= arrinfo(0,i) %>"></td>
      <td  align="center" ><%= arrinfo(0,i) %></td>
      <td><%

	Dim AName,modeid
	modeid=ChkNumeric(arrinfo(5,i))
	If modeid=0 Then modeid=1
	Set AName=fycms.ACTEXE("Select title from  "&fycms.ACT_C(modeid,2)&"  where ID = "& arrinfo(1,i))
	If Not Aname.eof Then 
		echo "<a target=""_blank"" href="&fycms.actsys&fycms.act_c(arrinfo(5,i),5)&"/index.asp?ID="&arrinfo(1,i)&">"&Aname("title")&"</a>"
	Else
		echo "<font color=red>该文章已被删除</font>"
	End If 
  	  %></td>
      <td>
<span id="Zoom<%=i%>"></span><span onClick="window.open('<%= arrinfo(2,i) %>');" onMouseOver="zoom('Zoom<%=i%>','<%= arrinfo(2,i) %>');" style="cursor:pointer;" onMouseOut="Zoom<%=i%>.innerHTML='';" >
<%= arrinfo(2,i) %></span>	  
	  </td>
      <td><%= arrinfo(4,i) %></td>
      <td  align="center" ><%= arrinfo(3,i) %></td>
    </tr><% 
	Next
	End If
	%>
    <tr>
      <td colspan="6" class="tl"><label for=chk>
        <input id="chk" type="checkbox" name="chkall" value="checkbox" onClick="CheckAll(this.form)">
        选择全部</label>
        <input type="button" class="btn btn_primary"  name="yd" value="批量删除" onClick="delpost()"></td>
    </tr>
	
	
	</table></form>
    <div class="pagelist">
  <%= strPageInfo%>
   </div>  <% end sub
CloseConn %>
</div>
  <script language="javascript">
function CheckAll(form)  
  {  
 for (var i=0;i<form.elements.length;i++)  
    {  
    var e = Article.elements[i];  
   if (e.name != 'chkall')  
      e.checked = Article.chkall.checked;  
   }  
  }

 
function zoom(zid,zimg) {
	var div = document.getElementById(zid);
	div.style.position = 'absolute';
	div.innerHTML = "<img src=" + zimg + " style='padding:1px;border:1px solid #9FD253;background-color:#fff;margin:18px 0px 0px 0px;'>"
}

function delpost(){
    document.Article.method="post";
    document.Article.action="?Action=del";
{
	if(confirm('确认要删除选中的文件吗?')){
	this.document.Article.submit();
	return true;}return false;
}
	}
</script>
</body>
</html>
