<%@ page language="C#" autoeventwireup="true" inherits="ims.Filters, ims.web" enableviewstatemac="false" enableEventValidation="false" %>
<!DOCTYPE html>
<html id="filters">
<head runat="server">
    <title>过滤器管理</title><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="sm" runat="server" OnAsyncPostBackError="AsyncError" />
        <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" OnPreRender="AddScript" UpdateMode="Conditional">
        <ContentTemplate>
            <div runat="server" id="EmptyPrompt" visible="false" class="highlight"></div>
            <table class="hr">
            <asp:Repeater ID="rptFilters" runat="server" OnItemCommand="rptFilters_Command" OnItemDataBound="rptFilters_ItemBound">
            <HeaderTemplate><tr><th style="width:28px">序号</th><th style="width:110px">名称</th><th class="hide2">筛选条件</th><th style="width:36px">隐藏</th><th style="width:60px">操作</th></tr></HeaderTemplate>
            <ItemTemplate>
                <tr runat="server" id="ItemTr" class="moveable">
                    <td runat="server" ></td>
                    <td runat="server"></td>
                    <td runat="server" class="hide2"></td>
                    <td runat="server"></td>
                    <td runat="server"><asp:ImageButton CommandName="showRefed" ToolTip="查看引用" CssClass="pointer" ID="ibRef" ImageAlign="Bottom" ImageUrl="images/export.png" runat="server" /> <asp:ImageButton CommandName="edit" ToolTip="编辑" CssClass="pointer" ID="ibEdit" ImageAlign="Bottom" ImageUrl="images/edit.gif" runat="server" /> <asp:ImageButton ImageAlign="Bottom" CommandName="del" ID="ibDel" CssClass="pointer" ToolTip="删除" runat="server" ImageUrl="images/del.gif" OnClientClick="return toDel();" /></td>
                </tr>
            </ItemTemplate>
            </asp:Repeater>
            </table>
        </ContentTemplate>
        </asp:UpdatePanel>
        <div class="footBtnArea bigger">
            <asp:Button runat="server" ID="btnAdd" Text="添加过滤器" OnClick="toAdd" CssClass="btn" />
            <input type="button" onclick="back();" value="返回" class="btn" />
            <asp:Button runat="server" id="btnSort" OnClick="SaveOrder" CssClass="hide" />
        </div>
        <ims:Pop runat="server" ID="refs" ShowOkButton="false" CanelButtonText="关闭" CustomCss="noline" Width="440">
            <ContentTemplate>
                <div runat="server" id="divRefs" class="mtop_m"></div>
            </ContentTemplate>
        </ims:Pop>
    <script src="js/comm.js"></script>
    <script>
        $(function () {
            $("table.hr").sortable({
                items: "tr[FilterName]",
                opacity: 0.7,
                ghosting: true,
                scroll: false,
                update: function () {
                    var orders = "";
                    $("table.hr:first tr[FilterName]").each(function () {
                        orders += Base64($(this).attr("FilterName")) + ",";
                    });
                    __doPostBack("btnSort", orders);
                    try {
                        parent.leftFrame.reloadTabs('browse');
                    }catch(e){}
                }
            });
        });
        function confirmDel(ctlid, msg) {
            if (!confirm(msg)) return false;
            setTimeout(function () { __doPostBack(ctlid, "Confirmed"); }, 0);
        }
        function Init() {
            var trs = $("table.hr tr:gt(0)").hover(function () { $(this).addClass("RowMouseOver"); }, function () { $(this).removeClass("RowMouseOver"); });
            trs.dblclick(function () {
                $(this).find(":image:first").click();
            }).attr("title", "双击编辑过滤器；拖动调整顺序");
        }
        function toDel() {
            return confirm('删除过滤器将导致引用它的数据无法打开，请先查看并修改引用。\n\n确定要删除此过滤器吗？');
        }
    </script>
    </form>
</body>
</html>