<%@ Page Language="C#" AutoEventWireup="true" CodeFile="gathertablelist.aspx.cs"
    MasterPageFile="~/whir_system/master/SystemMasterPage.master" Inherits="whir_system_module_extension_gathertablelist" %>

<%@ Import Namespace="Whir.Language" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(function () {
            var isInput = '<%=IsInput %>'.toLowerCase() == 'true' ? true : false;
            var isDelete = '<%=IsDelete %>'.toLocaleLowerCase() == 'true' ? true : false;


            //是否具有入库功能 lbChooseJoin
            if (isInput) {
                whir.control.getAllControlByNameToEnabled("a", "name", "lbJoin");  //行 入库
                $("#<%=lbChooseJoin.ClientID %>").css("display", "");  //选择入库
                $("#<%=lbAllJoin.ClientID %>").css("display", "");  //全部入库
            }
            else {
                whir.control.getAllControlByNameToDisabled("a", "name", "lbJoin");
                $("#<%=lbChooseJoin.ClientID %>").css("display", "none");  //选择入库
                $("#<%=lbAllJoin.ClientID %>").css("display", "none");  //全部入库
            }


            //是否具有删除功能
            if (isDelete) {
                whir.control.getAllControlByNameToEnabled("a", "name", "lbDelete");
                $("#<%=lbChooseDelete.ClientID %>").css("display", "");  //选择删除
                $("#<%=lbAllDelete.ClientID %>").css("display", "");  //全部入库删除
            }
            else {
                whir.control.getAllControlByNameToDisabled("a", "name", "lbDelete");
                $("#<%=lbChooseDelete.ClientID %>").css("display", "none");  //选择删除
                $("#<%=lbAllDelete.ClientID %>").css("display", "none");  //全部入库删除
            }

        });

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="mainbox">
        <dl class="title_column">
            <a href="gatherlist.aspx"><b>
                <%="采集管理".ToLang() %></b></a><em class="line"></em><a href="gather_edit.aspx"> <b>
                    <%="添加采集点".ToLang() %></b></a><em class="line"></em> <a class="aSelect"><b>
                        <%="采集结果".ToLang() %></b></a>
        </dl>
        <dl class="search_list">
            <div class="search" style="float: right;">
                <table border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td>
                            <b>
                                <%="关键字：".ToLang() %></b>
                        </td>
                        <td>
                            <whir:TextBox ID="txtKeyword" CssClass="text_common" runat="server" MaxLength="20" />
                        </td>
                        <td>
                            <asp:Button ID="btnSearch" runat="server" CssClass="button_search" OnClick="btnSearch_Click" />
                        </td>
                    </tr>
                </table>
            </div>
        </dl>
        <div class="clear">
        </div>
        <div class="All_list">
            <table id="ta_list" width="100%" border="0" cellspacing="0" cellpadding="0" class="Table">
                <tr class="biaoti">
                    <th width="20" style="text-align: center;">
                       <div class="th-inner "> <input id="chkAll" type="checkbox" name="cb_Top" onclick="whir.checkbox.selectAll(this,'cb_Position');"
                            title="<%="全选".ToLang()%>/<%="全不选".ToLang()%>" /></div>
                    </th>
                    <th align="center" style="text-align: center;">
                        <%="标题".ToLang()%>
                    </th>
                    <th align="center" style="text-align: center;">
                        <%="发布时间".ToLang()%>
                    </th>
                    <th align="center" style="text-align: center;">
                        <%="采集时间".ToLang()%>
                    </th>
                    <th align="center" style="text-align: center;">
                        <%="状态".ToLang()%>
                    </th>
                    <th width='<%=LanguageHelper.GetSplitValue("120px|120px|160px") %>'>
                        <%="操作".ToLang()%>
                    </th>
                </tr>
                <tbody id="tbdList">
                    <asp:Repeater ID="rpGatherTable" runat="server" OnItemCommand="rpGatherTable_ItemCommand"
                        OnItemDataBound="rpGatherTable_ItemDataBound">
                        <ItemTemplate>
                            <tr>
                                <td align="center">
                                    <input type="checkbox" name="cb_Position" value='<%# Eval("GatherTableId")%>' onclick="choose_file();" />
                                </td>
                                <td align="center">
                                    <a href="<%#Eval("url") %>" target="_blank">
                                        <%# Eval("title") %></a>
                                </td>
                                <td align="center">
                                    <%# Eval("publishdate","{0:yyyy-MM-dd}")%>
                                </td>
                                <td align="center">
                                    <%# Eval("createdate", "{0:yyyy-MM-dd}")%>
                                </td>
                                <td align="center">
                                    <%# switchstr(Eval("state").ToStr())%>
                                </td>
                                <td>
                                    <a href="<%#Eval("url") %>" target="_blank"><%="查看".ToLang()%></a>
                                    <asp:LinkButton ID="lbJoin" name="lbJoin" runat="server" CommandName="Join" CommandArgument='<%# Eval("GatherTableId") %>'>[<%="入库".ToLang()%>]</asp:LinkButton>
                                    <asp:LinkButton ID="lbDelete" name="lbDelete" runat="server" CommandName="Delete"
                                        CommandArgument='<%# Eval("GatherTableId") %>'><%="删除".ToLang()%></asp:LinkButton>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
            <asp:Literal ID="ltNoRecord" runat="server"></asp:Literal>
        </div>
        <div class="pages">
              <whir:WhirPager ID="AspNetPager1" runat="server" OnPageChanged="PageChanged" 
                NumericButtonCount="5" PageSize="10"
                UrlPaging="True" AlwaysShow="True" 
                LayoutType="Div" CssClass="btn-group pageNumA"
                CustomInfoClass="page_total" ShowCustomInfoSection="Left" 
                PagingButtonsClass="btn btn-white" CurrentPageButtonClass="btn btn-primary"
                FirstLastButtonsClass="btn btn-white first-last" PrevNextButtonsClass="btn btn-white prev-next"
                >
            </whir:WhirPager>
        </div>
        <div class="operate_foot">
            <asp:HiddenField ID="hidChoose" runat="server" />
            <asp:HiddenField ID="hidSort" runat="server" />
            <a href="javascript:whir.checkbox.selectAll(null,'cb_Position');">
                <%="全选".ToLang()%></a>/<a href="javascript:whir.checkbox.cancelSelectAll(null,'cb_Position');"><%="取消".ToLang()%></a>
            <asp:LinkButton ID="lbChooseJoin" name="lbChooseJoin" runat="server" OnCommand="Operate_Commad"
                CommandName="ChooseJoin" CssClass="aLink"><b><%="选择入库".ToLang()%></b></asp:LinkButton>
            <asp:LinkButton name="lbAllJoin" ID="lbAllJoin" runat="server" OnCommand="Operate_Commad"
                CommandName="AllJoin" CssClass="aLink"><b><%="全部入库".ToLang()%></b></asp:LinkButton>
            <asp:LinkButton ID="lbChooseDelete" runat="server" OnCommand="Operate_Commad" CommandName="ChooseDelete"
                CssClass="aLink"><b><%="批量删除".ToLang()%></b></asp:LinkButton>
            <asp:LinkButton ID="lbAllDelete" runat="server" OnCommand="Operate_Commad" CommandName="AllDelete"
                CssClass="aLink"><b><%="全部删除".ToLang()%></b></asp:LinkButton>
        </div>
    </div>
    <script type="text/javascript">
        //点击选中文件列表中的多选框
        function choose_file() {
            var choose = "";
            var flag_count = 0;
            var $checkbox = $("#tbdList input[type='checkbox']");
            $checkbox.each(function () {
                if ($(this).attr("checked") == true) {
                    choose += $(this).val() + "*";
                    flag_count += 1;
                }
            });
            $("#chkAll").attr("checked", $checkbox.length == flag_count ? true : false);
            $("#<%= hidChoose.ClientID %>").val(choose);
        }
        //全选
        function chooseAll(obj) {
            var checked = $(obj).attr("checked");
            $("#ta_list input[type='checkbox']").attr("checked", checked);
            choose_file();
        }
    </script>
</asp:Content>
