<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="admin.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>分类信息</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="style/js.js"></script>
</head>

<body id="page">
<h2 class="title">分类信息</h2>
<%'//批量操作
if request("action")=3 then
 select case request("sub")
   case 1
     conn.execute("update cw_info set isnice=1 where id in("&request("id")&")") 
   case 2
     conn.execute("update cw_info set istop=1 where id in("&request("id")&")")
   case 3
     conn.execute("update cw_info set ispass=1 where id in("&request("id")&")")
   case 4
     conn.execute("update cw_info set isnice=0 where id in("&request("id")&")")
   case 5
     conn.execute("update cw_info set istop=0 where id in("&request("id")&")")
   case 6
     conn.execute("update cw_info set ispass=0 where id in("&request("id")&")")
   case 9
	 set dl=server.CreateObject("adodb.recordset")
	 dlq="select * from cw_info where id in("&request("id")&")"
	 dl.open dlq,conn,1,3
	 if not dl.eof then
	 do while not dl.eof
	   pic=dl("pic")	   
	   if pic<>"" then cw_del(cf_root&pic)
	   '//删除静态文件
	   html=cf_root&cw_class("html","cw_info_class",dl("classid"))&dl("id")&".html"
	   if html<>"" then cw_del(html)
	   dl.delete
	 dl.movenext
	 loop	 
	 end if
	 dl.close
	 set dl=nohting	 
   case 10
      call c_show(request("id"),2,"1",0,"cw_info")
      response.Write("<script>var url='cw_info.asp'; setTimeout('location.href=(url)',2000)</script>")
      response.End()
   end select
   response.Redirect"cw_info.asp"
end if
%>
<table width="99%" border="0" align="center" class="nav">
  <tr>
    <td height="20">&nbsp;网站后台管理 &gt;&gt; <a href="cw_info.asp">分类信息</a></td>
	<td align="right"><form action="cw_info.asp" method="post" name="form" onsubmit="if(this.key.value==''){this.key.focus();return false}">信息搜索
          <select name="lei" id="lei">
            <option value="1" <%if request("lei")=1 then%>selected="selected"<%end if%>>标题</option>
            <option value="2" <%if request("lei")=2 then%>selected="selected"<%end if%>>用户名</option>
            <option value="3" <%if request("lei")=3 then%>selected="selected"<%end if%>>信息ID</option>
          </select>
          <input name="key" type="text" id="key" size="18" maxlength="50" style="height:18px; line-height:18px" value="<%=request("key")%>" />
        <input type="submit" name="Submit2" value="搜索" /></form></td>
  </tr>
</table>
<%if Request("action")="" then%>
<form action="cw_info.asp?action=3" method="post" name="form">
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
      <tr>
        <td width="3%" align="center" bgcolor="#F0F3F5">&nbsp;</td>
        <td width="36%" align="center" bgcolor="#F0F3F5">标题</td>
        <td width="6%" align="center" bgcolor="#F0F3F5">缩略图</td>
		<td width="10%" align="center" bgcolor="#F0F3F5">用户</td>
        <td width="8%" align="center" bgcolor="#F0F3F5">分类</td>
	    <td width="16%" align="center" bgcolor="#F0F3F5">状态</td>
        <td width="14%" align="center" bgcolor="#F0F3F5">管理</td>
      </tr>
    <%
	   lei=request("lei")
	   key=trim(request("key"))
	   userid=cw_userid(key)
	   select case lei
	     case 1
		   sql="select * from cw_info where title like '%"&key&"%' order by id desc"
		 case 2
		   sql="select * from cw_info where userid="&userid&" order by id desc"
		 case 3
		   sql="select * from cw_info where id="&cint(key)&" order by id desc"
		 case else
		   sql="select * from cw_info order by id desc"
	   end select
		set rs1=server.CreateObject("adodb.recordset")
		rs1.open sql,conn,1,1
		if not rs1.eof then
		page_count=10
  		if Request("page")="" or Request("page")="0" then
   		 page=1
  		else
    	 page=cint(Request("page"))
  		End if 
		totalcount=rs1.RecordCount
   		totalpage=int(totalcount/page_count+(page_count-1)/page_count)
  		if page>totalpage then page=totalpage
  		if rs1.EOF then    
   		else
   		 for i = 1 to (page-1)*page_count
    		rs1.MoveNext
   			 Next
   			if page<totalpage then
    			psize=page_count
   			else
   				psize=totalcount-(page-1)*page_count
   			End if
   		for i = 1 to psize
		url=cf_root&cw_class("html","cw_info_class",rs1("classid"))&rs1("id")&".html"
		%>
      <tr>
        <td align="center" bgcolor="#FFFFFF"><input type="checkbox" name="id" id="id" value="<%=rs1("id")%>" /></td>
        <td bgcolor="#FFFFFF">&nbsp;<a href="<%=url%>" target="_blank"><%=rs1("title")%></a></td>
        <td align="center" bgcolor="#FFFFFF"><%if rs1("pic")<>"" then%>是<%else%><font color="#CCCCCC">否</font><%end if%></td>
		<td align="center" bgcolor="#FFFFFF"><%if rs1("userid")=0 then%>Admin<%else%><%=cw_class("user","cw_user",rs1("userid"))%><%end if%></td>
        <td align="center" bgcolor="#FFFFFF" ><%=cw_class("title","cw_info_class",rs1("classid"))%></td>
        <td align="center" bgcolor="#FFFFFF" >
		<%if rs1("isnice")=1 then%><a href="cw_info.asp?action=3&sub=4&id=<%=rs1("id")%>" class="action">己推荐</a><%else%><a href="cw_info.asp?action=3&sub=1&id=<%=rs1("id")%>">未推荐</a><%end if%>&nbsp;
		<%if rs1("istop")=1 then%><a href="cw_info.asp?action=3&sub=5&id=<%=rs1("id")%>" class="action">己置顶</a><%else%><a href="cw_info.asp?action=3&sub=2&id=<%=rs1("id")%>">未置顶</a><%end if%>&nbsp;
		<%if rs1("ispass")=1 then%><a href="cw_info.asp?action=3&sub=6&id=<%=rs1("id")%>" class="action">己审核</a><%else%><a href="cw_info.asp?action=3&sub=3&id=<%=rs1("id")%>">未审核</a><%end if%>		</td>
	<td align="center" bgcolor="#FFFFFF" ><a <%if rs1("ispass")=1 then%>href="cw_info.asp?action=3&sub=10&id=<%=rs1("id")%>"<%end if%>>生成</a> | <a href="cw_info.asp?action=10&id=<%=rs1("id")%>">查看</a> | <a href="cw_info.asp?sub=9&id=<%=rs1("id")%>&action=3" onclick="return confirm('你确定要删除？')">删除</a></td>
      </tr>
	      <%
		 rs1.MoveNext
 		next
		end if
		end if
		rs1.close
		set rs1=nothing
		%>
      <tr >
        <td colspan="7" align="center" bgcolor="#FFFFFF">
		<div style="float:left">
		<input name="button" type="button" onclick="qxbox(this.form.id)" value="全 选" />
        &nbsp;&nbsp;
        <input name="button" type="button"  onclick="fxbox(this.form.id)" value="反 选" />
        &nbsp;&nbsp;
        <select name="sub" id="sub">
          <option value="">请选择操作</option>
		  <option value="1">设为推荐</option>
		  <option value="2">设为置顶</option>
		  <option value="3">通过审核</option>
		  <optgroup label="&nbsp;&nbsp;"></optgroup>
		  <option value="4">取消推荐</option>
		  <option value="5">取消置顶</option>
		  <option value="6">取消审核</option>
		  <optgroup label="&nbsp;&nbsp;"></optgroup>
		  <option value="10">批量生成</option>
		   <optgroup label="&nbsp;&nbsp;"></optgroup>
		   <option value="9">批量删除</option>
        </select>
        <input type="submit" name="Submit" value="批量执行操作" onclick="return confirm('你确定要执行？')" />
		</div>
		<!--#include file="../inc/page.asp"-->		</td>
    </tr>
  </table>
