<%@ page language="VB" masterpagefile="~/blank.master" autoeventwireup="false" title="用户列表" inherits="WebExam.Web.department_manage_userLIst, App_Web_st1xh0ee" %>
<%@ MasterType VirtualPath="~/blank.master" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID ="h" ContentPlaceHolderID="ContentHead"  runat="server">
<script type ="text/javascript" >    if (top == this) top.location = "/";</script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager><telerik:RadWindowManager ID="RadWindowManager1" Skin="Web20" runat="server" VisibleStatusbar="False" Modal="True">
        
    </telerik:RadWindowManager>
     <script type ="text/javascript" >
         parent.document.title = self.document.title
         $().ready(
        function () {
            $("td a[href^='../userinfo.aspx']").each(function () {
                var u = "";
                $(this).parent().parent().children().each(function (i) {
                    
                    if (i == 1) { u = this.innerText; return; };
                });
                this.href = "javascript:userInfo('" + u + "')";
            });


        })
        function userInfo(userid) {
            //window.showModelessDialog('adduser.aspx'+window.location.search,'','scroll:yes;Status:no;help:no');
            var newwin = window.showModalDialog('/department/userinfo.aspx?userid=' + encodeURI(userid), "msgWindow", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=530,height=530,screenX=1,screenY=1,top=" + (screen.AvailHeight - 500) / 2 + ",left=" + (screen.AvailWidth - 540) / 2);


            //window.top.location ='userInfo.aspx?userid='+userid
        }
        function checkselect() {
            var userList = "";
            var userListBox = document.getElementById("<%= TB_importUser.ClientID %>");
            var form = document.forms[0];
            if (form.select.length == null) {
                if (form.select.checked) userListBox.value = form.select.value;
                else

                    userListBox.value = "";
            }
            else {
                var checklength = form.select.length

                for (var i = 0; i < checklength; i++) {
                    if (form.select(i).checked)
                    { userList += "," + form.select(i).value }
                }
                if (userList != "")
                    userList = userList.substring(1);
                userListBox.value = userList;

            }


        }
        function getCover() {
            var cover = document.getElementById("cover");

            if (cover == null) {
                var doc = document;

                var div = doc.createElement("div");
                div.style.zIndex = "10000";
                div.style.top = "0";
                div.style.left = "0";
                div.style.position = "absolute";
                div.style.background = "#808080";
                div.style.filter = "alpha(opacity=90)";
                div.style.width = "100%";
                div.style.height = "100%";
                div.id = "cover";


                document.forms[0].appendChild(div);
                cover = div;
            }
            else {
                //cover.innerHTML="";

            }
            return cover;
        }
        function lifeDateChange(display) {

            if (!display)
                div_exp.style.visibility = "hidden";
            else
                div_exp.style.visibility = "visible";


        }
        function inputPW() {
            //Force reload in order to guarantee that the onload event handler of the dialog which configures it executes on every show.
            //var oWnd = window.radopen(null, "DialogWindow");
            //oWnd.setUrl(oWnd.get_navigateUrl());
            //$('#enterPwd').modal();
            radprompt('请您输入新的密码', CallBackFunction, 300, 100, null, '重置密码', '000000');

        }


        function CallBackFunction(returnValue) {

            var oArea = document.getElementById("newPwd");
            if (returnValue) { oArea.value = returnValue; document.getElementById("<%= Btn_resetPwd.ClientId %>").click(); }
            else oArea.value = "";

        }

        // Called when a window is being closed.
             
     </script>

    <div>
    <h3>
            用户列表</h3>
  
        <asp:GridView ID="GV_userlist" runat="server" AutoGenerateColumns="False" CellPadding="4"
            ForeColor="#333333" GridLines="None">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
                <asp:TemplateField>
                    <ItemStyle Width="30px"></ItemStyle>
                    <ItemTemplate>
                        <input type="checkbox" value='<%# DataBinder.Eval(Container.DataItem, "id") %>' name="select"
                            onclick="checkselect()" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="id" HeaderText="用户名" ReadOnly="True" />
                <asp:BoundField DataField="userName" HeaderText="姓名" />
                <asp:CheckBoxField DataField="isMan" HeaderText="男" />
                <asp:BoundField DataField="birthday" HeaderText="出生年月" DataFormatString="{0:d}" />
                <asp:BoundField DataField="Email" HeaderText="电子信箱" />
                <asp:BoundField DataField="CreationDate" HeaderText="创建日期" ReadOnly="True" />
                <asp:BoundField DataField="LastLoginDate" HeaderText="上次登陆" ReadOnly="True" />
                <asp:BoundField DataField="LastActivityDate" HeaderText="最近活动" ReadOnly="True" />
                <asp:CheckBoxField DataField="IsLockedOut" HeaderText="冻结" ReadOnly="True" />
                <asp:BoundField DataField="expiredDate" HeaderText="有效期" NullDisplayText="长期" ReadOnly="True" />
                <asp:HyperLinkField Text="详情" NavigateUrl="../userinfo.aspx" />
                <asp:HyperLinkField DataNavigateUrlFields="id" Text="编辑" DataNavigateUrlFormatString="../edituserinfo.aspx?userid={0}" Target="_parent" />
            </Columns>
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
       
            <pagers:PageNumbersPager ID="PageNumbersPager1" runat="server" style=" text-align:center" />
          
            <p align="left" class="bottomSpace">
                <asp:TextBox ID="TB_importUser" runat="server" Width="330" ValidationGroup="mm"></asp:TextBox>
                <asp:RequiredFieldValidator ValidationGroup="mm" Display="None" ID="RequiredFieldValidator1"
                    runat="server" ErrorMessage="请输入或选择用户名！" ControlToValidate="TB_importUser"></asp:RequiredFieldValidator>
                <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server"
                    TargetControlID="RequiredFieldValidator1">
                </ajaxToolkit:ValidatorCalloutExtender>
                <asp:Button ID="Btn_importUser" runat="server" Text="转入用户" ValidationGroup="mm" />
                <asp:Button ID="Btn_del" runat="server" Text="删除用户" ValidationGroup="mm" />
                <input type ="button" value="重设密码" onclick="return inputPW();" />
                <asp:Button ID="Btn_resetPwd" runat="server" Text="重设密码" style="display:none" ValidationGroup="mm" />
                <asp:Button ID="Btn_UnlockUser" runat="server" Text="帐号解冻" ValidationGroup="mm" />
                <asp:Button ID="btnInfo" runat="server" OnClientClick="return false;" Text="修改有效期" />
   
                <input id="newPwd" name="newPwd" style="display:none" />
            </p>
            <p align="left" class="bottomSpace">
                <input type="button" value ="新建单用户" onclick ="parent.location='/newUser.aspx?fromadmin=1&partId='+jQuery.url.param('id')" />
                &nbsp; <input type="button" value ="新建多用户" onclick ="parent.location='newUsers.aspx?fromadmin=1&partId='+jQuery.url.param('id')" />
               
                <br />
            </p>
    </div>
     <!-- "Wire frame" div used to transition from the button to the info panel -->
    <div id="flyout" style="display: none; overflow: hidden; z-index: 2; background-color: #FFFFFF;
        border: solid 1px #D0D0D0;">
    </div>
    <div id="info" style="display: none; width: 180px; height: 140px; z-index: 2; opacity: 0;
        filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); font-size: 12px;
        border: solid 1px #CCCCCC; background-color: #FFFFFF; padding: 5px;">
        <div id="btnCloseParent" style="float: right; opacity: 0; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);">
            <asp:LinkButton ID="btnClose" runat="server" OnClientClick="return false;" Text="X"
                ToolTip="Close" Style="background-color: #666666; color: #FFFFFF; text-align: center;
                font-weight: bold; text-decoration: none; border: outset thin #FFFFFF; padding: 5px;" />
        </div>
        <div>
            <h1>
                修改有效期</h1>
            <div style="margin: 15px; width: 100%">
                <asp:RadioButton ID="R_add" runat="server" GroupName="e" Text="指定有效期" Checked="True"
                    onkeypress="javascript:lifeDateChange(true)" onclick="javascript:lifeDateChange(true)" />
                <asp:RadioButton ID="R_long" runat="server" GroupName="e" Text="长期有效" onkeypress="javascript:lifeDateChange(false)"
                    onclick="javascript:lifeDateChange(false)" />
            </div>
            <div style="margin: 15px; width: 100%;">
                <span id="div_exp">
                    <asp:TextBox ID="TB_exp" runat="server" onblur="this.style.borderColor='#A3BFA8';"
                        onfocus="this.style.borderColor='#99E300';" Width="70"></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TB_exp"
                        MaskType="Date" Mask="9999/99/99" MessageValidatorTip="true" OnFocusCssClass="MaskedEditFocus"
                        OnInvalidCssClass="MaskedEditError" DisplayMoney="Left" AcceptNegative="Left"
                        ErrorTooltipEnabled="True">
                    </ajaxToolkit:MaskedEditExtender>
                   
                </span>
                <asp:Button ID="Btn_changeExp" runat="server" ValidationGroup="mm" Text="保存" Style="margin-left: 5px;
                    width: 50px" />
            </div>
        </div>
    </div>

     <script type="text/javascript" language="javascript">
         // Move an element directly on top of another element (and optionally
         // make it the same size)
         function Cover(bottom, top, ignoreSize) {
             var location = Sys.UI.DomElement.getLocation(bottom);
             top.style.position = 'absolute';
             top.style.top = location.y + 'px';
             top.style.left = location.x + 'px';
             if (!ignoreSize) {
                 top.style.height = bottom.offsetHeight + 'px';
                 top.style.width = bottom.offsetWidth + 'px';
             }
         }
            
    </script>

    <ajaxToolkit:AnimationExtender ID="OpenAnimation" runat="server" TargetControlID="btnInfo">
        <Animations>
                <OnClick>
                    <Sequence>
                        <%-- Disable the button so it can't be clicked again --%>
                        <EnableAction Enabled="false" />
                        
                        <%-- Position the wire frame on top of the button and show it --%>
                        <ScriptAction Script="Cover($get('ctl00_mainCopy_btnInfo'), $get('flyout'));" />
                        <StyleAction AnimationTarget="flyout" Attribute="display" Value="block"/>
                        
                        <%-- Move the wire frame from the button's bounds to the info panel's bounds --%>
                        <Parallel AnimationTarget="flyout" Duration=".3" Fps="25">
                            <Move Horizontal="70" Vertical="-60" />
                            <Resize Width="190" Height="150" />
                            <Color PropertyKey="backgroundColor" StartValue="#AAAAAA" EndValue="#FFFFFF" />
                        </Parallel>
                        
                        <%-- Move the info panel on top of the wire frame, fade it in, and hide the frame --%>
                        <ScriptAction Script="Cover($get('flyout'), $get('info'), true);" />
                        <StyleAction AnimationTarget="info" Attribute="display" Value="block"/>
                        <FadeIn AnimationTarget="info" Duration=".2"/>
                        <StyleAction AnimationTarget="flyout" Attribute="display" Value="none"/>
                        
                        <%-- Flash the text/border red and fade in the "close" button --%>
                        <Parallel AnimationTarget="info" Duration=".5">
                           
                            <Color PropertyKey="borderColor" StartValue="#666666" EndValue="#FF0000" />
                        </Parallel>
                        <Parallel AnimationTarget="info" Duration=".5">
                           
                            <Color PropertyKey="borderColor" StartValue="#FF0000" EndValue="#666666" />
                            <FadeIn AnimationTarget="btnCloseParent" MaximumOpacity=".9" />
                        </Parallel>
                    </Sequence>
                </OnClick>
        </Animations>
    </ajaxToolkit:AnimationExtender>
    <ajaxToolkit:AnimationExtender ID="CloseAnimation" runat="server" TargetControlID="btnClose">
        <Animations>
                <OnClick>
                    <Sequence AnimationTarget="info">
                        <%--  Shrink the info panel out of view --%>
                        <StyleAction Attribute="overflow" Value="hidden"/>
                        <Parallel Duration=".3" Fps="15">
                            <Scale ScaleFactor="0.05" Center="true" ScaleFont="true" FontUnit="px" />
                            <FadeOut />
                        </Parallel>
                        
                        <%--  Reset the sample so it can be played again --%>
                        <StyleAction Attribute="display" Value="none"/>
                        <StyleAction Attribute="width" Value="250px"/>
                        <StyleAction Attribute="height" Value=""/>
                        <StyleAction Attribute="fontSize" Value="12px"/>
                        <OpacityAction AnimationTarget="btnCloseParent" Opacity="0" />
                        
                        <%--  Enable the button so it can be played again --%>
                        <EnableAction AnimationTarget="btnInfo" Enabled="true" />
                    </Sequence>
                </OnClick>
                <OnMouseOver>
                    <Color Duration=".2" PropertyKey="color" StartValue="#FFFFFF" EndValue="#FF0000" />
                </OnMouseOver>
                <OnMouseOut>
                    <Color Duration=".2" PropertyKey="color" StartValue="#FF0000" EndValue="#FFFFFF" />
                </OnMouseOut>
        </Animations>
    </ajaxToolkit:AnimationExtender>
</asp:Content> 
