<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file = "tuzh_pri.asp"-->
<!--#include file = "../setup.asp"-->
<!--#include file="../connadmin.asp"-->
<html>
<link rel="stylesheet" type="text/css" href="../img/css.css"><title></title>

<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 != "chkAll"&&e.disabled==false)
       e.checked = form.chkAll.checked;
    }
  }
function SureDel(id)
{
    if ( confirm("警告!你是否真的要删除？"))
        {
            window.location.href = "do.asp?action=delenews&id=" + id
        }
}
function checkform2()
{var ch=window.confirm("你确定要删除这些文章？这个操作是不可恢复的。")
if(ch){
return true;}
else
{return false;}
}

</script>
<style type=text/css>
body  {
SCROLLBAR-FACE-COLOR: #9CC5D7;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; 
SCROLLBAR-SHADOW-COLOR: #006699; 
SCROLLBAR-3DLIGHT-COLOR: #006699; 
SCROLLBAR-ARROW-COLOR: #330000; 
SCROLLBAR-TRACK-COLOR: #E2F3F1; 
SCROLLBAR-DARKSHADOW-COLOR: #ffffff;}
</style>
<body>
<table class="border" width="98%" border="0" align="center" cellpadding="1" cellspacing="0">
  <tr> 
    <td height="565" align="center" valign="top" class="bg_low"> <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td align="center" valign="middle" class="bgtop"><font color="#FFFFFF"><b>管理新闻</b></font> 
          </td>
        </tr>
      </table>
      <%
''''''''创建记录集///////////////////////////////////////////////////////////////////////////////////////
set rs=server.createobject("ADODB.recordset")
if HX_Replace(request("dokind"))="search" then
   if request.Form("langmu")="" then
      sql="select * from news where title like'%"&HX_Replace(request.Form("sertxt"))&"%' order by id desc"
   elseif request.Form("langmu")<>"" and request.Form("langmu2")="" then
	  sql="select * from news where yiid="&cint(request.Form("langmu"))&" and title like'%"&HX_Replace(request.Form("sertxt"))&"%' order by id desc"
   elseif request.Form("langmu")<>"" and request.Form("langmu2")<>"" then
      sql="select * from news where yiid="&cint(request.Form("langmu"))&" and erid="&cint(request.Form("langmu2"))&" and title like'%"&HX_Replace(request.Form("sertxt"))&"%' order by id desc"
   end if
else
 sql="select * from news order by id desc"
end if
rs.open sql,conn,1,1
if  rs.eof then
response.Write("暂无信息")
response.End()
end if

number= hou_news_show_count   '设置梅页显示条数
if request("page")="" then
curpage = 1
else
curpage = cint(request("page"))
end if

rs.pagesize=cint(number)
rs.absolutepage = curpage%>
      <form name="myform" method="Post" action="do.asp?style=many&action=delenews"  onsubmit="javascript:return checkform2();">
        <table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#ABCEDD">
          <%for i= 1 to rs.pagesize%>
          <tr> 
            <td width="50"><%=rs("id")%></td>
            <td><a href="../show.asp?id=<%=rs("id")%>" target="_blank" title="<%=rs("title")%>[<%=rs("newstime")%>]"><%=rs("title")%></a></td>
            <td width="40"><a href="addnews.asp?action=modi&id=<%=rs("id")%>">编辑</a></td>
            <td width="60"> 
              <input name='ArticleID' type='checkbox' onClick="unselectall()" id="ArticleID2" value='<%=cstr(rs("id"))%>'>
              <a href='javascript:SureDel(<%=rs("id")%>)'> 删除</a></td>
          </tr>
          <%rs.movenext
       if rs.eof then
           i=i+1
           exit for
       end if
next%>
        </table>
        <br>
        <%
''''''''设置上一页,下一页功能///////////////////////////////////////////////////////////////////////////////////////
    response.Write "当前"&curpage&"页/总共"&rs.pagecount&"页"
     if curpage = 1 then 
		response.write "首页 前页 "
	else
		response.write "<a class='xiahua' href='manage.asp?page=1'>首页</a> <a class='xiahua' href='manage.asp?page=" & cstr(curpage-1) & "'>前页</a> "
	end if
	if  curpage = rs.pagecount then
		response.write "后页 末页"
	else
		response.write "<a class='xiahua' href='manage.asp?page=" & cstr(curpage+1) & "'>后页</a> <a class='xiahua' href='manage.asp?page=" & cstr(rs.pagecount) & "'>末页</a>"
	end if
	response.write "(总共"&rs.recordcount&"条新闻)"
''''''''设置上一页,下一页功能////////////////////////////////////////////////////////////////////////////////////

rs.close
set rs=nothing
%>
        <br>
        <br>
        <input name="Action" type="hidden" id="Action2" value="Del">
        <input name="chkAll" type="checkbox" id="chkAll2" onclick=CheckAll(this.form) value="checkbox">
        选中本页显示的所有文章 
        <input name="submit" type='submit' value='删除选定的文章' onClick="document.myform.Action.value='Del'" <%if PurviewChecked=False and AdminPurview=2 and AdminPurview_Article>=3 then response.write "disabled"%>>
      </form>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from yikind"
rs.open sql,conn,1,1
dim lm1
lm1=""
do while not rs.eof
lm1=lm1&"<option value='"&rs("yiid")&"'>"&rs("yiname")&"</option>"
rs.movenext
loop
rs.close
sql="select erid,yiid,ername from erkind"
rs.open sql,conn,3,1%>
      <script language = "JavaScript">
var lmcount;
lm=new Array();
<%count=0
do while not rs.eof
%>
lm[<%=count%>]=new Array("<%= trim(rs(2))%>","<%= trim(rs(1))%>","<%= trim(rs(0))%>");
<%
count=count+1
rs.movenext
loop
rs.close
%>
lmcount=<%=count%>;
function changelangmu1(langmu1){
document.form1.langmu2.length=1; 
var langmu1=langmu1;
var i;
for (i=0;i<lmcount; i++){
if (lm[i][1]==langmu1){ 
document.form1.langmu2.options[document.form1.langmu2.length]=new Option(lm[i][0], lm[i][2]);
}        
}
} 
</script> <form name="form1" method="post" action="manage.asp?dokind=search">
        <select size="1" name="langmu" onChange="changelangmu1(document.form1.langmu.value)">
          <option value="" selected>请选择一级栏目</option>
          <%=lm1%> 
        </select>
        <select size="1" name="langmu2">
          <option selected value="">请选择二级栏目</option>
        </select>
        <input name="sertxt" type="text" id="sertxt2" size="30">
        <input type="submit" name="Submit" value="搜索">
      </form>
      <%conn.close
set conn=nothing
%>
    </td>
  </tr>
</table>
</body>
</html>
