<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="manageAlbum.aspx.cs" Inherits="Web.User.manageAlbum" %>

<!DOCTYPE html>

<html>
<!--<![endif]-->
<head>
    <title>manageAlbum</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file="../Css/head.htm"-->

</head>
<body>
    <form id="newsMange" method="post" runat="server">
        <div class="list-func-box func-box">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li>
                        <i class="ace-icon fa  fa-desktop"></i>
                        <asp:Label ID="lbpageNav" runat="server" Text=""></asp:Label>
                    </li>
                </ul>
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="bd">
                            <div class="page-header clearfix">
                                <div class="action-field">
                                    <asp:Button ID="btnSave" class="btn btn-sm btn-primary" runat="server" Text="保 存" OnClick="Btn_Click"></asp:Button>
                                    &nbsp;
                    <asp:Button ID="btnAdd" class="btn btn-sm btn-primary" runat="server" Text="添 加" OnClick="Btn_Click"></asp:Button>
                                    &nbsp;
                    <asp:Button ID="btnDel" class="btn btn-sm btn-primary" runat="server" Text="删 除" OnClick="Btn_Click"></asp:Button>
                                    &emsp;
                    <asp:Label ID="lbTip" runat="server" ForeColor="Red" Text=""></asp:Label>
                                </div>
                                <!--/action-field-->
                            </div>
                            <div class="function-bd">
                                <!--[if lte IE 7]><div style="zoom:1"><![endif]-->
                                <asp:HiddenField ID="hfidstr" runat="server" />
                                <asp:HiddenField ID="hftitlestr" runat="server" />
                                <asp:GridView ID="GridView1" runat="server" OnRowCommand="GridView1_RowCommand" OnRowDataBound="GridView1_RowDataBound"
                                    AllowSorting="True" AutoGenerateColumns="False" class="table table-striped table-bordered table-hover" EmptyDataText="暂无数据">
                                    <Columns>
                                        <asp:TemplateField HeaderStyle-CssClass="title text-center" ItemStyle-CssClass="text-center" ItemStyle-Width="36px">
                                            <HeaderTemplate>
                                                <asp:CheckBox ID="cbAll" Text=" " runat="server" onclick="GridSelectAll('GridView1',this.checked)" />
                                            </HeaderTemplate>
                                            <ItemTemplate>
                                                <asp:CheckBox ID="cbthis" runat="server" Text=" "></asp:CheckBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="pkId" HeaderText="ID号" HeaderStyle-CssClass="hidden" ItemStyle-CssClass="hidden" FooterStyle-CssClass="hidden"></asp:BoundField>
                                        <asp:TemplateField HeaderText="相册名" HeaderStyle-CssClass="title">
                                            <ItemTemplate>
                                                <span id="imageName" style="height: auto; width: auto" data-original-title="封面图片" data-html="true" data-placement="right" data-rel="popover" data-content='<img src=".<%# Eval("imageName").ToString() %>" alt="封面图片" width="220" height="160">' data-trigger="hover"><%# Eval("albumname").ToString() %></span>
                                            </ItemTemplate>
                                            <HeaderStyle CssClass="title"></HeaderStyle>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="发布时间" HeaderStyle-CssClass="title">
                                            <ItemTemplate>
                                                <span data-placement="right" data-rel="popover" data-content="<%# Eval("updateTime") %>" data-trigger="hover">
                                                    <asp:Label ID="lbtime" runat="server" Text='<%# Eval("updateTime", "{0:yyyy-M-d}") %>'></asp:Label>
                                                </span>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="固顶" HeaderStyle-CssClass="title">
                                            <ItemTemplate>
                                                <asp:DropDownList ID="isTop" runat="server" SelectedValue='<%# Eval( "isTop") %>'>
                                                    <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="gradeDrop" runat="server" SelectedValue='<%# Eval("gradeId") %>' DataSource="<%# dt_grade %>" DataTextField="name" DataValueField="pkId">
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="浏览权限" HeaderStyle-CssClass="title">
                                            <ItemTemplate>
                                                <asp:DropDownList ID="gate" runat="server" SelectedValue='<%# Eval("gate") %>'>
                                                    <asp:ListItem Value="0" Selected="True">无限制</asp:ListItem>
                                                    <asp:ListItem Value="1">仅内网可见</asp:ListItem>
                                                    <asp:ListItem Value="2">仅登录可见</asp:ListItem>
                                                    <asp:ListItem Value="3">内网或登录可见</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="排序" HeaderStyle-CssClass="title">
                                            <ItemTemplate>
                                                <asp:TextBox ID="Priority" runat="server" MaxLength="6" Text='<%#Eval("Priority")%>' class="input-md priority" Style="width: 45px;"></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="管理" HeaderStyle-CssClass="title" ItemStyle-CssClass="td-a">
                                            <ItemTemplate>
                                                <div class="action-buttons">
                                                    <asp:LinkButton ID="edit" runat="server" CommandName="edit" CommandArgument='<%# Eval("pkId") %>' data-toggle="tooltip" Visible="false" data-placement="bottom" title="编辑"><i class="ace-icon fa fa-pencil bigger-120 blue" ></i></asp:LinkButton>
                                                    <asp:LinkButton ID="edit1" runat="server" data-toggle="tooltip" data-placement="bottom" title="很抱歉，您没有权限编辑" Visible="false" Enabled="false"><i class="ace-icon fa fa-pencil bigger-120 grey"></i></asp:LinkButton>
                                                    <asp:LinkButton ID="add" runat="server" CommandName="add" CommandArgument='<%# Eval("pkId") %>' data-toggle="tooltip" data-placement="bottom" title="添加相片"><i class="glyphicon glyphicon-picture bigger-120 blue" ></i></asp:LinkButton>
                                                </div>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField Visible="False" DataField="grade" HeaderText="等级"></asp:BoundField>
                                    </Columns>
                                </asp:GridView>

                                <!--[if lte IE 7]></div><![endif]-->
                            </div>
                        </div>
                        <!--/bd-->
                        <div class="ft">
                            <div class="pagination">
                                <asp:Label ID="showPage" runat="server"></asp:Label>
                            </div>
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--#include file = "../Css/foot.htm" -->
    <script type="text/javascript">
        jQuery(function ($) {

            $("#btnSave").click(function () {
                return GridSelectCheck('GridView1', true);
            });

            $("#btnDel").click(function () {
                return GridSelectCheck('GridView1', true);
            });

        });

        //设置复选框自动选中和选中行背景
        $(function () {

            $('.text-center input').click(function () {
                $(this).parents('tr').toggleClass('active');
            })
            $('.title .text-center input').click(function () {

                if ($('.table tr:first').hasClass('active')) {
                    $('.table tr').addClass('active');
                } else {
                    $('.table tr').removeClass('active');
                }
            })

            $('.table select').change(function () {
                //背景选中
                if ($(this).parents('tr').hasClass('active')) {

                } else {
                    $(this).parents('tr').toggleClass('active');
                }

                //复选框自动选中
                var checkbox = $(this).parents("tr").find("input");
                for (var i = 0; i < checkbox.length; i++) {
                    if (checkbox[i].type == 'checkbox') {
                        checkbox[i].checked = true;
                    }
                }
            })
            //排序输入框失去焦点时选中
            $('.priority').blur(function () {
                //背景选中
                if ($(this).parents('tr').hasClass('active')) {

                } else {
                    $(this).parents('tr').toggleClass('active');
                }

                //复选框选中
                var checkbox = $(this).parents("tr").find("input");
                for (var i = 0; i < checkbox.length; i++) {
                    if (checkbox[i].type == 'checkbox') {
                        checkbox[i].checked = true;
                    }
                }

            })

        })

    </script>
</body>
</html>

