<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserInfo.aspx.cs" Inherits="Web.User.UserInfo" %>
<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>用户信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file = "../Css/userCssEdit.htm" -->
    <script language="javascript" type="text/javascript" src="../Editor/My97DatePicker/WdatePicker.js"></script>
    <script language="javascript" type="text/javascript" src="../Js/pwdintensity.js"></script>
    <script type="text/javascript" src="../Editor/WpdccEditor/lang/zh_CN.js" charset="utf-8"></script>
    <script type="text/javascript" src="../Editor/WpdccEditor/kindeditor.js"></script>
    <link rel="stylesheet" href="../Editor/UserEditor/themes/default/default.css" />
    <script language="javascript" type="text/javascript">
    var rank = 100;
	function changePwdRank(o) {
	    if (o) {
		    rank = PwdIntensity(o.value);
		    printIntensity(rank);
	    }
    }
	
	function CheckPassword(){

        var flag = document.getElementById("<%= allow.ClientID %>");
        if(flag==null )
        {
            if (rank < <%= Common.Config.userStrongPassword %>)
                {
                    alert("密码过于简单,请重新输入密码!")
                    return false;
                }else{
                    if(addCheckText()){
                        return true ;
                    }else {
                        return false ;
                    }
                }
        }
        else{
            if (flag.checked)
            {
                if (rank < <%= Common.Config.userStrongPassword %>)
                {
                    alert("密码过于简单,请重新输入密码!")
                    return false;
                }else{
                    if(checkText()){
                        return true ;
                    }else {
                        return false ;
                    }
                }
            }else{
                if(checkTextNopwd()){
                    return true ;
                }else {
                    return false ;
                }
            }
        }
        
	}
	
	//加载预览图片
	function showuserphoto(){
		if(document.user.photo.value!=null)
		{
		    var arr = document.user.photo.value;
		    document.getElementById("pho").innerHTML="<img src="+arr+" height='80' width='80' />";
		}
	}
	
	function checkTextNopwd(){
	    var fullName=document.getElementById("fullName").value;
	    if(fullName==""){
	        alert ("用户昵称不能为空");
	        return false ;
	    }
	    var email=document.getElementById("email").value;
	    if(email==""){
	        alert ("电子邮件不能为空");
	        return false ;
	    }else{
	        var zzmob = /^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/;
                if ( !(zzmob.test(document.getElementById("email").value)) ) {
                    alert("电子邮件格式有误!");
                    document.getElementById("email").focus();
                    return false;
                }
	    }
	    //验证
	    if (checkAllValidate()) {
	        return true;
	    }
	    else {
	        return false;
	    }
	    return true ;
	}
	
	function checkText(){
	    var password=document.getElementById("password").value;
	    if(password==""){
	        alert ("密码不能为空");
	        return false ;
	    }
	    var password1=document.getElementById("password1").value;
	    if(password1!=password){
	        alert ("验证密码不一致");
	        return false ;
	    }
	    
	    var fullName=document.getElementById("fullName").value;
	    if(fullName==""){
	        alert ("用户昵称不能为空");
	        return false ;
	    }
	    var email=document.getElementById("email").value;
	    if(email==""){
	        alert ("电子邮件不能为空");
	        return false ;
	    }else{
	        var zzmob = /^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/;
                if ( !(zzmob.test(document.getElementById("email").value)) ) {
                    alert("电子邮件格式有误!");
                    document.getElementById("email").focus();
                    return false;
                }
	    }
	    //验证
	    if (checkAllValidate()) {
	        return true;
	    }
	    else {
	        return false;
	    }
	    return true ;
	}
	
	function addCheckText(){
	    var password=document.getElementById("name").value;
	    if(password==""){
	        alert ("用户帐号不能为空");
	        return false ;
	    }
	    var password=document.getElementById("password").value;
	    if(password==""){
	        alert ("密码不能为空");
	        return false ;
	    }
	    var password1=document.getElementById("password1").value;
	    if(password1!=password){
	        alert ("验证密码不一致");
	        return false ;
	    }
	    
	    var fullName=document.getElementById("fullName").value;
	    if(fullName==""){
	        alert ("用户昵称不能为空");
	        return false ;
	    }
	    var email=document.getElementById("email").value;
	    if(email==""){
	        alert ("电子邮件不能为空");
	        return false ;
	    }else{
	        var zzmob = /^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/;
                if ( !(zzmob.test(document.getElementById("email").value)) ) {
                    alert("电子邮件格式有误!");
                    document.getElementById("email").focus();
                    return false;
                }
	    }
	    //验证
	    if (checkAllValidate()) {
	        return true;
	    }
	    else {
	        return false;
	    }
	    return true ;
	}
    </script>
