<%@ page language="C#" autoeventwireup="true" inherits="V5Shop.Admin.Template_Page_Manage, V5Shop.Shop.Template" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Src="control/ManageHeader.ascx" TagName="ManageHeader" TagPrefix="uc3" %>
<%@ Register Src="control/PageBottom.ascx" TagName="PageBottom" TagPrefix="uc2" %>
<%@ Register Src="control/HiddenField.ascx" TagName="HiddenField" TagPrefix="uc1" %>
<%@ Register TagPrefix="V5Shop" Namespace="V5Shop.Control" Assembly="V5Shop.Control" %>
<!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" >
<head runat="server">
    <title>页面管理</title>
<link href="css/css.css" rel="stylesheet" type="text/css">
<link href="css/css_list.css" rel="stylesheet" type="text/css">
<link href="css/control.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="javascript" src="js/Common.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
        <uc3:ManageHeader ID="ManageHeader1" runat="server" />

        <div id="searcharea"><b style="color:#4B6888">搜索页面：</b>
            <asp:Label ID="lblName" runat="server" Text="页面名称"></asp:Label>
            <asp:TextBox ID="txtName" Width="100px" runat="server"></asp:TextBox>

            <asp:Label ID="lblCategory" runat="server" Text="所在模板"></asp:Label>
            <asp:DropDownList ID="ddlCategory" runat="server"></asp:DropDownList>
            <asp:Button ID="btnSearch" runat="server" Text="查询" OnClick="btnSearch_Click" class="button"/>
        </div>
        
        <div id="content">
            <div id="tool">
              <input class="checkbox" type="checkbox" id="CheckAllBox" onclick="CheckAll()" /> 全选
        　    <asp:LinkButton ID="btnAdd" runat="server" ForeColor="#4B6888" OnClick="btnAdd_Click"><img src="images/icon/key_add.gif" /> 添加</asp:LinkButton>
        　    <asp:LinkButton ID="btnEdit" runat="server" ForeColor="#4B6888" OnClientClick="return EditPage()"><img src="images/icon/key_edit.gif" /> 编辑</asp:LinkButton>
        　    <asp:LinkButton ID="btnDel" runat="server" ForeColor="#4B6888" OnClientClick="return CheckDel()"><img src="images/icon/key_delete.gif" /> 删除</asp:LinkButton>
        　    <asp:LinkButton ID="LinkButton1" runat="server" ForeColor="#4B6888" OnClientClick="return ViewPage()"><img src="images/icon/key_detail.gif" /> 浏览页面</asp:LinkButton>
            </div>
            <div class="listborder">
                <V5Shop:V5ShopGridView ID="GridViewShow" runat="server"
                AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CssClass="datalist" 
                HeaderStyle-Height="18px" HeaderStyle-ForeColor="#000" EmptyDataText="没有查询到任何记录" TableName="TemplatePage" PageSize="10">
                    <Columns>
                        <asp:TemplateField ItemStyle-Width="2%">
                            <ItemTemplate>
                                <input class="checkbox" runat="server" Value='<%# Eval("Name") %>' ID="CheckBoxID" type="checkbox" onmouseover="this.mouse='over'" onmouseout="this.mouse='out'" mouse="out">
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="PageName" SortExpression="PageName" HeaderText="页面名称"/>
                        <asp:BoundField DataField="Size" SortExpression="Size" HeaderText="页面大小"/>
                        <asp:BoundField DataField="ModifyDate" SortExpression="ModifyDate" HeaderText="上次修改时间"/>
                    </Columns>
                </V5Shop:V5ShopGridView>
            </div>
        </div>
        
        <div id="hiddenfield">
            <asp:HiddenField ID="CheckedIDS" runat="server" Value="0" />
            <asp:HiddenField ID="PageIndex" runat="server" Value="0"/>
            <asp:HiddenField ID="MaxPageIndex" runat="server" Value="0"/>
            <uc1:HiddenField ID="Alert" runat="server" />
        </div>
        <uc2:PageBottom ID="PageBottom1" runat="server" />
    </div>
    </form>
    <script>
        function ViewPage(){
            if(CheckEdit()){
                form1.target = "_blank";
                form1.action = "../" + document.getElementById("CheckedIDS").value + ".aspx";
                form1.submit();
                form1.action = "";
                form1.target = "_self";
                return false;
            }else{
                return false;
            }
        }
        
        function EditPage(){
            if(CheckEdit()){
                var tplname = document.getElementById("ddlCategory").options[document.getElementById("ddlCategory").options.selectedIndex].value;
            
                form1.target = "_blank";
                form1.action = "Template_Page_Operate.aspx?path=<%=path%>&name=" + tplname + "&id=" + document.getElementById("CheckedIDS").value;
                form1.submit();
                form1.action = "";
                form1.target = "_self";
                return false;
            }else{
                return false;
            }
        }
    </script>
</body>
</html>
