<!--#include file="conn.asp"-->
<!--#include file="check.asp"-->
<!--#include file="../sub.asp"-->
<%
Action=request.QueryString("Action")
if Action="Rec" then
	titleID=request.Form("titleID")
	conn.execute("update title set Recomm=0 where titleID in ("&titleID&")")
	response.Redirect("allrec.asp")
elseif Action="Del" then
	titleID=request.QueryString("titleID")
	set fo=server.CreateObject("Scripting.FileSystemObject")
	set rs=conn.execute("select photo from imgbook where titleID="&titleID)
	do while not rs.eof
		FilePath=rs(0)&","&FilePath
		rs.movenext
	loop
	rsclose
	FilePath=split(FilePath,",")
	conn.execute("delete from title where titleID="&titleID)
	for each FileName in FilePath
		if FileName<>"" then
	    s_filename=Replace(FileName,"UploadImages","UploadImages/s")
		fo.DeleteFile server.MapPath(FileName)
		fo.DeleteFile server.MapPath(s_filename)
		end if
	next
	set fo=nothing
	response.Redirect("allrec.asp")
end if
sql="select titleID,titleName,titleNum,Photoer,ClassID,Recomm,updatetime from title order by updatetime desc"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<link href="images/bbs.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
function unselectall()
{
    if(document.myform.chkAll.checked){
	document.myform.chkAll.checked = document.myform.chkAll.checked&0;
    } 	
}

function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "")
       e.checked = form.chkAll.checked;
    }
  }
function ConfirmDel(){
	if(confirm("确定要删除选中的图片吗？本操作是无法恢复的！"))
		return true;
	else
		return false;
}
</script>
<style type="text/css">
<!--
.style1 {
	color: #FF0000;
	font-weight: bold;
}
.style2 {color: #FFFFFF}
-->
</style>
</head>
<body leftmargin="0" topmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
      <td width="17%" align="center" bgcolor="#799AE1" style="border-bottom: 1 solid #000000">&nbsp;      </td>
      <td height="22" colspan="4" align="center" bgcolor="#799AE1" style="border-bottom: 1 solid #000000"><span class="style2">所有推荐组图</span></td>
      <td width="35%" colspan="2" bgcolor="#799AE1" style="border-bottom: 1 solid #000000">&nbsp;     </td> 
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="6" cellspacing="0">
<form action="?Action=Rec" method="post" name="myform"><tr>
      <td width="26">ID</td> 
      <td width="124" height="20">&nbsp;组图名称</td>
      <td width="115"> 
        <div align="center">缩略图</div></td>
      <td width="106"> 
        <div align="center">上传日期</div></td>
      <td width="70"> 
        <div align="center">推荐</div></td>
      <td width="62"> 
        <div align="center"><font color="#FF0000">摄影师</font></div></td>
      <td width="192"> 
        <div align="center">操作</div>
      </td>
  </tr>
  <% 
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1

rs.pagesize=10
rs.cachesize=10
currentpage=Clng(request("page"))
if currentpage<1 then currentpage=1
if currentpage>rs.pagecount then currentpage=rs.pagecount
rs.absolutepage=currentpage

Do While Not rs.Eof 
	set rsShow=conn.execute("select ID,photo,titleid from imgbook where titleID="&rs("titleID"))%>
  <tr> 
      <td width="26">
<input name="titleID" type="checkbox" value="<%=rs("titleID")%>"  onclick="unselectall()"></td> 
      <td height="20" width="124"><a href="../list.asp?titleID=<%=rs("titleID")%>&ClassID=<%=RS("ClassID")%>&KeyWords=<%=rs("titleName")%>" title="点击查看详细情况" target="_blank"><%=rs("titleName")%></a></td>
      <td height="20" width="115"> 
        <div align="center"><%if not RSshow.eof then%><script src="../showpic.asp?location=admin&FileName=<%=rsShow("photo")%>"></script><%Else%><%Response.write "暂无组图！"%><%End if%></div></td>
      <td height="20" width="106"> 
        <div align="center"><%=rs("updatetime")%></div></td>
      <td height="20" align="center" width="70"> 
        <%if rs("Recomm")=1 then%>
        <span class="style1">√</span> 
        <%else%>
        <strong>×</strong> 
        <%end if%>
      </td>
      <td height="20" width="62"> 
        <div align="center"><font color="#FF0000"><%=rs("Photoer")%></font></div></td>
      <td height="20" width="192">
        <div align="center"><a href="setRec.asp?rec=1&titleID=<%=rs("titleID")%>&action=2&page=<%=currentpage%>" class="black">推荐</a>|<a href="setRec.asp?rec=0&Action=2&TitleID=<%=rs("TitleID")%>&page=<%=currentpage%>" class="black">不推荐</a><br>
          <a href="?Action=Del&titleID=<%=rs("titleID")%>" class="black" onClick="javascript:return ConfirmDel();">删除</a>|<a href="modify_load.asp?titleID=<%=rs("titleID")%>&classid=<%=rs("classID")%>&page=<%=currentpage%>" class="black">修改</a></div>
      </td>
  </tr>
  <%
i=i+1
rs.MoveNext
If i>=rs.pagesize Then Exit Do
Loop  %>
  <tr>
      <td height="20" align="center" width="26">
<input name="chkAll" type="checkbox" id="chkAll" value="1" onclick=CheckAll(this.form)></td>
      <td height="20" width="124">选中本页组图</td>
    <td height="20" colspan="5" style="padding-left: 20px;"><input type="submit" name="Submit3" value="取消对选中的组图的推荐">
    </td>
    </tr>
</form>
</table>
  <table width="84%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td><div align="center">共有图片:<font color=red><%=rs.recordcount%></font> 组,<%=rs.pagecount%>页&nbsp;&nbsp;
          <%if currentpage>1 then%>
          <a href=manage.asp class="black">首页</a>&nbsp; <a href=manage.asp?page=<%=currentpage-1%> class="black"> 
          上一页</a>
          <%end if%>
          <%if currentpage<rs.pagecount then%> &nbsp;
          <a href=manage.asp?page=<%=currentpage+1%> class="black">下一页</a>&nbsp;  <a href=manage.asp?page=<%=rs.pagecount%> class="black">尾页</a>
          <%end if%>
          每页显示<%=rs.pagesize%>组&nbsp; &nbsp;&nbsp; 
        </div></td>
    </tr>
  </table>
</body>
</html>
<%
rsclose
ConnClose()
%>