<%@language=vbscript codepage=936 %>
<%
option explicit
response.buffer=true
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
%>
<!--#Include File="../Conn.asp"-->
<!--#Include File="../Inc/Cl_ClsSysTem.asp"-->
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>栏目树形导航</title>
<base target="_self" />
<link href="../Skins/User_Style.Css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="10" topmargin="10">
<table border=0 width="100%" height=0 cellspacing=1 cellpadding=0 class=border>
<%
Cl.GetWeb_Setting
if Not Cl.ChkUserLogin then
	User_ShowErr("<li>以下操作需要登录后方或进行，您未登录。</li><li>请点击<a href='LogIn.asp' target='_Top'>这里登录</a>。")
	Response.end
end if
dim rsClass,sqlClass,strTemp,iDepth,i
dim arrShowLine(10)
dim arrChildID,ChannelID,ClassID,sType
arrChildID=Trim(Request("ID"))
ClassID=Cl.ChkCLng(Request("ClassID"))
ChannelID=Cl.ChkCLng(Request("ChannelID"))
arrChildID=Replace(arrChildID," ","")
if Not IsNumeric(Replace(arrChildID,",","")) then arrChildID=0
if Not IsNumeric(ChannelID) then ChannelID=1
for i=0 to ubound(arrShowLine)
	arrShowLine(i)=False
next
Cl.GetWeb_CSetting(ChannelID)
if ClassID>0 then
	set rsClass=Cl.Execute("select ParentPath From Cl_Class Where ClassID="&ClassID)
	if Not rsClass.eof then
		arrChildID=rsClass(0)
	end if
	set rsClass=Nothing
end if
sqlClass="Select ClassID,ClassName,ParentID,ParentPath,Child,Depth,NextID From Cl_Class where (ParentID In ("&arrChildID&") or Depth=0) and ChannelID="&ChannelID&" order by RootID,OrderID"
set rsClass=Cl.Execute(sqlClass)
'rsClass.open sqlClass,Conn,1,1
if rsClass.bof and rsClass.bof then
	response.write "请先添加栏目"
else
	do while not rsClass.eof
		response.write "<tr class=tdbg><td>"
		iDepth=rsClass("Depth")
		if rsClass("NextID")>0 then
			arrShowLine(iDepth)=True
		else
			arrShowLine(iDepth)=False
		end if
		if iDepth>0 then
	  		for i=1 to iDepth 
				if i=iDepth then 
					if rsClass("NextID")>0 then 
						response.write "<img src='"&Cl.Webdir&"images/Tree/line1.gif' width='17' height='16' valign='abvmiddle'>" 
					else 
						response.write "<img src='"&Cl.Webdir&"images/Tree/line2.gif' width='17' height='16' valign='abvmiddle'>" 
					end if 
				else 
					if arrShowLine(i)=True then
						response.write "<img src='"&Cl.Webdir&"Images/Tree/line3.gif' width='17' height='16' valign='abvmiddle'>" 
					else
						response.write "<img src='"&Cl.Webdir&"images/Tree/line4.gif' width='17' height='16' valign='abvmiddle'>" 
					end if
				end if 
	  		next 
		end if
		if rsClass("Child")>0 then
			if Instr(","&arrChildID&",",","&rsClass("ParentPath") & "," & rsClass("ClassID")&",")>0 then
	  			response.write "<a href='?ChannelID="&ChannelID&"&ID=" & rsClass("ParentPath") & "' title='收起栏目'><img src='"&Cl.Webdir&"images/Tree/folder3.gif' width='15' height='15' valign='abvmiddle' border=0>" & rsClass("ClassName") & "</a> ("&rsClass("Child")&")"
			else
	  			response.write "<a href='?ChannelID="&ChannelID&"&ID=" & rsClass("ParentPath") & "," & rsClass("ClassID") & "' title='展开栏目'><img src='"&Cl.Webdir&"images/Tree/folder4.gif' width='15' height='15' valign='abvmiddle' border=0>" & rsClass("ClassName") & "</a> ("&rsClass("Child")&")"
			end if
			response.write "&nbsp;[<a href='#' onClick='window.returnValue="""&rsClass("ClassID")&"|"&rsClass("ClassName")&""";window.close();' title='选择栏目'>选择</a>]"
		else
			if ClassID=rsClass("ClassID") then
	  			response.write "<a href='#' onClick='window.returnValue="""&rsClass("ClassID")&"|"&rsClass("ClassName")&""";window.close();' title='选择栏目'><img src='"&Cl.Webdir&"images/Tree/folder3.gif' width='15' height='15' valign='abvmiddle' border=0>" & rsClass("ClassName") & "</a>(<font color=red>当前</font>)"
			else
	  			response.write "<a href='#' onClick='window.returnValue="""&rsClass("ClassID")&"|"&rsClass("ClassName")&""";window.close();' title='选择栏目'><img src='"&Cl.Webdir&"images/Tree/folder3.gif' width='15' height='15' valign='abvmiddle' border=0>" & rsClass("ClassName") & "</a>"
			end if
		end if
	  	'response.write "<br>"
		response.write "</td></tr>"
	rsClass.movenext 
	loop 
end if
rsClass.close:set rsClass=nothing
%>
</table>
</Body>
</Html>