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

📄 admin_board.asp

📁 功能强大的bbs
💻 ASP
📖 第 1 页 / 共 5 页
字号:
	'获得所指定的论坛的相关信息
	set trs=Dvbbs.Execute("select * from dv_board where boardid="&request("class"))
	'得到其下属版面数
	ParentStr=ParentStr & ","
	set rs=Dvbbs.Execute("select count(*) from dv_board where ParentStr like '%"&ParentStr & newboardid&"%'")
	boardcount=rs(0)
	if isnull(boardcount) then boardcount=1
	'在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
	Dvbbs.Execute("update dv_board set orders=orders + "&boardCount&" + 1 where rootid="&trs("rootid")&" and orders>"&trs("orders")&"")
	'更新当前版面数据
	If trs("parentstr")="0" Then
	Dvbbs.Execute("update dv_board set depth="&trs("depth")&"+1,orders="&trs("orders")&"+1,rootid="&trs("rootid")&",ParentID="&request("class")&",ParentStr='" & trs("boardid") & "' where boardid="&newboardid)
	Else
	Dvbbs.Execute("update dv_board set depth="&trs("depth")&"+1,orders="&trs("orders")&"+1,rootid="&trs("rootid")&",ParentID="&request("class")&",ParentStr='" & trs("parentstr") & "," & trs("boardid") & "' where boardid="&newboardid)
	End If
	i=1
	'如果有则更新下属版面数据
	'深度为原有深度加上当前所属论坛的深度
	set rs=Dvbbs.Execute("select * from dv_board where ParentStr like '%"&ParentStr & newboardid&"%' order by orders")
	do while not rs.eof
	i=i+1
	If trs("parentstr")="0" Then
	iParentStr=trs("boardid") & "," & replace(rs("parentstr"),ParentStr,"")
	Else
	iParentStr=trs("parentstr") & "," & trs("boardid") & "," & replace(rs("parentstr"),ParentStr,"")
	End If
	Dvbbs.Execute("update dv_board set depth=depth+"&trs("depth")&"-"&depth&"+1,orders="&trs("orders")&"+"&i&",rootid="&trs("rootid")&",ParentStr='"&iParentStr&"' where boardid="&rs("boardid"))
	rs.movenext
	loop
	ParentID=request("class")
	if rootid=trs("rootid") then
	'在同一分类下移动
	'更新所指向的上级论坛版面数,i为本次移动过来的版面数
	'更新其父类版面数
	Dvbbs.Execute("update dv_board set child=child+"&i&" where (not ParentID=0) and boardid="&parentid)
	for k=1 to trs("depth")
		'得到其父类的父类的版面ID
		set rs=Dvbbs.Execute("select parentid from dv_board where (not ParentID=0) and boardid="&parentid)
		if not (rs.eof and rs.bof) then
			parentid=rs(0)
			'更新其父类的父类版面数
			Dvbbs.Execute("update dv_board set child=child+"&i&" where (not ParentID=0) and  boardid="&parentid)
		end if
	next
	'更新其原父类版面数
	Dvbbs.Execute("update dv_board set child=child-"&i&" where (not ParentID=0) and boardid="&iparentid)
	'更新其原来所属论坛数据
	'response.write iparentid & "<br>"
	for k=1 to depth
		'得到其原父类的父类的版面ID
		set rs=Dvbbs.Execute("select parentid from dv_board where (not ParentID=0) and boardid="&iparentid)
		if not (rs.eof and rs.bof) then
			iparentid=rs(0)
			'response.write iparentid & "<br>"
			'更新其原父类的父类版面数
			Dvbbs.Execute("update dv_board set child=child-"&i&" where (not ParentID=0) and  boardid="&iparentid)
		end if
	next
	else
	'更新所指向的上级论坛版面数,i为本次移动过来的版面数
	'更新其父类版面数
	Dvbbs.Execute("update dv_board set child=child+"&i&" where boardid="&parentid)
	for k=1 to trs("depth")
		'得到其父类的父类的版面ID
		set rs=Dvbbs.Execute("select parentid from dv_board where boardid="&parentid)
		if not (rs.eof and rs.bof) then
			parentid=rs(0)
			'更新其父类的父类版面数
			Dvbbs.Execute("update dv_board set child=child+"&i&" where boardid="&parentid)
		end if
	next
	'更新其原父类版面数
	Dvbbs.Execute("update dv_board set child=child-"&i&" where boardid="&iparentid)
	'更新其原来所属论坛数据
	for k=1 to depth
		'得到其原父类的父类的版面ID
		set rs=Dvbbs.Execute("select parentid from dv_board where boardid="&iparentid)
		if not (rs.eof and rs.bof) then
			iparentid=rs(0)
			'更新其原父类的父类版面数
			Dvbbs.Execute("update dv_board set child=child-"&i&" where boardid="&iparentid)
		end if
	next
	end if 'end if rootid=trs("rootid") then
	else
	'如果原来是一级论坛改成其他论坛的下属论坛
	'得到所指定的论坛的相关信息
	set trs=Dvbbs.Execute("select * from dv_board where boardid="&request("class"))
	set rs=Dvbbs.Execute("select count(*) from dv_board where rootid="&rootid)
	boardcount=rs(0)
	'更新所指向的上级论坛版面数,i为本次移动过来的版面数
	ParentID=request("class")
	'更新其父类版面数
	Dvbbs.Execute("update dv_board set child=child+"&boardcount&" where boardid="&parentid)
	'response.write parentid & "-"&boardcount&"<br>"
	for k=1 to trs("depth")
		'得到其父类的父类的版面ID
		set rs=Dvbbs.Execute("select parentid from dv_board where boardid="&parentid)
		if not (rs.eof and rs.bof) then
			parentid=rs(0)
			'更新其父类的父类版面数
			Dvbbs.Execute("update dv_board set child=child+"&boardcount&" where boardid="&parentid)
		end if
	'response.write parentid & "-"&boardcount&"<br>"
	next
	'在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
	Dvbbs.Execute("update dv_board set orders=orders + "&boardCount&" + 1 where rootid="&trs("rootid")&" and orders>"&trs("orders")&"")
	i=0
	set rs=Dvbbs.Execute("select * from dv_board where rootid="&rootid&" order by orders")
	do while not rs.eof
	i=i+1
	if rs("parentid")=0 then
		if trs("ParentStr")="0" then
		parentstr=trs("boardid")
		else
		parentstr=trs("parentstr") & "," & trs("boardid")
		end if
	Dvbbs.Execute("update dv_board set depth=depth+"&trs("depth")&"+1,orders="&trs("orders")&"+"&i&",rootid="&trs("rootid")&",ParentStr='"&ParentStr&"',parentid="&request("class")&" where boardid="&rs("boardid"))
	else
		if trs("ParentStr")="0" then
		parentstr=trs("boardid") & "," & rs("parentstr")
		else
		parentstr=trs("parentstr") & "," & trs("boardid") & "," & rs("parentstr")
		end if
	Dvbbs.Execute("update dv_board set depth=depth+"&trs("depth")&"+1,orders="&trs("orders")&"+"&i&",rootid="&trs("rootid")&",ParentStr='"&ParentStr&"' where boardid="&rs("boardid"))
	end if
	rs.movenext
	loop
	end if