</head>
<body>
    <form id="user" method="post" runat="server">
    <div class="edit-func-box func-box">
        <div class="hd b">
            <asp:Label ID="labtitle" runat="server" Text=""></asp:Label></div>
        <div class="bd">
            <table class="edit-table">
                <tr>
                    <th width="20%">
                        用户帐号：
                    </th>
                    <td width="30%">
                        <asp:TextBox ID="name" class="input-txt" runat="server" MaxLength="30"></asp:TextBox>
                        <span style="color: red;">*</span>
                        <asp:Label ID="nameExit" runat="server" ForeColor="Red" Visible="False">用户名已存在！</asp:Label>
                    </td>
                    <th rowspan="4" width="20%" align="center">
                            
                    </th>
                    <td rowspan="4" align="left" valign="middle" >
                    <div id="pho" style="display: inline; width: 80px; height: 80px; " runat="server"></div>
                    <asp:HiddenField ID="photo" runat="server" />
                    <p><a id="uploaduserphoto" href="#">上传头像</a></p><p><span class="lgrey">(80*80)</span></p>
                    </td>
                </tr>
                <tr>
                    <th>
                        用户昵称：
                    </th>
                    <td colspan="3">
                        <asp:TextBox ID="fullName" runat="server" CssClass="input-txt" MaxLength="30"></asp:TextBox>
                        <span style="color: red;">*</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        <asp:CheckBox ID="allow" runat="server" Text="更改密码：" AutoPostBack="True" OnCheckedChanged="allow_CheckedChanged">
                        </asp:CheckBox><asp:Label ID="lbpwd" runat="server" Text="输入密码：" Visible="false"></asp:Label>
                    </th>
                    <td>
                        <asp:TextBox ID="password" runat="server" TextMode="Password" Enabled="False" onkeyup="changePwdRank(this)" CssClass="input-txt" MaxLength="30"></asp:TextBox>
                        <span id="PasswordCheck" style="width: 200px; display: none; background-position: 0px 0px;
                            background-image: url(../images/system/password_check_bk.gif); background-repeat: no-repeat;
                            height: 15px; overflow: hidden"></span><span style="color: red;">*</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        确认密码：
                    </th>
                    <td>
                        <asp:TextBox ID="password1" runat="server" TextMode="Password" Enabled="False" CssClass="input-txt" MaxLength="30"></asp:TextBox>
                        <span style="color: red;">*</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        性别：
                    </th>
                    <td>
                        <asp:DropDownList ID="sex" class="drop-txt" runat="server">
                            <asp:ListItem Value="" Selected="True">未选择</asp:ListItem>
                            <asp:ListItem Value="男">男</asp:ListItem>
                            <asp:ListItem Value="女">女</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                    出生日期：
                    </th>
                    <td>
                        <asp:TextBox ID="born" runat="server" CssClass="input-txt" MaxLength="19" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" ></asp:TextBox>
                    </td>
                    </tr>
                <tr>
                    <th>
                        工作单位：
                    </th>
                    <td>
                        <asp:TextBox ID="company" runat="server" CssClass="input-txt" MaxLength="40"></asp:TextBox>
                    </td>
                    <th id="add1"  runat="server">
                        密码提示问题：
                    </th>
                    <td id="add2"  runat="server">
                        <asp:TextBox ID="question" runat="server" CssClass="input-txt" MaxLength="30" notNull="true" msgName="密码提示问题"></asp:TextBox><span style="color: red;">*</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        所在部门：
                    </th>
                    <td>
                        <asp:DropDownList ID="department" runat="server" DataTextField="name" DataValueField="pkId" class="drop-txt">
                        </asp:DropDownList>
                    </td>
                    <th id="add3"  runat="server">
                        提示问题答案：
                    </th>
                    <td id="add4"  runat="server">
                        <asp:TextBox ID="answer" runat="server" CssClass="input-txt" MaxLength="30" notNull="true" msgName="提示问题答案"></asp:TextBox><span style="color: red;">*</span>
                    </td>
                </tr>
                <tr>
                    <th>
                        联系电话：
                    </th>
                    <td>
                        <asp:TextBox ID="tel" runat="server" CssClass="input-txt" MaxLength="30"></asp:TextBox>
                    </td>
                    <th>
                            <asp:Label ID="labNetworkTest" runat="server" Text="内外网测试员："></asp:Label>
                    </th>
                    <td>
                        <asp:DropDownList ID="networkTest" runat="server" CssClass="input-txt" >
                            <asp:ListItem Value="0">否</asp:ListItem>
                            <asp:ListItem Value="1">是</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                        QQ号码：
                    </th>
                    <td>
                        <asp:TextBox ID="qq" runat="server" CssClass="input-txt" MaxLength="15"></asp:TextBox>
                    </td>
                    <th>
                            <asp:Label ID="labGradeId" runat="server" Text="用户等级："></asp:Label>
                    </th>
                    <td>
                        <asp:DropDownList ID="gradeId" runat="server" DataValueField="pkId" DataTextField="name" CssClass="input-txt" >
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                        电子邮件：
                    </th>
                    <td>
                        <asp:TextBox ID="email" CssClass="input-txt" runat="server"></asp:TextBox>
                        <span style="color: red;">*</span>
                    </td>
                    <th>
                        <asp:Label ID="labUsersGroup" runat="server" Text="用户组："></asp:Label>
                    </th>
                    <td >
                        <asp:DropDownList ID="usersGroup" runat="server"  DataTextField="groupName" DataValueField="pkId" CssClass="input-txt" >
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                        个人简介：
                    </th>
                    <td colspan="3">
                        <asp:TextBox ID="intro" runat="server" CssClass="input-txt" Height="50" Width="455" TextMode="MultiLine" MaxLength="50"></asp:TextBox>
                    </td>
                </tr>
            </table>
            <asp:HiddenField ID="readInfoType" runat="server" />
            <asp:HiddenField ID="manageAll" runat="server" />
            <asp:HiddenField ID="Auditing" runat="server" />
            <asp:HiddenField ID="recommandRight" runat="server" />
            <asp:HiddenField ID="topRight" runat="server" />
        </div>
        <div class="ft">
            <div class="action-field txt-c">
                <asp:Button ID="ok" class="btn" runat="server" Text="修 改" OnClientClick="return CheckPassword();" OnClick="ok_Click"></asp:Button>
                &nbsp;&nbsp;&nbsp;
                <input type="button" class="btn" value="关 闭" onclick="parent.$.fancybox.close();" />
                <asp:Label ID="labMassage" runat="server" Text="" ForeColor="Red" Visible="false"></asp:Label>
            </div>
        </div>
    </div>
    </form>
    
    <script type="text/javascript" src="../Editor/UserEditor/kindeditor.js"></script>

    <script type="text/javascript" src="../Editor/UserEditor/lang/zh_CN.js" charset="utf-8"></script>

    <script type="text/javascript" language="javascript">
    //自定义上传图片控件加载，支持自定义上传图片功能需先引用三个文件，[themes/default/default.css] [kindeditor.js] [lang/zh_CN.js]
			KindEditor.ready(function(K) {
				var editor = K.editor({
				    uploadJson : '../Editor/UserEditor/aspnet/upload_json.ashx',
				    fileManagerJson : '../Editor/UserEditor/aspnet/file_manager_json.ashx',
					allowFileManager : true
				});
				K('#uploaduserphoto').click(function() {
					editor.loadPlugin('zdyimage', function() {
						editor.plugin.zdyimageDialog({
							zdyimageUrl : K('#photo').val(),
							clickFn : function(url) {
								K('#photo').val(url);
								editor.hideDialog();
								showuserphoto();
							}
						});
					});
				});
			});
    </script>
</body>
</html>
