<!--#include file="Config.asp" -->
<link rel="stylesheet" href="../inc/jquery.treeview/jquery.treeview.css" />
<script src="../inc/jquery.treeview/lib/jquery.js" type="text/javascript"></script>
<script src="../inc/jquery.treeview/lib/jquery.cookie.js" type="text/javascript"></script>
<script src="../inc/jquery.treeview/jquery.treeview.js" type="text/javascript"></script>
<script type="text/javascript">
		$(function() {
			$("#tree").treeview({
				collapsed: true,
				animated: "medium",
				control:"#sidetreecontrol",
				persist: "location"
			});
		})
</script>
<div class='menu'>&nbsp;分类管理</div>
<%
eTable = Prefix&eims
eSort = Prefix&eims&"Sort"
SortUrl = "Sort.asp?eims="&eims
ListUrl = "Sort.asp?eims="&eims
AddUrl = "SortAdd.asp?eims="&eims
EditUrl = "SortEdit.asp?eims="&eims
Mgt("admin") 'Cookies : Permission
If action="Del" Then
'================================================
'检测该分类下是否有子分类
'================================================
Set Rs=Conn.Execute("Select * From ["&eSort&"] Where ParentID="&ItemID)
If Not (Rs.Eof And Rs.Bof) Then WtMsg("请删除该分类下的子分类再删除此分类！")
Conn.Execute ("Delete From ["&eSort&"] Where ItemID="&ItemID)
Response.Redirect SortUrl
Response.End()
End If
%>
<div class="content">
<div id="sidetree" style="margin:8px;">
<div id="sidetreecontrol" style="margin:5px 0;"><a href="?#">隐藏全部下级分类</a> | <a href="?#">展开全部下级分类</a></div>
<ul id="tree">
<%
sti=0 : SortView(0)
Function SortView(fParentID)
Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.Open "Select * From ["&eSort&"] Where ParentID="&int(fParentID)&" Order By SortSeq",Conn,1,1
While Not Rs.Eof

SortSh="显示"
if Int(Rs("SortSh"))=0 then SortSh="<font color=red>隐藏</font>"
response.write "<li>"
%>
<%=Trim(Rs("SortSeq"))%> &gt; 
<%=Trim(Rs("SortName"))%> | <%=SortSh%> | 
系统编号：<%=Trim(Rs("ItemID"))%> &gt; 操作：
[<a href="<%=AddUrl%>&ParentID=<%=Trim(Rs("ItemID"))%>">添加下级分类</a>] | 
[<a href="<%=EditUrl%>&ItemID=<%=Trim(Rs("ItemID"))%>&action=Edit">修改</a>] | 
[<a href="<%=ListUrl%>&ItemID=<%=Int(Rs("ItemID"))%>&action=Del" onClick="return confirm('确定要删除吗？')">删除</a>]
<%
	'判断是否有下级栏目
	set Rs2=conn.execute("Select ItemID From ["&eSort&"] Where ParentID="&int(Rs("ItemID")))
	if not Rs2.eof then
	sti=sti+1
	response.write "<ul>"	
	SortView(Rs("ItemID"))
	response.write "</ul>"	
	sti=sti-1
	end if
response.write "</li>"
Rs.movenext
Wend
Rs.close
Set Rs = Nothing
End Function
%>
</ul>
</div>
  <br>
</div>
<br>
</body></html>
<%Call CloseConn()%>
