% Response.Expires = 2 Server.ScriptTimeout = 10000 set con = server.createobject("ADODB.Connection") con.open Application("CString") con.CommandTimeout = 1000 i_MenuSectionID = 1 Session("b_Auxiliary") = 1 Session("MenuSectionID") = 1 i_MenuLevels = 2 i_MenuOptions = NULL Sub MaxLevels(intMenuID, intMaxCount, intLevel) if intMenuID = 0 then strSQL = "SELECT MenuID FROM CMS_Menu WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID IS NULL" else strSQL = "SELECT MenuID FROM CMS_Menu WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID end if set rsMenuCount = con.execute(strSQL) if not rsMenuCount.EOF then do while not rsMenuCount.EOF MaxLevels rsMenuCount("MenuID"), intMaxCount, intLevel + 1 rsMenuCount.MoveNext loop end if set rsMenuCount = Nothing if intLevel > intMaxCount then intMaxCount = intLevel end if End Sub Sub GetSubs(intMenuID, strMainOption, intLevel) if intLevel < i_MenuLevels or IsNull(i_MenuLevels) then strSQL = "SELECT MenuID, MenuName, MenuOrder FROM CMS_Menu WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID &" ORDER BY MenuOrder" set rsSubMenus = con.execute(strSQL) do while not rsSubMenus.EOF i_MenuID = rsSubMenus("MenuID") s_MenuName = rsSubMenus("MenuName") Response.Write("" & VBCrLf) GetSubs i_MenuID, strMainOption &" \ "& s_MenuName, intLevel + 1 rsSubMenus.MoveNext loop set rsSubMenus = Nothing end if End Sub Sub DeleteSubs(intMenuID) strSQL = "SELECT MenuID FROM CMS_Menu WHERE MainMenuID = "& intMenuID set rsSubMenus = con.execute(strSQL) if not rsSubMenus.EOF then do while not rsSubMenus.EOF DeleteSubs rsSubMenus("MenuID") rsSubMenus.MoveNext() loop strSQL = "DELETE FROM CMS_Menu WHERE MainMenuID = "& intMenuID con.execute(strSQL) end if set rsSubMenus = Nothing End Sub Function GetMenuLine(intID) strSQL = "SELECT MainMenuID, MenuName FROM CMS_Menu WHERE MenuID = "& intID set rsMenu = con.execute(strSQL) if not rsMenu.EOF then rsMenu.MoveFirst() i_tmpMainMenuID = rsMenu("MainMenuID") s_tmpMenuName = rsMenu("MenuName") if Not IsNull(i_tmpMainMenuID) then GetMenuLine = GetMenuLine & GetMenuLine(i_tmpMainMenuID) end if GetMenuLine = GetMenuLine & s_tmpMenuName & " \ " end if set rsMenu = Nothing End Function strSQL = "(SELECT *, 1 AS 'Subs' "&_ "FROM CMS_Menu "&_ "WHERE MenuSectionID = "& i_MenuSectionID &" AND MainMenuID IS NULL AND "&_ "MenuID IN (SELECT DISTINCT MainMenuID "&_ " FROM CMS_Menu "&_ " WHERE MenuSectionID = "& i_MenuSectionID &" AND MainMenuID IS NOT NULL)) "&_ "UNION "&_ "(SELECT *, 0 AS 'Subs' "&_ "FROM CMS_Menu "&_ "WHERE MenuSectionID = "& i_MenuSectionID &" AND MainMenuID IS NULL AND "&_ "MenuID NOT IN (SELECT DISTINCT MainMenuID "&_ " FROM CMS_Menu "&_ " WHERE MenuSectionID = "& i_MenuSectionID &" AND MainMenuID IS NOT NULL)) "&_ "ORDER BY MenuOrder" set rsMenu = con.execute(strSQL) s_Heading = "Sitemap" %>
|
<%if Not bRSEnd then%>
|
<%rsMenu.movenext%>
<%if rsMenu.EOF then%>
|