<%@ Page Language="C#" MasterPageFile="~/Manager/Manger.Master" EnableEventValidation="false" AutoEventWireup="true" CodeBehind="Master.aspx.cs" Inherits="Stat.web.Manager.Master" Title="管理员管理" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    
<script type="text/javascript">

$(document).ready(function(){ 
 $("input[name$='btnSaveUser']").bind('click',CheckFrom); 
 $("a:contains('删除')").bind('click',function(){return confirm('确认要删除吗？');});  
 $("a:contains('Delete')").bind('click',function(){return confirm('确认要删除吗？');});  
 $(".forumRowHighlight").css("background-color","F6FBFF");
 $("input[name='chkall']").bind('click',function CheckPower(){ $("input[name!='chkall']").attr("checked",$(this).attr("checked")); });
 var isDisabled=$("input[name$='txtUserName']").attr("disabled"); 
 if(!isDisabled){ $("input[name$='txtUserName']").bind('blur',IsRegUser);} 

});

 function CheckFrom()
 { 
    var supan=$("#span_uName").text()
    var isDisabled=$("input[name$='txtUserName']").attr("disabled"); 
    var txtUserPWD1=$("input[name$='txtUserPWD1']").val();  
    var txtUserPWD2=$("input[name$='txtUserPWD2']").val(); 
    var domain= $("input[name$='txtSysID']").val();
    if(!isDisabled){if(supan !="可以使用！"){alert("请先验证 用户名 可用");$("input[name$='txtUserName']").focus(); return false;}}
    if(!isDisabled){if(!CheckLength(txtUserPWD1, 1)){$("input[name$='txtUserPWD1']").focus();alert("密码不能够为空！");return false;}}
    if(!CheckEqualsValue(txtUserPWD1,txtUserPWD2)){alert("两次密码不相同！");$("input[name$='txtUserPWD2']").focus();return false;} 
    if(!checkNum(domain)){   alert("需要一个数字");$("input[name$='txtSysID']").focus(); return false;   }
 
 }
      function IsRegUser()
      {
        var uName=$("input[name$='txtUserName']").val();
         if(!checkNum(uName))
         {
           $.get("/MyAJAX/HdCheckUser.ashx?t=Reg&n="+uName, callBack);
         }
         else{
           $("#span_uName").html("<span style=\"color:#FF0000\">不允许全是数字组合！</span>");
         }
                            
         
      }
      function callBack(data)
      {
          if(data=="ok")
          {
             $("#span_uName").html("可以使用！");
          }
          else if(data=="0")
          {
            $("#span_uName").html("<span style=\"color:#FF0000\">该用户已经存在！</span>");
          }
          else
          {
            $("#span_uName").html("网络错误，请稍候再试！");
          }
      }  
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpTop" runat="server">
<div style="margin-top: 5px;">
    当前位置：用户管理 &gt; 管理员
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cpMSG" runat="server">
 <span class="M_b14">小贴士：</span> 你可以管理 管理员信息。   
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="cpMain" runat="server">
<br />
        <table align="left" width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td valign="top" align="center">
                    <asp:Panel ID="pnUserList" runat="server" BackColor="White" Width="100%">
                        <asp:GridView ID="gvUserList" runat="server" AutoGenerateColumns="False" EmptyDataText="没有找到"
                            GridLines="None" OnRowDataBound="gvUserList_RowDataBound" OnRowDeleting="gvUserList_RowDeleting"
                            OnRowEditing="gvUserList_RowEditing" Width="100%" BorderColor="#CEDFEF" 
                            BorderWidth="1px" CssClass="tableBorder" onrowcommand="gvUserList_RowCommand">
                            <Columns>
                                <asp:BoundField DataField="UserId" HeaderText="ID" SortExpression="WebId">
                                    <HeaderStyle Height="25px" Font-Size="14px" />
                                    <ItemStyle HorizontalAlign="Center" Width="50px" />
                                </asp:BoundField>
                                <asp:BoundField DataField="UserName" HeaderText="用户名" SortExpression="WebName">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="UserGroup" HeaderText="用户组" SortExpression="WebUrl">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:BoundField DataField="AddTime" HeaderText="注册时间">
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:BoundField DataField="UserState" HeaderText="状态">
                                <ItemStyle CssClass="forumRow" HorizontalAlign="Center" Width="40px" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="编辑权限">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lBtnEditPower" runat="server" CommandArgument='<%#Eval("UserId")%>' 
                                            CommandName="editPower">编辑权限</asp:LinkButton>
                                    </ItemTemplate>
                                    <ItemStyle Width="70px" />
                                </asp:TemplateField>
                                <asp:ButtonField CommandName="Edit" Text="编辑">
                                    <ItemStyle Width="30px" />
                                </asp:ButtonField>
                                <asp:CommandField ShowDeleteButton="True">
                                    <ItemStyle Width="30px" />
                                </asp:CommandField>
                            </Columns>                            
                            <HeaderStyle BackColor="#E9F1FA" Height="20px" />
                        </asp:GridView>
                        <br />                        
                        用户名或者EMAIL或者QQ：<asp:TextBox ID="txtW" runat="server"></asp:TextBox>&nbsp;
         <asp:Button ID="btnSearch" runat="server" Text="查找" onclick="btnSearch_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
         <br />  <br />
         <asp:Literal ID="ltrPageIndex" runat="server"></asp:Literal>
         
        </asp:Panel>                        
                        
                        
                    <asp:Panel ID="pnUserAdd" runat="server" BackColor="White" Visible="False"
                        Width="100%">
                        <table bgcolor="#cedfef" border="0" cellpadding="0" cellspacing="1" class="padding" style="width: 100%">
                            <tr>
                                <td colspan="2" style="height: 3px" bgcolor="#e9f1fa" height="25">
                                    <strong><span style="font-size: 12pt">
                                    添加/修改用户资料</span></strong></td>
                            </tr>
                            <tr>
                                <td style="width: 155px; height: 64px; text-align: right" bgcolor="#ffffff">
                                    用户：</td>
                                <td style="height: 64px; text-align: left" bgcolor="#ffffff">
                                    <asp:TextBox ID="txtUserName" runat="server" Width="150px"></asp:TextBox><span id="span_uName">
                                    *</span>         
                                    <asp:HiddenField ID="hdfUserId" runat="server" />
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 155px; text-align: right" bgcolor="#ffffff">
                                    新密码：</td>
                                <td style="text-align: left" bgcolor="#ffffff">
                                    <asp:TextBox ID="txtUserPWD1" runat="server" TextMode="Password" Width="150px"></asp:TextBox>
                                    </td>
                            </tr>
                            <tr>
                                <td style="width: 155px; text-align: right" bgcolor="#ffffff">
                                    确认新密码：</td>
                                <td style="text-align: left" bgcolor="#ffffff">
                                    <asp:TextBox ID="txtUserPWD2" runat="server" TextMode="Password" Width="150px"></asp:TextBox>
                                    </td>
                            </tr>
                            <tr>
                                <td style="width: 155px; height: 22px; text-align: right" bgcolor="#ffffff">
                                    Email：</td>
                                <td style="height: 22px; text-align: left" bgcolor="#ffffff">
                                    <asp:TextBox ID="txtUEmail" runat="server" Width="150px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td bgcolor="#ffffff" style="width: 155px; height: 22px; text-align: right">
                                    QQ：</td>
                                <td bgcolor="#ffffff" style="height: 22px; text-align: left">
                                    <asp:TextBox ID="txtUQQ" runat="server" Width="150px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td bgcolor="#ffffff" style="width: 155px; height: 22px; text-align: right">
                                    域ID：</td>
                                <td bgcolor="#ffffff" style="height: 22px; text-align: left">
                                    <asp:TextBox ID="txtSysID" runat="server" Width="50px"></asp:TextBox>(数字)
                                </td>
                            </tr>
                            <tr>
                                <td bgcolor="#ffffff" style="width: 155px; height: 22px; text-align: right">
                                    状态：</td>
                                <td bgcolor="#ffffff" style="height: 22px; text-align: left">
                                    <asp:RadioButtonList ID="rBtnList" runat="server" RepeatDirection="Horizontal">
                                        <asp:ListItem Selected="True" Value="1">启用</asp:ListItem>
                                        <asp:ListItem Value="0">禁用</asp:ListItem>
                                    </asp:RadioButtonList>
                                </td>
                            </tr>
                            <tr>
                                <td bgcolor="#ffffff" colspan="2">
                                    <asp:Button ID="btnSaveUser" runat="server" OnClick="btnSaveUser_Click" 
                                        Text="修改" />
                                    <asp:HiddenField ID="hdfOldPWD" runat="server" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                     <asp:Panel ID="pnPower" runat="server" BackColor="White" Visible="False" Width="100%">
                     
                        <table bgcolor="#cedfef" border="0" cellpadding="0" cellspacing="1" class="padding" width="100%">
                            <tr>
                                <td  colspan="2" style="height: 26px" bgcolor="#e9f1fa" height="25">
                                    <strong><span style="font-size: 12pt">
                                    [<asp:Literal ID="ltrMasterName" runat="server"></asp:Literal>] 权限配置</span></strong></td>
                            </tr>
                            <tr style="color: #000000">
                                <td bgcolor="#ffffff">
                                <br />
                                    注意：【管理员管理】是最高的权限，拥有该权限的用户，可给所有用户（包括自身）分配权限。
                                <br /><br />
                                <asp:Literal ID="ltrPowerList" runat="server"></asp:Literal>
                                   </td>        
                            </tr>
                            <tr>
                                <td bgcolor="#FFFFFF" style="height: 26px; " colspan="2">
                                <input name="chkall" id="chkall" type="checkbox" value="" />选择所有权限&nbsp; &nbsp;<asp:Button ID="btnEditSave" runat="server" OnClick="btnEditSave_Click" 
                                        Text="保存权限" />
                                    <asp:HiddenField ID="hdfEditMasterId" runat="server" />
                                </td>
                            </tr>
                        </table>
                     
                        </asp:Panel>
                    
                </td>
            </tr>
        </table> 
</asp:Content>