<%@language=VBScript.Encode codepage=936 %>
<!--#include file="conn.asp"--><!--#include file="application.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim i,j
dim sql,rs
sql="select * from [ProdClass] where Fid = 0 order by ClassID desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
%>
<SCRIPT language=javascript>
function unselectall()
{
    if(document.del.chkAll.checked){
	document.del.chkAll.checked = document.del.chkAll.checked&0;
    } 	
}

function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
  }
function ConfirmDel()
{
   if(confirm("确定要删除选中的信息吗？一旦删除将不能恢复！"))
     return true;
   else
     return false;
}
</SCRIPT>
<!-- #include file="Inc/Head.asp" -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="862" align="center" valign="top"> <br>
    <strong>产品分类管理</strong>&nbsp;&nbsp;&nbsp;&nbsp;<a href="ClassAdd.asp" style="color: #990000; font-weight:bold;">添加一级分类</a><br>
    <br>
      <form name="del" method="Post" action="ClassDel.asp" onSubmit="return ConfirmDel();">
        <table width="620" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" class="border" style="word-break:break-all">
          <tr bgcolor="#A4B6D7" class="title"> 
            <td width="41" height="25" align="center">选中</td>
            <td width="46"  height="25" align="center">ID</td>
            <td width="190" align="center" bgcolor="#A4B6D7" >一级分类</td>
            <td width="165" align="center" >二级分类</td>
            <td width="81" align="center" >操作</td>
          </tr>
          <%do while not rs.eof%>
          <tr class="tdbg"> 
            <td width="41" height="22" align="center" bgcolor="#A4B6D7"> 
              <input name='ID' type='checkbox' onClick="unselectall()" id="ID" value='<%=cstr(rs("ClassID"))%>'>            </td>
            <td width="46" align="center" bgcolor="#ECF5FF"><%=rs("ClassID")%></td>
            <td  bgcolor="#ECF5FF">&nbsp;
			<%=rs("ClassName")%></td>
            <td align="center" bgcolor="#ECF5FF"><a href="ClassAdd.asp?Fid=<%=rs("ClassID")%>" style="color: #990000; font-weight:bold;">添加二级分类</a></td>
            <td width="81" align="center" bgcolor="#ECF5FF"> <a href="ClassEdit.asp?ID=<%=rs("ClassID")%>&page=<%=currentPage%>">修改</a> 
              <a href="ClassDel.asp?ID=<%=rs("ClassID")%>&Action=Del&page=<%=currentPage%>" onClick="return ConfirmDel();">删除</a>            </td>
          </tr>
          <%
		  set rs2=server.CreateObject("adodb.recordset")
		  rs2.open"select * From ProdClass where Fid="&rs("ClassID"),conn,1,1
		  do while not rs2.eof 
		  %>
		  <tr class="tdbg"> 
            <td width="41" height="22" align="center" bgcolor="#A4B6D7"> 
              <input name='ID' type='checkbox' onClick="unselectall()" id="ID" value='<%=cstr(rs2("ClassID"))%>'>            </td>
            <td width="46" align="center" bgcolor="#ECF5FF"><%=rs2("ClassID")%></td>
            <td  bgcolor="#ECF5FF">&nbsp;┕┈</td>
            <td align="center" bgcolor="#ECF5FF">&nbsp;<%=rs2("ClassName")%></td>
            <td width="81" align="center" bgcolor="#ECF5FF"> <a href="ClassEdit.asp?ID=<%=rs2("ClassID")%>&page=<%=currentPage%>">修改</a> 
              <a href="ClassDel.asp?ID=<%=rs2("ClassID")%>&Action=Del&page=<%=currentPage%>" onClick="return ConfirmDel();">删除</a>            </td>
          </tr>
		  <%
		  rs2.movenext
		  loop
		  rs2.close:Set rs2=nothing
	    rs.movenext
	loop
%>
        </table>
        <table width="620" border="0" cellpadding="0" cellspacing="0">
          <tr> 
            <td width="250" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
              选中本页显示的所有信息</td>
            <td><input name="submit" type='submit' value='删除选定的信息'> 
              <input name="Action" type="hidden" id="Action" value="Del"></td>
          </tr>
        </table>
      </form>
</td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
<%
rs.close
set rs=nothing 
call CloseConn()
%>