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

📄 admin_board.asp

📁 功能强大的一个b/s工作站
💻 ASP
📖 第 1 页 / 共 5 页
字号:
	'得到其下属版面数
	ParentStr=ParentStr & ","
	set rs=conn.execute("select count(*) from board where ParentStr like '%"&ParentStr&"%'")
	boardcount=rs(0)
	if isnull(boardcount) then boardcount=1
	'在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
	conn.execute("update board set orders=orders + "&boardCount&" + 1 where rootid="&trs("rootid")&" and orders>"&trs("orders")&"")
	'更新当前版面数据
	conn.execute("update board set depth="&trs("depth")&"+1,orders="&trs("orders")&"+1,rootid="&trs("rootid")&",ParentID="&request("class")&",ParentStr='" & trs("parentstr") & "," & trs("boardid") & "' where boardid="&newboardid)
	i=1
	'如果有则更新下属版面数据
	'深度为原有深度加上当前所属论坛的深度
	set rs=conn.execute("select * from board where ParentStr like '%"&ParentStr&"%' order by orders")
	do while not rs.eof
	i=i+1
	iParentStr=trs("parentstr") & "," & trs("boardid") & "," & replace(rs("parentstr"),ParentStr,"")
	conn.execute("update 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为本次移动过来的版面数
	'更新其父类版面数
	conn.execute("update board set child=child+"&i&" where (not ParentID=0) and boardid="&parentid)
	for k=1 to trs("depth")
		'得到其父类的父类的版面ID
		set rs=conn.execute("select parentid from board where (not ParentID=0) and boardid="&parentid)
		if not (rs.eof and rs.bof) then
			parentid=rs(0)
			'更新其父类的父类版面数
			conn.execute("update board set child=child+"&i&" where (not ParentID=0) and  boardid="&parentid)
		end if
	next
	'更新其原父类版面数
	conn.execute("update board set child=child-"&i&" where (not ParentID=0) and boardid="&iparentid)
	'更新其原来所属论坛数据
	'response.write iparentid & "<br>"
	for k=1 to depth
		'得到其原父类的父类的版面ID
		set rs=conn.execute("select parentid from board where (not ParentID=0) and boardid="&iparentid)
		if not (rs.eof and rs.bof) then
			iparentid=rs(0)
			'response.write iparentid & "<br>"
			'更新其原父类的父类版面数
			conn.execute("update board set child=child-"&i&" where (not ParentID=0) and  boardid="&iparentid)
		end if
	next
	else
	'更新所指向的上级论坛版面数,i为本次移动过来的版面数
	'更新其父类版面数
	conn.execute("update board set child=child+"&i&" where boardid="&parentid)
	for k=1 to trs("depth")
		'得到其父类的父类的版面ID
		set rs=conn.execute("select parentid from board where boardid="&parentid)
		if not (rs.eof and rs.bof) then
			parentid=rs(0)
			'更新其父类的父类版面数
			conn.execute("update board set child=child+"&i&" where boardid="&parentid)
		end if
	next
	'更新其原父类版面数
	conn.execute("update board set child=child-"&i&" where boardid="&iparentid)
	'更新其原来所属论坛数据
	for k=1 to depth
		'得到其原父类的父类的版面ID
		set rs=conn.execute("select parentid from board where boardid="&iparentid)
		if not (rs.eof and rs.bof) then
			iparentid=rs(0)
			'更新其原父类的父类版面数
			conn.execute("update board set child=child-"&i&" where boardid="&iparentid)
		end if
	next
	end if 'end if rootid=trs("rootid") then
	else
	'如果原来是一级论坛改成其他论坛的下属论坛
	'得到所指定的论坛的相关信息
	set trs=conn.execute("select * from board where boardid="&request("class"))
	set rs=conn.execute("select count(*) from board where rootid="&rootid)
	boardcount=rs(0)
	'更新所指向的上级论坛版面数,i为本次移动过来的版面数
	ParentID=request("class")
	'更新其父类版面数
	conn.execute("update board set child=child+"&boardcount&" where boardid="&parentid)
	'response.write parentid & "-"&boardcount&"<br>"
	for k=1 to trs("depth")
		'得到其父类的父类的版面ID
		set rs=conn.execute("select parentid from board where boardid="&parentid)
		if not (rs.eof and rs.bof) then
			parentid=rs(0)
			'更新其父类的父类版面数
			conn.execute("update board set child=child+"&boardcount&" where boardid="&parentid)
		end if
	'response.write parentid & "-"&boardcount&"<br>"
	next
	'在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
	conn.execute("update board set orders=orders + "&boardCount&" + 1 where rootid="&trs("rootid")&" and orders>"&trs("orders")&"")
	i=0
	set rs=conn.execute("select * from 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
	conn.execute("update 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
	conn.execute("update 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
response.write "<p>论坛修改成功!<br><br>"&str
set rs=nothing
set mrs=nothing
set trs=nothing
'cache版面数据
call cache_board()
'end cache
end sub

'删除版面,删除版面帖子,入口:版面ID
sub del()
'更新其上级版面论坛数,如果该论坛含有下级论坛则不允许删除
set rs=conn.execute("select ParentStr,child,depth from 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
	conn.execute("update board set child=child-1 where boardid in ("&rs(0)&")")
end if
sql = "delete from board where boardid="&Request("editid")
conn.execute(sql)
for i=0 to ubound(AllPostTable)
sql = "delete from "&AllPostTable(i)&" where boardid="&Request("editid")
conn.execute(sql)
next
end if
set rs=nothing
call cache_board()
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 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=conn.execute("select boardid from board where rootid="&orderid)
	if rs.eof and rs.bof then
	response.write "设置成功,请返回。"
	conn.execute("update board set rootid="&OrderID&" where rootid="&cID)
	else
	response.write "请不要和其他论坛设置相同的序号"
	end if
	call cache_board()
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 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=pic/plus.gif>"
	else
		response.write "<img src=pic/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=conn.execute("select count(*) from board 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 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
	response.write "</table>"
end if
rs.close
set rs=nothing
%>
	</td>
	</tr>
</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 board where boardid="&request("editID"))
	ParentID=rs(0)
	orders=rs(1)
	ParentStr=rs(2) & "," & request("editID")
	child=rs(3)
	i=0

⌨️ 快捷键说明

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