<%@ Page Title="发布信息管理" StylesheetTheme="AdminSkin" Language="C#" MasterPageFile="~/Others/AdminMasterPage.Master" AutoEventWireup="true" CodeBehind="InformationManage.aspx.cs" Inherits="Solution.Admin.Contents.TransactionManage" %>

<%@ Register Assembly="BX.Common" Namespace="Common" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="AdminContentHead" runat="server">
    <script type="text/javascript">
        function status(v) {
            if (v == "1") {
                return "有效";
            }
            else if (v == "2") {
                return "等待审核";
            }
            else if (v == "3") {
                return "审核失败";
            }
            else {
                return "";
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="AdminContentCenter" runat="server">
    <form id="Form1" runat="server">
        <asp:ObjectDataSource ID="ObjectDataSourceUserData" runat="server" EnablePaging="True"
            SelectCountMethod="Count" SelectMethod="List" TypeName="Logic.ReleaseInformation"
            OldValuesParameterFormatString="original_{0}">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="0" Name="conditional" QueryStringField="conditional"
                    Type="String" />
                <asp:QueryStringParameter DefaultValue="0" Name="category" QueryStringField="category"
                    Type="String" />
                <asp:QueryStringParameter DefaultValue="0" Name="keywords" QueryStringField="keywords"
                    Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <div class="DivRightCenter">
            <div class="listdiv">
                <div class="grid-title">
                    <div class="grid-title-text">
                        <h4>
                            <span>发布信息管理</span>
                        </h4>
                    </div>
                    <div class="grid-title-menu">
                        <ul>
                            <li><a href="InformationManage.aspx"><span>所有内容</span></a></li>
                            <li><a href="InformationManage.aspx?conditional=equals&category=recommend&keywords=1">
                                <span>所有推荐</span></a></li>
                            <li><a href="InformationManage.aspx?conditional=equals&category=status&keywords=1">
                                <span>显示状态</span></a></li>
                            <li><a href="InformationManage.aspx?conditional=equals&category=status&keywords=2">
                                <span>待审核</span></a></li>
                            <li><a href="InformationManage.aspx?conditional=equals&category=status&keywords=3">
                                <span>审核未通过</span></a>

                            </li>
                        </ul>
                    </div>
                </div>
                <div class="grid-search">
                    Search:
                       <div class="grid-searchcontent">
                           <div class="userddl">
                               <ul>
                                   <li class="userddl-li">
                                       <input style="width: 40px;" class="ddltext" value="" id="ddlSearchOption" type="text" /><a href="javascript:" class="ddlarrow"></a></li>
                               </ul>
                           </div>
                           <input class="searchtext" id="txtKeywords" onkeypress="if(event.keyCode==13){ListSearch();}" type="text" /><input class="searchbutton" id="Button6" type="button" value="" onclick="ListSearch();" />
                       </div>
                </div>
                <div class="grid-list">
                    <cc1:ExtendedGridView ID="ExtendedGridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                        CssClass="grid" DataSourceID="ObjectDataSourceUserData"
                        CheckBox="False" EnableTheming="False" ItemName="发布信息管理" PageSize="20">
                        <Columns>
                            <asp:BoundField DataField="ID" HeaderText="ID">
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Wrap="False" Width="50px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CategoryName" HeaderText="类别">
                                <HeaderStyle Wrap="False" />
                                <ItemStyle Wrap="False" Width="100px" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Title" HeaderText="标题"></asp:BoundField>
                            <asp:BoundField DataField="UserAccount" HeaderText="发布人">
                                <ItemStyle Width="100px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="CreateDate" HeaderText="创建时间">
                                <ItemStyle Width="50px" Wrap="False" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Views" HeaderText="浏览量">
                                <ItemStyle Width="50px" Wrap="False" />
                            </asp:BoundField>
                            <asp:TemplateField HeaderText="状态">
                                <ItemStyle Width="50px" Wrap="False" />
                                <ItemTemplate>
                                    <script type="text/javascript">
                                        document.write(status('<%#Convert.ToInt32(DataBinder.Eval(Container.DataItem,"Status")) %>'));
                                    </script>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="推荐">
                                <ItemStyle Width="50px" Wrap="False" />
                                <ItemTemplate>
                                    <%#Convert.ToInt32(DataBinder.Eval(Container.DataItem, "Recommend")) == 1 ? "是" : "否"%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="操作">
                                <ItemStyle Width="100px" Wrap="False" />
                                <ItemTemplate>
                                    <a href='InformationManage.aspx?cmd=delete&id=<%#DataBinder.Eval(Container.DataItem, "ID")%>&infoid=<%#DataBinder.Eval(Container.DataItem, "InfoID")%>&categoryid=<%#DataBinder.Eval(Container.DataItem, "CategoryID")%>'
                                        onclick="return confirm('确认删除?');">删除</a>&nbsp; 
                                    <a href='InformationManage.aspx?cmd=pass&id=<%#DataBinder.Eval(Container.DataItem, "ID")%>'>审核通过</a>&nbsp;

                                    <a href='InformationManage.aspx?cmd=recommend&id=<%#DataBinder.Eval(Container.DataItem, "ID")%>'><%#Convert.ToInt32(DataBinder.Eval(Container.DataItem, "Recommend")) == 1?"取消推荐":"推荐" %></a>
                                    <a href='/Item/<%#DataBinder.Eval(Container.DataItem, "InfoID")%>' target="_blank">查看</a>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </cc1:ExtendedGridView>
                </div>
            </div>
            <script type="text/javascript">
                var searchOption = new DropDownList("ddlSearchOption");
                searchOption.initial({ "标题": "Title" }, { "extend": true });
                function ListSearch() {
                    var keywords = document.getElementById("txtKeywords").value;
                    if (keywords != "") {
                        window.location.href = "InformationManage.aspx?category=" + searchOption.get() + "&keywords=" + encodeURI(keywords);
                    } else {
                        window.location.href = "InformationManage.aspx";
                    }
                }
            </script>
        </div>
    </form>
</asp:Content>
