<%@ Page Language="c#" Inherits="Web.User.manageNews" CodeBehind="manageNews.aspx.cs" %>

<%@ Register Src="~/Module/pageNavi.ascx" TagPrefix="uc1" TagName="pageNavi" %>
<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>manageNews</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 -->
        <form id="Form1" method="post" runat="server">
            <div class="breadcrumbs">
                <!-- #1  breadcrumbs 重复了些，可去掉吗； 2 action field 、search-box ；3整个页面层次规范-->
                <ul class="breadcrumb">
                    <li>
                        <i class="ace-icon fa  fa-desktop"></i>
                        <asp:Label ID="lbpageNav" runat="server" Text=""></asp:Label>
                    </li>
                </ul>
                <div class="user-service pull-right">
                    <span data-original-title="帮助" data-placement="left" data-rel="popover" data-content="将鼠标悬停在发布人名字上可以看到发布IP地址" data-trigger="hover"><i class="fa fa-question-circle bigger-120 blue"></i></span>
                </div>
            </div>
            <!-- /section:basics/content.breadcrumbs -->
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <div class="page-content">
                <div class="page-header clearfix">
                    <div class="pull-left">
                        <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="btnMove" runat="server" class="btn btn-sm btn-primary" Text="移 动"></asp:Button>
                        &nbsp;
                    <asp:Button ID="btnDel" class="btn btn-sm btn-primary" runat="server" Text="删 除" OnClick="Btn_Click"></asp:Button>
                        &nbsp;
                    <asp:Button ID="btnMoveSave" class="btn btn-sm btn-primary" runat="server" Text="MoveSave" OnClick="Btn_Click" Style="display: none"></asp:Button>
                        <asp:HiddenField ID="MoveTargetBigClassID" runat="server" />
                        <asp:HiddenField ID="MoveTargetMenuID" runat="server" />
                        <asp:Label ID="Tips" runat="server" ForeColor="Red" Text="图文翻动栏目前台最多显示最新的6条数据" Visible="False"></asp:Label>
                    </div>
                    <!--/action-field-->
                    <div class="pull-right">
                        <asp:DropDownList ID="ddlSearchType" runat="server" EnableViewState="False" CssClass="input-md" Width="80">
                            <asp:ListItem Value="pkId">编号</asp:ListItem>
                            <asp:ListItem Selected="True" Value="intacttitle">标题</asp:ListItem>
                            <asp:ListItem Value="content">内容</asp:ListItem>
                            <asp:ListItem Value="fullname">发布人</asp:ListItem>
                            <asp:ListItem Value="copyfrom">来源</asp:ListItem>
                        </asp:DropDownList>
                        <asp:TextBox ID="tbSearch" class="input-md" runat="server"></asp:TextBox>
                        <asp:Button ID="btnSerach" class="btn btn-sm btn-primary" runat="server" OnClick="Btn_Click" Text="查 询" />
                    </div>
                    <!--/search-box-->
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <!--[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" EmptyDataText="暂无数据…"
                            AllowSorting="True" OnSorting="GridView1_Sorting" AutoGenerateColumns="False" class="table table-striped table-bordered table-hover table-sorting">
                            <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="标题" SortExpression="intactTitle">
                                    <ItemTemplate>
                                        <asp:Label ID="V" Visible="false" runat="server" Text="[过期]" ForeColor="Red"></asp:Label>
                                        <asp:Label ID="D" Visible="false" runat="server" Text="[抄]" ForeColor="Red"></asp:Label>
                                        <asp:Label ID="L" Visible="false" runat="server" Text="[链]" ForeColor="Red"></asp:Label>

                                        <span data-placement="right" data-rel="popover" data-content="<%# Eval( "intactTitle") %>" data-trigger="hover">
                                            <asp:HyperLink ID="intactTitle" runat="server" Text='<%# Eval( "intactTitle") %>'
                                                Target="_blank" NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.pkId", "../newsInfo.aspx?pkId={0}") %>'>
                                            </asp:HyperLink>
                                        </span>
                                        <asp:Panel ID="StaticDiv" runat="server" data-rel="popover" data-trigger="hover" data-placement="right" data-content="可能此条信息未审核通过或者设置了浏览权限、用户等级、链接标题等功能则不会静态化。" Visible="false" Style="display: inline-block;">
                                            <i class="fa fa-question-circle bigger-120 blue"></i>
                                        </asp:Panel>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="发布人" SortExpression="fullName">
                                    <ItemTemplate>
                                        <span data-placement="right" data-rel="popover" data-content="发布IP：<%# Eval("updateIp").ToString() %>" data-trigger="hover"><%# Eval("fullName").ToString() %></span>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="发布时间" SortExpression="updateTime">
                                    <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="今日推荐" Visible="true">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="isRecommand" runat="server" SelectedValue='<%# Eval( "isRecommand") %>'>
                                            <asp:ListItem Value="0" Selected="True">取消</asp:ListItem>
                                            <asp:ListItem Value="1">推荐</asp:ListItem>
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="click" HeaderText="阅读" SortExpression="click"></asp:BoundField>
                                <asp:TemplateField HeaderText="固顶" SortExpression="isTop">
                                    <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="审核" SortExpression="passed">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="pass" runat="server" SelectedValue='<%# Eval( "passed") %>'>
                                            <asp:ListItem Value="0" Selected="True">待审</asp:ListItem>
                                            <asp:ListItem Value="1">通过</asp:ListItem>
                                            <asp:ListItem Value="2">不通过</asp:ListItem>
                                        </asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="显示等级" SortExpression="gradeId">
                                    <ItemTemplate>
                                        <asp:DropDownList ID="grade" runat="server" SelectedValue='<%# Eval("gradeId") %>' DataValueField="pkId" DataTextField="name" DataSource="<%# dt_grade %>"></asp:DropDownList>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="浏览权限" SortExpression="gate">
                                    <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="排序" SortExpression="Priority">
                                    <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="管理" ItemStyle-Width="100px">
                                    <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:Label ID="lbpushmark" runat="server"><a href='pushmark.aspx?pkid=<%# Eval("pkId")%>' target="_blank" class="FBox" data-toggle="tooltip" data-placement="bottom" title="推送" ><i class="ace-icon fa fa-weixin bigger-120 green" ></i></a></asp:Label>
                                            <a href='manageReview.aspx?newsId=<%# DataBinder.Eval(Container, "DataItem.pkId")%>' target="_blank" data-toggle="tooltip" data-placement="bottom" title="评论"><i class="ace-icon fa fa-edit bigger-120 blue"></i></a>
                                        </div>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <%--     <asp:BoundField Visible="False" DataField="grade" HeaderText="等级" HeaderStyle-CssClass="title"></asp:BoundField>
                                    <asp:BoundField Visible="False" DataField="useListTitle" HeaderText="useListTitle"></asp:BoundField>
                                    <asp:BoundField Visible="False" DataField="listTitle" HeaderText="listTitle" HeaderStyle-CssClass="title"></asp:BoundField>
                                    <asp:BoundField Visible="false" DataField="isDuplicated"  HeaderText="是否抄送" HeaderStyle-CssClass="title"></asp:BoundField>
                                    <asp:BoundField Visible="false" DataField="duplicateFrom" HeaderText="抄送来源" HeaderStyle-CssClass="title"></asp:BoundField>
                                    <asp:BoundField Visible="false" DataField="duplicatedPkId" HeaderText="抄送Id" HeaderStyle-CssClass="title"></asp:BoundField>
                                    <asp:BoundField Visible="false" DataField="isStatic" HeaderText="是否静态化" HeaderStyle-CssClass="title"></asp:BoundField>
                                    <asp:BoundField Visible="false" DataField="staticUrl" HeaderText="静态化URL" HeaderStyle-CssClass="title"></asp:BoundField>--%>
                            </Columns>
                        </asp:GridView>
                        <!--[if lte IE 7]></div><![endif]-->
                        <div class="grid-pager">
                            <uc1:pageNavi runat="server" id="pageNavi" dataCtlName="GridView1" />
                        </div>
                    </div>

                </div>
            </div>
            <!-- /.page-content -->
        </form>
    </div>
    <!--#include file="../Css/foot.htm"-->
    <script type="text/javascript">
        jQuery(function ($) {

            $("#btnSave").click(function () {

                if (GridSelectCheck('GridView1', true)) {
                    //加载load特效（防止在生成静态页阶段重复点击按钮） 不显示弹出层的关闭按钮，按ESC来关闭弹出层
                    $.fancybox({
                        'type': 'image',
                        'width': 50,
                        'height': 50,
                        'hideOnOverlayClick': false,
                        'padding': '0',
                        'scrolling': 'no',
                        'enableEscapeButton': 'true',
                        'showCloseButton': false,
                        'href': '../images/resfile/loading.gif'
                    });
                    return true;
                }
                else {
                    return false;
                }
            });

            $("#btnDel").click(function () {
                if (GridSelectCheck('GridView1', true)) {
                    //加载load特效（防止在生成静态页阶段重复点击按钮） 不显示弹出层的关闭按钮，按ESC来关闭弹出层
                    $.fancybox({
                        'type': 'image',
                        'width': 50,
                        'height': 50,
                        'hideOnOverlayClick': false,
                        'padding': '0',
                        'scrolling': 'no',
                        'enableEscapeButton': 'true',
                        'showCloseButton': false,
                        'href': '../images/resfile/loading.gif'
                    });
                    return true;
                }
                else {
                    return false;
                }
            });

            $("#btnMove").click(function () {
                debugger; if (GridSelectCheck('GridView1', false)) {
                    //改用弹出层，因为201409发布的最新ghome开始不支持showModalDialog()
                    $.fancybox({
                        'type': 'iframe',
                        'width': 400,
                        'height': 350,
                        'hideOnOverlayClick': false,
                        'href': 'MoveItem.aspx?templateID=<%=TemplateID %>&menuID=<%=menuId %>'
                     });
                 }
                 return false;
             });

             $(".FBox").click().fancybox({
                 'width': 690,
                 'height': 520,
                 'hideOnOverlayClick': false,
                 'transitionIn': 'elastic',
                 'transitionOut': 'fade',
                 'type': 'iframe',
                 'padding': '0'
             });
             $('[data-rel=popover]').popover({ container: 'body' });

         });

         //栏目移动确认小页面调用本方法 
         function CallMoveSubmit() {
             //加载load特效（防止在生成静态页阶段重复点击按钮） 不显示弹出层的关闭按钮，按ESC来关闭弹出层
             $.fancybox({
                 'type': 'image',
                 'width': 50,
                 'height': 50,
                 'hideOnOverlayClick': false,
                 'padding': '0',
                 'scrolling': 'no',
                 'enableEscapeButton': 'true',
                 'showCloseButton': false,
                 'href': '../images/resfile/loading.gif'
             });

             $("#btnMoveSave").click();
         }

         ////选中背景特效
         //$(function () {
         //    $('.text-center input').click(function () {
         //        $(this).parents('tr').toggleClass('active');
         //    })
         //    $('.title.text-center input').click(function () {

         //        if ($('.list-table tr:first').hasClass('active')) {
         //            $('.list-table tr').addClass('active');
         //        } else {
         //            $('.list-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>
