<!--------MetInfo 网站管理系统------->
<!--这是一个免费开源程序，您可以在不用于商业目的的前提下对程序进行修改和再发布-->
<!--版权所有：www.MetInfo.com.cn-->

<%@language=vbscript codepage=936 %>
<!--#include file="../inc/conn.asp"-->
<!--#include file="../admin.asp"-->
<!--#include file="../../Inc/Ubbcode.asp"-->
<!--#include file="../Inc/Function.asp"-->
<%
dim ID
ID=trim(request("id"))
if ID="" then 
response.Write("<br><br>没有找到相关文章！")
else
Set rslanmu= Server.CreateObject("ADODB.Recordset")
sql="select * from lanmu where id="&Cint(ID)
rslanmu.open sql,conn,1,1

dim strFileName
const MaxPerPage=20
dim totalPut,CurrentPage,TotalPages
dim i,j
dim ArticleID
dim Title
dim sql,rs
dim BigClassName,SmallClassName,SpecialName
dim PurviewChecked
dim strAdmin,arrAdmin
PurviewChecked=false
classid2=trim(request("classid2"))
classid3=trim(request("classid3"))
strFileName="News_Manage.asp?id="&cint(ID)
if classid2<>"" then
strFileName=strFileName&"&classid2="&cint(classid2)
end if
if classid3<>"" then
strFileName=strFileName&"&classid3="&cint(classid3)
end if

Title=Trim(request("Title"))
ID=Request("ID")
if request("page")<>"" then
    currentPage=cint(request("page"))
else
	currentPage=1
end if

sql="select * from news where class1="&Cint(ID)
if classid2<>"" then
	sql=sql&" and class2="&Cint(classid2)
	if classid3<>"" then
		sql=sql&"and class3="&Cint(classid3)
	end if
end if
if Title<>"" then
	sql=sql&" and Title like '%"&Title&"%'"
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><head>
<link href="../css/metinfo.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
</head>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td align="center" valign="top"><br><p align="center"><strong><%=rslanmu("lmname")%>管理</strong></p>
      <table width="92%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#003366" class="border">
        <tr class="title"> 
          <td class="back_southidc1" height="25"><span style="color:#000000">二级栏目:</span>&nbsp;&nbsp; 
<%
Set rsclass2= Server.CreateObject("ADODB.Recordset")
    sql="select * from lanmu where bigclass="&ID
rsclass2.open sql,conn,1,1
if rsclass2.eof then 
	response.Write("&nbsp;无")
end if
do while not rsclass2.eof
	if rsclass2("id")=cint(classid2) then
		response.Write("<a href='News_Manage.asp?id="&ID&"&classid2="&rsclass2("id")&"'><font style='color: #f60'>"&rsclass2("lmname")&"</font></a> | ")		
	else
		response.Write("<a href='News_Manage.asp?id="&ID&"&classid2="&rsclass2("id")&"'>"&rsclass2("lmname")&"</a> | ")
	end if
	rsclass2.movenext
loop
rsclass2.close
set rsclass2=nothing
%> </td> </tr>

 <%
if classid2<>"" then
	sql="select * from lanmu where bigclass="&cint(classid2)
	Set rsclass3= Server.CreateObject("ADODB.Recordset")
	rsclass3.open sql,conn,1,1
	if not (rsclass3.bof and rsclass3.eof) then
		response.write "<tr class='tdbg'><td bgcolor='#C0C0C0'>"
		do while not rsclass3.eof
			if rsclass3("id")=cint(classid3) then
				response.Write("&nbsp;<a href='News_Manage.asp?id="&ID&"&classid2="&classid2&"&classid3="&rsclass3("id")&"'><font style='color: #f60'>"&rsclass3("lmname")&"</font></a>&nbsp;&nbsp;")				
			else
				response.Write("&nbsp;<a href='News_Manage.asp?id="&ID&"&classid2="&classid2&"&classid3="&rsclass3("id")&"'>"&rsclass3("lmname")&"</a>&nbsp;&nbsp;")				
			end if
			rsclass3.movenext
		loop
		response.write "</td></tr>"
	end if
	rsclass3.close
	set rsclass3=nothing
end if
%>
 </table>

 <form name="del" method="Post" action="News_Del.asp" onSubmit="return ConfirmDel();">
   <table width="92%" border="0" cellpadding="0" cellspacing="1" bgcolor="#003366">
     <tr bgcolor="#A4B6D7">
       <td height="25" class="back_southidc2"><a href="News_Manage.asp?id=<%=Cint(ID)%>">&nbsp;<%=rslanmu("lmname")%></a> >>
           <%
