SelectClass.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:5k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../../FS_Inc/Function.asp"-->
  4. <!--#include file="../../../FS_InterFace/MF_Function.asp" -->
  5. <!--#include file="../../../FS_InterFace/NS_Function.asp" -->
  6. <%
  7. Dim Conn
  8. Dim TypeSql,RsTypeObj,LableSql,RsLableObj
  9. MF_Default_Conn
  10. %>
  11. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  12. <html>
  13. <head>
  14. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  15. <title>选择栏目</title>
  16. </head>
  17. <style>
  18. .LableSelectItem {
  19. background-color:highlight;
  20. cursor: hand;
  21. color: white;
  22. text-decoration: underline;
  23. }
  24. .LableItem {
  25. cursor: hand;
  26. }
  27. </style>
  28. <link href="../../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  29. <body ondragstart="return false;" onselectstart="return false;" topmargin="0" leftmargin="0">
  30. <table width="98%" border="0" align="center" cellpadding="2" cellspacing="0">
  31.   <%
  32. TypeSql = "Select ClassID,ClassName,ParentID,ReycleTF,isUrl from FS_NS_NewsClass where ParentID='0' and ReycleTF=0 and isUrl=0 order by OrderID desc,id desc"
  33. Set RsTypeObj = Conn.Execute(TypeSql)
  34. if Not RsTypeObj.Eof then
  35. do while Not RsTypeObj.Eof
  36. %>
  37.   <tr ParentID="<% = RsTypeObj("ParentID") %>">
  38. <td><table border="0" cellspacing="0" cellpadding="0">
  39.         <tr>
  40.           <td valign="top">
  41.   <%
  42. Dim str_action,obj_news_rs_1
  43. Set obj_news_rs_1 = server.CreateObject(G_FS_RS)
  44. obj_news_rs_1.Open "Select Count(ID) from FS_NS_NewsClass where ParentID='"& RsTypeObj("ClassID") &"'",Conn,1,1
  45. if obj_news_rs_1(0)>0 then
  46. str_action=  "<img src=""../images/+.gif""></img>"
  47. Else
  48. str_action=  "<img src=""../images/-.gif""></img>"
  49. End if
  50. obj_news_rs_1.close:set obj_news_rs_1 =nothing
  51. Response.Write str_action
  52.   %></td>
  53.           <td valign="bottom"><span onDblClick="SubmitLable(this);" Extend="False" class="LableItem" TypeID="<% = RsTypeObj("ClassID") %>" onClick="SelectFolder(this)">
  54. <% = RsTypeObj("ClassName") %></span></td>
  55.         </tr>
  56.       </table>
  57.     </td>
  58. </tr>
  59. <%
  60. Response.Write(GetChildTypeList(RsTypeObj("ClassID"),""," style=""display:none;"" "))
  61. RsTypeObj.MoveNext
  62. loop
  63. end if
  64. %>
  65. </table>
  66. </body>
  67. </html>
  68. <%
  69. Set Conn = Nothing
  70. Function GetChildTypeList(TypeID,CompatStr,ShowStr)
  71. Dim ChildTypeListRs,ChildTypeListStr,TempStr
  72. Set ChildTypeListRs = Conn.Execute("Select * from FS_NS_NewsClass where ParentID='" & TypeID & "' and IsUrl=0 order by OrderID desc,id desc" )
  73. TempStr = CompatStr & "&nbsp;&nbsp;&nbsp;&nbsp;"
  74. do while Not ChildTypeListRs.Eof
  75. Dim str_action_1,obj_news_rs_1s
  76. Set str_action_1 = server.CreateObject(G_FS_RS)
  77. str_action_1.Open "Select Count(ID) from FS_NS_NewsClass where ParentID='"& ChildTypeListRs("ClassID") &"'",Conn,1,1
  78. if str_action_1(0)>0 then
  79. str_action_1=  "<img src=""../images/+.gif""></img>"
  80. Else
  81. str_action_1=  "<img src=""../images/-.gif""></img>"
  82. End if
  83. set obj_news_rs_1s =nothing
  84.    GetChildTypeList = GetChildTypeList & "<tr TypeFlag=""Class"" ParentID=""" & ChildTypeListRs("ParentID") & """ " & ShowStr & ">" & Chr(13) & Chr(10)
  85. GetChildTypeList = GetChildTypeList & "<td>" & Chr(13) & Chr(10)
  86. GetChildTypeList = GetChildTypeList & "<table border=""0"" cellspacing=""0"" cellpadding=""0"">" & Chr(13) & Chr(10) & "<tr>"  & Chr(13) & Chr(10) & "<td>" & TempStr & ""& str_action_1 &"</td>"
  87. GetChildTypeList = GetChildTypeList & "<td><span onDblClick=""SubmitLable(this);"" class=""LableItem"" TypeID=""" & ChildTypeListRs("ClassID") & """ Extend=""False"" onClick=""SelectFolder(this)"">" & ChildTypeListRs("ClassName") & "</span></td>" & Chr(13) & Chr(10) & "</tr>" & Chr(13) & Chr(10) & "</table>"
  88. GetChildTypeList = GetChildTypeList & "</td>" & Chr(13) & Chr(10)
  89. GetChildTypeList = GetChildTypeList & "</tr>" & Chr(13) & Chr(10)
  90. GetChildTypeList = GetChildTypeList & GetChildTypeList(ChildTypeListRs("ClassID"),TempStr,ShowStr)
  91. ChildTypeListRs.MoveNext
  92. loop
  93. ChildTypeListRs.Close
  94. Set ChildTypeListRs = Nothing
  95. End Function
  96. %>
  97. <script language="JavaScript">
  98. function SelectLable(Obj)
  99. {
  100. for (var i=0;i<document.all.length;i++)
  101. {
  102. if (document.all(i).className=='LableSelectItem') document.all(i).className='LableItem';
  103. }
  104. Obj.className='LableSelectItem';
  105. }
  106. function SelectFolder(Obj)
  107. {
  108. var CurrObj;
  109. for (var i=0;i<document.all.length;i++)
  110. {
  111. if (document.all(i).className=='LableSelectItem') document.all(i).className='LableItem';
  112. }
  113. Obj.className='LableSelectItem';
  114. if (Obj.Extend=='True')
  115. {
  116. ShowOrDisplay(Obj,'none',true);
  117. Obj.Extend='False';
  118. }
  119. else
  120. {
  121. ShowOrDisplay(Obj,'',false);
  122. Obj.Extend='True';
  123. }
  124. }
  125. function ShowOrDisplay(Obj,Flag,Tag)
  126. {
  127. for (var i=0;i<document.all.length;i++)
  128. {
  129. CurrObj=document.all(i);
  130. if (CurrObj.ParentID==Obj.TypeID)
  131. {
  132. CurrObj.style.display=Flag;
  133. if (Tag) 
  134. if (CurrObj.TypeFlag=='Class') ShowOrDisplay(CurrObj.children(0).children(0).children(0).children(0).children(1).children(0),Flag,Tag);
  135. }
  136. }
  137. }
  138. function SubmitLable(Obj)
  139. {
  140. var LableName=Obj.TypeID+'***'+Obj.innerText;
  141. window.returnValue=LableName;
  142. window.close();
  143. }
  144. window.onunload=SetReturnValue;
  145. function SetReturnValue()
  146. {
  147. if (typeof(window.returnValue)!='string') window.returnValue='';
  148. }
  149. </script>