<!--#include file="../../Inc/conn.asp"-->
<!--#include file="../admin.asp"-->
<%
dim strFileName
const MaxPerPage=14
dim totalPut,CurrentPage,TotalPages
dim i,j
dim ArticleID
dim Title
dim sql,rs
dim BigClassID,SmallClassID
dim PurviewChecked
dim strAdmin,arrAdmin
PurviewChecked=false


BigClassID=strToNum(request("BigClassID"))
SmallClassID=strToNum(request("SmallClassID"))
strFileName="News_Manage2.asp?BigClassID=" & BigClassID & "&SmallClassID=" & SmallClassID
if request("page")<>"" then
    currentPage=cint(request("page"))
else
	currentPage=1
end if

sql="select * from news where 1=1"
if BigClassID<>0 then
	sql=sql & " and BigClass=" & BigClassID
end if
if SmallClassID<>0 then
	sql=sql & " and SmallClass=" & SmallClassID
end if
sql=sql & " order by id desc"

Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<SCRIPT language=javascript>
function unselectall()
{
    if(document.del.chkAll.checked){
	document.del.chkAll.checked = document.del.chkAll.checked&0;
    } 	
}

function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
  }
function ConfirmDel()
{
   if(confirm("确定要删除选中的信息吗？一旦删除将不能恢复！"))
     return true;
   else
     return false;
	 
}

</SCRIPT>
<!-- #include file="../Inc/Head.asp" -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="862" align="center" valign="top">
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="table_southidc">
        <tr style="display:none"> 
          <td height="25">&nbsp;栏目导航： | 
          <%
dim sqlBigClass,sqlSmallClass,rsBigClass,rsSmallClass,sqlSpecial,rsSpecial
sqlBigClass="select * from BigClass_new"
Set rsBigClass= Server.CreateObject("ADODB.Recordset")
rsBigClass.open sqlBigClass,conn,1,1
if rsBigClass.eof then 
	response.Write("还没有任何栏目，请首先添加栏目。")
end if
do while not rsBigClass.eof
	if rsBigClass("BigClassName")=BigClassName then
		response.Write("<a href='News_Manage.asp?BigClassName=" & rsBigClass("BigClassName") & "'><font color='red'>" & rsBigClass("BigClassName") & "</font></a> | ")
		if session("purview")=3 then
			strAdmin=rsBigClass("Admin")
			if Instr(strAdmin,"|")>0 then
				arrAdmin=split(strAdmin)
				for i=0 to ubound(arrAdmin)
					if trim(arrAdmin(i))=session("admin") then
						PurviewChecked=True
						exit for
					end if
				next
			else
				if trim(strAdmin)=session("Admin") then
					PurviewChecked=True
				end if
			end if
		end if
	else
		response.Write("<a href='News_Manage.asp?BigClassName=" & rsBigClass("BigClassName") & "'>" & rsBigClass("BigClassName") & "</a> | ")
	end if
	rsBigClass.movenext
loop
rsBigClass.close
set rsBigClass=nothing
%></td>
        </tr>
        <%
if BigClassName<>"" then
	sqlSmallClass="select * from SmallClass_new where BigClassName='" & BigClassName & "'"
	Set rsSmallClass= Server.CreateObject("ADODB.Recordset")
	rsSmallClass.open sqlSmallClass,conn,1,1
	if not (rsSmallClass.bof and rsSmallClass.eof) then
		response.write "<tr class='tdbg'><td bgcolor='#ECF5FF' height='20'>"
		do while not rsSmallClass.eof
			if rsSmallClass("SmallClassName")=SmallClassName then
				response.Write("&nbsp;<a href='News_Manage.asp?BigClassName=" & rsSmallClass("BigClassName") & "&SmallClassName=" & rsSmallClass("SmallClassName") & "'><font color='red'>" & rsSmallClass("SmallClassName") & "</font></a>&nbsp;&nbsp;")
				if session("purview")=4 then
					strAdmin=rsSmallClass("Admin")
					if Instr(strAdmin,"|")>0 then
						arrAdmin=split(strAdmin)
						for i=0 to ubound(arrAdmin)
							if trim(arrAdmin(i))=session("admin") then
								PurviewChecked=True
								exit for
							end if
						next
					else
						if trim(strAdmin)=session("Admin") then
							PurviewChecked=True
						end if
					end if
				end if
			else
				response.Write("&nbsp;<a href='News_Manage.asp?BigClassName=" & rsSmallClass("BigClassName") & "&SmallClassName=" & rsSmallClass("SmallClassName") & "'>" & rsSmallClass("SmallClassName") & "</a>&nbsp;&nbsp;")
			end if
			rsSmallClass.movenext
		loop
		response.write "</td></tr>"
	end if
	rsSmallClass.close
	set rsSmallClass=nothing
end if
%>
      </table>
      <form name="del" method="Post" action="News_Del.asp" onSubmit="return ConfirmDel();">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" class="table_southidc">
          <tr style="display:none"> 
            <td height="25"><a href="News_Manage.asp">&nbsp;信息资讯管理</a> &gt;&gt; 
              <%
if request.querystring="" then
	response.write "所有信息"
