<%@ Page Language="C#" AutoEventWireup="false" EnableEventValidation="false" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Controls" Assembly="Hishop.Web.Controls" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Management" Assembly="Hishop.Web.Management" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Validator" Assembly="Hishop.Web.Validator" %>
<%@ Register TagPrefix="UI" Namespace="ASPNET.WebControls" Assembly="ASPNET.WebControls" %>
<%@ Import Namespace="Hishop.SystemServices" %>

<!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>
    <Hishop:HeadContainer ID="HeadContainer1" runat="server" />
    <Hishop:PageTitle ID="PageTitle1" runat="server" />
    <link rel="stylesheet" href="../../utility/validate/pagevalidator.css" type="text/css" />
    <link rel="stylesheet" href="../css/Hishopv5.css" type="text/css" />
    <script type="text/javascript" src="../../utility/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="../../utility/validate/pagevalidator.js"></script>
    
    <script type="text/javascript" src="../js/Hishopv5.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div class="PageTitleArea">
                <div class="PageTitle">
                    <asp:Literal ID="litManagerTop" runat="server" Text="<%$ Resources:Managers, IDS_PageTitle %>" ></asp:Literal>
                </div>
                <div style="width: 80%;">
                    <asp:Literal ID="litManagerDisciption" runat="server" Text="<%$ Resources:Managers, IDS_PageDesc %>" ></asp:Literal>
                </div>
            </div>
            <Hishop:Managers ID="Managers" runat="server">
            <SkinTemplate>

 <script type="text/javascript">
     

      
    $(document).ready(function(){
    
        var $_txtUserName=$('#Managers_txtUserName');
        var $_txtRoles=$('#Managers_txtRoles');
        var $_txtUserId=$('#Managers_txtUserId');
        var $_txtRoleType=$('#txtRoleType');
       
        jQuery.myfn={
           OpenWindow: function(userId,userName)
           {
             if (dialogMessage.get_isShowing()) {
                dialogMessage.Close();			
             }
             else {
                $_txtUserId.attr({'value':userId});
                $_txtUserName.attr({'value':userName});
                $_txtRoles.attr({'value':''});
                CB_LstUserTable.callback('ShowRoles',userName,userId);
                CB_LstAddUserTable.callback('ShowRoles',userName,userId);
                dialogMessage.Show();
             }
           },
           AddRoles:function(){
                if ($_txtRoles.attr('value')==undefined)
                {
                  alert('当前没有选择操作的部门或当前用户为超级管理员无须设置部门.');
                }
                else if ($_txtRoleType.attr('value')!='Managers_lstUserTable')
                {
                  alert('添加部门需要选择左边还没有添加的部门.');
                }
                else
                {
                  CB_LstAddUserTable.callback('addRoles',$_txtUserName.attr('value'),$_txtRoles.attr('value'),$_txtUserId.attr('value'));
                  CB_LstUserTable.callback('ShowRoles',$_txtUserName.attr('value'),$_txtUserId.attr('value'));
                  $_txtRoles.attr({'value':''});
                  $_txtRoleType.attr({'value':''});
                }
           },     
           DeleteRoles:function(){
                if ($_txtRoles.attr('value')==undefined)
                {
                  alert('当前没有选择操作的部门或当前用户为超级管理员无须设置部门.');
                }
                else if ($_txtRoleType.attr('value')!='Managers_lstAddUserTable')
                {
                  alert('删除需要选择右边栏已添加的部门.');
                }
                else
                {
                  CB_LstAddUserTable.callback('deleteRoles',$_txtUserName.attr('value'),$_txtRoles.attr('value'),$_txtUserId.attr('value'));
                  CB_LstUserTable.callback('ShowRoles',$_txtUserName.attr('value'),$_txtUserId.attr('value'));
                  $_txtRoles.attr({'value':''});
                  $_txtRoleType.attr({'value':''});
                }
           },
           SelectOption:function(SelectControl)
           {
                var index=SelectControl.selectedIndex;
                var val = SelectControl.options[index].value;
                $_txtRoles.attr({'value':val});
                $_txtRoleType.attr({'value':SelectControl.id});

           }
        };
    }
  );

	
</script>

<Hishop:StatusMessage id="Status" runat="server" Visible="False" />
        
