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

<!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/userCssList.htm"-->

    <script type="text/javascript">
        jQuery(function ($) {

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

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

            $("#btnMove").click(function () {
                if (GridSelectCheck('newsGrid', 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'
            });
            
        });
        
        
        //栏目移动确认小页面调用本方法 
        function CallMoveSubmit()
        {
            $("#btnMoveSave").click();
        }
    
        //选中背景特效
        $(function(){
            $('.txt-c input').click(function(){
	            $(this).parents('tr').toggleClass('active');
            })
            
            $('.title.txt-c input').click(function(){
	            
	            if($('.list-table tr:first').hasClass('active')){
		            $('.list-table tr').addClass('active');
	            }else{
		            $('.list-table tr').removeClass('active');
	            }
            })
            
            $('.list-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;
                    }
                }
                
            })
            /*列表高度*/
            $('.function-bd').height($(window).innerHeight() - 145);

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

</head>
<body>
    <div class="list-func-box func-box">
        <form id="Form1" method="post" runat="server">
            <div class="hd">
                <div class="breadcrumb">
                    <asp:PlaceHolder ID="placeHead" runat="server"></asp:PlaceHolder>
                </div>
                <!--/breadcrumb-->
                <div class="user-service">
                    <a class="help" href="#" title="帮助：可直接点击信息标题查看信息。将鼠标悬停放在发布人名字上可看到发布IP地址。">帮助</a>
                </div>
                <!--/user-service-->
            </div>
            <div class="bd">
                <div class="function-hd">
                    <div class="search-box fr">
                        <asp:DropDownList ID="ddlSearchType" runat="server" EnableViewState="False" CssClass="drop-txt" Width="80">
                            <asp:ListItem Selected="True" Value="intacttitle">标题</asp:ListItem>
                            <asp:ListItem Value="content">内容</asp:ListItem>
                            <asp:ListItem Value="fullname">发布人</asp:ListItem>
                        </asp:DropDownList>
                        <asp:TextBox ID="tbSearch" class="input-txt" runat="server"></asp:TextBox>
                        <asp:Button ID="btnSerach" class="btn" runat="server" OnClick="Btn_Click" Text="查 询" />
                    </div>
                    <!--/search-box-->
                    <div class="action-field">
                        <asp:Button ID="btnSave" class="btn" runat="server" Text="保 存" OnClick="Btn_Click"></asp:Button>
                        &nbsp;
                    <asp:Button ID="btnAdd" class="btn" runat="server" Text="添 加" OnClick="Btn_Click"></asp:Button>
                        &nbsp;
                    <asp:Button ID="btnMove" runat="server" class="btn" Text="移 动"></asp:Button>
                        &nbsp;
                    <asp:Button ID="btnDel" class="btn" runat="server" Text="删 除" OnClick="Btn_Click"></asp:Button>
                        &nbsp;
                    <asp:Button ID="btnMoveSave" class="btn" 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>
                <div class="function-bd" style="height: 592px; overflow: auto;">
                    <!--[if lte IE 7]><div style="zoom:1"><![endif]-->
                    <asp:HiddenField ID="hfidstr" runat="server" />
                    <asp:HiddenField ID="hftitlestr" runat="server" />
                    <asp:DataGrid ID="newsGrid" class="list-table" runat="server" AllowSorting="True" AutoGenerateColumns="False" OnItemCommand="newsGrid_ItemCommand">
                        <Columns>
                            <asp:TemplateColumn HeaderStyle-CssClass="title txt-c" ItemStyle-CssClass="txt-c" ItemStyle-Width="36px">
                                <HeaderTemplate>
                                    <asp:CheckBox ID="cbAll" Text="" runat="server" onclick="GridSelectAll('newsGrid',this.checked)" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="cbthis" runat="server" Text=""></asp:CheckBox>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:BoundColumn DataField="pkId" HeaderText="ID号" HeaderStyle-CssClass="hidden" ItemStyle-CssClass="hidden" FooterStyle-CssClass="hidden"></asp:BoundColumn>
                            <asp:TemplateColumn HeaderText="标题" HeaderStyle-CssClass="title">
                                <ItemTemplate>
                                    <asp:HiddenField ID="hfvalid" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.validDays") %>' />
                                    <asp:Label ID="Valid" Visible="false" runat="server" Text="[过期]" ForeColor="Red"></asp:Label>
                                    <asp:Label ID="CC" Visible="false" runat="server" Text="[抄送]" ForeColor="Red"></asp:Label>
                                    <asp:Label ID="IsListTitle" Visible="false" runat="server" Text="[链接]" ForeColor="Red"></asp:Label>
                                    <asp:HyperLink ID="intactTitle" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.intactTitle") %>' Target="_blank" NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.pkId", "../newsInfo.aspx?pkId={0}") %>'></asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderText="发布人" HeaderStyle-CssClass="title">
                                <ItemTemplate>
                                    <a href="#">
                                        <asp:Label ID="info" runat="server" Text='<%#Eval("fullName") %>' ToolTip='<%# "发布IP："+ Eval("updateIp") %>'></asp:Label></a>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderText="发布时间" HeaderStyle-CssClass="title">
                                <ItemTemplate>
                                    <a href="#">
                                        <asp:Label ID="lbtime" runat="server" Text='<%# Eval("updateTime", "{0:yyyy-M-d}") %>' ToolTip='<%# Eval("updateTime") %>'></asp:Label></a>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderText="今日推荐" HeaderStyle-CssClass="title" Visible="false">
                                <ItemTemplate>
                                    <asp:DropDownList ID="isRecommand" runat="server" SelectedIndex='<%# DataBinder.Eval(Container, "DataItem.isRecommand") %>'>
                                        <asp:ListItem Value="0" Selected="True">否</asp:ListItem>
                                        <asp:ListItem Value="1">推荐</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:BoundColumn DataField="click" HeaderText="点击量" HeaderStyle-CssClass="title"></asp:BoundColumn>
                            <asp:TemplateColumn HeaderText="固顶" HeaderStyle-CssClass="title">
                                <ItemTemplate>
                                    <asp:DropDownList ID="isTop" runat="server" SelectedIndex='<%# DataBinder.Eval(Container, "DataItem.isTop") %>'>
                                        <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="pass" runat="server" SelectedIndex='<%# DataBinder.Eval(Container, "DataItem.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:TemplateColumn>
                            <asp:TemplateColumn HeaderText="显示等级" HeaderStyle-CssClass="title">
                                <ItemTemplate>
                                    <asp:DropDownList ID="gradeDrop" runat="server" DataValueField="pkId" DataTextField="name" DataSource="<%# dv %>">
                                    </asp:DropDownList>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderText="浏览权限" HeaderStyle-CssClass="title">
                                <ItemTemplate>
                                    <asp:DropDownList ID="gate" runat="server" SelectedIndex='<%# DataBinder.Eval(Container, "DataItem.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:TemplateColumn>
                            <asp:TemplateColumn HeaderText="排序" HeaderStyle-CssClass="title">
                                <ItemTemplate>
                                    <asp:TextBox ID="Priority" runat="server" MaxLength="6" Text='<%#Eval("Priority")%>' class="input-txt priority" Style="width: 45px;"></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:TemplateColumn HeaderText="管理" HeaderStyle-CssClass="title" ItemStyle-CssClass="td-a">
                                <ItemTemplate>
                                    <asp:LinkButton ID="edit" runat="server" CommandName="edit">编辑</asp:LinkButton>&nbsp;&nbsp;
                                    <a href='manageReview.aspx?newsId=<%# DataBinder.Eval(Container, "DataItem.pkId")%>' target="_blank">评论</a>&nbsp;&nbsp;
                                    <asp:Label ID="lbpushweike" runat="server"><a href='PushWeike.aspx?pkid=<%# DataBinder.Eval(Container, "DataItem.pkId")%>' target="_blank" class="FBox" >推送</a></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateColumn>
                            <asp:BoundColumn Visible="False" DataField="grade" HeaderText="等级" HeaderStyle-CssClass="title"></asp:BoundColumn>
                            <asp:BoundColumn Visible="False" DataField="useListTitle" HeaderText="useListTitle"></asp:BoundColumn>
                            <asp:BoundColumn Visible="False" DataField="listTitle" HeaderText="listTitle" HeaderStyle-CssClass="title"></asp:BoundColumn>
                            <asp:BoundColumn DataField="isDuplicated" Visible="false" HeaderText="是否抄送" HeaderStyle-CssClass="title"></asp:BoundColumn>
                            <asp:BoundColumn DataField="duplicateFrom" Visible="false" HeaderText="抄送来源" HeaderStyle-CssClass="title"></asp:BoundColumn>
                            <asp:BoundColumn DataField="duplicatedPkId" Visible="false" HeaderText="抄送Id" HeaderStyle-CssClass="title"></asp:BoundColumn>
                        </Columns>
                    </asp:DataGrid>
                    <!--[if lte IE 7]></div><![endif]-->
                </div>
                <!--/function-bd-->
            </div>
            <div class="ft">
                <div class="pagination">
                    <asp:Label ID="showPage" runat="server"></asp:Label>
                </div>
            </div>
            <!--/user-xyz-->
        </form>
    </div>
</body>
</html>