if request("Query")="" and classid2="" and classid3="" 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 classid2<>"" then
		    Set rsclass2= Server.CreateObject("ADODB.Recordset")
            sql="select * from lanmu where id="&Cint(classid2)
            rsclass2.open sql,conn,1,1
			response.write "<a href='News_Manage.asp?id="&ID&"&classid2="&classid2&"'>"&rsclass2("lmname")&"</a>&nbsp;&gt;&gt;&nbsp;"
			rsclass2.close
			set rsclass2=nothing
			if classid3<>"" then
			Set rsclass3= Server.CreateObject("ADODB.Recordset")
            sql="select * from lanmu where id="&Cint(classid3)
            rsclass3.open sql,conn,1,3
				response.write "<a href='News_Manage.asp?id="&ID&"&classid2="&classid2&"&classid3="&rsclass3("id")&"'>"&rsclass3("lmname")&"</a>"
			rsclass3.close
			set rsclass3=nothing
			else
				response.write "所有小类"
			end if
		end if		
	end if
end if
%>       </td>
       <td width="150" class="back_southidc2">&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 width="92%" border="0" cellpadding="0" cellspacing="1" bgcolor="#003366" class="border" style="word-break:break-all">
          <tr class="back_southidc2"> 
            <td width="10%" height="25" align="center">选中</td>
            <td width="10%"  height="25" align="center">ID</td>
            <td width="40%" align="center" >文章标题</td>
            <td width="10%" align="center" >图片文章</td>
            <td width="10%" align="center" >推荐文章</td>
            <td width="10%" align="center" >加入时间</td>
            <td width="10%" align="center" >操作</td>
          </tr>
          <%do while not rs.eof
		    Set rslmfile= Server.CreateObject("ADODB.Recordset")
            sqllmfile="select * from lanmu where id="&Cint(rs("class1"))
			rslmfile.open sqllmfile,conn,1,1
			lmfile=rslmfile("webname")
			rslmfile.close
			set rslmfile=nothing
		  %>
          <tr class="tdbg"> 
            <td height="22" align="center" class="left1"> 
              <input name='ID' type='checkbox' onClick="unselectall()" id="ID" value='<%=cstr(rs("ID"))%>' class="xz"></td>
            <td align="center" bgcolor="#ECF5FF"><%=rs("id")%></td>
            <td  bgcolor="#ECF5FF"><a href="../../<%=lmfile%>/Shownews.asp?ID=<%=rs("id")%>" target="_blank"><%=left(rs("title"),30)%></a></td>
            <td  bgcolor="#ECF5FF">
<div align="center"><% if rs("tpnews")=True then%>是<%else%>否<% end if %></div></td>
            <td  bgcolor="#ECF5FF">
<div align="center"><% if rs("tjnews")=True then%>是<%else%>否<% end if %></div></div></td>
            <td align="center" bgcolor="#ECF5FF"><%= FormatDateTime(rs("infotime"),2) %> </td>
            <td align="center" bgcolor="#ECF5FF"> <a href="News_modi.asp?ID=<%=rs("id")%>">修改</a> 
              <a href="News_Del.asp?class1=<%=ID%>&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="92%" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="250" height="30"><input name="chkAll" class="xz" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
              选中本页显示的所有文章</td>
            <td><input name="submit" type='submit' value='删除选定的文章'> 
              <input name="Action" type="hidden" id="Action" value="Del">
			  <input name="class1" type="hidden"  value="<%=ID%>"></td>
          </tr>
        </table>
        <%
   end sub 
%>
      </form>
      <br> <table width="80%" border="0" cellpadding="0" cellspacing="0" class="border">
        <tr class="tdbg"> 
          <form name="searchsoft" method="get" action="News_Manage.asp" >
		  <input name="id" type="hidden" value="<%=Cint(ID)%>" />
		  <input name="classid2" type="hidden" value="<%=Cint(classid2)%>" />
		  <input name="classid3" type="hidden" value="<%=Cint(classid3)%>" />
            <td height="30"> <strong>当前栏目文章查找：</strong> <input name="Title" type="text" class=smallInput id="Title3" size="20" maxlength="50"> 
              <input name="Query" type="submit" id="Query" value="查 询"> 
            &nbsp;&nbsp;请输入文章标题关键字。如果为空，则查找所有文章。</td>
          </form>
        </tr>
      </table></td>
  </tr>
</table>
<%
rs.close
set rs=nothing 
end if 
call CloseConn()
%>