<%@ Page Title="" Language="C#" MasterPageFile="~/Management/SiteManage.Master" AutoEventWireup="true" CodeBehind="RedirectRule.aspx.cs" Inherits="Amr.SuperSiteGroup.Web.Management.RedirectRule" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="right" style="text-align: center; margin-top: 10px;">
        <table width="100%" border="0" cellspacing="1" cellpadding="1" class="edit">
            <tr>
                <td class="title_edit">
                    <h1 style="float: left">
                        <asp:Literal ID="ltEdit" runat="server" Text="编辑" Visible="false"></asp:Literal><asp:Literal ID="ltAdd" runat="server" Text="添加"></asp:Literal>重定向规则</h1>
                </td>
            </tr>
            <tr>
                <td class="edit_main">
                    <asp:HiddenField ID="hfRedirectRuleId" runat="server" />
                            <table width="100%" border="0" cellspacing="1" cellpadding="1" class="table_list">
                                <tr>
                                    <td colspan="2">
                                        <asp:Label ID="laErrorInfo" runat="server" ForeColor="Red"></asp:Label>
                                        <asp:Label ID="laSuccessInfo" runat="server" ForeColor="Green"></asp:Label>
                                    </td>
                                        </tr>
                                <tr>
                                    <td>
                                        <div align="right">
                                            规则名称：</div></td>
                                    <td align="left">
                                                    <asp:TextBox ID="tbName" runat="server" Width="80" Wrap="False" />
                                                </td>
                                        </tr>
                                <tr>
                                    <td>
                                        <div align="right">
                                            优先级（数字小的先生效）：</div></td>
                                    <td align="left">
                                        <asp:TextBox ID="tbPriority" runat="server" Text="1"
                                             Width="80" Wrap="False" />
                                        <validation targetid="<%=tbPriority.ClientID%>" targetname="优先级" type="number" />
                                             </td>
                                        </tr>
                                <tr>
                                    <td width="20%">
                                        <div align="right">
                                            匹配表达式 <font color="red">*</font>：</div>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="tbMatchExpression" runat="server" CausesValidation="True"
                                            EnableViewState="False" Wrap="False" 
                                            ValidationGroup="checkAdd" /> 此处输入网址后面不能带有“/”
                                        <validation targetid="<%=tbMatchExpression.ClientID%>" targetname="匹配表达式" type="text" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div align="right">
                                            重定向网址：</div>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="tbRedirectUrl" runat="server" Wrap="False" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div align="right">
                                            规则选项：</div>
                                    </td>
                                    <td align="left">
                                        <asp:CheckBox ID="cbIsEnable" CssClass="checkbox" runat="server" Checked="true"
                                            Text="是否激活" />
                                                    <asp:CheckBox ID="cbExactMatch" CssClass="checkbox" runat="server"
                                                    Text="是否精确匹配" 
                                                        ForeColor="Black" />
                                        <asp:CheckBox ID="cbIsRegex" CssClass="checkbox" runat="server"
                                            Text="是否正则表达式" />
                                    &nbsp;&nbsp;</td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <asp:LinkButton ID="lbSubmit" runat="server" 
                                            Text="【提交】" onclick="lbSubmit_Click"  OnClientClick="return validateForm()" />
                                        &nbsp;<asp:LinkButton ID="lbCancel" runat="server" Text="【取消】" onclick="lbCancel_Click"/>
                                    </td>
                                </tr>
                            </table>
                </td>
            </tr>
        </table>
    </div>
    <div class="clear">
    </div>
        <div class="right" style="text-align: center; margin-top: 10px;">
        <div class="clear">
        </div>
        <table width="100%" border="0" cellspacing="1" cellpadding="1" class="edit">
            <tr>
                <td class="title_edit">
                    <h1 style="float: left">
                        重定向规则列表</h1>
                </td>
            </tr>
            <tr>
                <td class="edit_main">
                    <asp:GridView ID="gvRedirectRules" runat="server" AutoGenerateColumns="False" 
                        GridLines="None" CssClass="table_list" Width="100%" 
                        EnableModelValidation="True">
                        <Columns>
                            <asp:TemplateField HeaderText="操作" ShowHeader="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False"
                                        Text="【编辑】" CommandArgument='<%# Bind("Id") %>' onclick="lbEdit_Click"></asp:LinkButton>
                                    &nbsp;<asp:LinkButton ID="lbDelete" runat="server" CausesValidation="False" CommandArgument='<%# Bind("Id") %>'
                                        Text="【删除】" onclick="lbDelete_Click" OnClientClick="if(confirm('确认删除记录?')){eval(this.attributes['href'].value)}else{return false}"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="Priority" HeaderText="优先级" 
                                SortExpression="Priority" />
                        <asp:CheckBoxField DataField="IsEnable" HeaderText="是否激活" SortExpression="IsEnable" />
                        <asp:BoundField DataField="RuleName" HeaderText="规则名称" SortExpression="RuleName" />
                            <asp:TemplateField HeaderText="匹配表达式" SortExpression="RuleExpression">
                                <ItemTemplate>
                                    <asp:TextBox ID="ruleExpression" runat="server" Text='<%# Bind("RuleExpression") %>' ReadOnly="true"
                                        TextMode="MultiLine" Width="300px" Wrap="False"></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="重定向网址" SortExpression="RedirectUrl">
                                <ItemTemplate>
                                    <asp:TextBox ID="redirectUrl" runat="server" Text='<%# Bind("RedirectUrl") %>' ReadOnly="true"
                                        TextMode="MultiLine" Width="300px" Wrap="False"></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CheckBoxField DataField="IsRegex" HeaderText="是否正则表达式" SortExpression="IsRegex" />
                            <asp:CheckBoxField DataField="ExactMatch" HeaderText="是否精确匹配" SortExpression="ExactMatch" />
                        </Columns>
                        <HeaderStyle CssClass="tr1" />
                        <RowStyle CssClass="tr_a" />
                        <AlternatingRowStyle CssClass="tr_b" />
                        <FooterStyle CssClass="dg_header" />
                    </asp:GridView>
                </td>
            </tr>
        </table>
    </div>
    <div class="clear" style="margin-top: 10px;">
    </div>
</asp:Content>