end if
dv_suc("论坛修改成功!<br>" & str)
set rs=nothing
set mrs=nothing
set trs=nothing
'cache版面数据
Dvbbs.ReloadAllBoardInfo()
Dvbbs.Name="setup"
Dvbbs.ReloadSetup
Dvbbs.CacheData=Dvbbs.value

Dim iUpdateRootID
'原来的RootID
iUpdateRootID=RootID
'现在的RootID
Set tRs=Dvbbs.Execute("Select RootID From Dv_Board Where BoardID="&request("editid"))
Dim UpdateRootID
UpdateRootID = tRs(0)
Set tRs=Dvbbs.Execute("Select BoardID From Dv_Board Where RootID="&UpdateRootID&" Order By Orders")
Do While Not tRs.Eof
	Dvbbs.ReloadBoardInfo(tRs(0))
tRs.Movenext
Loop
'如果编辑版面更改了一级分类,即RootID不一样,则更新原RootID所属的论坛缓存
If iUpdateRootID<>UpdateRootID Then
	Set tRs=Dvbbs.Execute("Select BoardID From Dv_Board Where RootID="&iUpdateRootID&" Order By Orders")
	Do While Not tRs.Eof
		Dvbbs.ReloadBoardInfo(tRs(0))
	tRs.Movenext
	Loop
End If
Set tRs=Nothing

Dvbbs.DelCahe "BoardJumpList"
Dvbbs.DelCahe "MyAllBoardList"
'end cache
end sub

