<%@ Page Title="" Language="C#" MasterPageFile="~/Management/SiteManage.Master" AutoEventWireup="true" CodeBehind="NodeRule.aspx.cs" Inherits="Amr.SuperSiteGroup.Web.Management.NodeRule" %>
<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">
                        广告管理</h1>
                </td>
            </tr>
            <tr>
                <td class="edit_main">
                            <table width="100%" border="0" cellspacing="1" cellpadding="1" class="table_list">
                                <tr class="tr1">
                                    <td colspan="2">
                                        <asp:Label ID="laTitle" runat="server" Text="添加广告管理"></asp:Label><br />
                                        <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">
                                            广告位名称<font color="red">*</font>：</div></td>
                                    <td align="left">
                                                    <asp:TextBox ID="tbName" runat="server" Width="80" Wrap="False" />
                                                    <validation targetid="<%=tbName.ClientID%>" targetname="广告位名称" type="text" />
                                                </td>
                                        </tr>
                                <tr>
                                    <td width="20%">
                                        <div align="right">
                                            规则表达式<font color="red">*</font>：</div>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="tbExpression" runat="server" CausesValidation="True"
                                            EnableViewState="False" TextMode="MultiLine" Width="100%" Wrap="False" 
                                            ValidationGroup="checkAdd" />
                                        <validation targetid="<%=tbExpression.ClientID%>" targetname="规则表达式" type="text" />
                                        <br />
                                        您试图应用规则的节点的xpath
                                    </td>
                                </tr>
                                <tr style="display:none">
                                    <td>
                                        <div align="right">
                                            属性名称：</div>
                                    </td>
                                    <td align="left">
                                                    <asp:TextBox ID="tbAttributeName" runat="server" Width="80" 
                                                Wrap="False" />
                                            <br />
                                            如果选择的是属性操作，请填写具体属性名称
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div align="right">
                                            广告代码：</div>
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="tbOperationValue" runat="server"
                                            TextMode="MultiLine" Width="100%" Wrap="False" />
                                          </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div align="right">
                                            操作索引<font color="red">*</font>：
                                            </div>
                                    </td>
                                    <td align="left">
                                                    <asp:TextBox ID="tbOperationIndex" runat="server" Width="80" Wrap="False" >0</asp:TextBox>
                                                    <validation targetid="<%=tbOperationIndex.ClientID%>" targetname="操作索引" type="number" />
                                                    <br />xpath会匹配很多个选项
                                                    ，当匹配到多个时，您希望对第几个匹配项使用规则，填写0，所有的匹配项，填写其他数值，如果匹配项个数不足，规则也将不生效，比如匹配1个您填写2</td>
                                </tr>
                                <tr>
                                    <td>
                                        <div align="right">
                                            操作类型：</div>
                                    </td>
                                    <td align="left">
                                                    <asp:DropDownList ID="ddlOperationType" runat="server">
                                                      <asp:ListItem Value="0">删除广告</asp:ListItem>
                                                        <asp:ListItem Value="1">替换广告内容</asp:ListItem>
                                                        <asp:ListItem Value="2">在广告内容前添加指定内容</asp:ListItem>
                                                        <asp:ListItem Value="3">在广告内容后添加指定内容</asp:ListItem>
                                                        <asp:ListItem Value="4">添加新属性</asp:ListItem>
                                                        <asp:ListItem Value="5">改变指定属性值</asp:ListItem>
                                                        <asp:ListItem Value="6">删除指定属性</asp:ListItem>
                                                        <asp:ListItem Value="12">在属性值前面添加内容</asp:ListItem>
                                                        <asp:ListItem Value="13">在属性值后面添加内容</asp:ListItem>
                                                        <asp:ListItem Value="7">改变属性名</asp:ListItem>
                                                        <asp:ListItem Value="8">广告交换位置</asp:ListItem>
                                                        <asp:ListItem Value="9">替换广告</asp:ListItem>
                                                        <asp:ListItem Value="10">在广告前插入内容</asp:ListItem>
                                                        <asp:ListItem Value="11">在广告后插入内容</asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                </tr>
                                <tr>
                                    <td>
                                        <div align="right">
                                            优先级<font color="red">*</font>：</div>
                                    </td>
                                    <td align="left">
                                                    <asp:TextBox ID="tbPriority" runat="server" Width="80" Wrap="False" >10</asp:TextBox>
                                                    <validation targetid="<%=tbPriority.ClientID%>" targetname="优先级" type="number" />
                                                    <br />
                                                    请指定优先级，优先级高的规则先生效，数字越小代表优先级越高。</td>
                                </tr>
                                <tr>
                                    <td>
                                        <div align="right">
                                            选项：</div>
                                    </td>
                                    <td align="left">
                                        <asp:CheckBox ID="cbIsEnable" CssClass="checkbox" runat="server" 
                                            Text="是否激活" Checked="True" />
                                        </td>
                                </tr>
                                <tr>
                            <td>
                                <div align="right">
                                    页面匹配：</div>
                            </td>
                            <td align="left">
                                <fieldset>
                                    <legend>指定页面匹配</legend>
                                    <asp:CheckBox ID="cbMatchUrl" CssClass="checkbox" runat="server" onclick="$('#matchUrlParameter').toggle()"
                                        Text="规则用于指定页面（当前规则只对指定的页面生效）" />
                                    <br />
                                    <div id="matchUrlParameter" style="display: <%=cbMatchUrl.Checked?string.Empty:"none"%>">
                                        <asp:CheckBox ID="cbExactMatch" CssClass="checkbox" runat="server" Text="是否精确匹配指定网址（对指定页面地址采取精确匹配或者模糊匹配，模糊匹配只要页面网址包含指定网址【这里是指原网页地址】，则规则生效）" />
                                        <br />
                                        指定地址：
                                        <asp:TextBox ID="tbUrl" runat="server" Width="80%" Wrap="False" />
                                    </div>
                                </fieldset>
                            </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="gvNodeRules" runat="server" AutoGenerateColumns="False" 
                        GridLines="None" CssClass="table_list" Width="100%" 
                        EnableModelValidation="True" onrowdatabound="gvNodeRules_RowDataBound">
                        <Columns>
                            <asp:TemplateField HeaderText="操作" ShowHeader="False">
                                <ItemTemplate>
                                    <asp:LinkButton ID="lbEdit" runat="server" CausesValidation="False"
                                        Text="【编辑】" CommandArgument='<%# Bind("RuleId") %>' onclick="lbEdit_Click"></asp:LinkButton>
                                    &nbsp;<asp:LinkButton ID="lbDelete" runat="server" CausesValidation="False" CommandArgument='<%# Bind("RuleId") %>'
                                        Text="【删除】" onclick="lbDelete_Click" OnClientClick="if(confirm('确认删除记录?')){eval(this.attributes['href'].value)}else{return false}"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="RuleId" HeaderText="编号" 
                                SortExpression="RuleId" />
                        <asp:CheckBoxField DataField="IsEnable" HeaderText="是否激活" SortExpression="IsEnable" />
                        <asp:BoundField DataField="Priority" HeaderText="优先级" SortExpression="Priority" />
                        <asp:BoundField DataField="Name" HeaderText="广告位名称" SortExpression="Name" />
                            <asp:TemplateField HeaderText="表达式" SortExpression="Expression">
                                <ItemTemplate>
                                    <asp:TextBox ID="expression" runat="server" Text='<%# Bind("Expression") %>' ReadOnly="true"
                                        TextMode="MultiLine" Width="300px" Wrap="False"></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="广告代码" SortExpression="OperationValue">
                                <ItemTemplate>
                                    <asp:TextBox ID="operationValue" runat="server" 
                                        Text='<%# Bind("OperationValue") %>' ReadOnly="true"
                                        TextMode="MultiLine" Width="300px" Wrap="False"></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="OperationIndex" HeaderText="操作索引" 
                                SortExpression="OperationIndex" />
                        </Columns>
                        <HeaderStyle CssClass="tr1" />
                        <RowStyle CssClass="tr_a" />
                        <AlternatingRowStyle CssClass="tr_b" />
                        <EmptyDataTemplate>
                            没有数据，请先添加！
                        </EmptyDataTemplate>
                        <FooterStyle CssClass="dg_header" />
                    </asp:GridView>
                </td>
            </tr>
        </table>
    </div>
    <div class="clear" style="margin-top: 10px;">
    </div>
</asp:Content>
