<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="HL_Admin_Admin_ShopClass, HoWaveVGO" title="商城栏目管理" enableviewstate="false" enableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"/>
<script type="text/javascript" language="javascript">
function AddClass(id,action){
  switch (action){
      case "Add":
      var arr=showModalDialog('Admin_ShopAddClass.aspx?Action=Add&ParentID='+id,window,'dialogWidth:650px; dialogHeight:500px; help: yes; scroll: yes; status: no');
      break;
      case "Modify":
      var arr2=showModalDialog('Admin_ShopAddClass.aspx?Action=Modify&ClassID='+id,window,'dialogWidth:650px; dialogHeight:500px; help: yes; scroll: yes; status: no');
      break;
  }
   
}

function AddNewClass(){
     var arr=showModalDialog('Admin_ShopAddClass.aspx?ParentID=-1',window,'dialogWidth:650px; dialogHeight:500px; help: no; scroll: yes; status: no');
     if (arr != null){
       document.getElementById(ctlName).value=arr;
     }     
}

function showHide(theHiddenMess) {
    var i;
	var item;
    for (i = 0; i <myClass.length; ++i)
	{
		item = myClass[i];
		if (!item)
			continue;
		if(item[3]==theHiddenMess)
			{
		    var view = document.getElementById("tr"+item[0]);
			if(view.style.display == "none")
   			    {view.style.display =  "";}
		    else
				{view.style.display = "none";
				if(item[2]>0)
				    showHide2(item[0],i);
				}	   
			}
	}
}
function showHide2(theHiddenMess,start) {
    var i
	var item;
    for(i=start;i<myClass.length;i++)
    {
	    item = myClass[i];
		if (!item)
		    continue;
		if(item[3]==theHiddenMess)
    		{
		    var view = document.getElementById("tr"+item[0]);
            view.style.display = "none";
			if(item[2]>0)
			    showHide2(item[0],i);
			}
    }
}
</script>
<table class="adminheading">                       
          <tr>
            <th class="msgconfig">
                商城栏目管理</th>
            <td align="right">
            <div style="width:100px"><a href="#" id="AddNewClass" onclick="AddNewClass()" >添加新栏目</a></div>  
            </td>
            <td class="rtdw"></td>
          </tr>                        
       </table> 
 
  <asp:UpdatePanel ID="UpdatePanel1" runat="server">
      <ContentTemplate>
<asp:GridView id="GridView1" runat="server" AllowSorting="True" DataSourceID="ObjectDataSource1" DataKeyNames="ClassID" CssClass="adminlist" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound" PageSize="40" RowStyle-Height="15px" Width="100%"><Columns>
<asp:BoundField DataField="ClassID" HeaderText="ID">
<ControlStyle Width="20%"></ControlStyle>
</asp:BoundField>
<asp:TemplateField HeaderText="栏目名称及目录">
<ItemStyle Width="30%" HorizontalAlign="Left"></ItemStyle>
<ItemTemplate>
                           <%# DisplayClassName((S_Class.HLShop_ClassRow)((System.Data.DataRowView) Container.DataItem).Row) %>
                       
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="权限">
<ItemStyle Width="20%"></ItemStyle>
<ItemTemplate>
                          <asp:Literal ID="Access" runat="server" Text='<%# Eval("ShowOnTop") %>'/> 
                        
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="操作选项">
<ItemStyle Width="30%"></ItemStyle>
<ItemTemplate>
                           <a href="javascript:void(0)" id="AddChildClass" onclick="AddClass('<%# Eval("ClassID") %>','Add')" >添加子栏目</a>|
                           <a href="javascript:void(0)" id="UpdateChildClass"  onclick="AddClass('<%# Eval("ClassID") %>','Modify')">修改设置</a>|
                           <a href="../Shop/Browse/ShopCategory.aspx?ParentID=<%# Eval("ClassID") %>" target="_blank" >查看该分类商品</a>|
                           <asp:HiddenField ID="HiddenChildClass" runat="server" Value='<%# Eval("ClassID") %>' />
                           <asp:LinkButton id="btnDelete" runat="server" OnClientClick ="return confirm('删除栏目操作将删除此栏目中的所有子栏目及商品,并且不能恢复!确定要删除此栏目吗?')" CommandName="Delete" Text="删除"/>               
                       
</ItemTemplate>
</asp:TemplateField>
</Columns>

<RowStyle Height="15px"></RowStyle>
</asp:GridView> 
</ContentTemplate>  
  </asp:UpdatePanel> 
<%=m_Script + "[0,0,0,0]];</script>"%>   
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAllClass" TypeName="Shop_Class" DeleteMethod="DeleteClassByClassID" OnInserted="ObjectDataSource1_Inserted"  >
        <DeleteParameters>
            <asp:Parameter Name="ClassID" Type="Int32" />
        </DeleteParameters>
    </asp:ObjectDataSource>
   
</asp:Content>

