<%@ Language=VBScript %>
<%Option Explicit%>
<!-- #INCLUDE FILE = "../inc.asp" -->
<%
CheckAdminLogin()
Dim key, aRTs
Dim iBound, i
iBound = Request.Form("Bound")
ReDim aGroups(iBound, 5)
For Each key In Request.Form
	Select Case Left(key,2)
		Case "GN"'数组的第1列存储GroupName；GroupName
			If Request.Form(key) = Empty Then err("组名不能为空。")
			aGroups(Right(key,Len(key) - 2),1) = Trim(Request.Form(key))
		Case "RT"'数组的第2列存储Authorities；RighTs
			aRTs = split(Right(key,Len(key) - 2),"-")
			If IsEmpty(aGroups(aRTs(0),2)) Then
				aGroups(aRTs(0),2) = aRTs(1)
			Else
				aGroups(aRTs(0),2) = aGroups(aRTs(0),2) & "," & aRTs(1)
			End If
		Case "LV"'数组的第3列存储Priority；LeVel
			If Request.Form(key) = Empty Then err("等级不能为空。")
			If Not IsNumeric(Request.Form(key)) Then err("等级必须是数字。")
			aGroups(Right(key,Len(key)-2),3) = CInt(Request.Form(key))
		Case "DL"'数组的第4列表示删除；DeLete
			aGroups(Right(key,Len(key)-2),4) = True
		Case "ON"'数组的第5列存储旧GroupName；OldName
			aGroups(Right(key,Len(key)-2),5) = Request.Form(key)
	End Select
Next
Dim oChat
Set oChat = Server.CreateObject("LSChat.ChatRooms")
oChat.Configure g_SiteName, g_SiteDomain, g_DBString, g_ErrFile, g_ScriptName
If Not oChat.modifyGroups(aGroups) Then
	Set oLSChat = Nothing
	err("修改组及权限时发生错误。请与<a href=""mailto:shooray@sina.com"">作者</a>联系。")
End If

Set oChat = Nothing
Dim sURL
sURL = "m_vgroups.asp"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
<!--
var dtTime = 3000;
function Redirect(){
	RedirectDIV.innerHTML = "您已经执行了修改组及权限的命令！<font color=\"red\"><b>" + dtTime/1000 + "</b></font> 秒钟之后，系统将自动为您转到“检阅组及权限”页面。";
	dtTime -= 1000;
	if(dtTime>=0)
		setTimeout("Redirect()", 1000, "javascript");
	else
		self.location = "<%=sURL%>";
}
//-->
</script>
<link rel="stylesheet" href="manager.css" type="text/css">
</head>
<body <%=g_BodyTag%>>
<div name="RedirectDIV" id="RedirectDIV" align="center"></div>
<script language="javascript">
<!--
Redirect();
//-->
</script>
</body>
</html>