'删除版面,删除版面帖子,入口:版面ID
sub del()
Dim trs
'更新其上级版面论坛数,如果该论坛含有下级论坛则不允许删除
Set tRs=Dvbbs.Execute("Select RootID From Dv_Board Where BoardID="&request("editid"))
Dim UpdateRootID
UpdateRootID = tRs(0)
set rs=Dvbbs.Execute("select ParentStr,child,depth from dv_board where boardid="&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
	Dvbbs.Execute("update dv_board set child=child-1 where boardid in ("&rs(0)&")")
	Dim UpdateBoardID
	UpdateBoardID=Split(Rs(0),",")
	For i=0 To Ubound(UpdateBoardID)
		Dvbbs.ReloadBoardInfo(UpdateBoardID(i))
	Next
end if
sql = "delete from dv_board where boardid="&Request("editid")
Dvbbs.Execute(sql)
for i=0 to ubound(AllPostTable)
sql = "delete from "&AllPostTable(i)&" where boardid="&Request("editid")
Dvbbs.Execute(sql)
next
Dvbbs.Execute("delete from dv_topic where boardid="&Request("editid"))
Dvbbs.Execute("delete from dv_besttopic where boardid="&Request("editid"))
Dvbbs.Execute("delete from dv_upfile where f_boardid="&Request("editid"))
end if
set rs=nothing
Dvbbs.ReloadAllBoardInfo()
Dvbbs.Name="setup"
Dvbbs.ReloadSetup
Dvbbs.CacheData=Dvbbs.value

Set tRs=dvbbs.Execute("Select BoardID From Dv_Board Where RootID="&UpdateRootID&" Order By Orders")
Do While Not tRs.Eof
	Dvbbs.ReloadBoardInfo(tRs(0))
tRs.Movenext
Loop
Set tRs=Nothing
'Dvbbs.ReloadBoardInfo(request("editid"))

Dvbbs.DelCahe "BoardJumpList"
Dvbbs.DelCahe "MyAllBoardList"
response.write "<p>论坛删除成功!"
end sub

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

	<tr>
	<td class="Forumrow"><table width="50%">
<%
	set rs = server.CreateObject ("Adodb.recordset")
	sql="select * from dv_Board 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_board.asp?action=updatorders method=post><tr><td width=""50%"">"&rs("boardtype")&"</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=Dvbbs.Execute("select boardid from dv_board where rootid="&orderid)
	if rs.eof and rs.bof Then
		Dv_suc("设置")
	Dvbbs.Execute("update dv_board set rootid="&OrderID&" where rootid="&cID)
	else
	response.write "请不要和其他论坛设置相同的序号"
	end if

	Dvbbs.ReloadAllBoardInfo()
	Dim Forum_Boards
	Dvbbs.Name="setup"
	Dvbbs.ReloadSetup
	Dvbbs.CacheData=Dvbbs.value
	Forum_Boards=Split(Dvbbs.CacheData(27,0),",")
	For i=0 To Ubound(Forum_Boards)
		Dvbbs.ReloadBoardInfo(Forum_Boards(i))
	Next
end sub

sub boardorders()
%>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center class="tableBorder">
	<tr> 
	<th height="22">论坛N级分类重新排序修改(请在相应论坛分类的排序表单内输入相应的排列序号)
	</th>
	</tr>
	<tr>
	<td class="Forumrow"><table width="90%">
<%
dim trs,uporders,doorders
set rs = server.CreateObject ("Adodb.recordset")
sql="select * from dv_Board 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_board.asp?action=updatboardorders method=post><tr><td width=""50%"">"
	if rs("depth")>0 then
	for i=1 to rs("depth")
		response.write "&nbsp;"
	next
	end if
	if rs("child")>0 then
		response.write "<img src=skins/default/plus.gif>"
	else
		response.write "<img src=skins/default/nofollow.gif>"
	end if
	if rs("parentid")=0 then
		response.write "<b>"
	end if
	response.write rs("boardtype")
	if rs("child")>0 then
		response.write "("&rs("child")&")"
	end if
	response.write "</td><td width=""50%"">"
	if rs("ParentID")>0 then
	'算出相同深度的版面数目,得到该版面在相同深度的版面中所处位置(之上或者之下的版面数)
	'所能提升最大幅度应为For i=1 to 该版之上的版面数
	set trs=Dvbbs.Execute("select count(*) from dv_board where ParentID="&rs("ParentID")&" and orders<"&rs("orders")&"")
	uporders=trs(0)
	if isnull(uporders) then uporders=0
	'所能降低最大幅度应为For i=1 to 该版之下的版面数
	set trs=Dvbbs.Execute("select count(*) from dv_board 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("boardid")&""">&nbsp;<input type=submit name=Submit value=修改>"
	end if
	end if
	response.write "</td></tr></form>"
	uporders=0
	doorders=0
	rs.movenext
	loop

⌨️ 快捷键说明

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