<!--#include file="../Ku_inc/Ku_sql.asp"-->
<!--#include file="../Ku_inc/Ku_config.asp"-->
<!--#include file="Ku_conn.asp"-->
<!--#include file="../Ku_inc/Ku_md5.asp"-->
<!--#include file="../Ku_inc/inc.asp"-->
<!-- #include file="Session.asp"-->

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻分类</title>
<link href="include/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
input{
	height:22px;
	border:1px solid #BEBEBE;
	background-color:#FFF;
	padding-top: 2px;
	padding-right: 8px;
	padding-bottom: 0pt;
	padding-left: 3px;
}
-->
</style>
</head>

<body>

<div align="center">

<table border="0" width="95%" height="70" cellpadding="0" cellspacing="0"  >
	<tr >
		<td height="30" style="border: 1px solid #D0D4D9" bgcolor="#EEEEEE" >&nbsp;<b>当前栏目：</b>&gt; 新闻分类</td>
	</tr>
    <tr><td height="30">
    <input class="input_back" type="button" name="Submit0" value="新闻列表"onclick="location.href='news_list.asp'"/>      
	<input class="input_back" type="button" name="Submit1" value="管理首页"onclick="location.href='main.asp'"/></td></tr>
</table>

</div>
<div align="center">

<table border="0" width="95%"  cellpadding="3" cellspacing="10" style="border: 1px solid #D0D4D9">
	<tr bgcolor="#ffffff">
		<td height="30" bgcolor="#EEEEEE" colspan="3"><b>分 类 列 表　|</b> 
		<a href="News_kind.asp?action=add">添 加 分 类</a></td>
	</tr>
	<%
	set rs=server.CreateObject("adodb.recordset")
sql="select * from ku_newskind order by id desc"
rs.open sql,conn,1,1
if rs.eof then
%>
<tr style="border: 1px solid #D0D4D9"><td>没有分类</td></tr>
<% else 
  'response.write bmrs("title")
  dim k
  k=1
%>
<tr align="center" >
<% do while not rs.eof%>
<td width="30%" style="border: 1px solid #D0D4D9"><b><%=left(rs("name"),6)%></b>  【<b><a href="news_add.asp?class=<%=rs("id")%>"><font color="#CC0000">在此类添加新闻</font></a></b>】  [<a href="news_kind.asp?action=edit&id=<%=rs("id")%>">修改</a>] [<a href="news_kind.asp?action=del&id=<%=rs("id")%>">删除]</a> 
</td>
<% if k mod 3 =0 then%> 
</tr><tr align="center" bgcolor="#ffffff">
<% end if%><% k=k+1
   rs.movenext
   loop
end if
rs.close
set rs=nothing
%>
<td height="30" style="border: 1px solid #D0D4D9" ></td>
	</tr>
</table>

</div>
<%
if request("action")="del" then
id=Request.QueryString("id")

	set rs=server.createobject("adodb.recordset")
	sql="select * from ku_news where class="&id&" "
	rs.open sql,conn,1,1	
	if (rs.eof and rs.bof) then
	
    delsql="delete from ku_newskind where id="&id
    conn.execute(delsql)

    conn.close
    response.redirect"news_kind.asp"
    else
           Response.Write "<script>alert(""此类下有新闻，不能直接删除。请先删除此类下的所有新闻！"");location.href=""javascript:history.back()"";</script>"
    end if
end if
%>
<!---添加分类--->
<% if request("action")="add" then%>
<div align="center">

<table border="0" width="96%" height="146" cellpadding="0" cellspacing="5"  >
     <tr><td height="30">
    
    </td></tr>
	<tr >
		<td height="30"  bgcolor="#EEEEEE" style="border: 1px solid #D0D4D9">&nbsp;<b>当前操作：</b>&gt; 添加分类</td>
	</tr>
    <tr><td height="66" style="border: 1px solid #D0D4D9">
    		<form method="POST" action="deal_news.asp?action=add">

			<p>　</p>
			<p align="center"><b>填写分类名称</b>：<input type="text" name="mingcheng" size="20"> <input type="submit" value="添 加" name="B1"> <input type="reset" value="重 置" name="B2"></p>
		</form>
    	</td></tr>
</table>

</div>
<%
end if
if request("action")="edit" then
id=request("id")
set rs=server.createobject("adodb.recordset")
    sql="select * from ku_newskind where id="&id
    rs.open sql,conn,1,3

%>
<!--->
<!---修改分类-->
<div align="center">

<table border="0" width="96%" height="146" cellpadding="0" cellspacing="5"  >
     <tr><td height="30">
    
    </td></tr>
	<tr >
		<td height="30"  bgcolor="#EEEEEE" style="border: 1px solid #D0D4D9">&nbsp;<b>当前操作：</b>&gt; 修改分类</td>
	</tr>
    <tr><td height="66" style="border: 1px solid #D0D4D9">
    		<form method="POST" action="deal_news.asp?action=edit&id=<%=rs("id")%>">

			<p>　</p>
			<p align="center"><b>修改分类名称</b>：<input type="text" name="mingcheng" size="20" value="<%=rs("name")%>"> <input type="submit" value="修 改" name="B1" > <input type="reset" value="重 置" name="B2"></p>
		</form>
    	</td></tr>
</table>

</div>
<% end if %>
<!--->
<p align="center"><!-- #include file="Ku_bottom.asp"--></p>
</body>

</html>