<%@ page language="C#" autoeventwireup="true" inherits="e_administrator_do, ZKCMS" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>
<%@ Register TagName="meta" TagPrefix="UC" Src="~/e/meta.ascx" %>
<%@ Register TagName="head" TagPrefix="UC" Src="~/e/head.ascx" %>
<%@ Register TagName="foot" TagPrefix="UC" Src="~/e/foot.ascx" %><!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>
<UC:meta ID="meta1" runat="server" />
</head>
<body>
<form id="form1" runat="server" autocomplete="off">
    <asp:Label ID="pathcode" runat="server" style="display: none">&nbsp;&raquo;&nbsp;系统设置&nbsp;&raquo;&nbsp;<a href="administrator.aspx">管理员设置</a>&nbsp;&raquo;&nbsp;添加/修改</asp:Label>
    <UC:head ID="head1" runat="server" />
    <%--main start--%>
        <div class="c1">
            <div class="b1">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td class="b1_l"></td>
                        <td>
                            <div class="con1">
                                <ul>
                                    <li><a href="role.aspx">角色设置</a></li>
                                    <li class="on" style="width: 80px"><a href="administrator.aspx">管理员设置</a></li>
                                </ul>
                                <div class="clear"></div>
                            </div>
                        </td>
                        <td align="right"><div class="con2"></div></td>
                        <td class="b1_r"></td>
                    </tr>
                </table>
            </div>
            <div class="v1">
                <div class="do1">
                    <script type="text/javascript">ContinueMake=1;
                        function check_u(){ContinueMake=0;ajax("get",location.href.substring(0,location.href.indexOf(".aspx")+5)+"?act=ajax&field=u&value="+base64en(document.getElementById("u").value)+"&id="+document.getElementById("HiddenField_ID").value+"&msg="+encodeURI("该用户名已被占用，请重新输入用户名！")+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){document.getElementById("msg_u").innerHTML=xmlHttp.responseText;ContinueMake=1;}});}
                        function check_tel(){ContinueMake=0;ajax("get",location.href.substring(0,location.href.indexOf(".aspx")+5)+"?act=ajax&field=tel&value="+base64en(document.getElementById("tel").value)+"&id="+document.getElementById("HiddenField_ID").value+"&msg="+encodeURI("该手机号码已被占用，请重新输入手机号码！")+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){document.getElementById("msg_tel").innerHTML=xmlHttp.responseText;ContinueMake=1;}});}
                        function check_qq(){ContinueMake=0;ajax("get",location.href.substring(0,location.href.indexOf(".aspx")+5)+"?act=ajax&field=qq&value="+base64en(document.getElementById("qq").value)+"&id="+document.getElementById("HiddenField_ID").value+"&msg="+encodeURI("该QQ号已被占用，请重新输入QQ号！")+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){document.getElementById("msg_qq").innerHTML=xmlHttp.responseText;ContinueMake=1;}});}
                        function check_email(){ContinueMake=0;ajax("get",location.href.substring(0,location.href.indexOf(".aspx")+5)+"?act=ajax&field=email&value="+base64en(document.getElementById("email").value)+"&id="+document.getElementById("HiddenField_ID").value+"&msg="+encodeURI("该邮箱已被占用，请重新输入邮箱！")+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){document.getElementById("msg_email").innerHTML=xmlHttp.responseText;ContinueMake=1;}});}
                        function check_pold(){ContinueMake=0;ajax("get",location.href.substring(0,location.href.indexOf(".aspx")+5)+"?act=ajax&field=pold&value="+base64en(document.getElementById("pold").value)+"&id="+document.getElementById("HiddenField_ID").value+"&msg="+encodeURI("原密码不正确！")+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){document.getElementById("msg_pold").innerHTML=xmlHttp.responseText;ContinueMake=1;}});}
                                        
                        function check(){if(ContinueMake!=1){setTimeout(check,1000);return false;}     
                            if(document.getElementById("role").value==""){alert("请选择角色组");return false;}         
                            if(document.getElementById("p").value==""){if(location.href.indexOf("act=mod")==-1){alert("请输入密码");return false;}}
                            if(document.getElementById("p").value!=document.getElementById("pcopy").value){alert("两次密码输入不一致！");return false;}
                            if(document.getElementById("u").value==""){alert("请输入用户名");return false;}         
                            if(document.getElementById("tel").value!=""){if (!telReg.test(document.getElementById("tel").value)){alert("请输入正确的手机号码！");return false;}}   
                            if(document.getElementById("qq").value!=""){if (!qqReg.test(document.getElementById("qq").value)){alert("请输入正确的QQ号！");return false;}} 
                            if(document.getElementById("email").value!=""){if (!emailReg.test(document.getElementById("email").value)){alert("请输入正确的邮箱！");return false;}}
                            if(document.getElementById("note").value!=""){if(document.getElementById("note").value.length>100){alert("备注长度超出限制！");return false;}}       
                                     
                            var arr1="u,tel,qq,email".split(",");var arr2="用户名,手机号码,QQ号,邮箱".split(",");
                            for(var i=0;i<arr1.length;i++){if(document.getElementById("msg_"+arr1[i]).innerHTML!=""){alert(arr2[i]+"被占用！");return false;}}
                                       
                            if(document.getElementById("msg_pold")){
                                if(document.getElementById("pold").value==""){alert("请输入原密码！");return false;}
                                if(document.getElementById("msg_pold").innerHTML.indexOf("原密码不正确！")!=-1){alert("原密码不正确！");return false;}
                            }
                        }
                    </script>
                    <asp:Panel ID="Panel1" runat="server" Visible="false">
                        <table border="0" cellpadding="0" cellspacing="0" class="table1">
                            <tr>
                                <td class="tt"><b>输入原密码：</b></td>
                                <td><asp:TextBox ID="pold" runat="server" TextMode="Password" MaxLength="20" CssClass="inp1" Width="150" onblur="check_pold()"></asp:TextBox><span id="msg_pold" style="margin-left: 10px"><span class="msgon">请输入原密码！</span></span></td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <table border="0" cellpadding="0" cellspacing="0" class="table1">
                        <tr>
                            <td class="tt"><b>所属角色组：<asp:HiddenField ID="HiddenField_ID" runat="server" /></b></td>
                            <td><asp:DropDownList ID="role" runat="server" CssClass="s12" Width="155"></asp:DropDownList></td>
                        </tr>
                        <tr>
                            <td class="tt"><b>密码：</b></td>
                            <td>
                                <table border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td><asp:TextBox ID="p" runat="server" TextMode="Password" MaxLength="20" CssClass="inp1" Width="150" autocomplete="off"></asp:TextBox></td>
                                        <td class="tt"><b>再次输入密码：</b></td>
                                        <td>
                                            <asp:TextBox ID="pcopy" runat="server" TextMode="Password" MaxLength="20" CssClass="inp1" Width="150" autocomplete="off"></asp:TextBox>
                                            <span id="msg_pwd" style="margin-left: 10px; display: none"><span class="msgon">不修改密码请留空！</span></span>
                                            <script type="text/javascript">
                                                if(location.href.indexOf("act=mod")!=-1)document.getElementById("msg_pwd").style.display="";
                                            </script>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td class="tt"><b>用户名：</b></td>
                            <td><asp:TextBox ID="u" runat="server" MaxLength="20" CssClass="inp1" Width="150" onkeyup="replaceCharLegal(this,this.value,1)" onblur="replaceCharLegal(this,this.value,0);check_u()" autocomplete="off"></asp:TextBox><span id="msg_u" style="margin-left: 10px"></span></td>
                        </tr>
                        <tr>
                            <td class="tt">手机号码：</td>
                            <td><asp:TextBox ID="tel" runat="server" MaxLength="11" CssClass="inp1" Width="150" onblur="check_tel()" autocomplete="off"></asp:TextBox><span id="msg_tel" style="margin-left: 10px"></span></td>
                        </tr>
                        <tr>
                            <td class="tt">QQ：</td>
                            <td><asp:TextBox ID="qq" runat="server" MaxLength="15" CssClass="inp1" Width="150" onblur="check_qq()" autocomplete="off"></asp:TextBox><span id="msg_qq" style="margin-left: 10px"></span></td>
                        </tr>
                        <tr>
                            <td class="tt">邮箱：</td>
                            <td><asp:TextBox ID="email" runat="server" MaxLength="100" CssClass="inp1" Width="300" onblur="check_email()" autocomplete="off"></asp:TextBox><span id="msg_email" style="margin-left: 10px"></span></td>
                        </tr>
                        <tr>
                            <td class="tt">备注：</td>
                            <td><asp:TextBox ID="note" runat="server" TextMode="MultiLine" CssClass="inp1" Width="423" Height="100" autocomplete="off"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td class="tt">&nbsp;</td>
                            <td><asp:Button ID="ButtonSubmit" runat="server" CssClass="but1" Text="添加" OnClick="ButtonSubmit_Click" OnClientClick="return check()" /><input class="but1" style="margin-left: 10px" type="button" value="返回" onclick="history.back()" /></td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    <%--main end--%>
    <UC:foot ID="foot1" runat="server" />
</form>
</body>
</html>