</form>
<%end if%>
<%if Request("action")=10 then%>
<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<%
		set rs1=server.CreateObject("adodb.recordset")
		sql="select * from cw_info where id="&request("id")
		rs1.open sql,conn,1,1
		if not rs1.eof then
		%>
      <tr>
        <td align="right" bgcolor="#F0F3F5">状态：</td>
        <td bgcolor="#F0F3F5"><%if rs1("isnice")=1 then%>【<a href="cw_info.asp?action=3&sub=4&id=<%=rs1("id")%>" class="action">己推荐</a>】<%else%>【<a href="cw_info.asp?action=3&sub=1&id=<%=rs1("id")%>">未推荐</a>】<%end if%>&nbsp;
		<%if rs1("istop")=1 then%>【<a href="cw_info.asp?action=3&sub=5&id=<%=rs1("id")%>" class="action">己置顶</a>】<%else%>【<a href="cw_info.asp?action=3&sub=2&id=<%=rs1("id")%>">未置顶</a>】<%end if%>&nbsp;
		<%if rs1("ispass")=1 then%>【<a href="cw_info.asp?action=3&sub=6&id=<%=rs1("id")%>" class="action">己审核</a>】<%else%>【<a href="cw_info.asp?action=3&sub=3&id=<%=rs1("id")%>">未审核</a>】<%end if%> 【<a href="cw_info.asp?sub=9&id=<%=rs1("id")%>&action=3" onclick="return confirm('你确定要删除？')">删除</a>】 （点击可进行操作）</td>
      </tr>
      <tr>
        <td width="100" align="right" bgcolor="#FFFFFF">标题：</td>
        <td width="1077" align="left" bgcolor="#FFFFFF"><%=rs1("title")%></td>
      </tr>
      
      <tr>
        <td align="right" bgcolor="#FFFFFF">内容： </td>
        <td bgcolor="#FFFFFF"><%=rs1("content")%></td>
      </tr>
      <tr>
        <td align="right" bgcolor="#FFFFFF">联系人：</td>
        <td bgcolor="#FFFFFF"><%=rs1("names")%></td>
      </tr>
      <tr>
        <td align="right" bgcolor="#FFFFFF">电话：</td>
        <td bgcolor="#FFFFFF"><%=rs1("tel")%></td>
      </tr>
      <tr>
        <td align="right" bgcolor="#FFFFFF">邮箱：</td>
        <td bgcolor="#FFFFFF"><%=rs1("email")%></td>
      </tr>
      <tr>
        <td align="right" bgcolor="#FFFFFF">腾讯QQ：</td>
        <td bgcolor="#FFFFFF"><%=rs1("qq")%></td>
      </tr>
      <tr>
        <td align="right" bgcolor="#FFFFFF">联系地址：</td>
        <td bgcolor="#FFFFFF"><%=rs1("address")%></td>
      </tr>
	  <tr>
        <td align="right" bgcolor="#FFFFFF">图片：</td>
        <td bgcolor="#FFFFFF"><img src="../<%=rs1("pic")%>" style="max-width:400px;" onerror="this.style.display='none'" /></td>
      </tr>
	  <%
	  end if
	  rs1.close
	  set rs1=nothing
	  %>
</table>
<%end if%>
<%call closes()%>
</body>
</html>
