<!--#include file="WebConfig/Conn.asp"-->
<!--#include file="WebConfig/LoginYN.asp"-->
<!--#include file="WebConfig/Function.asp"-->
<html xmlns:v>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link type="text/css" rel="stylesheet" href="Css/BackStyle.css" />
<title></title>
<script language="javascript" src="Js/Nor.js"></script>
<script language="javascript" src="Js/checkClass.js"></script>
</head>
<%
	'-------------------------------------------------------'
	'					删除分类信息						'
	'-------------------------------------------------------'
	If Request.Form("ck")<>"" Then
		conn.Execute("Delete from NewsClass where Id in ("&Request.Form("ck")&")")
	Else
	'-------------------------------------------------------'
	'					添加修改分类信息					'
	'-------------------------------------------------------'
		If Request.QueryString("Do")<>"" Then
			DoId=Request.Form("Id")
			If DoId="" Then
				conn.Execute("Insert into NewsClass (NewsClassName,ParentClass,Orders)values('"&Request.Form("ClassName")&"',"&Request.Form("ParentClass")&","&Request.Form("ClassNum")&")")
			Else 
				conn.Execute("Update NewsClass Set NewsClassName='"&Request.Form("ClassName")&"',ParentClass="&Request.Form("ParentClass")&",Orders="&Request.Form("ClassNum")&" where Id="&DoId)
			End If
		End If
	End If
	'-------------------------------------------------------'
	'					显示某条分类信息					'
	'-------------------------------------------------------'
	pC=-1
	If Request.QueryString("Id")<>"" Then
		Id=Request.QueryString("Id")
		Set rsClassOne=Server.CreateObject("ADODB.RecordSet")
		rsClassOne.Open "Select Id,NewsClassName,ParentClass,Orders from NewsClass where Id="&Id,conn,1,1
		If Not rsClassOne.Eof Then
			cId=rsClassOne("Id")
			Na=rsClassOne("NewsClassName")
			pC=rsClassOne("ParentClass")
			Ord=rsClassOne("Orders")
		End If
		rsClassOne.Close
		Set rsClassOne=Nothing
	End If
	Set rsClass=Server.CreateObject("ADODB.RecordSet")
	rsClass.Open "Select Id,NewsClassName,Orders From NewsClass where ParentClass=0 order by Orders Asc",conn,1,1
%>
<body>
<div id="BackBg">
	<v:RoundRect id="BackCo" strokeColor="#7EB977" arcsize=".01" Filled="T">
		<div id="BackDocTitle" class="B cW">网站信息分类管理 | Manage the Class of News</div>
		<form id="BaseInfo" name="BaseInfor" method="post">
		<div id="BackDoZone">
			<ul id="Ti" class="B">
			<p class="w10 bR">ID</p><p class="w20 bR">所属板块</p><p class="w30 bR">下属分类</p><p class="w5 bR">序号</p><p class="w30 bR">操作(<a href="javascript:closeAllMenu();">折叠全部分类</a>)</p><p class="w4">选择</p>
			</ul>
			<% Do While Not rsClass.Eof %>
			<ul id="Co">
			<p class="w10 bR bB"><%i=rsClass("Id"):Response.Write(rsClass("Id"))%></p><p class="w20 bR bB"><%=rsClass("NewsClassName")%></p><p class="w30 bR bB">包含下属分类 (<%=countClassNum(i)%>) 个</p><p class="w5 bR bB"><%=rsClass("Orders")%></p><p class="w30 bR bB"><a href="javascript:ExtendMenu('<%=rsClass("NewsClassName")%>');">查看下属分类</a> | <a href="?Id=<%=rsClass("Id")%>">修改分类信息</a></p><p class="w4 bB"><input name="ck" type="checkbox" value="<%=rsClass("Id")%>" onClick="selectOne();" /></p>
			</ul>
			<% 
				If countClassNum(i)<>0 Then
				Set rssClass=Server.CreateObject("ADODB.RecordSet")
				rssClass.Open "Select Id,NewsClassName,ParentClass,Orders From NewsClass where ParentClass="&rsClass("Id"),conn,1,1
				Do While Not rssClass.Eof
			%>
			<ul id="BacksClass">
					<p class="w10"><%=rssClass("Id")%></p>
					<p class="w20"><%=toChineseName(rssClass("ParentClass"))%></p>
					<p class="w30"><%=rssClass("NewsClassName")%></p>
					<p class="w5"><%=rssClass("Orders")%></p>
					<p class="w30"><a href="?Id=<%=rssClass("Id")%>">修改下属分类信息</a></p>
					<p class="w4"><input name="ck" type="checkbox" value="<%=rssClass("Id")%>" onClick="selectOne();" /></p>
			</ul>
			<%
				rssClass.MoveNext
				Loop
				rssClass.Close
				set rssClass=Nothing
				End If
			%>
			<%
				rsClass.MoveNext
				Loop
				rsClass.Close
				Set rsClass=Nothing
			%>
		</div>
		<div id="BackBn"><input id="BnDel" disabled="disabled" type="button" value="删除所选内容"  onClick="confirmDel('BaseInfo');" /> 全选 <input name="Total" type="checkbox" onClick="selectAll(this);" /></div>
		</form>
		<div id="BackDocTitle" class="B cW"><% If Id="" Then Response.Write"添加" Else Response.Write"修改" End If%>分类信息 | Add the ClassInfo of News</div>
		<form id="AddClass" method="post" action="?Do=Add">
		<div id="BackDoZone"><div class="fL mLl" <% If pC=0 Then Response.Write" style=display:none" Else If pC<>0 Then Response.Write" style=display:block" End If End If%>>所属板块 <select name="ParentClass"><option value="0">===请选择所属板块===</option>
		<%
			Set rsP=Server.CreateObject("ADODB.RecordSet")
			rsP.Open "Select Id,NewsClassName,ParentClass from NewsClass where ParentClass=0 order by Orders Asc",conn,1,1
			Do While Not rsP.Eof
		%>
			<option value="<%=rsP("Id")%>" <% If (pC<>0) and pC=rsP("Id") Then Response.Write" selected" End If%>><%=rsP("NewsClassName")%></option>
		<%
			rsP.MoveNext
			Loop
			rsP.Close
			Set rsP=Nothing
		%>
		</select></div> <input name="Id" type="hidden" value="<%=cId%>" />分类名称 <input name="ClassName" type="text" class="w60" onFocus="clearInput('ClassName');" value="<%=Na%>" /> 分类序号 <input name="ClassNum" type="text" class="w10" onFocus="clearInput('ClassNum');" value="<%=Ord%>" /> <input id="Bn" type="button" value="<% If Id="" Then Response.Write"添加" Else Response.Write"修改" End If%>信息" onClick="ckClass('AddClass');" /></div>
		</form>
	</v:roundrect>
</div>
</body>
</html>
