<%@ page language="C#" masterpagefile="~/manage/Main.master" autoeventwireup="true" inherits="manage_Menu, App_Web_fef3q6en" title="栏目管理" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MidContent" runat="Server">
    <div id="main">
        <asp:UpdatePanel ID="MsgUpdatePanel" UpdateMode="Conditional" runat="server">
            <ContentTemplate>
                <asp:Label ID="Msg" runat="server" Text="" CssClass="msg" Visible="False" EnableViewState="False"></asp:Label>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdatePanel ID="MenuListUpdatePanel" UpdateMode="Conditional" runat="server">
            <ContentTemplate>
                <asp:Panel ID="MpePanel" runat="server" CssClass="" Style='display: none'>
                    <asp:Panel ID="TitlePanel" CssClass="MTop" runat="server">
                        <div class="MTopLeft">
                        </div>
                        <div class="MTopMid">
                            <a class="MTopClose" title="关闭" href="javascript:hideModalPopupViaClient('MenuList');">
                            </a><span class="MTitle">系统提示</span></div>
                        <div class="MTopRight">
                        </div>
                    </asp:Panel>
                    <div class="MMid">
                        <div class="MMidBox">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tbody>
                                    <tr>
                                        <th class="MIcon">
                                            <div class="MIconInfo">
                                            </div>
                                        </th>
                                        <td class="MContext">
                                            将同时删除此栏目、所有子栏目、及其栏目内所有内容。<br />
                                            确定删除吗?
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="MBott">
                        <div class="MBottLeft">
                        </div>
                        <div class="MBottMid">
                            <div class="MBtBox">
                                <asp:Button ID="OkBt" runat="server" CssClass="MBt MOk" Text="确 定" />
                                <asp:Button ID="CancelBt" runat="server" CssClass="MBt MCancel" Text="取 消" />
                            </div>
                        </div>
                        <div class="MBottRight">
                        </div>
                    </div>
                </asp:Panel>
                <asp:GridView ID="MenuList" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                    OnPageIndexChanging="MenuList_PageIndexChanging" DataKeyNames="MenuId" OnRowCancelingEdit="MenuList_RowCancelingEdit"
                    OnRowEditing="MenuList_RowEditing" OnRowUpdating="MenuList_RowUpdating" PageSize="11"
                    OnRowDeleting="MenuList_RowDeleting" CellPadding="0" CssClass="gv" Width="100%"
                    OnRowDataBound="MenuList_RowDataBound" EmptyDataText="暂无任何栏目">
                    <Columns>
                        <asp:BoundField DataField="OrderId" HeaderText="排序号">
                            <ControlStyle CssClass="gvOrderId" />
                        </asp:BoundField>
                        <asp:BoundField DataField="MenuName" HeaderText="栏目名称" />
                        <asp:TemplateField HeaderText="栏目标识">
                            <EditItemTemplate>
                                <asp:TextBox ID="FileName" runat="server" Text='<%# Bind("FileName") %>'></asp:TextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="FileName"
                                    Display="Dynamic" ErrorMessage="必须填写"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="FileName"
                                    Display="Dynamic" ErrorMessage="栏目标识必须为小写字母或下划线组成" ValidationExpression="[a-z_]{0,50}"></asp:RegularExpressionValidator>
                                <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="FileName"
                                    Display="Dynamic" ErrorMessage="已存在此标识" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label4" runat="server" Text='<%# Bind("FileName") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="栏目位置">
                            <EditItemTemplate>
                                &nbsp;<asp:HiddenField ID="LocationHiddenField" runat="server" Value='<%# Eval("Location") %>' />
                                <asp:DropDownList ID="LocationList" runat="server">
                                </asp:DropDownList>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# ShanRui.Web.MenuProvider.GetLocation(Eval("Location").ToString()) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="栏目类型">
                            <EditItemTemplate>
                                <asp:HiddenField ID="AttributerHiddenField" runat="server" Value='<%# Eval("Attributer") %>' />
                                <asp:Label ID="Label2" runat="server" Text='<%# ShanRui.Web.MenuProvider.GetAttributer(Eval("Attributer").ToString()) %>'></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:HiddenField ID="AttributerHiddenField" runat="server" Value='<%# Eval("Attributer") %>' />
                                <asp:Label ID="Label2" runat="server" Text='<%# ShanRui.Web.MenuProvider.GetAttributer(Eval("Attributer").ToString()) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:CheckBoxField DataField="Encrypt" HeaderText="是否加密">
                            <ControlStyle CssClass="checkBox" />
                        </asp:CheckBoxField>
                        <asp:CheckBoxField DataField="Show" HeaderText="是否显示">
                            <ControlStyle CssClass="checkBox" />
                        </asp:CheckBoxField>
                        <asp:TemplateField HeaderText="打开方式">
                            <EditItemTemplate>
                                <asp:HiddenField ID="TargetHiddenField" runat="server" Value='<%# Eval("Target") %>' />
                                <asp:DropDownList ID="TargetList" runat="server">
                                </asp:DropDownList>
                                &nbsp;
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="Label3" runat="server" Text='<%# ShanRui.Web.MenuProvider.GetTarget(Eval("Target").ToString()) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="href" HeaderText="链接地址" NullDisplayText="无" />
                        <asp:TemplateField HeaderText="操作" ShowHeader="False">
                            <EditItemTemplate>
                                <asp:Button ID="UpdateBt" runat="server" CausesValidation="True" CommandName="Update"
                                    Text="更新" />
                                <asp:Button ID="CancelBt" runat="server" CausesValidation="False" CommandName="Cancel"
                                    Text="取消" />
                            </EditItemTemplate>
                            <ItemStyle CssClass="gvCommandField" />
                            <ItemTemplate>
                                <asp:Button ID="EditBt" runat="server" Text="编辑" CausesValidation="false" CommandName="Edit" />
                                <asp:Button ID="DelBt" runat="server" CausesValidation="False" CommandName="Delete"
                                    Text="删除" />
                                <ajaxToolkit:ConfirmButtonExtender ID="MyConfirmButtonExtender" runat="server" TargetControlID="DelBt"
                                    DisplayModalPopupID="ConfirmModalPopupExtender" />
                                <ajaxToolkit:ModalPopupExtender ID="ConfirmModalPopupExtender" runat="server" TargetControlID="DelBt"
                                    PopupControlID="MpePanel" PopupDragHandleControlID="TitlePanel" CancelControlID="CancelBt"
                                    OkControlID="OkBt" BackgroundCssClass="modalBackground" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <RowStyle CssClass="gvRow" />
                    <EditRowStyle CssClass="gvEditRow" />
                    <PagerStyle CssClass="gvPage" />
                    <HeaderStyle CssClass="gvHeader" />
                    <AlternatingRowStyle CssClass="gvAlternatingRow" />
                </asp:GridView>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdatePanel ID="MenuAddUpdatePanel" UpdateMode="Conditional" 
            runat="server" oninit="MenuAddUpdatePanel_Init">
            <ContentTemplate>
                <table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D7D7D7"
                    id="mainBottTable">
                    <tr>
                        <td colspan="2" bgcolor="#FFFFFF" class="mainTitle">
                            添加栏目&nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td align="right" bgcolor="#FFFFFF" class="mainLeftTd">
                            栏目名称:
                        </td>
                        <td bgcolor="#FFFFFF">
                            &nbsp;<asp:TextBox ID="MenuName" runat="server" ValidationGroup="menuAdd"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="MenuNameValidator1" runat="server" ControlToValidate="MenuName"
                                ErrorMessage="栏目名称必须填写" ValidationGroup="menuAdd"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" bgcolor="#FFFFFF" class="mainLeftTd" style="height: 20px">
                            栏目标识:
                        </td>
                        <td bgcolor="#FFFFFF" style="height: 20px">
                            &nbsp;<asp:TextBox ID="FileName" runat="server" ValidationGroup="menuAdd"></asp:TextBox>
                            <span class="explain">&nbsp;栏目唯一标识符，将用于url地址中，应为小写字母或"_"</span>
                            <asp:RequiredFieldValidator ID="FileNameRequiredFieldValidator" runat="server" ControlToValidate="FileName"
                                ErrorMessage="栏目标识必须填写" Display="Dynamic" ValidationGroup="menuAdd"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="FileName"
                                Display="Dynamic" ErrorMessage="栏目标识必须为小写字母或下划线组成" ValidationExpression="[a-z_]{0,30}"
                                ValidationGroup="menuAdd"></asp:RegularExpressionValidator>
                            <asp:CustomValidator ID="FileNameCustomValidator" runat="server" ControlToValidate="FileName"
                                Display="Dynamic" ErrorMessage="此标识已经存在" OnServerValidate="FileNameCustomValidator_ServerValidate"
                                ValidationGroup="menuAdd"></asp:CustomValidator>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" bgcolor="#FFFFFF" class="mainLeftTd">
                            栏目排序号:
                        </td>
                        <td bgcolor="#FFFFFF">
                            &nbsp;<asp:TextBox ID="OrderId" runat="server" ValidationGroup="menuAdd" Text="0"
                                Width="30px"></asp:TextBox>
                            <span class="explain">&nbsp;排序号从小到大排，可以为正负整数</span>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="OrderId"
                                ErrorMessage="排序号必须填写" Display="Dynamic" ValidationGroup="menuAdd"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="OrderId"
                                Display="Dynamic" ErrorMessage="排序号应为正负整数" ValidationExpression="[-]{0,1}[0-9]+"
                                ValidationGroup="menuAdd"></asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr id="locationTr">
                        <td align="right" bgcolor="#FFFFFF">
                            栏目位置:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <asp:RadioButtonList ID="LocationList" runat="server" CssClass="radio" RepeatDirection="Horizontal"
                                RepeatLayout="Flow" ValidationGroup="menuAdd">
                            </asp:RadioButtonList>
                            <asp:RequiredFieldValidator ID="LocationValidator" runat="server" ControlToValidate="LocationList"
                                Display="Dynamic" ErrorMessage="栏目位置必须选择" ValidationGroup="menuAdd"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr id="attributerTr">
                        <td align="right" bgcolor="#FFFFFF">
                            栏目类型:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <asp:RadioButtonList ID="AttributerList" runat="server" CssClass="radio" RepeatLayout="Flow"
                                ValidationGroup="menuAdd">
                            </asp:RadioButtonList>
                            <asp:RequiredFieldValidator ID="AttributerValidator" runat="server" ControlToValidate="AttributerList"
                                Display="Dynamic" ErrorMessage="栏目类型必须选择" ValidationGroup="menuAdd"></asp:RequiredFieldValidator><span
                                    class="explain"></span>
                        </td>
                    </tr>
                    <tr id="tr1" class="hide">
                        <td align="right" bgcolor="#FFFFFF">
                            链接地址:
                        </td>
                        <td bgcolor="#FFFFFF" id="menuHrefTd">
                            <span style="display:none"><asp:Literal ID="MenuHrefLanguage" runat="server"></asp:Literal></span>
                            &nbsp;<asp:TextBox ID="Href" runat="server" ValidationGroup="menuAdd"></asp:TextBox>
                            <span class="explain">&nbsp;插入站内功能连接：</span>&nbsp;
                            <a href="#">打开购物车</a>&nbsp;
                            <a href="#">加入收藏夹</a>&nbsp;
                        </td>
                    </tr>
                    <tr id="tr2">
                        <td align="right" bgcolor="#FFFFFF">
                            是否加密:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <asp:RadioButtonList ID="Encrypt" runat="server" CssClass="radio" RepeatDirection="Horizontal"
                                RepeatLayout="Flow" ValidationGroup="menuAdd">
                                <asp:ListItem Value="1">是</asp:ListItem>
                                <asp:ListItem Selected="True" Value="0">否</asp:ListItem>
                            </asp:RadioButtonList>
                            <span class="explain">&nbsp;栏目加密后，会员栏目访问权限设置才会生效。</span>
                        </td>
                    </tr>
                    <tr id="tr3">
                        <td align="right" bgcolor="#FFFFFF">
                            是否显示:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <asp:RadioButtonList ID="Show" runat="server" CssClass="radio" RepeatDirection="Horizontal"
                                RepeatLayout="Flow" ValidationGroup="menuAdd">
                                <asp:ListItem Selected="True" Value="1">是</asp:ListItem>
                                <asp:ListItem Value="0">否</asp:ListItem>
                            </asp:RadioButtonList>
                        </td>
                    </tr>
                    <tr id="tr4">
                        <td align="right" bgcolor="#FFFFFF">
                            打开方式:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <asp:RadioButtonList ID="TargetList" runat="server" CssClass="radio" RepeatDirection="Horizontal"
                                RepeatLayout="Flow" ValidationGroup="menuAdd">
                            </asp:RadioButtonList>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" bgcolor="#FFFFFF">
                        </td>
                        <td bgcolor="#FFFFFF">
                            &nbsp;<asp:Button ID="Add" runat="server" Text="添加栏目" CssClass="inputBt" OnClick="Add_Click"
                                ValidationGroup="menuAdd" />
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</asp:Content>
