DownSort.asp
资源名称:1.rar [点击查看]
上传用户:yrf020
上传日期:2007-07-24
资源大小:1287k
文件大小:17k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

HTML/CSS

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <% Option Explicit %>
  3. <HTML xmlns="http://www.w3.org/1999/xhtml">
  4. <HEAD>
  5. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
  6. <META NAME="copyright" CONTENT="Copyright 2006-2008 - Hokilly.com-STUDIO" />
  7. <META NAME="Author" CONTENT="红金羚软件,www.hokilly.com" />
  8. <META NAME="Keywords" CONTENT="" />
  9. <META NAME="Description" CONTENT="" />
  10. <TITLE>下载分类</TITLE>
  11. <link rel="stylesheet" href="Images/CssAdmin.css">
  12. <script language="javascript" src="../Script/Admin.js"></script>
  13. </HEAD>
  14. <!--#include file="../Include/Const.asp" -->
  15. <!--#include file="../Include/ConnSiteData.asp" -->
  16. <!--#include file="CheckAdmin.asp"-->
  17. <%
  18. Dim SERVER_NAME
  19. SERVER_NAME=trim(Request.ServerVariables("SERVER_NAME"))
  20. if  (SERVER_NAME= ""&chr(119)&chr(119)&chr(119)&chr(46)&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&"")or(SERVER_NAME=  ""&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&"")or(SERVER_NAME=  ""&chr(108)&chr(111)&chr(99)&chr(97)&chr(108)&chr(104)&chr(111)&chr(115)&chr(116)&"")or(SERVER_NAME=  ""&chr(49)&chr(50)&chr(55)&chr(46)&chr(48)&chr(46)&chr(48)&chr(46)&chr(49)&"") then
  21. if Instr(session("AdminPurview"),"|51,")=0 then 
  22.   response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
  23.   response.end
  24. end if
  25. '========判断是否具有管理权限
  26. %>
  27. <BODY>
  28. <%
  29. Dim Action
  30. Action=request.QueryString("Action")
  31. Select Case Action
  32.   Case "Add"
  33. addFolder
  34.    CallFolderView()
  35.   Case "Del"
  36.     Dim rs,sql,SortPath
  37.     Set rs=server.CreateObject("adodb.recordset")
  38.     sql="Select * From CompanyCMS_DownSort where ID="&request.QueryString("id")
  39.     rs.open sql,conn,1,1
  40. SortPath=rs("SortPath")
  41. conn.execute("delete from  CompanyCMS_DownSort  where Instr(SortPath,'"&SortPath&"')>0")
  42.     conn.execute("delete from  CompanyCMS_Download where Instr(SortPath,'"&SortPath&"')>0")
  43.     response.write ("<script language=javascript> alert('成功删除本类、子类及所有下属信息条目,点击确定查看类别树!');location.replace('DownSort.asp');</script>")
  44.   Case "Save"
  45. saveFolder ()
  46.   Case "Edit"
  47. editFolder
  48.    CallFolderView()
  49.   Case "Move"
  50. moveFolderForm ()
  51.    CallFolderView()
  52.   Case "MoveSave"
  53. saveMoveFolder ()
  54.   Case Else
  55. CallFolderView()
  56. End Select
  57. %>
  58. </body>
  59. </html> 
  60. <%
  61. else
  62. response.write "<meta http-equiv=refresh content=0;URL="&chr(104)&chr(116)&chr(116)&chr(112)&chr(58)&chr(47)&chr(47)&chr(104)&chr(111)&chr(107)&chr(105)&chr(108)&chr(108)&chr(121)&chr(46)&chr(99)&chr(111)&chr(109)&chr(47)&chr(114)&chr(101)&chr(103)&chr(46)&chr(97)&chr(115)&chr(112)&">"
  63. response.end%>
  64. <%end if%>
  65. <%
  66. '调用显示节点------------------------------
  67. Function CallFolderView()
  68. %>
  69. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  70.   <tr>
  71.     <td height="24" nowrap><font color="#FFFFFF"><strong>类别树查看管理:</strong></font></td>
  72.   </tr>
  73.   <tr>
  74.     <td height="24" align="center" nowrap  bgcolor="#eafefe"><a href="DownSort.asp?Action=Add&ParentID=0">添加一级分类</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="DownList.asp" onClick='changeAdminFlag("下载列表")'>查看所有下载</a></td>
  75.   </tr>
  76.   <tr>
  77.     <td height="24" nowrap  bgcolor="#eafefe"><% Folder(0) %></td>
  78.   </tr>
  79. </table>
  80. <%
  81. End Function
  82. '列出所有节点------------------------------
  83. Function Folder(id)
  84.   Dim rs,sql,i,ChildCount,FolderType,FolderName,onMouseUp,ListType,ViewFlag
  85.   Set rs=server.CreateObject("adodb.recordset")
  86.   sql="Select * From CompanyCMS_DownSort where ParentID="&id&" order by id"
  87.   rs.open sql,conn,1,1
  88.   if id=0 and rs.recordcount=0 then
  89.     response.write ("暂无分类!")
  90.     response.end
  91.   end if  
  92.   i=1
  93.   response.write("<table border='0' cellspacing='0' cellpadding='0'>")
  94.   while not rs.eof
  95.     ChildCount=conn.execute("select count(*) from CompanyCMS_DownSort where ParentID="&rs("id"))(0)
  96.     if ChildCount=0 then
  97.   if i=rs.recordcount then
  98.     FolderType="SortFileEnd"
  99.   else
  100.     FolderType="SortFile"
  101.   end if
  102.   FolderName=rs("SortNameCh")&"&nbsp;"&ViewFlag
  103.   onMouseUp=""
  104.     else
  105.   if i=rs.recordcount then
  106.   FolderType="SortEndFolderClose"
  107. ListType="SortEndListline"
  108. onMouseUp="EndSortChange('a"&rs("id")&"','b"&rs("id")&"');"
  109.   else
  110. FolderType="SortFolderClose"
  111. ListType="SortListline"
  112. onMouseUp="SortChange('a"&rs("id")&"','b"&rs("id")&"');"
  113.   end if
  114.   FolderName=rs("SortNameCh")&"&nbsp;"&ViewFlag
  115.     end if
  116.     response.write("<tr>")
  117.     response.write("<td nowrap id='b"&rs("id")&"' class='"&FolderType&"' onMouseUp="&onMouseUp&"></td><td nowrap>"&FolderName&"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
  118.     response.write("<font color='#FF0000'>分类:</font><a href='DownSort.asp?Action=Add&ParentID="&rs("id")&"'>添加</a>")
  119.     response.write("<font color='#367BDA'>&nbsp;|&nbsp;</font><a href='DownSort.asp?Action=Edit&ID="&rs("id")&"'>修改</a>")
  120.     response.write("<font color='#367BDA'>&nbsp;|&nbsp;</font><a href='DownSort.asp?Action=Move&ID="&rs("id")&"&ParentID="&rs("Parentid")&"&SortNameCh="&rs("SortNameCh")&"&SortPath="&rs("SortPath")&"'>移</a>")
  121.     response.write("→<a href='#' onclick='SortFromTo.rows[4].cells[0].innerHTML=""→&nbsp;"&rs("SortNameCh")&""";MoveForm.toID.value="&rs("ID")&";MoveForm.toParentID.value="&rs("ParentID")&";MoveForm.toSortPath.value="""&rs("SortPath")&""";'>至</a>")
  122. response.write("<font color='#367BDA'>&nbsp;|&nbsp;</font><a href=javascript:ConfirmDelSort('DownSort',"&rs("id")&")>删除</a>")
  123.     response.write("&nbsp;&nbsp;&nbsp;&nbsp;<font color='#FF0000'>下载:</font><a href='DownEdit.asp?Result=Add' onClick='changeAdminFlag(""添加下载"")'>添加</a>")
  124.     response.write("<font color='#367BDA'>&nbsp;|&nbsp;</font><a href='DownList.asp?SortID="&rs("ID")&"&SortPath="&rs("SortPath")&"' onClick='changeAdminFlag(""下载列表"")'>列表</a>")
  125.     response.write("</td></tr>")
  126.     if ChildCount>0 then
  127. %>
  128.       <tr id="a<%= rs("id")%>" style="display:yes"><td class="<%= ListType%>" nowrap></td><td ><% Folder(rs("id")) %></td></tr>
  129. <%
  130.     end if
  131.     rs.movenext
  132.     i=i+1
  133.   wend
  134.   response.write("</table>")
  135.   rs.close
  136.   set rs=nothing
  137. end function
  138. '添加节点---------------------------------
  139. Function addFolder()
  140.   Dim ParentID
  141.   ParentID=request.QueryString("ParentID")
  142.   addFolderForm ParentID
  143. end function
  144. '添加节点表单------------------------------
  145. Function addFolderForm(ParentID)
  146.   Dim ParentPath,SortTextPath,rs,sql
  147.   if ParentID=0 then
  148.     ParentPath="0,"
  149. SortTextPath=""
  150.   else 
  151.     Set rs=server.CreateObject("adodb.recordset")
  152.     sql="Select * From CompanyCMS_DownSort where ID="&ParentID
  153.     rs.open sql,conn,1,1
  154. ParentPath=rs("SortPath")
  155.   end if
  156. %>
  157. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  158. <form name="FolderForm" method="post" action="DownSort.asp?Action=Save&From=Add">
  159.   <tr>
  160.     <td height="24" nowrap><font color="#FFFFFF"><img src="Images/Explain.gif" width="18" height="18" border="0" align="absmiddle">&nbsp;<strong>添加类别:通过"显示"可控制每种分类是否在相应语言版网站里显示出来。</strong></font></td>
  161.   </tr>
  162.   <tr>
  163.     <td height="24" nowrap bgcolor="#eafefe">|&nbsp;根类&nbsp;→&nbsp;<% if ParentID<>0 then TextPath(ParentID)%></td>
  164.   </tr>
  165.   <tr>
  166.     <td height="24" bgcolor="#eafefe">
  167. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  168.       <tr>
  169.         <td width="80" nowrap>分类名称:</td>
  170.         <td width="140" nowrap><input name="SortNameCh" type="text" class="textfield" id="SortNameCh" size="20"></td>
  171.         <td width="36" nowrap>显示:</td>
  172.         <td width="92" nowrap><input name="ViewFlagCh" type="radio" value="1" checked="checked" />是<input name="ViewFlagCh" type="radio" value="0" />否</td>
  173.         <td width="110" nowrap>父类ID:<input readonly name="ParentID" type="text" class="textfield" id="ParentID" size="6" value="<%=ParentID %>"></td>
  174.         <td nowrap>父类数字路径:<input readonly name="ParentPath" type="text" class="textfield" id="ParentPath" size="44" value="<%=ParentPath%>"></td>
  175. <td nowrap><input name="submitSave" type="submit" class="button" id="保存" value="  保存  "></td>
  176.   </tr>
  177.     </table>
  178. </td>
  179.   </tr>
  180. </form>
  181. </table>
  182. <br>
  183. <%
  184. End Function
  185. '生成节点文字路径--------------------------
  186. Function TextPath(ID)
  187.   Dim rs,sql,SortTextPath
  188.   Set rs=server.CreateObject("adodb.recordset")
  189.   sql="Select * From CompanyCMS_DownSort where ID="&ID
  190.   rs.open sql,conn,1,1
  191.   SortTextPath=rs("SortNameCh")&"&nbsp;→&nbsp;"
  192.   if rs("ParentID")<>0 then TextPath rs("ParentID")
  193.   response.write(SortTextPath)
  194. End Function
  195. '保存添加、修改节点-------------------------
  196. Function saveFolder
  197.   if len(trim(request.Form("SortNameCh")))=0 then
  198.       response.write ("<script language=javascript> alert('类别名为必填项目!');history.back(-1);</script>")
  199.       response.end
  200.   end if
  201.   if request.Form("ViewFlagEn")=1 then
  202.     if len(trim(request.Form("SortNameEn")))=0 then
  203.       response.write ("<script language=javascript> alert('您已经选择了""英文""显示,因此英文类别名必填!');history.back(-1);</script>")
  204.       response.end
  205.     end if
  206.   end if
  207.   Dim From,Action,rs,sql,SortTextPath
  208.   From=request.QueryString("From")
  209.   Set rs=server.CreateObject("adodb.recordset")
  210.   if From="Add" then 
  211.     sql="Select * From CompanyCMS_DownSort"
  212.     rs.open sql,conn,1,3
  213.     rs.addnew
  214. Action="添加类别"
  215.     rs("SortPath")=request.Form("ParentPath") & rs("ID") &","
  216.   else
  217.     sql="Select * From CompanyCMS_DownSort where ID="&request.QueryString("ID")
  218.     rs.open sql,conn,1,3
  219. Action="修改类别"
  220.     rs("SortPath")=request.Form("SortPath")
  221.   end if
  222.   rs("SortNameCh")=request.Form("SortNameCh")
  223.   rs("ViewFlagCh")=request.Form("ViewFlagCh")
  224.   rs("ParentID")=request.Form("ParentID")
  225.   rs.update 
  226.   response.write ("<script language=javascript> alert('"&Action&"保存成功,点击确定查看类别树!');location.replace('DownSort.asp');</script>")
  227. End Function 
  228. '修改节点---------------------------------
  229. Function editFolder()
  230.   Dim ID
  231.   ID=request.QueryString("ID")
  232.   editFolderForm ID
  233. end function
  234. '修改节点表单------------------------------
  235. Function editFolderForm(ID)
  236.   Dim SortNameCh,ViewFlagCh,ParentID,SortPath,rs,sql
  237.   Set rs=server.CreateObject("adodb.recordset")
  238.   sql="Select * From CompanyCMS_DownSort where ID="&ID
  239.   rs.open sql,conn,1,1
  240.   SortNameCh=rs("SortNameCh")
  241.   ViewFlagCh=rs("ViewFlagCh")
  242.   ParentID=rs("ParentID")
  243.   SortPath=rs("SortPath")
  244. %>
  245. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  246. <form name="FolderForm" method="post" action="DownSort.asp?Action=Save&From=Edit&ID=<%=ID%>">
  247.   <tr>
  248.     <td height="24" nowrap><font color="#FFFFFF"><img src="Images/Explain.gif" width="18" height="18" border="0" align="absmiddle">&nbsp;<strong>修改类别:通过"显示"可控制每种分类是否在相应语言版网站里显示出来。</strong></font></td>
  249.   </tr>
  250.   <tr>
  251.     <td height="24" nowrap bgcolor="#eafefe">|&nbsp;根类&nbsp;→&nbsp;<% if ParentID<>0 then TextPath(ParentID)%></td>
  252.   </tr>
  253.   <tr>
  254.     <td height="24" bgcolor="#eafefe">
  255. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  256.       <tr>
  257.         <td width="80" nowrap>分类名称:</td>
  258.         <td width="140" nowrap><input name="SortNameCh" type="text" class="textfield" id="SortNameCh" size="20" value="<%=SortNameCh%>"></td>
  259.         <td width="36" nowrap>显示:</td>
  260.         <td width="92" nowrap><input name="ViewFlagCh" type="radio" value="1" <%if ViewFlagCh then response.write ("checked=checked")%> />是<input name="ViewFlagCh" type="radio" value="0" <%if not ViewFlagCh then response.write ("checked=checked")%>/>否</td>
  261.         <td width="110" nowrap>父类ID:<input readonly name="ParentID" type="text" class="textfield" id="ParentID" size="6" value="<%=ParentID %>"></td>
  262.         <td nowrap>本类数字路径:<input readonly name="SortPath" type="text" class="textfield" id="SortPath" size="44" value="<%=SortPath%>"></td>
  263. <td nowrap><input name="submitSave" type="submit" class="button" id="保存" value="  保存  "></td>
  264.   </tr>
  265.     </table>
  266. </td>
  267.   </tr>
  268. </form>
  269. </table>
  270. <br>
  271. <%
  272. End Function
  273. '转移节点表单------------------------------
  274. Function moveFolderForm()
  275.   Dim ID,ParentID,SortNameCh,SortPath
  276.   ID=request.QueryString("ID")
  277.   ParentID=request.QueryString("ParentID")
  278.   SortNameCh=request.QueryString("SortNameCh")
  279.   SortPath=request.QueryString("SortPath")
  280. %>
  281. <table id="SortFromTo" width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  282. <form name="MoveForm" method="post" action="DownSort.asp?Action=MoveSave">
  283.   <tr>
  284.     <td height="24" colspan="3" nowrap><font color="#FFFFFF"><img src="Images/Explain.gif" width="18" height="18" border="0" align="absmiddle">&nbsp;<strong>类别移动:通过点击分类树中类别对应的"移"可重新选择将要作移动的类别,包括本类、子类及所有下属信息条目将一起被移动。</strong></font></td>
  285.   </tr>
  286.   <tr>
  287.     <td height="24" colspan="3" nowrap bgcolor="#eafefe">→&nbsp;<% response.write (SortNameCh) %></td>
  288.   </tr>
  289.   <tr>
  290.     <td nowrap bgcolor="#eafefe">移动类ID:<input readonly name="ID" type="text" class="textfield" id="ID" size="14" value="<%=ID%>"></td>
  291.     <td nowrap bgcolor="#eafefe">移动类父ID:<input readonly name="ParentID" type="text" class="textfield" id="ParentID" size="14" value="<%=ParentID%>"></td>
  292.     <td nowrap bgcolor="#eafefe">移动类数字路径:<input readonly name="SortPath" type="text" class="textfield" id="SortPath" size="30" value="<%=SortPath%>"></td>
  293.   </tr>
  294.   <tr>
  295.     <td height="24" colspan="3" nowrap><font color="#FFFFFF"><strong>目标位置:通过点击"至"选择将要放置到的类别。</strong></font></td>
  296.   </tr>
  297.   <tr>
  298.     <td height="24" colspan="3" nowrap bgcolor="#eafefe">→&nbsp;请选择…</td>
  299.   </tr>
  300.   <tr>
  301.     <td nowrap bgcolor="#eafefe">目标类ID:<input readonly name="toID" type="text" class="textfield" id="toID" size="14" value=""></td>
  302.     <td nowrap bgcolor="#eafefe">目标类父ID:<input readonly name="toParentID" type="text" class="textfield" id="toParentID" size="14" value=""></td>
  303.     <td nowrap bgcolor="#eafefe">目标类数字路径:<input readonly name="toSortPath" type="text" class="textfield" id="toSortPath" size="30" value=""></td>
  304.   </tr>
  305.   <tr>
  306.     <td height="40" colspan="3" nowrap bgcolor="#eafefe" align="center"><input name="submitMove" type="submit" class="button" id="转移" value="  转移  "></td>
  307.   </tr>
  308. </form>
  309. </table>
  310. <br>
  311. <%
  312. End Function
  313. '保存转移节点------------------------------
  314. Function saveMoveFolder()
  315.   Dim rs,sql,fromID,fromParentID,fromSortPath,toID,toParentID,toSortPath,fromParentSortPath
  316.   fromID=request.Form("ID")
  317.   fromParentID=request.Form("ParentID")
  318.   fromSortPath=request.Form("SortPath")
  319.   toID=request.Form("toID")
  320.   toParentID=request.Form("toParentID")
  321.   toSortPath=request.Form("toSortPath")
  322.   if toID="" or toParentID="" or toSortPath="" then
  323.     response.write ("<script language=javascript> alert('没有选择移动的目标位置,请返回选择!');history.back(-1);</script>")
  324.     response.end
  325.   end if
  326.   if fromParentID=0 then
  327.     response.write ("<script language=javascript> alert('一级分类不能被移动,请返回选择!');history.back(-1);</script>")
  328.     response.end
  329.   end if
  330.   if fromSortPath=toSortPath then
  331.     response.write ("<script language=javascript> alert('选择的移动类别和目标位置相同了,请返回重新选择!');history.back(-1);</script>")
  332.     response.end
  333.   end if
  334.   if Instr(toSortPath,fromSortPath)>0 or fromParentID=toID then
  335.     response.write ("<script language=javascript> alert('不能将类别移动到本类或下属类里,请返回重新选择!');history.back(-1);</script>")
  336.     response.end
  337.   end if
  338.   Set rs=server.CreateObject("adodb.recordset")
  339.   sql="Select * From CompanyCMS_DownSort where ID="&fromParentID
  340.   rs.open sql,conn,0,1
  341.   fromParentSortPath=rs("SortPath")
  342.   conn.execute("update CompanyCMS_DownSort set SortPath='"&toSortPath&"'+Mid(SortPath,Len('"&fromParentSortPath&"')+1) where Instr(SortPath,'"&fromSortPath&"')>0")'更新类别数字路径
  343.   conn.execute("update CompanyCMS_DownSort set ParentID='"&toID&"' where ID="&fromID)'更新类别父类ID
  344.   conn.execute("update CompanyCMS_Download set SortPath='"&toSortPath&"'+Mid(SortPath,Len('"&fromParentSortPath&"')+1) where Instr(SortPath,'"&fromSortPath&"')>0")'更新信息数字路径
  345.   response.write ("<script language=javascript> alert('移动类别成功,点击确定查看类别树!');location.replace('DownSort.asp');</script>")
  346. End Function
  347. %>