<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Conn/conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link rel="stylesheet" href="../css/indexTwo.css" type="text/css">
<title>网站后台</title>
</head>
<body>
<table width="100%" border="0" cellspacing="1" class="Navi2">
  <tr>
    <th>信息类别列表</th>
  </tr>
</table>
<table width="100%" border="0" cellspacing="1" class="Navi2">
<tr>
	<td>类别名称</td>
	<td style="text-align:center">操作</td>
</tr>
<%
sql="select mode from TbNewsSet where id=1"
rs.open sql,conn,1,1
if not rs.eof then
	rootmode=rs("mode")
end if
rs.close
%>
<tr onmouseout="style.backgroundColor=''" onMouseover="style.backgroundColor='#bfdfff'">
	<td><img src='../images/file1.gif'><font color="#FF0000">根目录</font></td>
	<td style="text-align:left;padding-left:8px;">	
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr style="background:none;">
		<td style="width:25%;">&nbsp;</td>
		<td style="width:25%;">
		<%
		if rootmode=1 then
			response.Write("<img src='../images/icon_add.gif' >&nbsp;")
			response.Write("<a href='News_Sort_Add.asp?SortID=0&rank=1' class='link2'>添加</a>")
		else
			response.Write("&nbsp;&nbsp;")
		end if
		%>
		</td>
		<td style="width:25%;">&nbsp;</td>
		<td style="width:25%;">&nbsp;</td>
	  </tr>
	</table>
	</td>
</tr>
<%
sql="select * from TbNewsSort where pid=0 order by [order] asc"
rs.open sql,conn,1,1
if not rs.eof then
	do while not rs.eof 
		call sortShow(1,rs("name"),rs("id"),rs("setmode"),rs("addmode"),rs("editmode"),rs("delmode"))
		call Sort2(rs("id"))
		rs.movenext
	loop
end if
rs.close
%>
  <tr>
    <td colspan="2">&nbsp;</td>
  </tr>
</table>
</body>
</html>
<!--#include file="../Conn/conn_close.asp"-->
<%
sub sortShow(rank,SortName,SortID,SetMode,AddMode,EditMode1,DelMode)
	response.Write("<tr onmouseout=""style.backgroundColor=''"" onMouseover=""style.backgroundColor='#bfdfff'"">")
	response.Write("<td>")
	for i=1 to rank 
		response.Write("&nbsp;&nbsp;&nbsp;&nbsp;")
	next
	response.Write("<img src='../images/file1.gif'>")
	response.Write(SortName)
	response.Write("</td>")
	response.Write("<td style='text-align:left;padding-left:8px;'>")
	
	
	response.Write("<table width='100%' border='0' cellspacing='0' cellpadding='0'>")
	response.Write("  <tr style='background:none;'>")
	'设置
	response.Write("<td style='width:25%'>")
	call IsSetSort(SortID,SetMode)
	response.Write("</td>")
	'添加
	response.Write("<td style='width:25%'>")
	if rank<5 then
		if AddMode=1 then
			response.Write("<img src='../images/icon_add.gif' >&nbsp;")
			response.Write("<a href='News_Sort_Add.asp?SortID="&SortID&"&rank="&rank&"' class='link2'>添加</a>")
		else
			response.Write("&nbsp;&nbsp;")
		end if
	end if
	response.Write("</td>")
	'修改
	response.Write("<td style='width:25%'>")
	if EditMode1=1 then
		response.Write("<img src='../images/icon_edit.gif' >&nbsp;")
		response.Write("<a href='News_Sort_Edit.asp?SortID="&SortID&"' class='link2'>修改</a>")
	else
		response.Write("&nbsp;&nbsp;")
	end if

	response.Write("</td>")
	'删除
	response.Write("<td style='width:25%'>")
	call IsDelSort(SortID,DelMode)
	response.Write("</td>")
	response.Write("  </tr>")
	response.Write("</table>")

	response.Write("</td>")
	response.Write("</tr>")
end sub
sub Sort2(SortPid)
	sql2="select * from TbNewsSort where pid="&SortPid&" order by [order] asc"
	rs2.open sql2,conn,1,1
	if not rs2.eof then
		do while not rs2.eof
			call sortShow(2,rs2("name"),rs2("id"),rs2("setmode"),rs2("addmode"),rs2("editmode"),rs2("delmode"))
			call Sort3(rs2("id"))
			rs2.movenext
		loop
	end if
	rs2.close
end sub
sub Sort3(SortPid)
	set rs3=server.CreateObject("adodb.recordset")
	sql3="select * from TbNewsSort where pid="&SortPid&" order by [order] asc"
	rs3.open sql3,conn,1,1
	if not rs3.eof then
		do while not rs3.eof
			call sortShow(3,rs3("name"),rs3("id"),rs3("setmode"),rs3("addmode"),rs3("editmode"),rs3("delmode"))
			call Sort4(rs3("id"))
			rs3.movenext
		loop
	end if
	rs3.close
end sub
sub Sort4(SortPid)
	set rs4=server.CreateObject("adodb.recordset")
	sql4="select * from TbNewsSort where pid="&SortPid&" order by [order] asc"
	rs4.open sql4,conn,1,1
	if not rs4.eof then
		do while not rs4.eof
			call sortShow(4,rs4("name"),rs4("id"),rs4("setmode"),rs4("addmode"),rs4("editmode"),rs4("delmode"))
			call Sort5(rs4("id"))
			rs4.movenext
		loop
	end if
	rs4.close
end sub
sub Sort5(SortPid)
	set rs5=server.CreateObject("adodb.recordset")
	sql5="select * from TbNewsSort where pid="&SortPid&" order by [order] asc"
	rs5.open sql5,conn,1,1
	if not rs5.eof then
		do while not rs5.eof
			call sortShow(5,rs5("name"),rs5("id"),rs5("setmode"),rs5("addmode"),rs5("editmode"),rs5("delmode"))
			rs5.movenext
		loop
	end if
	rs5.close
end sub
sub IsSetSort(SortID,SetMode)
	set rsn=server.CreateObject("adodb.recordset")
	sqln="select top 1 * from TbNewsSort where pid="&SortID
	rsn.open sqln,conn,1,1
	if rsn.eof then
		if SetMode=1 then
			response.Write("<img src='../images/selectman.gif' >&nbsp;")
			response.Write("<a href='News_Sort_Set.asp?SortID="&SortID&"' class='link2'>")
			response.Write("设置")
			response.Write("</a>")
		else
			response.Write("&nbsp;&nbsp;")
		end if		
	end if
	rsn.close
end sub
sub IsDelSort(SortID,DelMode)
	set rsn=server.CreateObject("adodb.recordset")
	sqln="select top 1 * from TbNewsSort where pid="&SortID
	rsn.open sqln,conn,1,1
	if rsn.eof then
		if DelMode=1 then
			response.Write("<img src='../images/icon_dele.gif' >&nbsp;")
			response.Write("<a href='News_Sort_Del.asp?SortID="&SortID&"' class='link2'>删除</a>")
		else
			response.Write("&nbsp;&nbsp;")
		end if		
	end if
	rsn.close
end sub
%>