<!--#include file="../inc/DAL.asp"-->
<!--#include file="Check.asp"-->
<%
Dim ConfigRS,ParentRS
Set ConfigRS=Server.CreateObject( "ADODB.Recordset" )
if request.QueryString("Method")="Del" then 
    DB_CONN.EXECUTE("delete from [i_Sys_Room_Class] where [i_Sys_Room_Class_ID]="&request.QueryString("id"))
    RW "<script>location.href='RoomClass_Manage.asp';</script>"
end if
if request.form("Method")="SetPower" then
    ConfigRS.OPEN "select top 1 * from [i_Sys_Room_Class]" , DB_CONN , 1 , 3
    ConfigRS.addnew()
    ConfigRS("i_Sys_Room_Class_Name")=vbsEscape(request.form("i_Sys_Room_Class_Name"))
    ConfigRS("i_Sys_Room_Class_Sort")=request.form("i_Sys_Room_Class_Sort")
    ConfigRS("i_Sys_Room_CLass_ParentID")=request.form("i_Sys_Room_CLass_ParentID")
    ConfigRS.update()
    ConfigRS.close()
    RW "<script>alert('修改成功!');location.href='RoomClass_Manage.asp';</script>"
else
	if request.QueryString("ParentID")<>"" then 
		Set ConfigRS=DB_CONN.EXECUTE("select * from [i_Sys_Room_Class] where [i_Sys_Room_CLass_ParentID]="&request.QueryString("ParentID")&" order by [i_Sys_Room_Class_Sort] desc")
	else
		Set ConfigRS=DB_CONN.EXECUTE("select * from [i_Sys_Room_Class] order by [i_Sys_Room_Class_Sort] desc")
	end if
end if
Set ParentRS=DB_CONN.EXECUTE("select * from [i_Sys_Room_Class] where [i_Sys_Room_CLass_ParentID]=0 order by [i_Sys_Room_Class_Sort] desc")
%>
<!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>
<title>ImChat v1.5 Manage System</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="styles/layoutContent.css" rel="stylesheet" type="text/css" />
<link href="themes/blue/styles.css" rel="stylesheet" type="text/css" />
<link href="/i/v1/css/level.css" rel="stylesheet" type="text/css" />
<style>
.JSTB{border:#ccc solid 1px;border-right:none;border-bottom:none;margin-top:20px;}
.JSTB th,.JSTB td{border-bottom:#ccc solid 1px; border-right:#ccc solid 1px;}
</style>
</head>
<body>
<div class="contentcontainer">
    <div class="headings alt">
        <h2>房间类别列表&nbsp;&nbsp;&nbsp;<a href="javascript:\\;" onclick="location.reload();" style="text-decoration:none;">刷新</a>&nbsp;&nbsp;&nbsp;<a href="RoomClass_Manage.asp" style="text-decoration:none;">所有分类</a>
		<% 
		while not ParentRS.eof 
		if ParentRS("i_Sys_Room_CLass_ParentID")=0 then
		%>
		&nbsp;&nbsp;&nbsp;<a href="RoomClass_Manage.asp?ParentID=<%=ParentRS("i_Sys_Room_Class_ID")%>"><%=vbsUnEscape(ParentRS("i_Sys_Room_Class_Name"))%></a>
		<%
		end if
		ParentRS.MoveNext
		wend
		%>
		</h2>
    </div>
    <div class="contentbox">
        <table class="JSTB" width="100%" cellpadding="0" cellspacing="0" border="0">
            <th colspan="16">房间类别列表</th>
            <tr>
                <td>ID</td>
                <td>名称</td>
                <td>父类ID</td>
                <td>排序</td>
                <td>操作</td>
            </tr>
            <% while not ConfigRS.eof %>
            <tr>
                <td>&nbsp;<%=ConfigRS("i_Sys_Room_Class_ID")%></td>
                <td>&nbsp;<%=vbsUnEscape(ConfigRS("i_Sys_Room_Class_Name"))%></td>
                <td>&nbsp;<%if ConfigRS("i_Sys_Room_CLass_ParentID")=0 then RW "&nbsp;&nbsp;<label style='color:red;display:inline;'>根栏目</label>" else RW ConfigRS("i_Sys_Room_CLass_ParentID")%></td>
                <td>&nbsp;<%=ConfigRS("i_Sys_Room_Class_Sort")%></td>
                <td>&nbsp;<a href="EditRoomClass.asp?ID=<%=ConfigRS("i_Sys_Room_Class_ID")%>">编辑</a>&nbsp;<a href="?Method=Del&ID=<%=ConfigRS("i_Sys_Room_Class_ID")%>">删除</a>&nbsp;<a href="User_Manage.asp?t=c&CID=<%=ConfigRS("i_Sys_Room_Class_ID")%>">查看此类房间</a></td>
            </tr>
            <%
            ConfigRS.MoveNext
            wend
            %>
        </table>
        
        <form action="#" method="post" >
            <label for="i_Sys_Room_Class_Name"><strong>类别名称:</strong></label>
            <input type="text" id="i_Sys_Room_Class_Name" name="i_Sys_Room_Class_Name" class="inputbox" value=""/>
            <br>
            <label for="i_Sys_Room_CLass_ParentID"><strong>父类:</strong></label>
            <select id="i_Sys_Room_CLass_ParentID" name="i_Sys_Room_CLass_ParentID" >
				<option value="0">一级类</option>
				<%
				dim tRS
				Set tRS=DB_CONN.EXECUTE( "select * from [i_Sys_Room_Class] order by [i_Sys_Room_Class_Sort] desc" )
				while not tRS.eof
					RW "<option value='"&tRS("i_Sys_Room_Class_ID")&"' >"&vbsUnEscape(tRS("i_Sys_Room_Class_Name"))&"</option>"
					tRS.movenext()
				 wend
				%>
			</select>
            <br>
            <label for="i_Sys_Room_Class_Sort"><strong>排序(数字):</strong></label>
            <input type="text" id="i_Sys_Room_Class_Sort" name="i_Sys_Room_Class_Sort" class="inputbox" value=""/>
            <br>
            <input type="hidden" value="SetPower" name="Method"/>
            <input type="submit" value="提交" class="btn" />
        </form>
    </div>
</div>
</body>
</html>
