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

📄 admin_article_catalog.asp

📁 动感系统XP Access版,服务器需要安装Jmail 组件 配置SendMessages.asp 最后部分的参数
💻 ASP
📖 第 1 页 / 共 3 页
字号:
'删除版面,删除版面帖子,入口:版面ID
sub del()
'更新其上级版面栏目数,如果该栏目含有下级栏目则不允许删除
set rs=conn.execute("select ParentStr,child,depth from info_Catalog where CatalogID="&Request("editid"))
if not (rs.eof and rs.bof) then
if rs(1)>0 then
	response.write "该栏目含有下属栏目,请删除其下属栏目后再进行删除本栏目的操作"
	exit sub
end if
'如果有上级版面,则更新数据
if rs(2)>0 then
	conn.execute("update info_Catalog set child=child-1 where CatalogID in ("&rs(0)&")")
end if
sql = "delete from info_Catalog where CatalogID="&Request("editid")
conn.execute(sql)
end if
set rs=nothing

response.write "<p>栏目删除成功!"
end sub

sub orders()
%>
      <table width="100%" border="0" cellspacing="1" cellpadding="3"  align=center>
        <tr> 
	      <td height="22" class="tdbg1">栏目一级分类重新排序修改(请在相应栏目分类的排序表单内输入相应的排列序号) </td>
	</tr>

	<tr>
	      <td class="tdbg2">
