📄 admin_class.asp
字号:
Loop
Rsc.Close
Set Rsc = Nothing
Else
'如果是一级分类移动到其它一级分类,执行以下更新
nChildStr = Rss("ChildStr") & "," & ChildStr
NewAsp.Execute ("UPDATE NC_Classify SET ChildStr='"&nChildStr&"' WHERE ChannelID = "& ChannelID &" And classid = " & Rss("classid"))
End If
Rss.Close
Set Rss = Nothing
'更新子分类结束
'---------------------------------------------------
'得到所指定的分类的相关信息
Set trs = NewAsp.Execute("SELECT * FROM NC_Classify WHERE ChannelID = "& ChannelID &" And classid=" & CLng(Request("class")))
Set Rs = NewAsp.Execute("SELECT COUNT(ClassID) FROM NC_Classify WHERE ChannelID = "& ChannelID &" And rootid=" & rootid)
ClassCount = Rs(0)
Rs.Close
'更新所指向的上级分类数,i为本次移动过来的分类数
ParentID = Request("class")
'更新其父类分类数
NewAsp.Execute ("UPDATE NC_Classify SET child=child+" & ClassCount & " WHERE ChannelID = "& ChannelID &" And classid=" & ParentID)
For k = 1 To trs("depth")
'得到其父类的父类的分类ID
Set Rs = NewAsp.Execute("SELECT parentid FROM NC_Classify WHERE ChannelID = "& ChannelID &" And classid=" & ParentID)
If Not (Rs.EOF And Rs.BOF) Then
ParentID = Rs(0)
'更新其父类的父类分类数
NewAsp.Execute ("UPDATE NC_Classify SET child=child+" & ClassCount & " WHERE ChannelID = "& ChannelID &" And classid=" & ParentID)
End If
Next
'在获得移动过来的分类数后更新排序在指定分类之后的分类排序数据
NewAsp.Execute ("UPDATE NC_Classify SET orders=orders + " & ClassCount & " + 1 WHERE ChannelID = "& ChannelID &" And rootid=" & trs("rootid") & " and orders>" & trs("orders") & "")
i = 0
Set Rs = NewAsp.Execute("SELECT * FROM NC_Classify WHERE ChannelID = "& ChannelID &" And 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("classid")
Else
ParentStr = trs("ParentStr") & "," & trs("classid")
End If
NewAsp.Execute ("UPDATE NC_Classify SET depth=depth+" & trs("depth") & "+1,orders=" & trs("orders") & "+" & i & ",rootid=" & trs("rootid") & ",ParentStr='" & ParentStr & "',parentid=" & CLng(Request("class")) & " WHERE ChannelID = "& ChannelID &" And classid=" & Rs("classid"))
Else
If trs("ParentStr") = "0" Then
ParentStr = trs("classid") & "," & Rs("ParentStr")
Else
ParentStr = trs("ParentStr") & "," & trs("classid") & "," & Rs("ParentStr")
End If
NewAsp.Execute ("UPDATE NC_Classify SET depth=depth+" & trs("depth") & "+1,orders=" & trs("orders") & "+" & i & ",rootid=" & trs("rootid") & ",ParentStr='" & ParentStr & "' WHERE ChannelID = "& ChannelID &" And classid=" & Rs("classid"))
End If
Rs.movenext
Loop
'------------------------------------
End If
End If
Set Rs = Nothing
Set mrs = Nothing
Set trs = Nothing
Dim LocalPath
If CInt(NewAsp.IsCreateHtml) > 0 And CInt(Request.Form("TurnLink")) = 0 Then
LocalPath = NewAsp.InstallDir & ChannelDir & HtmlFileDir
'NewAsp.CreatPathEx(LocalPath)
End If
CheckAndFixClass 0,1
Call RemoveCache
SucMsg = "<li>恭喜您!分类修改成功。</li>"
Succeed(SucMsg)
End Sub
Sub DelClass()
Dim ChildStr,nChildStr
Dim Rss,Rsc
Dim Rs,SQL
On Error Resume Next
Set Rs = NewAsp.Execute("SELECT ParentStr,child,depth,parentid,HtmlFileDir,UseHtml FROM NC_Classify WHERE ChannelID = "& ChannelID &" And classid=" & NewAsp.ChkNumeric(Request("editid")))
If Not (Rs.EOF And Rs.BOF) Then
If Rs(1) > 0 Then
ErrMsg = "<li>该分类含有下属分类,请删除其下属分类后再进行删除本分类的操作</li>"
Founderr = True
Exit Sub
End If
HtmlFileDir = Rs(4)
'UseHtml = Rs(5)
If Rs(3) > 0 Then
ChildStr = "," & NewAsp.ChkNumeric(Request("editid"))
SQL = "SELECT classid,ParentStr FROM NC_Classify WHERE ChannelID = "& ChannelID &" And classid=" & NewAsp.ChkNumeric(Request("editid"))
Set Rss = NewAsp.Execute (SQL)
SQL = "SELECT classid,ChildStr FROM NC_Classify WHERE ChannelID = "& ChannelID &" And classid in (" & Rss("ParentStr") & ")"
Set Rsc = NewAsp.Execute (SQL)
Do While Not Rsc.EOF
nChildStr = Replace(Rsc("ChildStr"), ChildStr, "")
NewAsp.Execute ("UPDATE NC_Classify SET ChildStr='"&nChildStr&"' WHERE ChannelID = "& ChannelID &" And classid = " & Rsc("classid"))
Rsc.movenext
Loop
Rsc.Close
Set Rsc = Nothing
Set Rss = Nothing
End If
If Rs(2) > 0 Then
NewAsp.Execute ("UPDATE NC_Classify set child=child-1 WHERE ChannelID = "& ChannelID &" And classid in (" & Rs(0) & ")")
End If
SQL = "DELETE FROM NC_Classify WHERE ChannelID = "& ChannelID &" And classid=" & NewAsp.ChkNumeric(Request("editid"))
NewAsp.Execute (SQL)
Call DelRelated
End If
Set Rs = Nothing
NewAsp.Execute("UPDATE NC_Classify SET child=0 WHERE ChannelID="& ChannelID &" And child<0")
CheckAndFixClass 0,1
Call RemoveCache
Succeed ("恭喜您!分类删除成功。")
End Sub
Sub ResumeClass()
CheckAndFixClass 0,1
Response.Redirect Request.ServerVariables("HTTP_REFERER")
End Sub
Sub CheckAndFixClass(ParentID,orders)
Dim Rs,Child,ParentStr
If ParentID=0 Then
NewAsp.Execute("UPDATE NC_Classify SET Depth=0,ParentStr='0' WHERE ChannelID="& ChannelID &" And ParentID=0")
End If
Set Rs=NewAsp.Execute("SELECT classid,rootid,ParentStr,Depth FROM NC_Classify WHERE ChannelID="& ChannelID &" And ParentID="&ParentID&" ORDER BY rootid,orders")
Do while Not Rs.EOF
If Rs(2)<>"0" Then
ParentStr=Rs(2)&","&Rs(0)
Else
ParentStr=Rs(0)
End If
Conn.Execute "UPDATE NC_Classify SET Depth="&Rs(3)+1&",ParentStr='"&ParentStr&"',rootid="&rs(1)&" WHERE ChannelID="& ChannelID &" And ParentID="&Rs(0)&"",Child
NewAsp.Execute("UPDATE NC_Classify SET Child="&Child&",orders="&orders&" WHERE ChannelID="& ChannelID &" And classid="&Rs(0)&"")
orders=orders+1
CheckAndFixClass Rs(0),orders
Rs.MoveNext
Loop
Set Rs=Nothing
End Sub
Sub DelRelated()
On Error Resume Next
SELECT Case moduleidu
Case 1
NewAsp.Execute("DELETE NC_Comment FROM NC_Article A INNER JOIN NC_Comment C ON C.PostID=A.ArticleID WHERE A.ChannelID = "& ChannelID &" And A.classid=" & CLng(Request("editid")))
NewAsp.Execute("DELETE FROM NC_Article WHERE ChannelID = "& ChannelID &" And classid=" & CLng(Request("editid")))
Case 2
NewAsp.Execute ("DELETE NC_DownAddress FROM NC_SoftList A INNER JOIN NC_DownAddress D ON D.SoftID=A.SoftID WHERE A.ChannelID = "& ChannelID &" And A.classid=" & CLng(Request("editid")))
NewAsp.Execute ("DELETE NC_Comment FROM NC_SoftList A INNER JOIN NC_Comment C ON C.PostID=A.SoftID WHERE A.ChannelID = "& ChannelID &" And A.classid=" & CLng(Request("editid")))
NewAsp.Execute ("DELETE FROM NC_SoftList WHERE ChannelID = "& ChannelID &" And classid=" & CLng(Request("editid")))
Case 3
NewAsp.Execute("DELETE NC_Comment FROM NC_ShopList A INNER JOIN NC_Comment C ON C.PostID=A.ShopID WHERE A.ChannelID = "& ChannelID &" And A.classid=" & CLng(Request("editid")))
NewAsp.Execute("DELETE FROM NC_ShopList WHERE ChannelID = "& ChannelID &" And classid=" & CLng(Request("editid")))
Case 5
NewAsp.Execute("DELETE NC_Comment FROM NC_FlashList A INNER JOIN NC_Comment C ON C.PostID=A.flashid WHERE A.ChannelID = "& ChannelID &" And A.classid=" & CLng(Request("editid")))
NewAsp.Execute("DELETE FROM NC_FlashList WHERE ChannelID = "& ChannelID &" And classid=" & CLng(Request("editid")))
End SELECT
NewAsp.FolderDelete(NewAsp.InstallDir & ChannelDir & HtmlFileDir)
End Sub
Sub DelClassDir()
On Error Resume Next
Set Rs = NewAsp.Execute("SELECT HtmlFileDir FROM NC_Classify WHERE ChannelID = "& ChannelID &" And classid=" & CLng(Request("editid")))
If Not (Rs.EOF And Rs.BOF) Then
NewAsp.FolderDelete(NewAsp.InstallDir & ChannelDir & Rs("HtmlFileDir"))
End If
Succeed ("恭喜您!分类目录删除成功。")
End Sub
Sub orders()
Dim Rs,SQL,i,iCount,lCount
Response.Write " <table id=""tablehovered"" border=""0"" cellspacing=""1"" cellpadding=""3"" align=""center"" class=""tableborder"">" & vbCrLf
Response.Write " <tr>" & vbCrLf
Response.Write " <th colspan=""2"">分类一级分类重新排序修改(请在相应分类的排序表单内输入相应的排列序号) </th>"
Response.Write " </tr>" & vbCrLf
i=0:iCount=1:lCount=1
SQL = "SELECT * FROM NC_Classify WHERE ChannelID = "& ChannelID &" And ParentID=0 ORDER BY RootID"
Set Rs = NewAsp.Execute (SQL)
If Rs.BOF And Rs.EOF Then
ErrMsg = "<li>还没有相应的" & NewAsp.ModuleName & "分类。</li>"
Founderr = True
Exit Sub
Else
Do While Not Rs.EOF
If (i mod 2) = 0 Then iCount=1:lCount=2 Else iCount=2:lCount=1
Response.Write "<form action=""?action=neworders"" method=""post""><tr>" & vbCrLf
Response.Write " <td class=""tablerow"&iCount&" hovered"" align=""right"">"
Response.Write Rs("classname") & "</td>" & vbCrLf
Response.Write "<td class=""tablerow"&iCount&" hovered""><input type=""hidden"" name=""ChannelID"" value=""" & ChannelID & """><input type=""text"" name=""OrderID"" size=""4"" value=""" & Rs("rootid") & """><input type=""hidden"" name=""cID"" value=""" & Rs("rootid") & """> <input type=""submit"" name=""submit2"" class=""button"" value=""修 改""></td></tr></form>" & vbCrLf
Rs.movenext
i=i+1
Loop
End If
Rs.Close
Set Rs = Nothing
Response.Write " <tr><td class=""tablerow"&lCount&""" colspan=""2"">" & vbCrLf
Response.Write " <font color=""red"">请注意,这里一定<B>不能填写相同的序号</B>,否则非常难修复!</font></td>" & vbCrLf
Response.Write " </tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
End Sub
Sub updateorders()
Dim cID
Dim OrderID
Dim ClassName
Dim Rs
cID = Replace(Request.Form("cID"), "'", "")
OrderID = Replace(Request.Form("OrderID"), "'", "")
Set Rs = NewAsp.Execute("SELECT classid FROM NC_Classify WHERE ChannelID = "& ChannelID &" And rootid=" & OrderID)
If Rs.BOF And Rs.EOF Then
Succeed ("恭喜您!设置成功,请返回。")
NewAsp.Execute ("UPDATE NC_Classify SET rootid=" & OrderID & " WHERE ChannelID = "& ChannelID &" And rootid=" & cID)
Else
ErrMsg = "<li>请不要和其他分类设置相同的序号</li>"
Founderr = True
Exit Sub
End If
Call RemoveCache
Set Rs = Nothing
End Sub
Sub classorders()
Dim Rs,i,SQL,iCount,lCount,n
Dim trs
Dim uporders
Dim doorders
n=0:iCount=1:lCount=2
Response.Write " <table id=""tablehovered"" border=""0"" cellspacing=""1"" cellpadding=""2"" class=""tableborder"" align=""center"">" & vbCrLf
Response.Write " <tr>" & vbCrLf
Response.Write " <th colspan=""2"">分类N级分类重新排序修改(请在相应分类的排序表单内输入相应的排列序号)"
Response.Write " </th>"
Response.Write " </tr>" & vbCrLf
Set Rs = NewAsp.CreateAXObject("Adodb.recordset")
SQL = "SELECT * FROM NC_Classify WHERE ChannelID = "& ChannelID &" ORDER BY RootID,orders"
Rs.Open SQL, Conn, 1, 1
If Rs.BOF And Rs.EOF Then
Response.Write "还没有相应的分类。"
Else
Do While Not Rs.EOF
If (n mod 2) = 0 Then iCount=1:lCount=2 Else iCount=2:lCount=1
Response.Write "<form action=""?action=newclassorders&ChannelID=" & ChannelID & """ method=""post""><tr><td width=""50%"" class=""tablerow"&iCount&" hovered"">" & vbCrLf
If Rs("depth") = 1 Then Response.Write " <font color=""#666666"">├</font>"
If Rs("depth") > 1 Then
For i = 2 To Rs("depth")
Response.Write " <font color=""#666666"">│</font>"
Next
Response.Write " <font color=""#666666"">├</font> "
End If
If Rs("parentid") = 0 Then Response.Write ("<b>")
Response.Write Rs("classname")
If Rs("child") > 0 Then Response.Write "(" & Rs("child") & ")"
Response.Write "</td><td width=""50%"" class=""tablerow"&iCount&" hovered"">" & vbCrLf
If Rs("ParentID") > 0 Then
Set trs = NewAsp.Execute("SELECT COUNT(*) FROM NC_Classify WHERE ChannelID = "& ChannelID &" And ParentID=" & Rs("ParentID") & " And orders<" & Rs("orders") & "")
uporders = trs(0)
If IsNull(uporders) Then uporders = 0
Set trs = NewAsp.Execute("SELECT COUNT(*) FROM NC_Classify WHERE ChannelID = "& ChannelID &" And 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>" & vbCrLf
For i = 1 To uporders
Response.Write "<option value=""" & i & """>↑" & i & "</option>" & vbCrLf
Next
Response.Write "</select>"
End If
If doorders > 0 Then
If uporders > 0 Then Response.Write " "
Response.Write "<select name=""doorders"" size=""1""><option value=""0"">↓</option>" & vbCrLf
For i = 1 To doorders
Response.Write "<option value=""" & i & """>↓" & i & "</option>" & vbCrLf
Next
Response.Write "</select>" & vbCrLf
End If
If doorders > 0 Or uporders > 0 Then
Response.Write "<input type=""hidden"" name=""editID"" value=""" & Rs("classid") & """> <input type=""submit"" name=""submit2"" class=""button"" value=""修 改"">" & vbCrLf
End If
Else
Response.Write " "
End If
Response.Write "</td></tr></form>" & vbCrLf
uporders = 0
doorders = 0
Rs.movenext
n=n+1
Loop
End If
Rs.Close
Set Rs = Nothing
Response.Write "</table>"
End Sub
Sub updateclassorders()
Dim ParentID,orders,ParentStr,Child
Dim uporders,doorders,oldorders
Dim trs,ii
Dim Rs,i
If Not IsNumeric(Request("editID")) Then
ErrMsg = ErrMsg & "<li>非法的参数!</li>"
Founderr = True
Exit Sub
End If
If Request("ChannelID") = "" Then
ErrMsg = ErrMsg & "<li>非法的系统参数!</li>"
Founderr = True
Exit Sub
End If
If Request("uporders") <> "" And Not CInt(Request("uporders")) = 0 Then
If Not IsNumeric(Request("uporders")) Then
ErrMsg = ErrMsg & "<li>非法的参数!</li>"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -