<!--#include file="../Inc/conn.asp"-->
<% ClassType=Net.NetInt(Request("Type"),0) %>
<!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>管理<%= ManegeType(ClassType) %></title>
<link href="skings/css1/css.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
var ok=document.getElementsByName("action")
if (ok[0].checked == true){
return false;//移动操作退出函数
}
 eval(targ+".location='?type=<%= ClassType %>&classid="+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function checkall(form) {
var c = 'abc';
if(document.getElementById('ID')){
for(var e = 0; e < form.elements.length; e++) {
if (form.elements[e].name=="ID") {var v = form.elements[e];
v.checked = form.elements[c].checked;
}}}}
function checkall2(form) {
if(document.getElementById('ID')){
for(var e = 0; e < form.elements.length; e++) {
if (form.elements[e].name=="ID") {var v = form.elements[e];
if(v.checked){v.checked=false;}
else{v.checked=true;}
}}}}
//-->
</script>

</head>
<body>
<% 
Select Case Action
Case "shenhe"
ID=Net.SplitInt(Request("ID"))
If Post<>"post" or ID<1 Then :Response.Redirect(Net.History):Response.End()
 Execute"update ["&NetTable&"Content] set ok=1 Where ok=0 and id in("&ID&")":Response.Redirect(Net.History):Response.End()
 
Case "shenhe1"
ID=Net.SplitInt(Request("ID"))
If Post<>"post" or ID<1 Then :Response.Redirect(Net.History):Response.End()
Execute"update ["&NetTable&"Content] set ok=0 Where ok=1 and id in("&ID&")":Response.Redirect(Net.History):Response.End()
Case "del" 
ID=Net.SplitInt(Request("ID"))
If ID<1 Then Response.Redirect(Net.History)
Set Rs=ReadRs("Select ID,Title From ["&NetTable&"Content] Where ID In("&ID&")",3)
For i=1 To Rs.RecordCount
Title=Title&","&Rs("Title")
Rs.Delete
Rs.MoveNext
Next
Rs.Close
WriteLog "删除内容<font color=red>"&Title&"（ID:"&ID&"）</font>。" 
Response.Redirect(Net.History)
Response.End()
Case "move"
ID=Net.SplitInt(Request("ID"))
If Post<>"post" and ID<1 Then :Response.Redirect(Net.History):Response.End()
Execute"Update  ["&NetTable&"Content] Set ClassID="&ClassID&" Where id in("&ID&")":Response.Redirect(Net.History):Response.End()
End Select %>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
      <td height="50" align="left">
           <a href="News.asp?type=<%= ClassType %>&action=add"> </a><a href="EditClass.asp?type=<%= ClassType %>"></a></td>
      <td align="left"><form id="form1" name="form1" method="post" action="News.asp">查找：
          <input name="soso" type="text" id="soso" value="<%= Request("soso") %>" />
        <select name="sstr" id="sstr">
          <option value="1" <% If Net.NetInt(request("sstr"),0)=1 Then response.Write("selected=""selected""")%>>标题</option>
          <option value="2"<% If Net.NetInt(request("sstr"),0)=2 Then response.Write("selected=""selected""")%>>作者</option>
          <option value="3"<% If Net.NetInt(request("sstr"),0)=3 Then response.Write("selected=""selected""")%>>内容</option>
        </select>
        <input type="submit" name="Submit" value="搜索" />
        <input name="Type" type="hidden" id="Type" value="<%= ClassType %>" />
        </form></td>
  </tr>
</table>
<%Dim soso,sstr,Classstr
SS=""
soso=Net.NetSQL(Request("soso")) 
sstr=Net.NetInt(Request("sstr"),0)
ClassID=Net.NetInt(Request.QueryString("ClassID"),0)
IID=ClassID

ID=Net.SplitInt(Request("ID"))
If action="del"  and ID>0 Then Execute"Delete * From ["&NetTable&"Content] Where ID In("&ID&")" :Response.Redirect(Net.History):Response.End()

If Sstr>0 and soso<>"" Then
Select Case sstr
Case 2
ss=" and autor like '%"&soso&"%' "
Case 1
ss=" and title like '%"&soso&"%' "
End Select
End If

  
Sql="Select  * From ["&NetTable&"Content] Where ClassID iN("&ChildNode(ClassID,ClassType)&") "&ss&" Order By ID Desc"
Set Rs= ReadRs(SQL,1)
  RsCount=Rs.RecordCount
  NetPage
  If RsCount>0 Then Rs.Move (Page-1)*RsPageCount 
 %>
<form action="News.asp?type=<%= ClassType %>" method="post" name="form2" id="form2">
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
      <td colspan="7" align="center" class="bg_tr"><table width="100%" border="0" cellspacing="1" cellpadding="2">
        <tr>
          <td width="52%" align="left" class="line"><input name="abc" type="checkbox"  id="abc" value="checkbox" onclick="checkall(this.form)"/>
全选
  <input name="bc" type="checkbox" id="bc" value="checkbox"  onclick="checkall2(this.form)"/>
反选
<input type="radio" name="action" value="move" />
移动
<input type="radio" name="action" value="del" />
删除
<input name="action" type="radio" value="shenhe" checked="checked" />
审核
<input type="radio" name="action" value="shenhe1" />
不审核 </td>
          <td width="48%" align="right" class="line">选择栏目
            <select name="ClassID" id="ClassID" onChange="MM_jumpMenu('self',this,0)">
              <option selected="selected">===选择栏目===</option>
              <option value="0" >全部栏目</option>
	  <%=SelectClass(0,ClassID,ClassType,"","","")%> 
            </select>
&nbsp;
<input type="submit" name="Submit2" value="确认"  onClick="return confirm('确定执行操作？')"/></td>
        </tr>
        <tr>
          <td colspan="2" align="left"><a href="?type=<%= ClassType %>&classid=<%= IID%>&soso=<%= soso %>&sstr=<%= sstr %>&page=1">第一页</a>&nbsp;<a href="?type=<%= ClassType %>&classid=<%=IID%>&soso=<%= soso %>&sstr=<%= sstr %>&page=<%= Page-1 %>">上一页</a>&nbsp; <a href="?type=<%= ClassType %>&classid=<%=IID %>&soso=<%= soso %>&sstr=<%= sstr %>&page=<%= Page+1 %>">下一页</a>&nbsp; <a href="?type=<%= ClassType %>&classid=<%= IID %>&soso=<%= soso %>&sstr=<%= sstr %>&page=<%= RsPage %>">最后一页</a>&nbsp;当前<%="<font color=red>"&Page&"</font>/"&RsPage %>页&nbsp;<%= RsPageCount %>条记录/页&nbsp;共条<%= RsCount %>记录</td>
          </tr>
      </table></td>
    </tr>
    <tr>
      <td width="5%" align="center" class="bg_tr">选择</td>
      <td width="34%" align="center" class="bg_tr">标题</td>
      <td width="12%" align="center" class="bg_tr">所属分类</td>
      <td width="10%" align="center" class="bg_tr">状态</td>
      <td width="12%" align="center" class="bg_tr">发布人</td>
      <td width="14%" align="center" class="bg_tr">发布时间</td>
      <td width="13%" align="center" class="bg_tr">操作</td>
    </tr>
<%

 For i=1 To RsPageCount
 If Rs.Eof OR Rs.Bof  Then Exit For%>
  <tr style="font-family: '微软雅黑,Verdana, 新宋体';color:#1E5494;font-size:12px;font-weight:bolder;background:#E4F1FA;line-height: 22px;" onmouseover="this.style.background='#ffffff'" onmouseout="this.style.background='#E4F1FA'">
      <td align="center"><input name="ID" type="checkbox" id="ID" value="<%= Rs("ID") %>" /></td>
      <td ><%= Rs("Title") %></td>
      <td  align="center" ><%=ClassIDCache.documentElement.selectSingleNode("ClassID[@id="&Rs("ClassID")&"]/@title").text%></td>
      <td align="center" >
	  <% Select Case Rs("ok")
	  Case 1
	  Response.Write("已审核")
	  Case Else
	  Response.Write("未审核")
	  End Select
	   %></td>
      <td  align="center" ><%= Rs("AddUser") %></td>
      <td align="center" ><%=  FormatDateTime(Rs("AddDate"),2) %></td>
      <td align="center">
	  <% If Review_ok=1 Then %>
	  <a href="view.asp?IID=<%= Rs("ID") %>" target="_self">评论</a> 
	  <% End If %>
	  <a href="EditNew.asp?type=<%=ClassType %>&amp;action=edit&iid=<%= iid %>&amp;id=<%= Rs("ID") %>" target="_self">编辑</a> <a href="?type=<%=ClassType %>&action=del&iid=<%= iid %>&id=<%= Rs("ID") %>" target="_self" onClick="return confirm('确定要删除吗？')">删除</a></td>
    </tr>
		<% Rs.Movenext
	Next %>
  </table>
</form>
<% CloseConn %>
</body>
</html>
