<% Option Explicit %>
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Const.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0802") then Call ReturnError1()
Dim AdminGroupSql,RsAdminGroupObj,CheckInfo,GroupMen,RsTempObj
CheckInfo = ""
AdminGroupSql = "Select * from AdminGroup"
Set RsAdminGroupObj = Server.CreateObject("ADODB.recordset")
RsAdminGroupObj.open AdminGroupSql,Conn,1,1
if RsAdminGroupObj.Eof then
	CheckInfo = "没有系统管理员组，请添加系统管理员组！"
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>系统管理员组列表</title>
</head>
<link href="../../CSS/css.css" rel="stylesheet">
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<body topmargin="0" leftmargin="0" oncontextmenu="SelectAdminGroup();showMenu(MouseRightMenu);return false;">
<table width="100%" border="0" onClick="SelectAdminGroup();" cellspacing="0" cellpadding="0">
  <tr>
  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="6%" height="20" class="ButtonList"><div align="center">编号</div></td>
    <td width="33%" height="20" class="ButtonList"><div align="center">管理员组</div></td>
    <td width="33%" height="20" class="ButtonList"><div align="center">组成员</div></td>
    <td width="28%" height="20" class="ButtonList"><div align="center">简介</div></td>
  </tr>
  <% if RsAdminGroupObj.eof then %>
  <tr>
  	<td align="center" colspan="4"><font color="#FF0000">暂时没有记录</font></td>
  </tr>
  <%else
if CheckInfo = "" then
	Dim Temp_id
	Temp_id = 1
	 Dim page_size,page_no,page_total,record_all,PageNums
	page_size=Request.QueryString("page_size")
	if page_size<=0 or page_size="" then page_size=20
	If isnumeric(Request.Form("PageNums")) then
		if Request.Form("PageNums")<>0 then
			page_size = Cint(Request.Form("PageNums"))
		end if
	End if
	page_no=request.querystring("page_no")
	if page_no<=1 or page_no="" then page_no=1
	If Request.QueryString("page_no")="" then
		page_no=1
	end if
	RsAdminGroupObj.PageSize=page_size
	page_total=RsAdminGroupObj.PageCount
	if (cint(page_no)>page_total) then page_no=page_total
	RsAdminGroupObj.AbsolutePage=page_no
	record_all=RsAdminGroupObj.RecordCount
	Dim i
	for i=1 to RsAdminGroupObj.PageSize
	if RsAdminGroupObj.eof then exit for
		GroupMen = ""
		Set RsTempobj = Conn.Execute("Select Name from Admin where GroupID=" & RsAdminGroupObj("ID"))
		if Not RsTempObj.Eof then
			do while Not RsTempObj.Eof
				if GroupMen = "" then
					GroupMen = RsTempobj("Name")
				else
					GroupMen = GroupMen & "|" & RsTempobj("Name")
				end if
				RsTempObj.MoveNext
			loop
		else
			GroupMen = "暂无成员"
		end if
		RsTempObj.Close
		Set RsTempObj = Nothing
%>
  <tr AdminGroupID="<% = RsAdminGroupObj("ID") %>" style="background:white;cursor:default;">
    <td style="width:6%"><div align="center"><%=Temp_id%></div></td>
    <td>&nbsp;&nbsp;&nbsp;
      <% = RsAdminGroupObj("GroupName") %></td>
    <td height="26"> <div align="center">
        <% = GroupMen %>
      </div></td>
    <td ><div align="center"> 
        <a href="#" title="<%=RsAdminGroupObj("Comment")%>"><% = Left(RsAdminGroupObj("Comment"),15) %></a>
      </div></td>
  </tr>
  <%
  		Temp_id = Temp_id + 1
		RsAdminGroupObj.MoveNext
	Next
else
%>
  <tr> 
    <td height="26" colspan="4"> <div align="center"> 
        <% = CheckInfo %>
      </div></td>
  </tr>
  <%
