⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_classsmalla.asp

📁 新闻发布系统
💻 ASP
字号:
<!--#include file = include.asp-->
<!--#include file = admin_CheckMana.asp-->
<%
'=========================================================
'产品目录:风讯产品N系列
'软件名称:风讯站点管理系统
'当前版本:2004.I.0225
'最新更新:2004.2.10
'=========================================================
'Copyright (C) 2002-2004 cooin.com. All rights reserved.
'网站: http://www.cooin.com  Foosun.net
'程序制作:轻风云(QQ:655071)
'Email:skeen@cooin.com,skeen@Foosun.net
'论坛支持:风讯在线论坛(http://BBS.COOIN.COM)
'=========================================================
%>

<%
if request("classcn") = "" or request("classen") = "" then
   Response.write"<script>alert(""栏目的中文与英文名称必须填写!"");location.href=""admin_ClassManage.asp"";</script>"
   Response.end
end if

sql="select classcn,classen from newsclass where classcn='"&request("classcn")&"' or classen='"&request("classen")&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
   Response.write"<script>alert(""栏目的中文或英文名称已经存在!"");location.href=""admin_ClassManage.asp"";</script>"
   Response.end
end if

if request("class")<>"0" then
   set rs=conn.execute("select rootid,id,depth,orders,ParentStr from newsclass where id="&request("class"))
   rootid=rs(0)
   parentid=rs(1)
   depth=rs(2)
   orders=rs(3)
   if depth+1>20 then
	  response.write "本新闻系统限制最多只能有20级分类栏目"
	  response.end
   end if
   parentstr=rs(4)
else
   set rs=conn.execute("select max(id) from newsclass")
   maxrootid=rs(0)+1
   if isnull(MaxRootID) then MaxRootID=1
end if
sql="select id from newsclass where id="&request("newsclassid")
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
	response.write "您不能指定和别的栏目一样的序号。"
	response.end
else
	id=request("newsclassid")
end if
set rs = server.CreateObject ("adodb.recordset")
sql = "select * from newsclass"
rs.Open sql,conn,1,3
rs.AddNew
if request("class")<>"0" then
   rs("depth")=depth+1
   rs("rootid")=rootid
   rs("orders") = Request.form("newsclassid")
   rs("parentid") = Request.Form("class")
   if ParentStr="0" then
      rs("ParentStr")=Request.Form("class")
   else
      rs("ParentStr")=ParentStr & "," & Request.Form("class")
   end if
else
   rs("depth")=0
   rs("rootid")=maxrootid
   rs("orders")=0
   rs("parentid")=0
   rs("child")=0
   rs("parentstr")=0
end if
rs("id") = Request.form("newsclassid")
rs("classcn") = Request.Form("classcn")
rs("classen") = Request.form("classen")
rs("OrderRule") = Request.form("OrderRule")

rs.Update 
rs.Close
if request("class")<>"0" then
if depth>0 then
	for i=1 to depth
		if parentid<>"" then
		conn.execute("update newsclass set child=child+1 where id="&parentid)
		end if
		set rs=conn.execute("select parentid from newsclass where id="&parentid)
		if not (rs.eof and rs.bof) then
			parentid=rs(0)
		end if
		if i=depth and parentid<>"" then
		conn.execute("update newsclass set child=child+1 where id="&parentid)
		end if
	next
	conn.execute("update newsclass set orders=orders+1 where rootid="&rootid&" and orders>"&orders)
	conn.execute("update newsclass set orders="&orders&"+1 where id="&Request.form("newsclassid"))
else
	'当上级分类深度为0的时候只要更新上级分类版面数和该版面排序序号即可
	conn.execute("update newsclass set child=child+1 where id="&request("class"))
	set rs=conn.execute("select max(orders) from newsclass where id="&Request.form("newsclassid"))
	conn.execute("update newsclass set orders="&rs(0)&"+1 where id="&Request.form("newsclassid"))
end if
end if
Response.write"<script>alert(""栏目添加成功!"");location.href=""admin_ClassManage.asp"";</script>"
set rs=nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -