<%@ page language="C#" autoeventwireup="true" inherits="ims.web.Filters, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="filters">
<head runat="server">
    <title>过滤器管理</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="sm" runat="server">
            <Scripts><asp:ScriptReference Name="MicrosoftAjax.js" ScriptMode="Auto" Path="~/js/MsAjax.js"/><asp:ScriptReference Name="MicrosoftAjaxWebForms.js" ScriptMode="Auto" Path="~/js/MsAjax.js"/></Scripts>
        </asp:ScriptManager>
        <asp:validationsummary id="ValSum" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="add"></asp:validationsummary>
        <div runat="server" id="pageTitle" class="pageTitle"></div>
        <asp:UpdatePanel ID="up" runat="server" RenderMode="inline" UpdateMode="Conditional">
        <ContentTemplate>
            <div runat="server" id="EmptyPrompt" visible="false" class="highlight corner"></div>
            <table class="normal" cellspacing="1">
            <asp:Repeater ID="rptFilters" runat="server" OnItemCommand="rptFilters_Command" OnItemDataBound="rptFilters_ItemBound">
            <HeaderTemplate><tr><th style="width:28px">序号</th><th style="width:120px">名称</th><th>过滤规则描述</th><th style="width:36px">隐藏</th><th style="width:72px" colspan="2">操作</th></tr></HeaderTemplate>
            <ItemTemplate>
                <tr runat="server" id="ItemTr">
                    <td runat="server" title="拖动调整顺序" class="handle"></td>
                    <td runat="server" title="拖动调整顺序" class="handle"></td>
                    <td runat="server"></td>
                    <td runat="server" align="center"></td>
                    <td runat="server" align="center"><asp:LinkButton CommandName="edit" ID="lbEdit" runat="server">编辑</asp:LinkButton></td>
                    <td runat="server" align="center"><asp:LinkButton CommandName="del" ID="lbDel" runat="server" OnClientClick="return confirm('确定要删除此过滤器吗？');">删除</asp:LinkButton></td>
                </tr>
            </ItemTemplate>
            </asp:Repeater>
            </table>
        </ContentTemplate>
        </asp:UpdatePanel>
        <div class="footBtnArea">
            <asp:Button runat="server" ID="btnAdd" Text="添加过滤器" Width="78" OnClick="toAdd" CssClass="btn" />
            <input type="button" onclick="back();" value="返回" class="btn" />
            <asp:Button runat="server" id="btnSort" OnClick="SaveOrder" CssClass="hide" />
        </div>
    <script src="js/comm.js"></script>
    <script>
        $(function () {
            $("table.normal").sortable({
                items: "tr[FilterName]",
                handle: "td.handle",
                helper: 'clone',
                opacity: 0.7,
                ghosting: true,
                scroll: false,
                update: function () {
                    var orders = "";
                    $("table.normal:first tr[FilterName]").each(function () {
                        orders += Base64($(this).attr("FilterName")) + ",";
                    });
                    __doPostBack("btnSort", orders);
                    parent.leftFrame.reloadTabs('browse');
                }
            });
        });
        function confirmDel(ctlid, msg) {
            if (confirm(msg)) {
                setTimeout(function () { __doPostBack(ctlid, "Confirmed"); }, 0);
            } else {
                return false;
            }
        }
    </script>
    </form>
</body>
</html>