<!--#include file="../common/conn.asp"-->
<%
'检查用户权限
call checkuser("管理员管理")
%>

<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE>
BODY {
	FONT-SIZE: 9pt
}
TABLE {
	FONT-SIZE: 9pt
}
TH {
	FONT-WEIGHT: 500; FONT-SIZE: 9pt
}
A:link {
	COLOR: #dd006f; TEXT-DECORATION: none
}
A:visited {
	TEXT-DECORATION: none
}
A:active {
	TEXT-DECORATION: none
}
A:hover {
	COLOR: #9933ff; TEXT-DECORATION: underline
}

</STYLE>
 <%

 strID=GetVariable("id")
  
 if strID="" then

 else
 	'取指定ID的新闻出来编辑
	strSQL="select * from web_admin where ID=" & strID
	 
	 set rs=server.CreateObject ("ADODB.Recordset")
	 rs.open strSQL,conn,1,1
	 
	 strUserName=trim(rs("LoginName"))
	 strRealName=trim(rs("RealName"))
	 'strPassWord=trim(rs("PassWord"))
	 strLimit=trim(rs("Limit"))
	 
	 rs.close
 end if

%>
<script language="JavaScript" src="../../common/JS_CheckForm.js"></script>
<script language="JavaScript">

function CheckForm(form){
	if(form.txtname.value==""){
		alert("错误提示：\n\n请你填写管理员账号　　");
		return false;
	}

	<%if strID="" then %>
	if(form.txtpass1.value.length<4){
		alert("错误提示：\n\n请你填写初始密码,不得少于4位!　　");
		return false;
	}
	<%end if%>
	if(form.txtpass1.value!=form.txtpass2.value){
		alert("错误提示：\n\n两次输入密码不同，请重输!　　");
		return false;
	}
	
	flag=true;
	for (i=0;i<form.chkLimit.length;i++){
		if(form.chkLimit[i].checked){
			flag=false;
			break;
		}
	}
	
	if(flag){
		alert("错误提示：\n\n请你给新管理员分配权限！　　");
		return false;
	}
}

function init(){

	//初始化权限选择框
	var strLimit="<%=strLimit%>";
	for (i=0;i<vbform.chkLimit.length;i++){
		if(strLimit.indexOf(vbform.chkLimit[i].value)>=0){
			vbform.chkLimit[i].checked=true;
		}
	}
}
</script>

<title>网站管理员</title></head>
<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" onLoad="init()">
<form action="save.asp?id=<%=strID%>" method="post" name="vbform" target="BackFrame" id="newform" onSubmit="return CheckForm(this)">
  <table width="100%" height="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#336600">
    <tr> 
      <td height="26" colspan="2" bgcolor="#669900"> <font color="#FFFFFF">::网站管理员</font></td>
    </tr>
    <tr bgcolor="#eeeeee"> 
      <td width="19%" height="26" align="right">账　号：</td>
      <td width="81%" height="26"> <input name="txtname" type="text" class=bginput id="txtname" value="<%=strUserName%>" size="20" maxlength="100">
        <font color="#FF0000">[必填]</font></td>
    </tr>
    <tr bgcolor="#F9F9F9"> 
      <td height="26" align="right">密　码：</td>
      <td height="26"> <input name="txtpass1" type="password" class=bginput id="txtpass1" value="<%=strPassWord%>" size="20" maxlength="50">
	  	<%if strID="" then %>
        <font color="#FF0000">[必填]</font>
		<%else%>
        <font color="#FF0000">[如果不希望修改密码，请不要填] </font>
		<%end if%>
		</td>
    </tr>
    <tr bgcolor="#eeeeee"> 
      <td height="26" align="right">确认密码：</td>
      <td height="26" bgcolor="#eeeeee"> <input name="txtpass2" type="password" class=bginput id="txtpass2" value="<%=strPassWord%>" size="20" maxlength="50"> 
      </td>
    </tr>
    <tr bgcolor="#F9F9F9"> 
      <td height="26" align="right">真实姓名：</td>
      <td height="26"> <input name="txtrealname" type="text" class=bginput id="txtrealname" value="<%=strRealName%>" size="20" maxlength="10"></td>
    </tr>
    <tr valign="top" bgcolor="#eeeeee"> 
      <td colspan="2" align="center"><table width="98%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="154" colspan="2" align="center" bgcolor="#eeeeee"> 
              <fieldset>
              <legend><strong>管理权限分配</strong></legend>
              <table width="95%" border="0" cellspacing="0" cellpadding="5">
                <tr> 
                  <td height="69" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
                      <tr> 
                        <td><input name="chkLimit" type="checkbox" value="管理员管理" checked>
                          管理员管理　
　<input name="chkLimit" type="checkbox" value="数据库管理">
                          数据库管理　<%if GetKey("Enable",WebUserID,"vote")="Yes" then%>
<input name="chkLimit" type="checkbox" value="调查管理">
                          调查管理
						  <%end if%>
<%if GetKey("Enable",WebUserID,"popwin")="Yes" then%>
<input name="chkLimit" type="checkbox" value="公告管理">
                          公告管理　
<%end if%>
<%if GetKey("Enable",WebUserID,"counter")="Yes" then%>
<input name="chkLimit" type="checkbox" value="流量控制">
                          流量控制
						  <%end if%></td>
                      </tr>
                      <tr>
                        <td>
						<%
						for i=1 to ubound(arrMenu)
						%>
						  <input name="chkLimit" type="checkbox" id="chkLimit" value="<%=arrMenu(i)%>">
                          <%=arrMenu(i)%>　
						<%
						next
						%>
						</td>
                      </tr>
                      <tr>
                        <td><%if GetKey("Enable",WebUserID,"member")="Yes" then%>
						<input name="chkLimit" type="checkbox" value="会员管理">
                          会员管理
						  <%end if%>
                          <%if GetKey("Enable",WebUserID,"ad")="Yes" then%>
						  <input name="chkLimit" type="checkbox" value="广告管理">
                          广告管理　
						  <%end if%>
						  <%if GetKey("Enable",WebUserID,"link")="Yes" then%>
<input name="chkLimit" type="checkbox" value="友情链接">
                          友情链接
						  <%end if%></td>
                      </tr>
                    </table>
                  </td>
                </tr>
                <tr> 
                  <td>&nbsp;</td>
                </tr>
              </table>
              </fieldset></td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
    </tr>
    <tr align="center" bgcolor="#eeeeee"> 
      <td height="40" colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="5">
          <tr> 
            <td height="50" align="center"> 
              <input name="submit" type=submit class=button value="　保　存　" >
              　 
              <input name="YL" type=button class=button value="　关　闭　" onClick="window.close()"></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
<iframe name="BackFrame" width="0" height="0" src="about:blank"></iframe>
</body>
</html>