end if
end if
%>
</table>
</td>
</tr>
<%if page_total>1 then%>
<tr height="18">
<td height="18">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr height="1">
	  <td width="42%" height="18"><table width="99%" border="0" cellspacing="0" cellpadding="0">
		  <tr>
		  </tr>
	   </table> </td>
	
	<td width="51%" height="25" valign="middle"> <div align="right">
		<% =  "NO.<b>"& page_no &"</b>,&nbsp;&nbsp;" %>
		<% = "Totel:<b>"& page_total &"</b>,&nbsp;RecordCounts:<b>" & record_all &"</b>&nbsp;&nbsp;&nbsp;"%>
		<%
			if Page_Total=1 then
					response.Write "&nbsp;<img src=../images/First1.gif border=0 alt=首页></img>&nbsp;"
					response.Write "&nbsp;<img src=../images/prePage.gif border=0 alt=上一页></img>&nbsp;"
					response.Write "&nbsp;<img src=../images/nextPage.gif border=0 alt=下一页></img>&nbsp;"
					response.Write "&nbsp;<img src=../images/endPage.gif border=0 alt=尾页></img>&nbsp;"
			else
				if cint(Page_No)<>1 and cint(Page_No)<>Page_Total then
					response.Write "&nbsp;<a href=?page_no=1&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/First1.gif border=0 alt=首页></img></a>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)-1)&"&page_size="&page_size&"&Keywords="&Request("Keywords")&"><img src=../images/prePage.gif border=0 alt=上一页></img></a>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)+1)&"&page_size="&page_size&"&Keywords="&Request("Keywords")&"><img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="& Page_Total &"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/endPage.gif border=0 alt=尾页></img></a>&nbsp;"
				elseif cint(Page_No)=1 then
					response.Write "&nbsp;<img src=../images/First1.gif border=0 alt=首页></img></a>&nbsp;"
					response.Write "&nbsp;<img src=../images/prePage.gif border=0 alt=上一页></img>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)+1)&"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="& Page_Total &"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/endpage.gif border=0 alt=尾页></img></a>&nbsp;"
				else
					response.Write "&nbsp;<a href=?page_no=1&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/First1.gif border=0 alt=首页></img>&nbsp;"
					response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)-1)&"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/prePage.gif border=0 alt=上一页></img></a>&nbsp;"
					response.Write "&nbsp;<img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
					response.Write "&nbsp;<img src=../images/endpage.gif border=0 alt=尾页></img>&nbsp;"
				end if
			end if
			%>
	</div></td>
	<td width="7%" valign="middle"><select onChange="ChangePage(this.value);" style="width:50;" name="select">
	  <% for i=1 to Page_Total %>
	  <option <% if cint(Page_No) = i then Response.Write("selected")%> value="<% = i %>">
	  <% = i %>
	  </option>
	  <% next %>
	</select></td>
  </tr>
</table>
</td>
</tr>
<% end if %>
</table>
</body>
</html>
<!-- 鼠标右键菜单 -->
<div id=MouseRightMenu onclick="ClickMenu(this);" onmouseover="MouseOverRightMenu();" onmouseout="MouseOverRightMenu();" class="menu"> 
  <div class="MouseRightItem" id="AddAdminGroup" ExeFunction="OpenWindow('Frame.asp?FileName=AdminGroupEdit.asp&Titles=新建管理员组',350,160,window);">新建</div> 
  <div class="MouseRightItem" id="EditAdminGroup" ExeFunction="OpenWindow('Frame.asp?FileName=AdminGroupEdit.asp&Titles=修改管理员组&ID='+AdminGroupID,350,160,window);">修改</div>
  <div class="MouseRightItem" id="DelAdminGroup" ExeFunction="OpenWindow('Frame.asp?FileName=SysAdminGroup_Del.asp&Titles=删除管理员组&ID='+AdminGroupID,230,110,window);">删除</div>
  <div class="MouseRightItem" id="SetPop" ExeFunction="OpenWindow('Frame.asp?FileName=SetAdminGroupPop.asp&Titles=设置管理员组权限&ID='+AdminGroupID,600,460,window);">设置权限</div> 
  <hr id="HR2">
  <div class="MouseRightItem" id="Refresh" ExeFunction="window.location.reload();">刷新</div>
   <hr id="HR3">
  <div class="MouseRightItem" id="Pros" ExeFunction="javascript:window.prompt('本页面路径属性' , '<%=Request.ServerVariables("SCRIPT_NAME")%>');">路径属性</div>
</div>
<%
Set Conn = Nothing
%>
<script language="JavaScript">
var AdminGroupID='';
var DisableOrActiveMenuArray=new Array();
DisableOrActiveMenuArray[0]=EditAdminGroup;
DisableOrActiveMenuArray[1]=DelAdminGroup;
DisableOrActiveMenuArray[2]=SetPop;
DisableMenu(DisableOrActiveMenuArray);
function SelectAdminGroup()
{
	var i=0;
	var EventObj=event.srcElement;
	var TRObj;
	switch (EventObj.tagName.toLowerCase())
	{
		case 'div':
			TRObj=EventObj.parentElement.parentElement;
			break;
		case 'td':
			TRObj=EventObj.parentElement;
			break;
		case 'tr':
			TRObj=EventObj;
			break;
		default:
			return;
	}
	for (j=0;j<document.all.length;j++)
	{
		if (document.all(j).style.backgroundColor=='highlight')
		{
			document.all(j).style.backgroundColor='';
			for (i=0;i<document.all(j).children.length;i++) document.all(j).children(i).style.color='black';
		}
	}
	if (TRObj.AdminGroupID!=null) AdminGroupID=TRObj.AdminGroupID;
	else return;
	if (AdminGroupID!='')
	{
		EditAdminGroup.className='MouseRightItem';
		DelAdminGroup.className='MouseRightItem';
		SetPop.className='MouseRightItem';
		TRObj.style.backgroundColor='highlight';
		for (i=0;i<TRObj.children.length;i++) TRObj.children(i).style.color='white';
	}
	else
	{
		AdminGroupID='';
		EditAdminGroup.className='MenuItemDisable';
		DelAdminGroup.className='MenuItemDisable';
		SetPop.className='MenuItemDisable';
	}
}
function ChangePage(PageNum)
{
	var page_size=<% = page_size %>
	window.location.href='?page_no='+PageNum+'&page_size='+page_size;
}
</script>