<table width="50%">
<%
	set rs = server.CreateObject ("Adodb.recordset")
	sql="select * from info_Catalog where ParentID=0 order by RootID"
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		response.write "还没有相应的栏目分类。"
	else
		do while not rs.eof
		response.write "<form action=Admin_Article_Catalog.asp?action=updatorders method=post><tr><td width=""50%"">"&rs("CatalogName")&"</td>"
		response.write "<td width=""50%""><input type=text name=""OrderID"" size=4 value="""&rs("rootid")&"""><input type=hidden name=""cID"" value="""&rs("rootid")&""">&nbsp;&nbsp;<input type=submit name=Submit value=修改></td></tr></form>"
		rs.movenext
		loop
%>
</table>
<BR>&nbsp;<font color=red>请注意,这里一定<B>不能填写相同的序号</B>,否则非常难修复!</font>
<%
	end if
	rs.close
	set rs=nothing
%>
	</td>
	</tr>
</table>
<%
end sub

sub updateorders()
	dim cID,OrderID,ClassName
	'response.write request.form("cID")(1)
	'response.end
	cID=replace(request.form("cID"),"'","")
	OrderID=replace(request.form("OrderID"),"'","")
	set rs=conn.execute("select CatalogID from info_Catalog where rootid="&orderid)
	if rs.eof and rs.bof then
	response.write "设置成功,请返回。"
	conn.execute("update info_Catalog set rootid="&OrderID&" where rootid="&cID)
	conn.execute("update info_Article set rootid="&OrderID&" where rootid="&cID)
	else
	response.write "请不要和其他栏目设置相同的序号"
	end if
	set rs=nothing
end sub


sub boardorders()
%>
      <table width="100%" border="0" cellspacing="1" cellpadding="2"  align=center>
        <tr> 
	      <td height="22" colspan=2 class="tdbg2">栏目N级分类重新排序修改(请在相应栏目分类的排序表单内输入相应的排列序号) 
          </td>
	</tr>
<%
dim trs,uporders,doorders
set rs = server.CreateObject ("Adodb.recordset")
sql="select * from info_Catalog order by RootID,orders"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
	response.write "还没有相应的栏目分类。"
else
	do while not rs.eof
	response.write "<form action=Admin_Article_Catalog.asp?action=updatboardorders method=post><tr><td width=""50%"" class=""tdbg2"">"
 if rs("depth") =1 then  Response.Write "&nbsp;&nbsp;<font color=""#666666"">├</font>"
 if rs("depth") >1 then
 for i=2 to rs("depth")
	Response.Write "&nbsp;&nbsp;<font color=""#666666"">│</font>"
 next
 Response.Write "&nbsp;&nbsp;<font color=""#666666"">├</font> "
 end if
 
  if rs("parentid")=0 then Response.Write("<b>")
  Response.Write rs("CatalogName")
  if rs("child")>0 then Response.Write "("&rs("child")&")"
	response.write "</td><td width=""50%"" class=""tdbg2"">"
	if rs("ParentID")>0 then
	'算出相同深度的版面数目,得到该版面在相同深度的版面中所处位置(之上或者之下的版面数)
	'所能提升最大幅度应为For i=1 to 该版之上的版面数
	set trs=conn.execute("select count(*) from info_Catalog where ParentID="&rs("ParentID")&" and orders<"&rs("orders")&"")
	uporders=trs(0)
	if isnull(uporders) then uporders=0
	'所能降低最大幅度应为For i=1 to 该版之下的版面数
	set trs=conn.execute("select count(*) from info_Catalog where ParentID="&rs("ParentID")&" and orders>"&rs("orders")&"")
	doorders=trs(0)
	if isnull(doorders) then doorders=0
	if uporders>0 then
		response.write "<select name=uporders size=1><option value=0>↑</option>"
		for i=1 to uporders
		response.write "<option value="&i&">↑"&i&"</option>"
		next
		response.write "</select>"
	end if
	if doorders>0 then
		if uporders>0 then response.write "&nbsp;"
		response.write "<select name=doorders size=1><option value=0>↓</option>"
		for i=1 to doorders
		response.write "<option value="&i&">↓"&i&"</option>"
		next
		response.write "</select>"
	end if
	if doorders>0 or uporders>0 then
	response.write "<input type=hidden name=""editID"" value="""&rs("CatalogID")&""">&nbsp;<input type=submit name=Submit value=修改>"
	end if
	end if
	response.write "</td></tr></form>"
	uporders=0
	doorders=0
	rs.movenext
	loop
	'response.write "</table>"
end if
rs.close
set rs=nothing
%>
</table>
<%
end sub

sub updateboardorders()
dim ParentID,orders,ParentStr,child
dim uporders,doorders,oldorders,trs,ii
if not isnumeric(request("editID")) then
	response.write "非法的参数!"
	exit sub
end if
if request("uporders")<>"" and not Cint(request("uporders"))=0 then
	if not isnumeric(request("uporders")) then
	response.write "非法的参数!"
	exit sub
	elseif Cint(request("uporders"))=0 then
	response.write "请选择要提升的数字!"
	exit sub
	end if
	'向上移动
	'要移动的栏目信息
	set rs=conn.execute("select ParentID,orders,ParentStr,child from info_Catalog where CatalogID="&request("editID"))
	ParentID=rs(0)
	orders=rs(1)
	ParentStr=rs(2) & "," & request("editID")
	child=rs(3)
	i=0
	'response.write "select CatalogID,orders from board where ParentID="&ParentID&" and orders<"&orders&" order by orders desc<br>"
	if child>0 then
	set rs=conn.execute("select count(*) from info_Catalog where ParentStr like '%"&ParentStr&"%'")
	oldorders=rs(0)
	else
	oldorders=0
	end if
	'和该栏目同级且排序在其之上的栏目-更新其排序,最末者为当前栏目排序号
	set rs=conn.execute("select CatalogID,orders,child,ParentStr from info_Catalog where ParentID="&ParentID&" and orders<"&orders&" order by orders desc")
	do while not rs.eof
	i=i+1
	if Cint(request("uporders"))>=i then
		'response.write "update info_Catalog set orders="&orders&" where CatalogID="&rs(0)&"<br>"
		if rs(2)>0 then
		ii=0
		set trs=conn.execute("select CatalogID,orders from info_Catalog where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
		if not (trs.eof and trs.bof) then
		do while not trs.eof
		ii=ii+1
		conn.execute("update info_Catalog set orders="&orders&"+"&oldorders&"+"&ii&" where CatalogID="&trs(0))
		trs.movenext
		loop
		end if
		end if
		conn.execute("update info_Catalog set orders="&orders&"+"&oldorders&" where CatalogID="&rs(0))
		if Cint(request("uporders"))=i then uporders=rs(1)
	end if
	orders=rs(1)
	rs.movenext
	loop
	'response.write "update info_Catalog set orders="&uporders&" where CatalogID="&request("editID")
	'更新所要排序的栏目的序号
	conn.execute("update info_Catalog set orders="&uporders&" where CatalogID="&request("editID"))
	'如果有下属栏目,则更新其下属栏目排序
	if child>0 then
	i=uporders
	set rs=conn.execute("select CatalogID from info_Catalog where ParentStr like '%"&ParentStr&"%' order by orders")
	do while not rs.eof
	i=i+1
	conn.execute("update info_Catalog set orders="&i&" where CatalogID="&rs(0))
	rs.movenext
	loop
	end if
	'response.end
	set rs=nothing
	set trs=nothing
elseif request("doorders")<>"" then
	if not isnumeric(request("doorders")) then
	response.write "非法的参数!"
	exit sub
	elseif Cint(request("doorders"))=0 then
	response.write "请选择要下降的数字!"
	exit sub
	end if
	set rs=conn.execute("select ParentID,orders,ParentStr,child from info_Catalog where CatalogID="&request("editID"))
	ParentID=rs(0)
	orders=rs(1)
	ParentStr=rs(2) & "," & request("editID")
	child=rs(3)
	i=0
	if child>0 then
	set rs=conn.execute("select count(*) from info_Catalog where ParentStr like '%"&ParentStr&"%'")
	oldorders=rs(0)
	else
	oldorders=0
	end if
	set rs=conn.execute("select CatalogID,orders,child,ParentStr from info_Catalog where ParentID="&ParentID&" and orders>"&orders&" order by orders")
	do while not rs.eof
	i=i+1
	if Cint(request("doorders"))>=i then
		if rs(2)>0 then
		ii=0
		set trs=conn.execute("select CatalogID,orders from info_Catalog where ParentStr like '%"&rs(3)&","&rs(0)&"%' order by orders")
		if not (trs.eof and trs.bof) then
		do while not trs.eof
		ii=ii+1
		'response.write "update info_Catalog set orders="&orders&"+"&ii&" where CatalogID="&trs(0)&"-a<br>"
		conn.execute("update info_Catalog set orders="&orders&"+"&ii&" where CatalogID="&trs(0))
		trs.movenext
		loop
		end if
		end if
		'response.write "update info_Catalog set orders="&orders&" where CatalogID="&rs(0)&"<br>"
		conn.execute("update info_Catalog set orders="&orders&" where CatalogID="&rs(0))
		if Cint(request("doorders"))=i then doorders=rs(1)
	end if
	orders=rs(1)
	rs.movenext
	loop
	'response.write "update info_Catalog set orders="&doorders&" where CatalogID="&request("editID")&"<br>"
	conn.execute("update info_Catalog set orders="&doorders&" where CatalogID="&request("editID"))
	'如果有下属栏目,则更新其下属栏目排序
	if child>0 then
	i=doorders
	set rs=conn.execute("select CatalogID from info_Catalog where ParentStr like '%"&ParentStr&"%' order by orders")
	do while not rs.eof
	i=i+1
	'response.write "update info_Catalog set orders="&i&" where CatalogID="&rs(0)&"-b<br>"
	conn.execute("update info_Catalog set orders="&i&" where CatalogID="&rs(0))
	rs.movenext
	loop
	end if
	'response.end
	set rs=nothing
	set trs=nothing
end if

response.redirect "Admin_Article_Catalog.asp?action=boardorders"
end sub


sub RestoreBoard()
'按照目前的排序循环i数值更新rootid
'还原所有版面的depth,orders,parentid,parentstr,child为0
i=0
set rs=conn.execute("select CatalogID from info_Catalog order by rootid,orders")
do while not rs.eof
i=i+1
conn.execute("update info_Catalog set rootid="&i&",depth=0,orders=0,ParentID=0,ParentStr='0',child=0 where CatalogID="&rs(0))
rs.movenext
loop
set rs=nothing
response.write "复位成功,请返回做栏目归属设置。"
end sub
%>
	</td>
  </tr>
</table>
<!-- #include file="admin_footer.asp" -->
</BODY></HTML>
<% CloseDatabase %>

⌨️ 快捷键说明

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