<%@ Page Language="c#" CodeBehind="manageUsers.aspx.cs" AutoEventWireup="True" Inherits="Web.Wpdcc.manageUsers" %>

<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>ManageUser</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file = "../Css/adminCss.htm" -->

    <script type="text/javascript" lang="javascript">
             
        $(document).ready(function(){        
            
            $(".FancyBox").click().fancybox({
                'width'		: 500,
				'height'	: 450,
				'hideOnOverlayClick': false,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type': 'iframe',
				'padding': '0'
            });
            
            $(".FancyBox_big").click().fancybox({
                'width'		: 700,
				'height'	: 700,
				'hideOnOverlayClick': false,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type': 'iframe',
				'padding': '0'
            });
            
            $("#FancyBox_reg").click().fancybox({
                'width'		: 700,
				'height'	: 620,
				'hideOnOverlayClick': false,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type': 'iframe',
				'padding': '0',
				'href' : '../user/UserInfo.aspx?mode=add'
            });
            
            $("#FancyBox_imp").click().fancybox({
                'width'		: 700,
				'height'	: 310,
				'hideOnOverlayClick': false,
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'type': 'iframe',
				'padding': '0',
				'href' : 'userImport.aspx'
            });
            /*列表高度*/
            $('.function-bd').height($(window).innerHeight() - 145);

            $(window).resize(function () {
                $('.function-bd').height($(window).innerHeight() - 145);
            });

        });
        
        
        //防止用户恶意保存
        function checkSave(){
            if (confirm("您确定要保存列表中的修改吗？") == true)
            {
                return true;
            }
            else{
                return false;
            }
        }
        //sql防注入验证
        function checkSelect()
        {
            var url = document.getElementById("userName").value;
            var re=/^\?(.*)(select%20|insert%20|delete%20from%20|count\(|drop%20table|update%20truncate%20|asc\(|mid\(|char\(|xp_cmdshell|exec%20master|net%20localgroup%20administrators|\"|:|net%20user|\|%20or%20)(.*)$/gi;
            var e = re.test(url);
            if(e) 
            {
                alert("用户名中含有非法字符～");
                return false ;
            }
            else
            {
                return true ;
            }
        }
    </script>

</head>
<body>
    <div class="list-func-box func-box">
        <div class="hd">
            您的位置：用户管理设置 &gt; 用户管理</div>
        <form id="userManage" method="post" runat="server">
        <div class="bd">
            <div class="function-hd">
                <div class="search-box fr">
                    用户筛选：
                    <asp:DropDownList ID="ddlUserType" runat="server" CssClass="drop-txt" AutoPostBack="True" OnSelectedIndexChanged="ddlUserType_SelectedIndexChanged">
                        <asp:ListItem Selected="True" Value="0">全部用户</asp:ListItem>
                        <asp:ListItem Value="1">网站用户</asp:ListItem>
                    </asp:DropDownList>
                    &nbsp;&nbsp;
                    <asp:Label ID="Label1" runat="server">用户搜索：</asp:Label>
                    <asp:TextBox ID="userName" class="input-txt" runat="server"></asp:TextBox>
                    &nbsp;
                    <asp:Button ID="search" class="btn1 btn" runat="server" Text="搜 索" OnClientClick="return checkSelect();" OnClick="search_Click">
                    </asp:Button>
                </div>
                <!--/search-box-->
                <div class="action-field">
                    <asp:Button ID="save" class="btn" runat="server" Text="保存列表" OnClientClick="return checkSave();" OnClick="save_Click"></asp:Button>&nbsp;&nbsp;
                    <input type="button" id="FancyBox_reg" class="btn" value="添 加" />&nbsp;&nbsp;
                    <input type="button" id="FancyBox_imp" class="btn" value="用户导入" />
                </div>
                <!--/action-field-->
            </div>
            <div class="function-bd" style="height:580px;overflow:auto;">
            <!--[if lte IE 7]><div style="zoom:1"><![endif]-->
            <asp:DataGrid ID="userGrid" class="list-table" runat="server" AutoGenerateColumns="False"
                AllowPaging="True" OnItemCommand="userGrid_ItemCommand" >
                <Columns>
                    <asp:BoundColumn DataField="pkId" HeaderText="ID" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                    <asp:TemplateColumn HeaderStyle-CssClass="title" HeaderText="用户帐号">
                        <ItemTemplate>
                            <a rel="Index" href="userInfo.aspx?pkId=<%#Eval("pkId") %>" class="FancyBox_big">
                                <%#Eval("userName")%></a>
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="fullName" HeaderText="用户名称" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                    <asp:BoundColumn Visible="False" DataField="sex" HeaderText="性别" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                    <asp:BoundColumn Visible="False" DataField="company" HeaderText="单位" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>                    
                    <asp:BoundColumn DataField="department" HeaderText="所在部门" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                    <asp:BoundColumn DataField="loginNum" HeaderText="登录数" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                    <asp:BoundColumn DataField="loginTime" HeaderText="最近登录" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                    <asp:BoundColumn DataField="loginIp" HeaderText="登录IP" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                    <asp:BoundColumn Visible="False" DataField="logIp" HeaderText="注册IP" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                    <asp:BoundColumn Visible="False" DataField="appear" HeaderText="发表数目" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                    <asp:TemplateColumn HeaderText="登录" HeaderStyle-CssClass="title">
                        <ItemTemplate>
                            <asp:DropDownList ID="logState" runat="server" SelectedIndex='<%# DataBinder.Eval(Container, "DataItem.examine") %>' CssClass="drop-txt" Width="70">
                                <asp:ListItem Value="0" Selected="True">不允许</asp:ListItem>
                                <asp:ListItem Value="1">允许</asp:ListItem>
                            </asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="用户组" HeaderStyle-CssClass="title">
                        <ItemTemplate>
                            <asp:DropDownList ID="userGroup" runat="server" DataValueField="pkId" DataTextField="groupName" DataSource="<%# dv %>" CssClass="drop-txt" Width="90">                                
                            </asp:DropDownList>
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:TemplateColumn HeaderText="执行" HeaderStyle-CssClass="title">
                        <ItemTemplate>
                            <a class="FancyBox_big blue" title="编辑" href='../user/UserInfo.aspx?pkid=<%#Eval("pkid") %>&mode=dccedit'>编辑</a>
                            <asp:LinkButton ID="LinkButton2" runat="server" CssClass="blue" CommandName="delRow" CommandArgument='<%#Eval("userName") %>'
                                OnClientClick="alert('注意：删除后该用户名将不可恢复！如只是想限制用户登录，可设置为不允许登录。');">删除</asp:LinkButton>
                                <a class="FancyBox blue" href='accredit.aspx?pkId=<%#Eval("pkid") %>&name=<%#Eval("userName") %>' title="适用于所有栏目授权">
                            授权</a> 
                                <a class="FancyBox blue" href='quickAccredit.aspx?pkId=<%#Eval("pkid") %>&name=<%#Eval("userName") %>' title="点击单个栏目，可快速对该栏目授权">
                            快速授权</a> 
                                <a class="FancyBox_big blue" href='UserInfoSearch.aspx?searchId=<%#Eval("pkid") %>&t=0'>发文搜索</a>
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="usersGroupId" Visible="false" HeaderText="用户组Id" HeaderStyle-CssClass="title">
                    </asp:BoundColumn>
                </Columns>
                <PagerStyle Visible="false" Mode="NumericPages"></PagerStyle>
            </asp:DataGrid>
            <!--[if lte IE 7]></div><![endif]-->
            </div><!--/function-bd-->
        </div>
        <div class="ft">
            <div class="pagination">
                <asp:Label ID="showPage" class="list-table" runat="server"></asp:Label>
            </div>
            <!--/action-field-->
        </div>
        </form>
    </div>
</body>
</html>