<Hishop:ManagerSearch ID="managerSearch" runat="server" >
<SkinTemplate>
<fieldset class="AdminSearchform">
    <legend>
        <asp:Literal ID="litSelectQuery" runat="server" Text="<%$ Resources:ManagerSearch, IDS_FromField_litSelectQuery %>"></asp:Literal></legend>
    <table width="45%" border="0" cellspacing="0" cellpadding="0" style="margin-left: 18px">
        <tr>
            <td class="searchTableLeftTD">
                <nobr>
                    <asp:Label ID="lblSearchText" runat="server" CssClass="searchFormText" Text="<%$ Resources:ManagerSearch, IDS_FromField_Keywords %>"></asp:Label>：</nobr>
            </td>
            <td class="searchTableControlTD">
                <asp:TextBox ID="txtSearchText" runat="server" Width="135px"></asp:TextBox></td>
            <td class="searchTableLeftTD">
                <nobr>
                    <asp:Label ID="lblUserGroup" CssClass="searchFormText" runat="server" Text="<%$ Resources:ManagerSearch, IDS_FromField_lblUserGroup %>"></asp:Label>：</nobr>
            </td>
             <td class="searchTableControlTD">
                <Hishop:RoleDropDownList ID="dropRolesList" runat="server" SystemAdmin="true"
                    NullToDisplay="<%$ Resources:ManagerSearch, IDS_FromField_RoleDropListNullName %>" /></td>
            <td class="searchTableLeftTD">
                <nobr>
                    <asp:Label ID="lblPageSize" CssClass="searchFormText" runat="server" Text="<%$ Resources:ManagerSearch, IDS_FromField_PageSize %>" />：</nobr></td>
            <td class="searchTableControlTD">
                <Hishop:PageSizeDropDownList ID="dropPageSize" runat="server" />
            </td>
            <td class="bottonTD">
                <asp:Button ID="btnSearchButton" runat="server" Text="<%$ Resources:ManagerSearch, IDS_Button_Search %>"
                    CssClass="inp_L1" /></td>
        </tr>
    </table>
</fieldset>
</SkinTemplate>
</Hishop:ManagerSearch>

<div class="grdGroupFormList">
    <div class="grdHeaderStyle">
        <ul>
            <li class="addAdministrator"><a href='<%= SiteUrls.Instance().UrlData.FormatUrl("admin_AddGlobalManager")%>'>
                <asp:Literal ID="lblAddManager" runat="server" Text="添加超级管理员"></asp:Literal></a></li>
            <li class="spirtLines">|</li>
            <li class="addAdministrator"><a href='<%= SiteUrls.Instance().UrlData.FormatUrl("admin_AddManager")%>'>
                <asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:Managers, IDS_FromField_lblAddManager %>"></asp:Literal></a></li>
            <li class="spirtLines">|</li>
            <li class="userGroupCheckAll"><a href="#" onclick="CheckClickAll()">
                <asp:Label ID="lblCheckAll" runat="server" Text="<%$ Resources:Resources, IDS_Label_CheckAll %>"></asp:Label></a></li>
            <li class="spirtLines">|</li>
            <li class="userGroupReverseCheck"><a href="#" onclick="CheckReverse()">
                <asp:Label ID="lblCheckReverse" runat="server" Text="<%$ Resources:Resources, IDS_Label_CheckReverse %>"></asp:Label></a></li>
            <li class="spirtLines">|</li>
            <li class="userGroupDelCheck"><Hishop:DeleteImageLinkButton ID="lkbDelectCheck" runat="server" Text="<%$ Resources:Resources, IDS_Button_DeleteCheck %>" /></li>
        </ul>
    </div>
    <div class="grdGroupListLi">
        <Hishop:CustomGridView ID="grdManager" runat="server" AutoGenerateColumns="False"
                    ShowHeader="true" DataKeyNames="hi_UserId" CssClass="GridViewStyle" GridLines="None"
                    RowStyle-CssClass="grdrow" HeaderStyle-CssClass="GridViewHeaderStyle" AllowSorting="true" SortOrderBy="CreateDate" SortOrder="DESC">
                    <Columns>
                        <Hishop:CheckBoxColumn />
                        <asp:TemplateField HeaderText="<%$ Resources:Managers, IDS_Header_UserName %>" SortExpression="UserName" ItemStyle-Width="280px">
                            <ItemTemplate>
	                                <asp:Label ID="lblUserName" runat="server" Text='<%# Bind("UserName") %>'></asp:Label>      
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField HeaderText="<%$ Resources:Managers, IDS_Header_Email %>" SortExpression="Email"
                            DataField="Email"  />
                        <asp:TemplateField HeaderText="<%$ Resources:Managers, IDS_Header_CreateDate %>"
                            SortExpression="CreateDate">
                            <ItemTemplate>
                                <Hishop:FormatedTimeLabel ID="lblCreateDate" Time='<%# Bind("CreateDate") %>' runat="server"></Hishop:FormatedTimeLabel>
                            </ItemTemplate>
                        </asp:TemplateField>
                             <asp:TemplateField HeaderText="<%$ Resources:Resources, IDS_Header_Options %>" ItemStyle-Width="20%">
                                 <ItemStyle CssClass="handleRightSelect"/>
                                 <ItemTemplate>
                                     <a href="#" class="SmallCommonTextButton" onclick="$.myfn.OpenWindow('<%# Eval("hi_UserId")%>','<%# Eval("UserName")%>');" >设置所属部门</a>
                                     <a href='<%# Globals.GetSiteUrls().UrlData.FormatUrl("admin_EditManager",Eval("hi_userID")) %>' class="SmallCommonTextButton"><asp:Literal ID="lblEdit" runat="server" Text="<%$ Resources:Resources, IDS_Button_Edit %>"></asp:Literal></a>
			                         <Hishop:DeleteImageLinkButton CssClass="SmallCommonTextButton" runat="server" ID="Delete" Text="<%$ Resources:Resources, IDS_Button_Delete %>" CommandName="Delete" />
                                 </ItemTemplate>
                             </asp:TemplateField>  
                    </Columns>
                </Hishop:CustomGridView>
                <!--分页开始-->
                <div class="grdGroupTabhead">
                    <UI:Pager runat="server" ListToPaging="grdManager" ID="pager" />
              </div>
                <!--分页结束-->
