<%@ 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/head.htm" -->
</head>
<body>
    <div class="main-content-inner">
        <!-- #section:basics/content.breadcrumbs -->
        <div class="breadcrumbs" id="breadcrumbs">
            <script type="text/javascript">
                try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { }
            </script>
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa  fa-desktop"></i>
                    <a href="welcome.aspx">主页</a>
                </li>
                <li>用户管理
                </li>
                <li class="active">用户管理</li>
            </ul>
            <!-- /.breadcrumb -->

            <!-- /section:basics/content.searchbox -->
        </div>
        <!-- /section:basics/content.breadcrumbs -->
        <div class="page-content">
            <div class="row">
                <div class="col-xs-12">
                    <!-- PAGE CONTENT BEGINS -->
                    <div class="list-func-box func-box">
                        <form id="userManage" method="post" runat="server">
                            <div class="bd">
                                <div class="page-header">
                                    <div class="search-box pull-right">
                                        <span>用户筛选：</span>
                                        <asp:DropDownList ID="ddlUserType" runat="server" CssClass="input-small" AutoPostBack="True" OnSelectedIndexChanged="ddlUserType_SelectedIndexChanged">
                                            <asp:ListItem Selected="True" Value="0">全部用户</asp:ListItem>
                                            <asp:ListItem Value="1">网站用户</asp:ListItem>
                                        </asp:DropDownList>
                                        &emsp;
                        <span>用户搜索：</span>
                                        <asp:TextBox ID="userName" class="input-md" runat="server"></asp:TextBox>
                                        &nbsp;
                    <asp:Button ID="search" class="btn btn-sm btn-primary" runat="server" Text="搜 索" OnClientClick="return checkSelect();" OnClick="search_Click"></asp:Button>
                                        <%--<button class="btn btn-sm btn-primary" type="button" runat="server" onserverclick="search_Click" onclick="return checkSelect();" >
                       <i class="ace-icon fa fa-search bigger-110"></i>
                       搜 索
                   </button>--%>
                                    </div>
                                    <!--/search-box-->
                                    <div class="action-field">
                                        <asp:Button ID="save" class="btn btn-sm btn-primary" runat="server" Text="保存列表" OnClientClick="return checkSave();" OnClick="save_Click"></asp:Button>&emsp;
                                        <input type="button" runat="server" id="FancyBox_reg" class="btn btn-sm btn-primary" value="添 加" />&emsp;
                                        <input type="button" runat="server" id="FancyBox_imp" class="btn btn-sm btn-primary" value="用户导入" title="用户导入后，需点击密码批量加密" />&emsp;
                                        <asp:Button ID="btnPwdLv" class="btn btn-sm btn-primary" runat="server" Text="密码批量加密" OnClientClick="return checkCalculate();" OnClick="btnPwdLv_Click"></asp:Button>
                                    </div>
                                    <!--/action-field-->
                                </div>
                                <div class="function-bd">
                                    <!--[if lte IE 7]><div style="zoom:1"><![endif]-->
                                    <asp:GridView ID="userGrid" class="table table-striped table-bordered table-hover" runat="server" AutoGenerateColumns="False"
                                        AllowPaging="True" OnRowCommand="userGrid_RowCommand" OnRowDataBound="userGrid_RowDataBound">
                                        <Columns>
                                            <asp:BoundField DataField="pkId" HeaderText="ID" HeaderStyle-CssClass="title"></asp:BoundField>
                                            <asp:TemplateField HeaderStyle-CssClass="title" HeaderText="用户帐号">
                                                <ItemTemplate>
                                                    <a rel="Index" href="userInfo.aspx?pkId=<%#Eval("pkId") %>" class="FancyBox_big">
                                                        <%#Eval("userName")%></a>
                                                    <asp:Label ID="manageAll" Visible="false" runat="server" Text="[超管]" ForeColor="Red"></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="fullName" HeaderText="用户名称" HeaderStyle-CssClass="title"></asp:BoundField>
                                            <asp:BoundField Visible="False" DataField="sex" HeaderText="性别" HeaderStyle-CssClass="title"></asp:BoundField>
                                            <asp:BoundField Visible="False" DataField="company" HeaderText="单位" HeaderStyle-CssClass="title"></asp:BoundField>
                                            <asp:BoundField DataField="department" HeaderText="所在部门" HeaderStyle-CssClass="title"></asp:BoundField>
                                            <asp:TemplateField HeaderText="密码等级" HeaderStyle-CssClass="title">
                                                <ItemTemplate>
                                                    <%# Eval("pwdlevel").ToString() == "1" ? "低" : Eval("pwdlevel").ToString() == "2" ? "中" : Eval("pwdlevel").ToString() == "3" ? "高" : "无强度" %>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="loginNum" HeaderText="登录数" HeaderStyle-CssClass="title"></asp:BoundField>
                                            <asp:BoundField DataField="loginTime" HeaderText="最近登录" HeaderStyle-CssClass="title" DataFormatString="{0:yyyy-MM-dd HH:mm}"></asp:BoundField>
                                            <asp:BoundField DataField="loginIp" HeaderText="登录IP" HeaderStyle-CssClass="title"></asp:BoundField>
                                            <asp:BoundField Visible="False" DataField="logIp" HeaderText="注册IP" HeaderStyle-CssClass="title"></asp:BoundField>
                                            <asp:BoundField Visible="False" DataField="appear" HeaderText="发表数目" HeaderStyle-CssClass="title"></asp:BoundField>
                                            <asp:TemplateField HeaderText="登录" HeaderStyle-CssClass="title">
                                                <ItemTemplate>
                                                    <asp:DropDownList ID="logState" runat="server" SelectedIndex='<%# DataBinder.Eval(Container, "DataItem.examine") %>' CssClass="input-md" Width="80">
                                                        <asp:ListItem Value="0" Selected="True">不允许</asp:ListItem>
                                                        <asp:ListItem Value="1">允许</asp:ListItem>
                                                    </asp:DropDownList>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="用户组" HeaderStyle-CssClass="title">
                                                <ItemTemplate>
                                                    <asp:DropDownList ID="userGroup" runat="server" DataValueField="pkId" DataTextField="groupName" DataSource="<%# dv %>" CssClass="input-md" Width="90">
                                                    </asp:DropDownList>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="执行" HeaderStyle-CssClass="title">
                                                <ItemTemplate>
                                                    <div class="action-buttons">
                                                        <asp:LinkButton ID="edit" runat="server" CssClass="FancyBox_bigger" href='<%#Eval("pkid","../user/UserInfo.aspx?pkid={0}&mode=dccedit")%>' data-toggle="tooltip" data-placement="bottom" title="编辑"><i class="ace-icon fa fa-pencil bigger-120 blue"></i></asp:LinkButton>
                                                        <a class="FancyBox_big" data-toggle="tooltip" data-placement="bottom" href='UserInfoSearch.aspx?searchId=<%#Eval("pkid") %>&t=0' title="用户发文搜索"><i class="ace-icon fa fa-search-plus bigger-120 light-blue"></i></a>
                                                        <a class="FancyBox" data-toggle="tooltip" data-placement="bottom" href="accredit.aspx?pkId=<%#Eval("pkid") %>&name=<%#Eval("userName") %>" data-original-title="栏目授权"><i class="ace-icon fa fa-cogs bigger-120 purple"></i></a>
                                                        <a class="FancyBox" data-toggle="tooltip" data-placement="bottom" href='quickAccredit.aspx?pkId=<%#Eval("pkid") %>&name=<%#Eval("userName") %>' title="快速授权"><i class="ace-icon fa fa-cog bigger-120 purple"></i></a>
                                                        <asp:LinkButton ID="LinkButton2" runat="server" CommandName="delRow" CommandArgument='<%#Eval("pkid") %>' data-toggle="tooltip" data-placement="bottom" title="删除" ><i class="ace-icon fa fa-trash-o bigger-120 red"></i></asp:LinkButton>
                                                        <asp:LinkButton ID="del1" runat="server" CssClass="FBox3" data-toggle="tooltip" data-placement="bottom" title="您没有删除权限或该用户为最后一个超管用户，不能删除！" Visible="false" Enabled="false"><i class="ace-icon fa fa-trash-o bigger-120 grey" ></i></asp:LinkButton>
                                                        <asp:LinkButton ID="assign" runat="server" CssClass="FancyBox" href='<%#Eval("pkid","managerAccredit.aspx?pkId={0}&name="+Eval("userName")+"")%>' data-toggle="tooltip" data-placement="bottom" title="频道管理授权"><i class="ace-icon fa fa-sitemap bigger-120 pink"></i></asp:LinkButton>
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="usersGroupId" Visible="false" HeaderText="用户组Id" HeaderStyle-CssClass="title"></asp:BoundField>
                                        </Columns>
                                    </asp:GridView>
                                    <!--[if lte IE 7]></div><![endif]-->
                                </div>
                                <!--/function-bd-->
                            </div>
                            <div class="pagination">
                                <asp:Label ID="showPage" runat="server"></asp:Label>
                            </div>
                            <!--/action-field-->
                        </form>
                    </div>

                    <!-- PAGE CONTENT ENDS -->
                </div>
            </div>
        </div>
        <!-- /.page-content -->
    </div>
    <!--#include file = "../Css/foot.htm" -->
    <script type="text/javascript" lang="javascript">

        $(document).ready(function () {

            $(".FancyBox").click().fancybox({
                'width': 500,
                'height': 450,
                autoSize: false,
                'hideOnOverlayClick': false,
                'transitionIn': 'elastic',
                'transitionOut': 'elastic',
                'type': 'iframe',
                'padding': 0
            });

            $(".FancyBox_big").click().fancybox({
                'width': 650,
                'height': 450,
                autoSize: false,
                'hideOnOverlayClick': false,
                'transitionIn': 'elastic',
                'transitionOut': 'elastic',
                'type': 'iframe',
                'padding': 0
            });

            $(".FancyBox_bigger").click().fancybox({
                'width': 767,
                'height': 710,
                autoSize: false,
                'hideOnOverlayClick': false,
                'transitionIn': 'elastic',
                'transitionOut': 'elastic',
                'type': 'iframe',
                'padding': 0
            });

            $("#FancyBox_reg").click().fancybox({
                'width': 767,
                'height': 710,
                autoSize: false,
                'hideOnOverlayClick': false,
                'transitionIn': 'elastic',
                'transitionOut': 'elastic',
                'type': 'iframe',
                'padding': 0,
                'href': '../user/UserInfo.aspx?mode=add'
            });

            $("#FancyBox_imp").click().fancybox({
                'width': 700,
                'height': 330,
                autoSize: false,
                'hideOnOverlayClick': false,
                'transitionIn': 'elastic',
                'transitionOut': 'elastic',
                'type': 'iframe',
                'padding': 0,
                'href': 'userImport.aspx'
            });

        });

        //防止用户恶意保存
        function checkSave() {
            if (confirm("您确定要保存列表中的修改吗？") == true) {
                return true;
            }
            else {
                return false;
            }
        }
        //防止用户恶意保存
        function checkCalculate() {
            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>
</body>
</html>
