<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserInfo_Form.aspx.cs"
    Inherits="RM.Web.RMBase.SysUser.UserInfo_Form" EnableEventValidation="false" %>

<!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 runat="server">
    <title><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("UserInfo_Form")%></title>
    <link href="/Themes/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/Validator/JValidator.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/artDialog.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/artDialog/iframeTools.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/TreeTable/jquery.treeTable.js" type="text/javascript"></script>
    <link href="/Themes/Scripts/TreeTable/css/jquery.treeTable.css" rel="stylesheet"
        type="text/css" />
    <link href="/Themes/Scripts/TreeView/treeview.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/TreeView/treeview.pack.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/jsAddress.js" type="text/javascript"></script>
    <script type="text/javascript">
        //初始化
        $(function () {
            Setform();
            treeAttrCss();
            $('#table2').hide();
            $('#table3').hide();
            $('#table4').hide();
            $('#table5').hide();
            $('#table6').hide();
            ChekOrgClick();
            $("#photo").hover(function () {
                $("#photo").css("width", "200px");
            }
            , function () {
                $("#photo").css("width", "50px");
            }
            );            
        })
        //点击切换面板
        var IsFixedTableLoad = 1;
        function panel(obj) {
            if (obj == 1) {
                $('#table1').show();
                $('#table2').hide();
                $('#table3').hide();
                $('#table4').hide();
                $('#table5').hide();
                $('#table6').hide();
            } else if (obj == 2) {
                $('#table1').hide();
                $("#table2").show();
                $('#table3').hide();
                $('#table4').hide();
                $('#table5').hide();
                $('#table6').hide();
            } else if (obj == 3) {
                $('#table1').hide();
                $("#table2").hide();
                $('#table3').show();
                $('#table4').hide();
                $('#table5').hide();
                $('#table6').hide();
            } else if (obj == 4) {
                $('#table1').hide();
                $("#table2").hide();
                $('#table3').hide();
                $('#table4').show();
                $('#table5').hide();
                $('#table6').hide();
            } else if (obj == 5) {
                $('#table1').hide();
                $("#table2").hide();
                $('#table3').hide();
                $('#table4').hide();
                $('#table5').show();
                $('#table6').hide();
            }
            else if (obj == 6) {
                $('#table1').hide();
                $("#table2").hide();
                $('#table3').hide();
                $('#table4').hide();
                $('#table5').hide();
                $('#table6').show();
                $("#dnd-example").treeTable({
                    initialState: "expanded" //collapsed 收缩 expanded展开的
                });
                if (IsFixedTableLoad == 1) {
                    FixedTableHeader("#dnd-example", $(window).height() - 105);
                    IsFixedTableLoad = 0;
                }
            }
        }
        //附加信息表单赋值
        function Setform() {
            var pk_id = GetQuery('key');
            if (IsNullOrEmpty(pk_id)) {
                var strArray = new Array();
                var strArray1 = new Array();
                var item_value = $("#AppendProperty_value").val(); //后台返回值
                strArray = item_value.split(';');
                for (var i = 0; i < strArray.length; i++) {
                    var item_value1 = strArray[i];
                    strArray1 = item_value1.split('|');
                    $("#" + strArray1[0]).val(strArray1[1]);
                }
            }
        }
        //获取表单值
        function CheckValid() {       
            var user_code=$("#User_Code").val();                 
            if(!IsNullOrEmpty('<%=_key %>')) //yinggai shi meiyou 
            {            
                var msg = "";
                getAjax("/Member/YuserName.ashx","code="+user_code,function(data)
                {                    
                    msg = data;                         
                });                
                if(!IsNullOrEmpty(msg))   
                {                       
                    alert("职工工号重复请您重新输入");
                    return false;
                }   
            }           
            if (!CheckDataValid('#form1')) {
                return false;
            }            
            if (!IsNullOrEmpty(ChekOrgVale)) {
                showWarningMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("UserStudent_Form_xzbm")%>");
                return false;
            }
            var item_value = '';
            $("#AppendProperty_value").empty;
            $("#table2 tr").each(function (r) {
                $(this).find('td').each(function (i) {
                    var pk_id = $(this).find('input,select').attr('id');
                    if ($(this).find('input,select').val() != "" && $(this).find('input,select').val() != "==<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("plaese_sel")%>==" && $(this).find('input,select').val() != undefined) {
                        item_value += pk_id + "|" + $(this).find('input,select').val() + ";";
                    }
                });
            });
            $("#AppendProperty_value").val(item_value);
            $("#checkbox_value").val(CheckboxValue())
            if (!confirm('<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("AllotAuthority_Form_save")%>')) {
                return false;
            }            
        }        
        //验证所属部门必填
        var ChekOrgVale = "";
        function ChekOrgClick() {
            var pk_id = GetQuery('key');
            if (IsNullOrEmpty(pk_id)) {
                ChekOrgVale = 1;
            }
            $("#table3 [type = checkbox]").click(function () {
                ChekOrgVale = "";
                if ($(this).val() != "") {
                    if ($(this).attr("checked") == "checked") {
                        ChekOrgVale = 1;
                    };
                }
            })
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <%-- 所有打勾复选框值--%>
    <input id="checkbox_value" type="hidden" runat="server" />
    <%--获取附加信息值--%>
    <input id="AppendProperty_value" type="hidden" runat="server" />
    <div class="frmtop">
        <table style="padding: 0px; margin: 0px; " cellpadding="0" cellspacing="0">
            <tr>
                <td id="menutab" style="vertical-align: bottom;">
                    <div id="tab0" class="Tabsel" onclick="GetTabClick(this);panel(1)">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Jbxx")%></div>
                    <div id="tab1" class="Tabremovesel" onclick="GetTabClick(this);panel(2);">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Fjxx")%></div>
                    <div id="tab2" class="Tabremovesel" onclick="GetTabClick(this);panel(3);">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Organization")%></div>
                    <div id="tab3" class="Tabremovesel" onclick="GetTabClick(this);panel(4);">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Role")%></div>
                    <div id="tab4" class="Tabremovesel" onclick="GetTabClick(this);panel(5);">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("UserGroup")%></div>
                    <div id="tab5" class="Tabremovesel" onclick="GetTabClick(this);panel(6);">
                        <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Qx")%></div>
                </td>
            </tr>
        </table>
    </div>
    <div class="div-frm" style="height: 275px;">
        <%--基本信息--%>
        <table id="table1" border="0" cellpadding="0" cellspacing="0" class="frm">
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("UserInfo_Form_no")%>:
                </th>
                <td>
                    <input id="User_Code" runat="server" type="text" class="txt" datacol="yes" err="职工工号"
                        checkexpession="NotNull" style="width: 200px" />
                </td>
                  <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("User_Name")%>:
                </th>
                <td>
                    <input id="User_Name" runat="server" type="text" class="txt" datacol="yes" err="职工姓名"
                        checkexpession="NotNull" style="width: 200px" />
                </td>
                </tr>
                <tr>
                   <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("User_Sex")%>:
                </th>
                <td>
                    <select id="User_Sex" class="select" runat="server" style="width: 206px">                        
                    </select>
                </td>
                 <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("SystemRole")%>:
                </th>
                <td>
                    <select id="User_RoleType" class="select" runat="server" style="width: 206px">
                
                    </select>
                </td>
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("LoginList_luser")%>:
                </th>
                <td>
                    <input id="User_Account" runat="server" type="text" class="txt" datacol="yes" err="登录账户"
                        checkexpession="NotNull" style="width: 200px" />
                </td>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("User_Pwd")%>:
                </th>
                <td>
                    <input id="User_w" runat="server" type="text" class="txt" datacol="yes" err="登录密码"
                        checkexpession="NotNull" style="width: 200px" />
                </td>
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("User_Email")%>:
                </th>
                <td>
                    <input id="Email" runat="server" type="text" class="txt" datacol="yes" err="电子邮箱"
                        checkexpession="EmailOrNull" style="width: 200px" />
                </td>
                  <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("User_Title")%>:
                </th>
                <td colspan="3">
                    <input id="Title" runat="server" type="text" class="txt" style="width: 200px" />
                </td>
            </tr>
        
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CreateUser")%>:
                </th>
                <td>
                    <input id="CreateUserName" disabled runat="server" type="text" class="txt" style="width: 200px" />
                </td>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("User_CreatDate")%>:
                </th>
                <td>
                    <input id="CreateDate" disabled="disabled" runat="server" type="text" class="txt" style="width: 200px" />
                </td>
            </tr>
                <tr>
                 <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("question_lxdh")%>:                                        
                </th>
                <td colspan="">
                    <input id="Phone" runat="server" type="text" class="txt"  style="width: 200px" />
                </td>
                <th>
                    管理员是否显示在讲师列表:
                </th>
                <td>
                <select id="isTShow" runat="server">
		            <option value="0">否</option>	
	        	    <option value="1">是</option>
		        </select>
                </td>
            </tr>
<%--            <tr>
                <th>
                    修改用户:
                </th>
                <td>
                    <input id="ModifyUserName" disabled runat="server" type="text" class="txt" style="width: 200px" />
                </td>
                <th>
                    修改时间:
                </th>
                <td>
                    <input id="ModifyDate" disabled runat="server" type="text" class="txt" style="width: 200px" />
                </td>
            </tr>--%>
            <tr>
            <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("user_area")%>:</th><td colspan="3">
                <asp:DropDownList ID="Province" runat="server">
                </asp:DropDownList>                
                <select id="City" runat="server"></select>　<select id="Area" runat="server"></select>
                <input type="text" style="display:none;"  id="txtProvince" runat="server" />
                <input type="text" style="display:none;" id="txtCity" runat="server" />
                <input type="text" style="display:none;" id="txtArea" runat="server" />
</td>
            </tr>
            <tr>
              
            </tr>
            <tr>
                <th>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("User_Description")%>:
                </th>
                <td colspan="3">
                    <textarea id="User_Remark" class="txtRemark" runat="server" style="width: 552px;
                        height: 83px;"></textarea>
                </td>
            </tr>
            <tr>
                <th><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("User_Photo")%></th>
                 <td colspan="3" style=" border:1px #ccc solid;">
                <asp:FileUpload ID="FileUpload1" runat="server" style=" width:252px;" /><img src="/Mall/User_Image.ashx?id=<%=_key %>" width="50" style=" position:absolute; top:30px; left:0;" id="photo" />
                </td>
            </tr>
        </table>
        <%--附加信息--%>
        <table id="table2" border="0" cellpadding="0" cellspacing="0" class="frm">
            <%=str_OutputHtml.ToString()%>
        </table>
        <%--所属部门--%>
        <div id="table3">
            <div class="btnbartitle">
                <div>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Organization")%>
                </div>
            </div>
            <div class="div-body" style="height: 245px;">
                <ul class="strTree">
                    <%=strOrgHtml.ToString()%>
                </ul>
            </div>
        </div>
        <%--所属角色--%>
        <div id="table4">
            <div class="btnbartitle">
                <div>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Role")%>
                </div>
            </div>
            <div class="div-body" style="height: 245px;">
                <ul class="strTree">
                    <%=strRoleHtml.ToString()%>
                </ul>
            </div>
        </div>
        <%--所属工作组--%>
        <div id="table5">
            <div class="btnbartitle">
                <div>
                    <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("UserGroup")%>
                </div>
            </div>
            <div class="div-body" style="height: 245px;">
                <ul class="strTree">
                    <%=strUserGroupHtml.ToString()%>
                </ul>
            </div>
        </div>
        <%--用户权限--%>
        <div id="table6">
            <div class="div-body" style="height: 273px;">
                <table class="example" id="dnd-example">
                    <thead>
                        <tr>
                            <td style="width: 200px; padding-left: 20px;">
                                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("UserInfo_Form_url")%>
                            </td>
                            <td style="width: 30px; text-align: center;">
                                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Button_List_ico")%>
                            </td>
                            <td style="width: 20px; text-align: center;">
                                <label id="checkAllOff" onclick="CheckAllLine()" title="<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Quanxuan")%>">
                                    &nbsp;</label>
                            </td>
                            <td>
                                <%=RM.Common.DotNetConfig.LanguageHelper.GetKey("AllotAuthority_Form_quaxian")%>
                            </td>
                        </tr>
                    </thead>
                    <tbody>
                        <%=strUserRightHtml.ToString()%>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class="frmbottom">
        <asp:LinkButton ID="Save" runat="server" class="l-btn" OnClientClick="return CheckValid();"
            OnClick="Save_Click"><span class="l-btn-left">
            <img src="/Themes/Images/disk.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Save")%></span></asp:LinkButton>
        <a class="l-btn" href="javascript:void(0)" onclick="OpenClose();"><span class="l-btn-left">
            <img src="/Themes/Images/cancel.png" alt="" /><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Close")%></span></a>
    </div>
    </form>

    <script type="text/javascript">
        addressInit('Province', 'City', 'Area', '<%=ProvinceStr %>', '<%=CityStr %>', '<%=AreaStr %>');
    </script>

</body>
</html>