</div>

        <UI:Dialog AnimationType="Live" ShowTransition="Fade" AnimationSlide="ExponentialDecelerate"
            CloseTransition="Fade" AnimationDuration="600" Modal="true"
            AllowDrag="true" Alignment="MiddleCentre" Title='<%$ Resources:Managers, IDS_FromField_UserPurview_Manager %>'
            ID="dialogMessage" runat="server" Width="410">
            <Content>
                <input type="text" id="txtUserId" runat="server" style="display:none;" />
                <input type="text" id="txtRoles" runat="server" style="display:none;" />
                 <input type="text" id="txtRoleType" style="display:none;" />
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td style="padding: 10px;">
                            <div style="margin-left:34px;">
                                <asp:Label runat="server" Text="<%$ Resources:Managers, IDS_FromField_CurrentUserName %>"></asp:Label>：
                                <input type="text" id="txtUserName" runat="server" readonly="readonly"  style="border:0px 0px 0px 0px;width:200px; " />
                            </div>
                            <div class="FGSideLeft fix">
                                <div class="col">
                                    <UI:CallBack id="CB_LstUserTable" CacheContent="false" runat="server" PostState="true" Debug="false">
                                    <Content>
                                        <asp:ListBox ID="lstUserTable" runat="server" Height="150px" Width="120px"  ></asp:ListBox>
                                    </Content>
                                    </UI:CallBack>
                                </div>
                            </div>
                            <div class="FGSideMiddle fix">
                                <div class="col">
                                    <input type="button" id="btnAdd" Value="添加>>" onclick='$.myfn.AddRoles();'  />
                                    <p></p>
                                    <input type="button" id="btnDelete" Value="<<删除" onclick='$.myfn.DeleteRoles();'  />
                                </div>
                            </div>
                            <div class="FGSideRight fix">
                                <div class="col">
                                    <UI:CallBack id="CB_LstAddUserTable" CacheContent="false" runat="server" PostState="true" Debug="false">
                                    <Content>
                                        <asp:ListBox ID="lstAddUserTable" runat="server" Height="150px" Width="120px" ></asp:ListBox>
                                    </Content>
                                    </UI:CallBack>
                                </div>
                            </div>
                        </td>
                    </tr>
                </table>
                
            </Content>
         </UI:Dialog>
        
        
            </SkinTemplate>
            </Hishop:Managers>
        
        </div>
        <br />
        <div style="text-align:center">
            <hr style="width:500px;" />
            <Hishop:SiteCopyright runat="server" />
        </div>
        <br />
        <Hishop:ValidatorContainer runat="server" ID="ValidatorContainer" />
    </form>
</body>
</html>