<!--#include file="../siteconfig/conn.asp"-->
<%
if session("adminlogin")<>sessionvar then
Response.Write("<script language=javascript>alert('你尚未登录，或者超时了！请重新登录');this.location.href='login.asp';</script>")
Response.End
End if
%>
<!--#include file="Admin_UrlFunction.asp"-->
<HTML>
<HEAD>
<TITLE>分类管理</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
<LINK REL="stylesheet" HREF="css.css" TYPE="text/css">
</HEAD>
<script language="JavaScript" type="text/javascript" src="js.js"></script>
<BODY>
<%dim Menu,Url_Id,Url_Name,Url_Url,Url_Memo,Url_UrlClassId,Url_TopId,Class_Id,UrlClass_ClassName
Class_Id=Request("Class_Id")
Url_Id=Request("Url_Id")
Url_Name=Trim(Request("Url_Name"))
Url_Url=Trim(Request("Url_Url"))
Url_Memo=Request("Url_Memo")
Url_UrlClassId=Request("Url_UrlClassId")
Url_TopId=Request("Url_TopId")
Menu=Request("Menu")
if Menu="AddUrl" then
   rs.open"select * from Url",conn,1,3
   rs.addnew
      rs("Url_Name")=Url_Name
	  rs("Url_Url")=Url_Url
	  rs("Url_Memo")=Url_Memo
	  rs("Url_UrlClassId")=Url_UrlClassId
	  rs("Url_TopId")=Url_TopId
   rs.update
   rs.close
   Response.Write("<script language=javascript>alert('网址添加成功');parent.window.location.reload();DivOpenClose('',2,0,0);</script>")
   Response.End()
end if
if Menu="Class_Id" then
   rs.open"select Class_Id,Class_Name from Class where Class_Id="&Class_Id,conn,1,3
   if not rs.eof and not rs.bof then
      UrlClass_ClassId=rs("Class_Id")
	  UrlClass_ClassName=rs("Class_Name")
   else
      Response.Write("<script language=javascript>alert('主分类ID不能为空');javascript:history.go(-1)</script>")
   end if
   rs.close%>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EEEEEE">
  <tr>
    <td width="45%">添加网址</td>
    <td width="55%" align="right"><a href="#" onClick="javascript:DivOpenClose('',2,0,0);return false">关闭</a></td>
  </tr>
</table>
<form name="UrlFrom" method="post" action="?Menu=AddUrl" id="UrlFrom" onSubmit="return UrlCheck();">
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EEEEEE">
  <tr bgcolor="#FFFFFF">
    <td>网站名称</td>
    <td><input name="Url_Name" type="text" id="Url_Name" size="20" class="inputcss"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>网站URL</td>
    <td><input name="Url_Url" type="text" id="Url_Url" size="35" class="inputcss" value="http://"></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>主分类</td>
    <td><%=UrlClass_ClassName%></td>
  <tr bgcolor="#FFFFFF">
    <td>子分类</td>
    <td><select name="Url_UrlClassId" id="Url_UrlClassId" class="inputcss">
<%
rs.open "select UrlClass_Id,UrlClass_Name from UrlClass where UrlClass_ClassId="&UrlClass_ClassId,conn,1,3
while not rs.eof
		response.write "<option value='"&rs("UrlClass_Id")&"'>"&rs("UrlClass_Name")&"</option>"
	rs.movenext
wend
rs.close
%>
</select></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>推荐级别</td>
    <td><input name="Url_TopId" type="text" id="Url_TopId" size="10" class="inputcss" value="0"> 
    越高排越前,数字</td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="添加网址" class="SubmitCss"></td>
  </tr>
</table>
</form>
<%
Response.End()
end if%>
<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EEEEEE">
  <tr>
    <td width="45%">选择主分类</td>
    <td width="55%" align="right"><a href="#" onClick="javascript:DivOpenClose('',2,0,0);return false">关闭</a></td>
  </tr>
</table>
<form name="UrlFrom" method="post" action="?Menu=Class_Id" id="UrlFrom">
  <table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#EEEEEE"><tr bgcolor="#FFFFFF">
      <td>选择分类</td>
      <td><select name="Class_Id" class="inputcss" id="Class_Id">
<%
set RsClass(0)=server.createobject("adodb.recordset")
RsClass(0).open "select Class_Id,Class_Name from Class where Class_TopClassId=0",conn,1,3
while not RsClass(0).eof
        rs.open "select UrlClass_Id from UrlClass where UrlClass_ClassId="&RsClass(0)("Class_Id"),conn,1,3
		if not rs.eof and not rs.bof then
		      response.write "<option value='"&RsClass(0)("Class_Id")&"'>"&RsClass(0)("Class_Name")&"</option>"&vbCrLf
		end if
		rs.close
	call addlistunder(1)
	RsClass(0).movenext
wend
%>
</select></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit2" value="选择主分类" class="SubmitCss"></td>
    </tr>
  </table>
</form>
</BODY>
</HTML>

