<%
Dim Action
Action=request.QueryString("Action")
Select Case Action
Case "Add"
addFolder
CallFolderView()
Case "Del"
Dim rs,sql,SortPath
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From NewsSort where ID="&request.QueryString("id")
rs.open sql,conn,1,1
SortPath=rs("SortPath")
conn.execute("delete from NewsSort where Instr(SortPath,'"&SortPath&"')>0")
conn.execute("delete from News where Instr(SortPath,'"&SortPath&"')>0")
response.write ("")
Case "Save"
saveFolder ()
Case "Edit"
editFolder
CallFolderView()
Case "Move"
moveFolderForm ()
CallFolderView()
Case "MoveSave"
saveMoveFolder ()
Case Else
CallFolderView()
End Select
%>
<%Function CallFolderView()%>
<%
End Function
Function Folder(id)
Dim rs,sql,i,ChildCount,FolderType,FolderName,onMouseUp,ListType
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From NewsSort where ParentID="&id&" order by id"
rs.open sql,conn,1,1
if id=0 and rs.recordcount=0 then
response.write ("
暂无日程分类
")
response.end
end if
i=1
response.write("
")
while not rs.eof
ChildCount=conn.execute("select count(*) from NewsSort where ParentID="&rs("id"))(0)
if ChildCount=0 then
if i=rs.recordcount then
FolderType="SortFileEnd"
else
FolderType="SortFile"
end if
FolderName=rs("SortNameCH")
onMouseUp=""
else
if i=rs.recordcount then
FolderType="SortEndFolderClose"
ListType="SortEndListline"
onMouseUp="EndSortChange('a"&rs("id")&"','b"&rs("id")&"');"
else
FolderType="SortFolderClose"
ListType="SortListline"
onMouseUp="SortChange('a"&rs("id")&"','b"&rs("id")&"');"
end if
FolderName=rs("SortNameCH")
end If
datafrom="NewsSort"
response.write("
")
response.write("
"&FolderName&" ")
if rs("ViewFlagCH") then
Response.Write "√"
else
Response.Write "×"
end if
if rs("ViewFlagEN") then
Response.Write "√"
else
Response.Write "×"
end if
response.write(" 操作:")
'If rs("ParentID") < 1 Then
response.write("添加 | ")
'End If
response.write("修改")
response.write(" | 移")
response.write("→至")
response.write(" | 删除")
response.write(" 日程:添加")
response.write(" | 列表")
response.write("
")
if ChildCount>0 then
%>
" style="display:yes">
<% Folder(rs("id")) %>
<%
end if
rs.movenext
i=i+1
wend
response.write("
")
rs.close
set rs=nothing
end Function
Function addFolder()
Dim ParentID
ParentID=request.QueryString("ParentID")
addFolderForm ParentID
end Function
Function addFolderForm(ParentID)
Dim ParentPath,SortTextPath,rs,sql
if ParentID=0 then
ParentPath="0,"
SortTextPath=""
else
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From NewsSort where ID="&ParentID
rs.open sql,conn,1,1
ParentPath=rs("SortPath")
end if
%>
<%
End Function
Function TextPath(ID)
Dim rs,sql,SortTextPath
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From NewsSort where ID="&ID
rs.open sql,conn,1,1
SortTextPath=rs("SortNameCH")&" → "
if rs("ParentID")<>0 then TextPath rs("ParentID")
response.write(SortTextPath)
End Function
Function saveFolder
if len(trim(request.Form("SortNameCH")))=0 then
response.write ("")
response.end
end if
Dim From,Action,rs,sql,SortTextPath
From=request.QueryString("From")
Set rs=server.CreateObject("adodb.recordset")
if From="Add" then
sql="Select * From NewsSort"
rs.open sql,conn,1,3
rs.addnew
Action="添加日程类别"
rs("SortPath")=request.Form("ParentPath") & rs("ID") &","
else
sql="Select * From NewsSort where ID="&request.QueryString("ID")
rs.open sql,conn,1,3
Action="修改日程类别"
rs("SortPath")=request.Form("SortPath")
end if
rs("SortNameCh")=request.Form("SortNameCh")
rs("ViewFlagCh")=request.Form("ViewFlagCh")
rs("SortNameEn")=request.Form("SortNameEn")
rs("ParentID")=request.Form("ParentID")
rs.update
response.write ("")
End Function
Function editFolder()
Dim ID
ID=request.QueryString("ID")
editFolderForm ID
end function
Function editFolderForm(ID)
Dim SortNameCh,ViewFlagCh,SortNameEn,ViewFlagEn,ParentID,SortPath,rs,sql
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From NewsSort where ID="&ID
rs.open sql,conn,1,1
SortNameCh=rs("SortNameCh")
ViewFlagCh=rs("ViewFlagCh")
SortNameEn=rs("SortNameEn")
ViewFlagEn=rs("ViewFlagEn")
ParentID=rs("ParentID")
SortPath=rs("SortPath")
%>
<%
End Function
Function moveFolderForm()
Dim ID,ParentID,SortNameCH,SortPath
ID=request.QueryString("ID")
ParentID=request.QueryString("ParentID")
SortNameCH=request.QueryString("SortNameCH")
SortPath=request.QueryString("SortPath")
%>
<%
End Function
Function saveMoveFolder()
Dim rs,sql,fromID,fromParentID,fromSortPath,toID,toParentID,toSortPath,fromParentSortPath
fromID=request.Form("ID")
fromParentID=request.Form("ParentID")
fromSortPath=request.Form("SortPath")
toID=request.Form("toID")
toParentID=request.Form("toParentID")
toSortPath=request.Form("toSortPath")
if toID="" or toParentID="" or toSortPath="" then
response.write ("")
response.end
end if
if fromParentID=0 then
response.write ("")
response.end
end if
if fromSortPath=toSortPath then
response.write ("")
response.end
end if
if Instr(toSortPath,fromSortPath)>0 or fromParentID=toID then
response.write ("")
response.end
end if
Set rs=server.CreateObject("adodb.recordset")
sql="Select * From NewsSort where ID="&fromParentID
rs.open sql,conn,0,1
fromParentSortPath=rs("SortPath")
conn.execute("update NewsSort set SortPath='"&toSortPath&"'+Mid(SortPath,Len('"&fromParentSortPath&"')+1) where Instr(SortPath,'"&fromSortPath&"')>0")
conn.execute("update NewsSort set ParentID='"&toID&"' where ID="&fromID)
conn.execute("update News set SortPath='"&toSortPath&"'+Mid(SortPath,Len('"&fromParentSortPath&"')+1) where Instr(SortPath,'"&fromSortPath&"')>0")
response.write ("")
End Function
%>