<%
subaction = Request("subaction")

if subaction = "modify" then	'修改操作员的口令权限
	adminid = Request("adminid")
	adminid = 0+adminid
	pass1 = Request("pass1")
	pass2 = Request("pass2")
	if adminid > 0 then
		if pass1 = pass2 then
			sql = "UPDATE bg_adminUser SET "
			if pass1 <> "" then
				sql = sql &"pass='"& MD5(pass1) &"', "
			end if
			sright = replace(Request("right")," ","")
			if sright = "" then
				errorMsg = errorMsg & "请选择操作员权限！"
			else
				sql = sql &"myright='"& sright &"' WHERE id="& adminid
				conn.Execute(sql)
				errorMsg = errorMsg & "成功的修改了操作员的口令权限。"
			end if
		else
			errorMsg = errorMsg & "您输入的口令不正确！"
		end if
	else
		errorMsg = errorMsg & "请先选择要修改的操作员！"
	end if
	if errorMsg <> "" then
		errorMsg = errorMsg & "请“<a href=""functions.asp?action=userModify&LOGINID="& LOGINID &""">选择操作员</a>”。"
		DisplayMessage errorMsg,True
	end if
elseif subaction = "select" then	'显示操作员的信息
	adminid = Request("adminid")
	adminid = 0+adminid
	if adminid > 0 then
		sql = "SELECT name,pass,myright,pid FROM bg_adminUser WHERE id="& adminid
		set rs = conn.Execute(sql)
		if not rs.Eof then
			name = rs("name")
			pid = rs("pid")
			sright = "."& rs("myright")
			rs.Close
%>
<table width="100%" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#CCE0CF" bordercolordark="#FFFFFF" align="center">
<form name="InfoEdit" action="functions.asp" method="post" onSubmit="return checkForm();">
<input type="hidden" name="action" value="<%=action%>">
<input type="hidden" name="subaction" value="modify">
<input type="hidden" name="LOGINID" value="<%=LOGINID%>">
<input type="hidden" name="adminid" value="<%=adminid%>">
  <tr class="ListTableHeader">
    <td colspan="2" background="images/TableHeaderBg.gif" nowrap><b>修改操作员 <%=name%> 的口令和权限：</b></td>
  </tr>
  <tr class="InputTableRow">
    <td align="right" width="14%">登录口令：</td>
    <td width="86%"><input type="password" name="pass1" size="16" maxlength="16" class="ButtonEditPwd">（留空表示不做修改）</td>
  </tr>
  <tr class="InputTableRow">
    <td align="right">登录口令确认：</td>
    <td><input type="password" name="pass2" size="16" maxlength="16" class="ButtonEditPwd"></td>
  </tr>
  <tr class="InputTableRow">
    <td align="right" valign="top">操作权限：</td>
    <td>
      <table>
<%
dim hasRight
for i = 0 to ubound(strMainFunction)
	response.write "        <tr><td bgcolor=""#C0C0C0"" colspan=""2""><b>"& strMainFunction(i) &"</b></td></tr>"& vbCrLf
    subFunctionList = split(strFunctionList(i),":")
    subFunctionAction = split(strFunctionAction(i),":")
	subFunctionRight = split(strFunctionRight(i),":")
	for j = 0 to Ubound(subFunctionList)
		hasRight = ""
		if InStr(sright,subFunctionRight(j)) > 0 then
			hasRight = " checked"
		end if
		response.write "        <tr><td bgcolor=""#EEEEEE""><input type=""checkbox"" name=""right"" value="""& subFunctionRight(j) &""""& hasRight &"></td><td bgcolor=""#EEEEEE""><input style=""background-color:#cccc99; border-width:1;border-style:solid"" value="""& subFunctionList(j) &""" size=""12"" READONLY> </td></tr>"& vbCrLf
	next
next
%>
      </table>
    </td>
  </tr>
  <tr class="MainPageBar" height="26">
    <td align="center" colspan="2"><input type="submit" name="Submit" value=" 确 定 " class="ButtonReply"> &nbsp <input type="reset" value=" 恢 复 " class="ButtonReply"></td>
  </tr>
</form>
</table>
<script language="JavaScript">
<!--//
  function checkForm()
  {
		  return true;
  }
//-->
</script>
<%
		else
			DisplayMessage "系统故障，操作失败！", false
		end if
	else
		DisplayMessage "请先选择要修改的操作员！<br>\n请点击浏览器的“后退”按钮修改。", false
	end if
else	'选择操作员
%>
<br>
<br>
<table border="0" align="center" width="300" bordercolorlight="#CCE0CF" bordercolordark="#FFFFFF">
<form action="functions.asp" method="post">
<input type="hidden" name="action" value="<% =action %>">
<input type="hidden" name="subaction" value="select">
<input type="hidden" name="LOGINID" value="<%=LOGINID%>">
  <tr class="ListTableHeader">
    <td background="images/TableHeaderBg.gif" nowrap><b>请选择要修改的操作员：</b></td>
  </tr>
  <tr>
    <td class="InputTableRow" align="center">
	  <select name="adminid" class="ButtonSelect">
<%
	sql="SELECT id,name FROM bg_adminUser"
	set rs = conn.Execute(sql)
	while not rs.Eof
		Response.Write "	    <option value="""& rs("id") &""">"& rs("name") &"</option>"& vbCrLf
		rs.MoveNext
	wend
%>
	  </select>
	</td>
  </tr>
  <tr class="MainPageBar" height="26">
    <td align="right"><input type="submit" name="Submit" value=" 确 定 " class="ButtonReply"></td>
  </tr>
</form>
</table>
<%
end if
%>