代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
ASP
】
无限分类移动修改栏目
作者:
xqf222
/ 发布于
2014/2/25
/
1072
无限分类移动修改栏目
<% '系统页面加载初始化参数设定 ClassID=request("ClassID") if ClassID="" or not isnumeric(ClassID) then response.Write("<script>alert('传递参数错误!系统即将返回!');history.go(-1);</script>") response.End() end if '类别列表读取函数 Function ShowClassFormOption(sChannelID,CurrentID,sClassDepth) dim rsClass,sqlClass,sTemp,tmpClassDepth,i,n dim arrShowLine(10) for i=0 to ubound(arrShowLine) arrShowLine(i)=False next sTemp="<option value=""0""" if CurrentID=0 then sTemp=sTemp & " selected"">顶级类别</option>" sqlClass="Select ClassID,ClassName,ClassDepth,ChannelID,RootID,OrderID From SoftClass " if sClassDepth>0 then sqlClass=sqlClass & " where ClassDepth<"&sClassDepth&" order by OrderID" else sqlClass=sqlClass & " order by OrderID" end if set rsClass=conn.Execute(sqlClass) if rsClass.bof and rsClass.bof then ShowClassFormOption = sTemp & "<option value="""">添加顶级类别</option>" rsClass.close set rsClass=Nothing Exit Function else sTemp="<option value=""0"""">顶级类别</option>" ClassRecord=rsClass.GetRows(-1) '获取最后一行记录 '数据字段1,类别ID,ClassID '数据字段2,类别名称,ClassName '数据字段3,类别深度,ClassDepth '数据字段4,类别ID,Class rsClass.close set rsClass=Nothing End if Dim sChecked, tempClassName For i=0 to Ubound(ClassRecord,2) tmpClassDepth=ClassRecord(2,i) '数据字段3,类别深度,ClassDepth if ClassRecord(3,i)>0 then arrShowLine(tmpClassDepth)=True else arrShowLine(tmpClassDepth)=False end if sChecked = "" : tempClassName = "" if ClassRecord(0,i)=CurrentID then sChecked = " selected" if tmpClassDepth>0 then for n=1 to tmpClassDepth tempClassName = tempClassName & " " if n=tmpClassDepth then if ClassRecord(3,i)>0 then tempClassName = tempClassName & "├ " else tempClassName = tempClassName & "└ " end if else if arrShowLine(n)=True then tempClassName = tempClassName & "│" else tempClassName = tempClassName & " " end if end if next end if tempClassName = tempClassName & ClassRecord(1,i) sTemp=sTemp & "<option value=""" & ClassRecord(0,i) & """ "&sChecked&">" & tempClassName & "</option>" Next ShowClassFormOption=sTemp ClassRecord=Empty End Function if request("action")="EditSave" then ChannelID=cint(trim(Request.Form("ChannelID"))) newParentClassID=Cint(trim(Request.Form("ParentID"))) ClassName=trim(Request.Form("ClassName")) ClassFolderName=trim(Request.Form("ClassFolderName")) ClassMemo=trim(Request.Form("ClassMemo")) ClassKeyWords=trim(Request.Form("ClassKeyWords")) ClassDescription=trim(Request.Form("ClassDescription")) IsCreateFolder=trim(Request.Form("IsCreateFolder")) if ClassName="" Then response.write("<script>alert('系统出错!请返回填写栏目类别名称');history.go(-1);</script>") response.End() end if if ClassFolderName="" Then response.write("<script>alert('系统出错!请返回填写栏目类别目录文件夹');history.go(-1);</script>") response.End() end if if ClassMemo="" Then response.write("<script>alert('系统出错!请返回填写栏目类别说明');history.go(-1);</script>") response.End() end if if ClassKeyWords="" Then response.write("<script>alert('系统出错!请返回填写栏目类别搜索关键字');history.go(-1);</script>") response.End() end if if ClassDescription="" Then response.write("<script>alert('系统出错!请返回填写栏目类别搜索描述词');history.go(-1);</script>") response.End() end if If IsValidWindowsFolderName(ClassFolderName)=False Then response.Write("<script language=javascript>alert('目录名格式不正确,按确定返回重新填写');history.back();</script>") response.End() end if ClassFolderName=Replace(PCase(ClassFolderName)," ","-") '查询网站频道项目 set rs=server.CreateObject("Adodb.recordset") sql="select * from SystemChannelList Where ChannelID="&ChannelID rs.open sql,conn,1,3 if rs.eof and rs.bof then rs.close set rs=nothing conn.close set conn=nothing response.write("<script>alert('无此数据,系统即将返回!');location.href='ClassList.asp';</script>") response.End() else ChannelName =rs("ChannelName") ChannelFolderUrl=rs("ChannelFolderUrl") ChannelFolderPath=rs("ChannelFolderPath") end if rs.close set rs=nothing '查询父类别ID是否改变 '读取要修改的ClassID类别数据 set rsClass=server.CreateObject("Adodb.recordset") sqlClass="select * from SoftClass where ClassID="&ClassID rsClass.open sqlClass,conn,1,3 if rsClass.eof and rsClass.bof then response.write("<script>alert('错误!未查询到对应类别!系统即将返回');location.href='ClassList.asp';</script>") response.End() else if rsClass("ParentID")<>newParentClassID then '更改了所属栏目,则要做一系列检查 rstUpdateQuried=1 if ParentClassID=rsClass("ClassID") then response.write("<script>alert('所属栏目不能为自己!!系统即将返回');location.href='ClassList.asp';</script>") response.End() end if '判断所指定的栏目是否为本栏目的下属栏目 if rsClass("ParentID")=0 then if newParentClassID>0 then set trs=conn.execute("select RootID,ClassID From SoftClass where ClassID="&newParentClassID) if trs.bof and trs.eof then response.write("<script>alert('找不到要移动到的父栏目!系统即将返回');location.href='ClassList.asp';</script>") response.End() else if rsClass("RootID")=trs(0) and rsClass("RootID")<>0 then response.write("<script>alert('不能指定顶级栏目的父栏目为其下属栏目!系统即将返回');location.href='ClassList.asp';</script>") response.End() end if end if trs.close set trs=nothing end if else set trs=conn.execute("select ClassID From SoftClass where ParentIDPath like '"&rsClass("ParentIDPath")&"," & rsClass("ClassID") & ",%' and ClassID="&newParentClassID) if not (trs.eof and trs.bof) then response.write("<script>alert('不能指定父栏目的下属栏目作为所属栏目!系统即将返回');location.href='ClassList.asp';</script>") response.End() end if trs.close set trs=nothing end if else rstUpdateQuried=0 end if '读取类别相关历史数据 oldClassDepth=Clng(rsClass("ClassDepth")) oldChild=Clng(rsClass("Child")) oldRootID=Clng(rsClass("RootID")) oldParentID=Clng(rsClass("ParentID")) oldParentIDPath=rsClass("ParentIDPath") oldPrevClassID=Clng(rsClass("PrevID")) oldNextID=Clng(rsClass("NextID")) oldClassOrderID=Clng(rsClass("ClassOrderID")) oldRootOrderID=Clng(rsClass("RootOrderID")) oldOrderID=Clng(rsClass("OrderID")) end if rsClass.close set rsClass=nothing IF newParentClassID=0 then '查询新父类相关数据 newParentClassName="" '父类名 newParentClassFolderName="" '父类目录名 newClassDepth=0 newParentClassID=0 newParentClassRootID=0 ClassFolderPath=ClassFolderName ClassLocalPath=ChannelFolderPath&"/"&ClassFolderPath ClassFolderUrl=ChannelFolderUrl&"/"&Replace(ClassFolderPath,"/","/") else '查询新父类相关数据 set rsParent=server.CreateObject("Adodb.recordset") sqlParent="select * from SoftClass where ClassID="&newParentClassID rsParent.open sqlParent,conn,1,3 if rsParent.eof and rsParent.bof then response.write("<script>alert('未能查询到新父类类别对应的数据!系统即将返回上一页');history.go(-1);</script>") response.End() else newParentClassID=Clng(rsParent("ClassID")) newParentClassName=rsParent("ClassName") '父类名 newParentClassFolderName=rsParent("ClassFolderName") '新父类目录名 newParentClassFolderPath=rsParent("ClassFolderPath") '新父类目录名 newParentClassFolderUrl=rsParent("ClassFolderUrl") '新父类访问路径 newParentClassIDPath=rsParent("ParentIDPath") newParentClassDepth=Clng(rsParent("ClassDepth")) newParentClassRootID=Clng(rsParent("RootID")) newParentClassChild=Clng(rsParent("Child")) newParentOrderID=Clng(rsParent("OrderID")) newParentClassOrderID=Clng(rsParent("ClassOrderID")) newParentRootOrderID=Clng(rsParent("RootOrderID")) end if rsParent.close set rsParent=nothing '根据父类数据得到当前路径相关参数 ClassFolderPath=newParentClassFolderPath&"/"&ClassFolderName ClassLocalPath=ChannelFolderPath&"/"&ClassFolderPath ClassFolderUrl=ChannelFolderUrl&"/"&Replace(ClassFolderPath,"/","/") end if '如果改变了父类,则要更新相关一些数据 IF rstUpdateQuried=1 then '首先更新历史父栏目的子栏目数量 '如果是顶类栏目,下面的语句是不执行的 conn.execute("update SoftClass set Child=Child-1 where ClassID="&oldParentID) '****************************************** '由一级别移动到1级别下面 '****************************************** IF oldParentID=0 and newParentClassRootID=0 and newParentClassID>0 then '分顶类栏目往前移动和往后移动 if oldClassOrderID>newParentClassOrderID then MovetoBehind=0'顶类栏目往前移动 response.Write("顶类栏目往前移动到系统根栏目") else MovetoBehind=1'顶类栏目往后移动 response.Write("顶类栏目往后移动到系统根栏目") end if response.Write("顶类栏目移动方向:"&MovetoBehind) '查询当前移动栏目的子类别数量 set rs1=conn.execute("select Count(*) from SoftClass where ParentIDPath like '0,"&ClassID&",%'") if isnull(rs1(0)) then ChildClassNumber=0 else ChildClassNumber=rs1(0) end if set rs1=nothing TotalMovingNumber=ChildClassNumber+1 response.Write("当前移动栏目包含子栏目的栏目数量"&TotalMovingNumber) newClassDepth=1 newRootID=newParentClassID if newParentClassChild>0 then '************************************* '不同顶类栏目中的顶类栏目移动到别的包含子栏目顶类栏目下 '************************************* response.Write("不同顶类栏目中的顶类栏目移动到别的包含子栏目顶类栏目下:") '获取新父栏目的子栏目中的当前类别的前一栏目 newPrevClassOrderID=conn.execute("select Max(ClassOrderID) from SoftClass where ParentID="&newParentClassID)(0) PrevClassID=conn.execute("select ClassID,ClassOrderID from SoftClass where ClassOrderID="&newPrevClassOrderID&" and ParentID="&newParentClassID)(0) conn.execute("Update SoftClass set NextID="&ClassID&" where ClassID="&PrevClassID) newClassOrderID=newPrevClassOrderID+1 '获取同一顶类栏目中的排列顺序 set rs1=conn.execute("select Max(RootOrderID) from SoftClass where ParentIDPath like '0,"&newRootID&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxRootOrderID=rs1(0) end if newRootOrderID=newMaxRootOrderID+1 set rs1=nothing response.Write("最大前一栏目的RootOrderID:"&newMaxRootOrderID) if MovetoBehind=0 then'顶类栏目往前移动 '获取所有栏目中的排列顺序 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '0,"&newRootID&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID+1 set rs1=nothing response.Write("最大前一栏目的OrderID:"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newRootID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID+"&TotalMovingNumber&" where OrderID>"&newMaxOrderID&" and OrderID<"&oldOrderID) '更新同一父栏目的上一个栏目的“NextID”字段值 conn.execute("update SoftClass set NextID=" & ClassID & " where ClassID=" & PrevClassID) '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) else'顶类栏目往后移动 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '0,"&newRootID&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID-TotalMovingNumber set rs1=nothing response.Write("最大前一栏目的OrderID:"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newRootID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and (ParentIDPath not like '0,"&newRootID&",%')") '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) '更新同一父栏目的上一个栏目的“NextID”字段值 conn.execute("update SoftClass set NextID=" & ClassID & " where ClassID=" & PrevClassID) end if'移动的栏目包含子栏目且顶类栏目往前往后移动代码结束 '********************************* '批量更新所有移动的子栏目的排序 '********************************* response.Write("批量更新所有移动的子栏目的排序--顶类栏目往前移动") set rs=conn.execute("select * From SoftClass where ParentIDPath like '0,"&ClassID&",%'") i=0 do while not rs.eof i=i+1 tempParentIDPath=replace(rs("ParentIDPath"),"0,","0,"&newParentClassID&",") conn.execute("update SoftClass set ClassDepth=ClassDepth+"&newClassDepth&"+1,RootOrderID="&newRootOrderID&"+"&i&",RootID="&newRootID&",ParentIDPath='"&tempParentIDPath&"'") rs.movenext loop rs.close set rs=nothing else '************************************************************* '不同顶类栏目中的顶类栏目移动到别的不包含子栏目顶类栏目下 '************************************************************* response.Write("不同顶类栏目中的顶类栏目移动到别的不包含子栏目顶类栏目下:") '获取新父栏目的子栏目中的当前类别的前一栏目 PrevClassID=0 '获取同一父类栏目中的排列顺序 newClassOrderID=1 '获取同一顶类栏目中的排列顺序 set rs1=conn.execute("select Max(RootOrderID) from SoftClass where ParentIDPath like '0,"&newParentClassID&",%'") if isnull(rs1(0)) then newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxRootOrderID=rs1(0) end if newRootOrderID=newMaxRootOrderID+1 set rs1=nothing response.Write("最大前一栏目的RootOrderID:"&newMaxRootOrderID) if MovetoBehind=0 then'顶类栏目往前移动 '获取所有栏目中的排列顺序 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '0,"&newParentClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID+1 set rs1=nothing response.Write("最大前一栏目的OrderID:"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID+"&TotalMovingNumber&" where OrderID>"&newMaxOrderID&" and OrderID<"&oldOrderID) '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) else'顶类栏目往后移动 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '0,"&newParentClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) newOrderID=newMaxOrderID-TotalMovingNumber else newMaxOrderID=rs1(0) newOrderID=newMaxOrderID-TotalMovingNumber end if set rs1=nothing '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<"&newMaxOrderID&" and (ParentIDPath not like '0,"&newParentClassID&",%')") '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) end if'顶类栏目往后移动分类代码结束 '批量更新所有移动的子栏目的排序 set rs=conn.execute("select * From SoftClass where ParentIDPath like '0,"&ClassID&",%'") i=0 do while not rs.eof i=i+1 tempParentIDPath=replace(rs("ParentIDPath"),"0,",newParentClassID) conn.execute("update SoftClass set ClassDepth=ClassDepth+"&newClassDepth&"+1,RootOrderID="&newRootOrderID&"+"&i&",RootID="&newRootID&",ParentIDPath='"&tempParentIDPath&"'") rs.movenext loop rs.close set rs=nothing end if'新父栏目包含与不包含子栏目分类代码结束 '****************************************** '由一级别移动到N级别(N>1) '****************************************** ELSEIF oldParentID=0 and newParentClassRootID>0 then response.Write("由一级别移动到N级别(N>1)") '分顶类栏目往前移动和往后移动 if oldClassOrderID>newParentClassOrderID then MovetoBehind=0'顶类栏目往前移动 response.Write("顶类栏目往前移动到N级栏目") else MovetoBehind=1'顶类栏目往后移动 response.Write("顶类栏目往后移动到N级栏目") end if '查询当前移动栏目的子类别数量 set rs1=conn.execute("select Count(*) from SoftClass where ParentIDPath like '"&oldParentIDPath&","&ClassID&",%'") if isnull(rs1(0)) then ChildClassNumber=0 else ChildClassNumber=rs1(0) end if set rs1=nothing TotalMovingNumber=ChildClassNumber+1 response.Write("当前移动栏目的栏目数量"&TotalMovingNumber) newClassDepth=newParentClassDepth+1 newRootID=newParentClassRootID if newParentClassChild>0 then '************************************************************* '不同顶类栏目中的顶类栏目移动到别的包含子栏目N级栏目下 '************************************************************* response.Write("不同顶类栏目中的顶类栏目移动到别的包含子栏目N级栏目下:") '获取新父栏目的子栏目中的当前类别的前一栏目 newPrevClassOrderID=conn.execute("select Max(ClassOrderID) from SoftClass where ParentID="&newParentClassID)(0) PrevClassID=conn.execute("select ClassID,ClassOrderID from SoftClass where ClassOrderID="&newPrevClassOrderID&" and ParentID="&newParentClassID)(0) response.Write("前一子栏目ID"&PrevClassID) conn.execute("Update SoftClass set NextID="&ClassID&" where ClassID="&PrevClassID) newClassOrderID=newPrevClassOrderID+1 response.Write("当前父栏目已经存在的子栏目数量"&newPrevClassOrderID) '获取同一顶类栏目中的排列顺序 set rs1=conn.execute("select Max(RootOrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&newParentClassID&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxRootOrderID=rs1(0) end if newRootOrderID=newMaxRootOrderID+1 set rs1=nothing response.Write("当前同一顶类最大排序:"&newMaxRootOrderID) if MovetoBehind=0 then'移动的栏目包含子栏目且顶类栏目往前移动 '获取所有栏目中的排列顺序 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&newParentClassID&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID+1 set rs1=nothing response.Write("前一栏目总排序:"&newMaxOrderID) response.Write("新父栏目的顶类栏目CLASSID:"&newParentClassRootID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and RootID="&newRootID) '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID+"&TotalMovingNumber&" where OrderID>"&newMaxOrderID&" and OrderID<"&oldOrderID) '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) else'移动的栏目包含子栏目且顶类栏目往后移动 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&newParentClassID&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID-TotalMovingNumber set rs1=nothing '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassRootID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and (ParentIDPath not like '"&newParentClassIDPath&","&ClassID&",%')") '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) '更新同一父栏目的上一个栏目的“NextID”字段值 conn.execute("update SoftClass set NextID=" & ClassID & " where ClassID=" & PrevClassID) end if'移动的栏目包含子栏目且顶类栏目往前往后移动代码结束 else '************************************************************* '不同顶类栏目中的顶类栏目移动到别的不包含子栏目N级栏目下 '************************************************************* response.Write("不同顶类栏目中的顶类栏目移动到别的不包含子栏目N级栏目下:") '获取新父栏目的子栏目中的当前类别的前一栏目 PrevClassID=0 '获取同一父类栏目中的排列顺序 newClassOrderID=1 '获取同一顶类栏目中的排列顺序 newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) newRootOrderID=newMaxRootOrderID+1 response.Write("最大存在上一顶类栏目的RootOrderID"&newMaxRootOrderID) if MovetoBehind=0 then'新父类栏目不包含子栏目且顶类栏目往前移动 '获取所有栏目中的排列顺序 newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) newOrderID=newMaxOrderID+1 '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassRootID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID+"&TotalMovingNumber&" where OrderID>"&newMaxOrderID&" and OrderID<"&oldOrderID) '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) else'新父类栏目不包含子栏目且顶类栏目往后移动 newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) newOrderID=newMaxOrderID-TotalMovingNumber '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassRootID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and (ParentIDPath not like '"&newParentClassIDPath&","&ClassID&",%')") '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) end if'顶类栏目往后移动分类代码结束 end if'移动的栏目包含与不包含子栏目分类代码结束 '****************************************** '由N级别移动到1级别栏目下 '****************************************** ELSEIF oldParentID>0 and newParentClassRootID=0 and newParentClassID>0 then '查询当前移动栏目的子类别数量 set rs1=conn.execute("select Count(*) from SoftClass where ParentIDPath like '"&oldParentIDPath&","&ClassID&",%'") if isnull(rs1(0)) then ChildClassNumber=0 else ChildClassNumber=rs1(0) end if set rs1=nothing TotalMovingNumber=ChildClassNumber+1 response.Write("当前移动栏目的栏目数量"&TotalMovingNumber) newRootID=newParentClassID if newParentClassChild>0 then '************************************************************* '不同顶类栏目中的N级栏目移动到别的包含子栏目的1级栏目下 '************************************************************* response.Write("不同顶类栏目中的N级栏目移动到别的包含子栏目的1级栏目下:") '获取新父栏目的子栏目中的当前类别的前一栏目 newPrevClassOrderID=conn.execute("select Max(ClassOrderID) from SoftClass where ParentID="&newParentClassID)(0) PrevClassID=conn.execute("select ClassID,ClassOrderID from SoftClass where ClassOrderID="&newPrevClassOrderID&" and ParentID="&newParentClassID)(0) response.Write("前一子栏目ID"&PrevClassID) conn.execute("Update SoftClass set NextID="&ClassID&" where ClassID="&PrevClassID) newClassOrderID=newPrevClassOrderID+1 response.Write("当前父栏目已经存在的子栏目数量"&newPrevClassOrderID) '获取同一顶类栏目中的排列顺序 set rs1=conn.execute("select Max(RootOrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxRootOrderID=rs1(0) end if newRootOrderID=newMaxRootOrderID+1 set rs1=nothing response.Write("当前同一顶类最大排序:"&newMaxRootOrderID) set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) newOrderID=newMaxOrderID-TotalMovingNumber else newMaxOrderID=rs1(0) newOrderID=newMaxOrderID-TotalMovingNumber end if set rs1=nothing '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and (ParentIDPath not like '0,"&newParentClassID&",%')") else '************************************************************* '不同顶类栏目中的N级栏目移动到别的不包含子栏目1级栏目下 '************************************************************* response.Write("不同顶类栏目中的N级栏目移动到别的不包含子栏目1级栏目下:") '获取新父栏目的子栏目中的当前类别的前一栏目 PrevClassID=0 '获取同一父类栏目中的排列顺序 newClassOrderID=1 response.Write("当前父类ClassID:"&newParentClassID) '获取同一顶类栏目中的排列顺序 set rs1=conn.execute("select Max(RootOrderID) from SoftClass where ParentIDPath like '0,"&newParentClassID&",%'") if isnull(rs1(0)) then newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxRootOrderID=rs1(0) end if newRootOrderID=newMaxRootOrderID+1 set rs1=nothing response.Write("前一栏目的RootOrderID"&newMaxRootOrderID) set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '0,"&newParentClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID-TotalMovingNumber set rs1=nothing response.Write("前一栏目的OrderID"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and (ParentIDPath not like '0,"&newParentClassID&","&ClassID&",%')") end if'移动的栏目包含与不包含子栏目分类代码结束 '****************************************** '由N级别移动到根目录下 '****************************************** ELSEIF oldParentID>0 and newParentClassID=0 then '************************************************************* '不同顶类栏目中的N级栏目移动到根目录下 '*************************************************************] response.Write("由N级别移动到根目录下:") '查询当前移动栏目的子类别数量 set rs1=conn.execute("select Count(*) from SoftClass where ParentIDPath like '"&oldParentIDPath&","&ClassID&",%'") if isnull(rs1(0)) then ChildClassNumber=0 else ChildClassNumber=rs1(0) end if set rs1=nothing TotalMovingNumber=ChildClassNumber+1 response.Write("当前移动栏目的栏目数量:"&TotalMovingNumber) newClassDepth=0 newRootID=0 '获取新父栏目的子栏目中的当前类别的前一栏目 newPrevClassOrderID=conn.execute("select Max(ClassOrderID) from SoftClass where ParentID=0")(0) PrevClassID=conn.execute("select ClassID,ClassOrderID from SoftClass where ClassOrderID="&newPrevClassOrderID&" and ParentID=0")(0) response.Write("前一顶类栏目的ClassID"&PrevClassID) conn.execute("Update SoftClass set NextID="&ClassID&" where ClassID="&PrevClassID) newClassOrderID=newPrevClassOrderID+1 response.Write("根栏目中的当前栏目的排序:"&newClassOrderID) '获取同一顶类栏目中的排列顺序 newRootOrderID=1 newMaxOrderID=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '0,"&PrevClassID&",%'")(0) if newMaxOrderID=oldOrderID then newOrderID=newMaxOrderID else newOrderID=newMaxOrderID-TotalMovingNumber end if set rs1=nothing '更新历史同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID-"&TotalMovingNumber&" where RootOrderID>"&oldRootOrderID&" and RootID="&oldRootID&" and (ParentIDPath not like '"&oldParentIDPath&",%')") if newOrderID<>oldOrderID then '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newOrderID&" and (ParentIDPath not like '"&oldParentIDPath&",%')") end if '批量更新所有移动的子栏目的排序 set rs=conn.execute("select * From SoftClass where ParentIDPath like '"&oldParentIDPath&",%'") i=0 do while not rs.eof if rs("ClassDepth")>1 then tempParentIDPath=replace(rs("ParentIDPath"),oldParentIDPath,"0,") conn.execute("update SoftClass set ClassDepth=ClassDepth-"&oldClassDepth&"+1,RootOrderID="&newRootOrderID&"+"&i&",RootID="&ClassID&",ParentIDPath='"&tempParentIDPath&"'") end if rs.movenext i=i+1 loop rs.close set rs=nothing '****************************************** '类别由N级别移动到N级别(N>1) '****************************************** ELSE '(oldParentID>0 and newParentClassRootID>0) '分移动到相同顶类的栏目跟不同顶类的栏目下 '移动到不同顶类目录下分往前移动和往后移动两类 newClassDepth=newParentClassDepth+1 if oldRootID<>newParentClassRootID then '分顶类栏目往前移动和往后移动 oldTopClassOrderID=Clng(conn.execute("select ClassOrderID,ClassID from SoftClass where RootID="&oldRootID)(0)) if oldTopClassOrderID>newParentClassOrderID then MovetoBehind=0'顶类栏目往前移动 else MovetoBehind=1'顶类栏目往后移动 end if '查询当前移动栏目的子类别数量 set rs1=conn.execute("select Count(*) from SoftClass where ParentIDPath like '"&oldParentIDPath&","&ClassID&",%'") if isnull(rs1(0)) then ChildClassNumber=0 else ChildClassNumber=rs1(0) end if set rs1=nothing TotalMovingNumber=ChildClassNumber+1 MaxOldChildOrderID=oldOrderID+ChildClassNumber if newParentClassChild>0 then'移动到包含子栏目的N级类别下 '************************************************************* '不同顶类栏目中的N级栏目移动到别的包含子栏目N级栏目下 '************************************************************* response.Write("不同顶类栏目中的N级栏目移动到别的包含子栏目N级栏目下:") '获取新父栏目的子栏目中的当前类别的前一栏目 PrevClassID=conn.execute("select Max(ClassID) from SoftClass where ParentID="&newParentClassID)(0) conn.execute("Update SoftClass set NextID="&ClassID&" where ClassID="&PrevClassID) '获取同一父类栏目中的排列顺序 newPrevClassOrderID=conn.execute("select Max(ClassOrderID) from SoftClass where ParentID="&newParentClassID)(0) newClassOrderID=newPrevClassOrderID+1 '获取同一顶类栏目中的排列顺序 set rs1=conn.execute("select Max(RootOrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxRootOrderID=rs1(0) end if newRootOrderID=newMaxRootOrderID+1 set rs1=nothing response.Write("前一栏目的RootOrderID"&newMaxRootOrderID) if MovetoBehind=0 then'移动栏目包含子栏目且其顶类栏目往前移动 '获取所有栏目中的排列顺序 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID+1 set rs1=nothing response.Write("前一栏目的OrderID"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassRootID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID+"&TotalMovingNumber&" where OrderID>"&newOrderID&" and OrderID<"&MaxOldChildOrderID&" and ParentIDPath not like '"&oldParentIDPath&","&ClassID&",%' ") '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) '更新同一父栏目的上一个栏目的“NextID”字段值 conn.execute("update SoftClass set NextID=" & ClassID & " where ClassID=" & PrevClassID) else'移动栏目包含子栏目且其顶类栏目往后移动 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID-TotalMovingNumber set rs1=nothing response.Write("前一栏目的OrderID"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassRootID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and (ParentIDPath not like '"&newParentClassIDPath&","&ClassID&",%')") '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) '更新同一父栏目的上一个栏目的“NextID”字段值 conn.execute("update SoftClass set NextID=" & ClassID & " where ClassID=" & PrevClassID) end if else'移动到不包含子栏目的N级类别下 '************************************************************* '不同顶类栏目中的N级栏目移动到别的不包含子栏目N级栏目下 '************************************************************* response.Write("不同顶类栏目中的N级栏目移动到别的不包含子栏目N级栏目下:") PrevClassID=0 '获取同一父类栏目中的排列顺序 newClassOrderID=1 '获取同一顶类栏目中的排列顺序 set rs1=conn.execute("select Max(RootOrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&",%'") if isnull(rs1(0)) then newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxRootOrderID=rs1(0) end if newRootOrderID=newMaxRootOrderID+1 set rs1=nothing response.Write("前一栏目的RootOrderID"&newMaxRootOrderID) if MovetoBehind=0 then'移动栏目不包含子栏目且其顶类栏目往前移动 '获取所有栏目中的排列顺序 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID+1 set rs1=nothing response.Write("前一栏目的OrderID"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassRootID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID+"&TotalMovingNumber&" where OrderID>"&newMaxOrderID&" and OrderID<"&oldOrderID) '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and (ParentIDPath not like '"&newParentClassIDPath&","&ClassID&",%')") '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) else'移动栏目不包含子栏目且其顶类栏目往后移动 '获取所有栏目中的排列顺序 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID-TotalMovingNumber set rs1=nothing response.Write("前一栏目的OrderID"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and ParentIDPath like '0,"&newParentClassRootID&",%'") '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and (ParentIDPath not like '"&newParentClassIDPath&","&ClassID&",%')") '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) end if end if'不同顶类N层栏目移动的代码结束 '********************************** '要移动的栏目在相同顶类栏目之间移动 '********************************** else '查询当前移动栏目的子类别数量 set rs1=conn.execute("select Count(*) from SoftClass where ParentIDPath like '"&oldParentIDPath&","&ClassID&",%'") if isnull(rs1(0)) then ChildClassNumber=0 else ChildClassNumber=rs1(0) end if set rs1=nothing TotalMovingNumber=ChildClassNumber+1 if newParentClassChild>0 then'移动到包含子栏目的N级类别下 '************************************************************* '相同顶类栏目中的N级栏目移动到别的包含子栏目N级栏目下 '************************************************************* response.Write("同一顶类栏目中的N级栏目移动到别的包含子栏目N级栏目下:") '获取新父栏目的子栏目中的当前类别的前一栏目 PrevClassOrderID=conn.execute("select Max(ClassOrderID) from SoftClass where ParentID="&newParentClassID) PrevClassID=conn.execute("select ClassID,ClassOrderID from SoftClass where ParentID="&newParentClassID&" and ClassOrderID="&PrevClassOrderID) conn.execute("Update SoftClass set NextID="&ClassID&" where ClassID="&PrevClassID) '获取同一父类栏目中的排列顺序 newPrevClassOrderID=conn.execute("select Max(ClassOrderID) from SoftClass where ParentID="&newParentClassID)(0) newClassOrderID=newPrevClassOrderID+1 '获取同一顶类栏目中的排列顺序 set rs1=conn.execute("select Max(RootOrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxRootOrderID=rs1(0) end if newRootOrderID=newMaxRootOrderID+1 set rs1=nothing response.Write("前一栏目的RootOrderID"&newMaxRootOrderID) if oldClassOrderID>newParentClassOrderID then'同一顶类栏目中移动栏目包含子栏目且往前移动 '获取所有栏目中的排列顺序 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID+1 set rs1=nothing response.Write("前一栏目的OrderID"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and RootOrderID<"&oldRootOrderID&" and RootID="&oldRootID) '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID+"&TotalMovingNumber&" where OrderID>"&newMaxOrderID&" and OrderID<"&oldOrderID&" and RootID="&oldRootID) '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) '更新同一父栏目的上一个栏目的“NextID”字段值 conn.execute("update SoftClass set NextID=" & ClassID & " where ClassID=" & PrevClassID) else'移动栏目包含子栏目且其顶类栏目往后移动 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&","&PrevClassID&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&PrevClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID-TotalMovingNumber set rs1=nothing response.Write("前一栏目的OrderID"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and RootOrderID<"&oldRootOrderID&" and RootID="&oldRootID) '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and RootID="&oldRootID) '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) '更新同一父栏目的上一个栏目的“NextID”字段值 conn.execute("update SoftClass set NextID=" & ClassID & " where ClassID=" & PrevClassID) end if else'移动到不包含子栏目的N级类别下 '************************************************************* '相同顶类栏目中的N级栏目移动到别的不包含子栏目N级栏目下 '************************************************************* response.Write("同一顶类栏目中的N级栏目移动到别的不包含子栏目N级栏目下:") PrevClassID=0 '获取同一父类栏目中的排列顺序 newClassOrderID=1 '获取同一顶类栏目中的排列顺序 set rs1=conn.execute("select Max(RootOrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&",%'") if isnull(rs1(0)) then newMaxRootOrderID=conn.execute("select RootOrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxRootOrderID=rs1(0) end if newRootOrderID=newMaxRootOrderID+1 set rs1=nothing response.Write("前一栏目的RootOrderID:"&newMaxRootOrderID) if oldClassOrderID>newParentClassOrderID then'移动栏目不包含子栏目且其顶类栏目往前后移动 '获取所有栏目中的排列顺序 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID+1 set rs1=nothing response.Write("前一栏目的OrderID:"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" where RootOrderID>"&newMaxRootOrderID&" and RootOrderID<"&oldRootOrderID&" and RootID="&oldRootID) '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID+"&TotalMovingNumber&" where OrderID>"&newMaxOrderID&" and OrderID<"&oldOrderID) '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and RootID="&oldRootID) '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) else'移动栏目不包含子栏目且其顶类栏目往后移动 set rs1=conn.execute("select Max(OrderID) from SoftClass where ParentIDPath like '"&newParentClassIDPath&",%'") if isnull(rs1(0)) then newMaxOrderID=conn.execute("select OrderID,ClassID from SoftClass where ClassID="&newParentClassID)(0) else newMaxOrderID=rs1(0) end if newOrderID=newMaxOrderID-TotalMovingNumber set rs1=nothing response.Write("前一栏目的OrderID:"&newMaxOrderID) '更新同一顶类栏目的RootOrderID conn.execute("update SoftClass set RootOrderID=RootOrderID+"&TotalMovingNumber&" RootOrderID>"&newMaxRootOrderID&" and RootOrderID<"&oldRootOrderID&" and RootID="&oldRootID) '更新所有栏目的OrderID conn.execute("update SoftClass set OrderID=OrderID-"&TotalMovingNumber&" where OrderID>"&oldOrderID&" and OrderID<="&newMaxOrderID&" and RootID="&oldRootID) '更新父栏目中的子栏目数量 conn.execute("Update SoftClass Set Child=Child+1 where ClassID="&newParentClassID) end if'同一顶类栏目中移动栏目 end if'移动到包含与不包含子栏目的N级类代码结束 END IF END IF END IF '移动栏目资料修改结束 '创建对应的类别目录 if IsCreateFolder=1 then response.Write(""&ClassLocalPath) CreateFolder ClassLocalPath,IsCreateFolder end if '更新数据库对应类别的字段值 UserIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR") If UserIP = "" Then UserIP = Request.ServerVariables("REMOTE_ADDR") UserFrom=Cstr(Request.ServerVariables("HTTP_REFERER")) CorrectSqlClassFolderName=replace(ClassFolderName,"'","''") CorrectSqlClassName=replace(ClassName,"'","''") set rs=server.CreateObject("Adodb.recordset") sql="select * from SoftClass where ClassID="&ClassID rs.open sql,conn,3,3 if rs.eof and rs.bof then rs.close set rs=nothing conn.close set conn=nothing response.write("<script>alert('栏目类别数据不存在!系统即将返回');history.go(-1);</script>") response.end else rs("ChannelID")=ChannelID rs("ChannelName")=ChannelName rs("ChannelFolderPath")=ChannelFolderPath rs("ChannelFolderUrl")=ChannelFolderUrl rs("ParentName")=newParentClassName rs("ParentID")=newParentClassID rs("ClassName")=ClassName rs("ClassFolderName")=ClassFolderName rs("ClassFolderPath")=ClassFolderPath rs("ClassLocalPath")=ClassLocalPath rs("ClassDepth")=newClassDepth if newClassDepth>0 then rs("RootID")=newParentClassID else rs("RootID")=0 end if rs("ClassMemo")=ClassMemo rs("ClassKeyWords")=ClassKeyWords rs("ClassDescription")=ClassDescription rs("IsCreateFolder")=IsCreateFolder if rstUpdateQuried=1 then rs("PrevID")=PrevClassID rs("OrderID")=newOrderID rs("RootOrderID")=newRootOrderID rs("ClassOrderID")=newClassOrderID end if rs("UpdateUser")=Session("ManagerUserName") rs("UpdateTime")=now() rs("UpdateIP")=UserIP rs("UpdateFrom")=UserFrom rs.update end if rs.close set rs=nothing conn.close set conn=nothing response.write("栏目类别"&ClassName&"修改完成!系统即将返回列表<a href='ClassList.asp'>点这里返回</a>") response.End() response.write("<script>alert('栏目类别"&ClassName&"修改完成!系统即将返回列表');location.href='ClassList.asp';</script>") response.End() end if %>
试试其它关键字
移动修改栏目
同语言下
.
二进制输出
.
查找text文本中指定字符或词所在句子
.
阻止浏览器冒泡事件,兼容firefox和ie
.
xmlhttp 读取文件
.
定时跳转页面
.
除asp中所有超链接
.
获取Session
.
打包时自定义应用程序的快捷方式与卸载
.
获取局域网中可用SQL Server服务器
.
判断汉字字数
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
xqf222
贡献的其它代码
(
82
)
.
VB编写的登录局域网内的sql2000数据库服务器
.
ASP .NET登录界面用户验证码
.
VB操作ACCESS数据库
.
批量发送邮件程序
.
批量抓取网页代码中的HTTP和邮件地址
.
禁止站外提交参数测试
.
FTP网站文件到本地的
.
调用对应的应用程打开文件
.
抓取邮件内容解析
.
保存文件时候的弹出选择要保存的文件夹带新建文件夹效
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3