else
	if request("Query")<>"" then
		if Title<>"" then
			response.write "名称中含有“<font color=blue>" & Title & "</font>”的产品"
		else
			response.Write("所有信息")
		end if
 	else
		if BigClassName<>"" then
			response.write "<a href='News_Manage.asp?BigClassName=" & BigClassName & "'>" & BigClassName & "</a>&nbsp;&gt;&gt;&nbsp;"
			if SmallClassName<>"" then
				response.write "<a href='News_Manage.asp?BigClassName=" & BigClassName & "&SmallClassName=" & SmallClassName & "'>" & SmallClassName & "</a>"
			else
				response.write "所有小类"
			end if
		end if		
	end if
end if
%> </td>
            <td width="150">&nbsp; 
              <%
  	if rs.eof and rs.bof then
		response.write "共找到 0 条信息</td></tr></table>"
	else
    	totalPut=rs.recordcount
		if currentpage<1 then
       		currentpage=1
    	end if
    	if (currentpage-1)*MaxPerPage>totalput then
	   		if (totalPut mod MaxPerPage)=0 then
	     		currentpage= totalPut \ MaxPerPage
		  	else
		      	currentpage= totalPut \ MaxPerPage + 1
	   		end if

    	end if
		response.Write "共找到 " & totalPut & " 条信息"
%> </td>
          </tr>
        </table>
        <%		
	    if currentPage=1 then
        	showContent
        	showpage strFileName,totalput,MaxPerPage,true,false,"条信息"
   	 	else
   	     	if (currentPage-1)*MaxPerPage<totalPut then
         	   	rs.move  (currentPage-1)*MaxPerPage
         		dim bookmark
           		bookmark=rs.bookmark
            	showContent
            	showpage strFileName,totalput,MaxPerPage,true,false,"条信息"
        	else
	        	currentPage=1
           		showContent
           		showpage strFileName,totalput,MaxPerPage,true,false,"条信息"
	    	end if
		end if
	end if
%>
        <%  
sub showContent
   	dim i
    i=0
%>
        <table class="table_southidc" border="0" cellspacing="1" width="100%" cellpadding="0" style="word-break:break-all">
          <tr bgcolor="#A4B6D7" class="title"> 
            <td width="35" height="25" align="center" bgcolor="#A4B6D7" class="tr_southidc">选中</td>
            <td width="54"  height="25" align="center" bgcolor="#A4B6D7" class="tr_southidc">ID</td>
            <td width="310" align="center" bgcolor="#A4B6D7" class="tr_southidc" >信息标题</td>
            <td width="102" align="center" bgcolor="#A4B6D7" class="tr_southidc" >一级栏目</td>
            <td width="92" align="center" bgcolor="#A4B6D7" class="tr_southidc" >二级栏目</td>
            <td width="70" align="center" bgcolor="#A4B6D7" class="tr_southidc" >加入时间</td>
            <td width="89" align="center" bgcolor="#A4B6D7" class="tr_southidc" >操作</td>
          </tr>
          <%do while not rs.eof%>
          <tr class="tdbg"> 
            <td width="35" height="22" align="center" bgcolor="#A4B6D7" class="tr_southidc"> 
              <input name='ID' type='checkbox' onClick="unselectall()" id="ID" value='<%=cstr(rs("ID"))%>'>            </td>
            <td width="54" align="center" bgcolor="#ECF5FF"><%=rs("id")%></td>
            <td  bgcolor="#ECF5FF">
			<a href="../../ReadNews.asp?rid=<%=rs("id")%>" target="_blank"><%=left(rs("title"),18)%></a>
			<%If rs("Elite")=True Then Response.Write("<font color='red'>荐</font>")%>
			</td>
            <td align="center"  bgcolor="#ECF5FF">
<%=rs("BigClassName")%></td>
            <td align="center"  bgcolor="#ECF5FF">
<%=rs("SmallClassName")%></td>
            <td align="center" bgcolor="#ECF5FF"><%= FormatDateTime(rs("PostTime"),2) %> </td>
            <td width="89" align="center" bgcolor="#ECF5FF"> <a href="News_modi.asp?BigClassID=<%=strToNum(request("BigClassID"))%>&SmallClassID=<%=strToNum(request("SmallClassID"))%>&ID=<%=rs("id")%>">修改</a> 
              <a href="News_Del2.asp?BigClassID=<%=strToNum(request("BigClassID"))%>&SmallClassID=<%=strToNum(request("SmallClassID"))%>&ID=<%=rs("ID")%>&Action=Del" onClick="return ConfirmDel();">删除</a>            </td>
          </tr>
          <%
	i=i+1
	      if i>=MaxPerPage then exit do
	      rs.movenext
	loop
%>
        </table>
        <table width="100%" border="0" cellpadding="0" cellspacing="1">
          <tr> 
            <td width="65" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
            全选</td>
            <td width="655"><input name="submit" type='submit' value='删除选定的信息' <%if session("purview")>=3 and session("purview")<=4 and PurviewChecked=False then response.write "disabled"%>> 
            <input name="Action" type="hidden" id="Action" value="Del"></td>
          </tr>
        </table>
      <%
   end sub 
%>
      </form>
	  
      <div align="left">
        <input type="submit" name="Submit" value="发布新闻" onClick="location.href='News_add2.asp?BigClassID=<%=strToNum(Request.QueryString("BigClassID"))%>&SmallClassID=<%=strToNum(Request.QueryString("SmallClassID"))%>';">
    </div></td>
  </tr>
</table>
<!-- #include file="../Inc/Foot.asp" -->
<%
rs.close
set rs=nothing  
call CloseConn()
%>