<!--#include file="bsconfig.asp"-->
<!--#include file="inc/md5.asp"--><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">

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 chk(workgroups)
{ var numchk=workgroups.length;
  var cnt=0;
  if(numchk>1)
      { for (var i=0;i<numchk;i++)
       if(workgroups[i].checked)
	  cnt=cnt+1;
      }
 else
   if (workgroups.checked) cnt=cnt+1;
  
	if (cnt==0)
	  {alert("请选择删除项");return false;
	  }
	else 
	 return confirm('您确定要删除吗');
}

</script>


<title></title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
.style3 {font-size: 14px}
.button1 { font-family: 宋体; font-size: 9pt; border: 0 ridge #666699;background-color: #E1F5FF;HEIGHT: 14px }
.adds {
	border: 0px solid #00CC00;
}
.button { font-family: 宋体; font-size: 9pt; border: 1 ridge #666699;background-color: #E1F5FF;HEIGHT: 18px }


a{
	font-color:#333333;
	font-unline:no;
	font-family: "宋体";
	font-size: 12px;
	color: #333333;
	text-decoration: none;
	line-height: 120%;


}
a:hover{
	Font-unline:yes;
	font-family: "宋体";
	color: #FFFFFF;
	text-decoration: underline;
	background-color: #333333;
}
.STYLE4 {
	color: #FFFFFF;
	font-weight: bold;
}
body {
	background-color: #D6DFF7;
}



-->
</style> 
<!-- #include file="Inc/Head.asp" -->

</head>

<% if request.QueryString("class")<>"" then %>

<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#A5B9EF" class="border">
  <tr  width=70% background="images/bg.gif">
    <td height="25" colspan="2" align="center"  class="STYLE4 style3" >标题</td>
    <td width="116" height="25" align="center"  class="STYLE4 style3">更新时间</td>
	<td width="50" height="25" align="center" >&nbsp;</td>
  </tr>
 <% 
 if request.querystring("page")="" then
 currentpage=1
 else
  currentpage=cint(request.querystring("page"))
	end if
if request.querystring("class")<>"" then
  classes=request.QueryString("class")
  sql="select * from article where class='"&classes&"' order by id "
 end if
  set rs=server.createobject("adodb.recordset")
  rs.open sql,conn,1,1
  if rs.eof and rs.bof then
  totalrs=0
  totalpage=0
  currentpage=0
  else
  rs.pagesize=20
  totalrs=rs.recordcount
  totalpage=rs.pagecount
  rs.absolutepage=currentpage
  end if
  if not (rs.eof and rs.bof) then
do until rs.absolutepage<>currentpage or rs.eof %>
  <form name="art" method="post" action="news.asp">
 <tbody> <tr bgcolor="#ECF5FF">
    <td width=29 height="25"><input name="a_id" type="checkbox" id="a_id" value=<%=rs("id")%> ></td>
    <td width="691" height="25" >
	<a href=../listshow.asp?id=<%=rs("id")%> target=_blank class="STYLE1"><%=rs("title")%></a></td>
    <td height="25" align=center><span class="STYLE1">
      <% =rs("date")%>
    </span></td>
    <td height="25" align=center><a href="news.asp?classes=<%=request("class")%>&art_id=<%=rs("id")%>" class="STYLE1">编辑</a></td>
    </tr> </tbody>
  <%rs.movenext
  loop
     else
    %>
  <tr bgcolor="#D6DFF7"><td colspan="2" bgcolor="#ECF5FF"><span class="STYLE1">当前没有文章</span>
  <td bgcolor="#ECF5FF"><span class="STYLE1"></span>
  <td bgcolor="#ECF5FF"><span class="STYLE1"></span></tr>
  <% 
  end if%> 
  <tr bgcolor="#D6DFF7"><td height=20 colspan="4" bgcolor="#ECF5FF"><span class="STYLE1">
  <input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
      &nbsp;选中所有记录&nbsp;
  共有记录<%=totalrs%>条，分<%=totalpage%>页
	<% if currentpage<2 then%>
	首页&nbsp;&nbsp;上一页 &nbsp;&nbsp;
	<%else%>
	<a href=news.asp?class=<%=request.QueryString("class")%>&page=1>首页</a>&nbsp;&nbsp;
	<a href=news.asp?class=<%=request.QueryString("class")%>&page=<%=currentpage-1%>>上一页</a>
	<%end if%>
	 <%if totalpage-currentpage<1 then%>
	 下一页&nbsp;&nbsp;尾页
	 <% else%>
     <a href=news.asp?class=<%=request.QueryString("class")%>&page=<%=currentpage+1%>>下一页</a>&nbsp;&nbsp;
	 <a href=news.asp?class=<%=request.QueryString("class")%>&page=<%=totalpage%>>尾页</a>
	 <%end if%>
    
</td>
  </tr>
  <tr bgcolor="#D6DFF7">
    <td height=20 colspan="5" bgcolor="#ECF5FF">
	    <input type=hidden name=classes value="<%=request("class")%>">
	    <input type=submit name=del_art  value=删除 class="button1" onClick="return chk(document.art.a_id);">
<a href="news.asp?actions=add&classes=<%=request.QueryString("class")%>" >增加</a> &nbsp;   </tr>
  </form>
</table>

<% rs.close
    set rs=nothing
	response.end
end if
%>




<!---------------------------------------edit artilce----------------------------->
<% if request.querystring("art_id")<>"" then
   set rs=conn.execute("select * from article where id="&request.querystring("art_id")&"")
 %>

<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">

<form name="editart" method="post" action="news.asp">

<input type=hidden name=art_id value="<%=rs("id")%>">
<tr bgcolor="#ECF5FF"><td height="30">
标题：
    <input type=text name=art_title size=80 value="<%=rs("title")%>" >
</tr>

<tr><td bgcolor="#EEEEEE">
  <textarea name="content" id="content" style="display:none"><% =rs("content") %></textarea>
  <IFRAME name="ewebeditor" src="../ewebeditor/ewebeditor.asp?id=content&style=s_blue" frameborder="0" scrolling="no" width="100%" height="500"></IFRAME>     
</tr>
<tr bgcolor="#ECF5FF"><td height="30">
<input type="hidden" name="action" value="edit_art">
<input type="hidden" name="classes" value="<%=request("classes")%>">
<input type=submit  name="Submit" id="Submit" class="button" value="确定修改" >
</tr></form>
</table>

<%response.end
end if%>

<%if request("action")="edit_art" then
sql="select * from article where id="&request("art_id")&""
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs("title")=request("art_title")

rs("content")=request("content")
rs("date")=date()
rs.update
rs.close
set rs=nothing
response.redirect "news.asp?class="&request("classes")&""
end if
%>


<!---------------------------del article----------------------------------->
<% if request("del_art")<>"" then
if request("a_id").count>1 then
for i=1 to request("a_id").count
conn.execute("delete from article where id="&request("a_id")(i)&"")
next
else
conn.execute("delete from article where id="&request("a_id")&"")
end if
response.redirect "news.asp?class="&request("classes")&""
end if%>
<!--------------------------add article-------------------------------------------->
<% if request.querystring("actions")="add" then%>

<table width="90%" border="0" align="center" cellpadding="0" cellspacing="1" >

<form name="editguide" method="post" action="news.asp">
<tr bgcolor="#ECF5FF"><td height="30">
标题：
    <input type=text name=art_title size="80" value= >
</tr>
<tr><td bgcolor="#EEEEEE" >
  <textarea name="content" id="content" style="display:none"></textarea>
  <IFRAME name="ewebeditor" src="../ewebeditor/ewebeditor.asp?id=content&style=S_blue" frameborder="0" scrolling="no" width="100%" height="500"></IFRAME>     
</tr>

<tr bgcolor="#ECF5FF"><td height="30">
<input type=hidden name=action value="add_art">
<input type=hidden name=classes value="<%=request.QueryString("classes")%>">
<input type=submit  name="Submit" id="Submit" class="button" value="确定添加" >
</tr></form>
</table>

<%response.end
end if%>

<%if request("action")="add_art" then
sql="select * from article "
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
rs.addnew

rs("title")=request("art_title")
rs("class")=request("classes")
rs("content")=request("content")
rs("date")=date()
rs.update
rs.close
set rs=nothing
response.redirect "news.asp?class="&request("classes")&""
end if
%></body>
</html>