<% Sub GetSubMenus(intMenuID, intLevel, intCounterx, bRSEnd, strMenuIDs) strSQL = "(SELECT *, 1 AS 'Subs' "&_ "FROM CMS_Menu "&_ "WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID &" AND "&_ "MenuID IN (SELECT DISTINCT MainMenuID "&_ " FROM CMS_Menu "&_ " WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID IS NOT NULL)) "&_ "UNION "&_ "(SELECT *, 0 AS 'Subs' "&_ "FROM CMS_Menu "&_ "WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID = "& intMenuID &" AND "&_ "MenuID NOT IN (SELECT DISTINCT MainMenuID "&_ " FROM CMS_Menu "&_ " WHERE MenuSectionID = "& Session("MenuSectionID") &" AND MainMenuID IS NOT NULL)) "&_ "ORDER BY MenuOrder" set rsSubMenu = con.execute(strSQL) s_AllSubPageIDs = "0" if Not rsSubMenu.EOF then do while not rsSubMenu.EOF i_SubPageID = rsSubMenu("PageID") if Not IsNull(i_SubPageID) then s_AllSubPageIDs = s_AllSubPageIDs & "," & i_SubPageID end if rsSubMenu.MoveNext Loop rsSubMenu.MoveFirst end if strSQL = "SELECT PageID, Heading, [FileName], Redirect FROM CMS_Page WHERE PageID IN (" & s_AllSubPageIDs & ")" Set rsAllPages = con.execute(strSQL) Dim arrPages() i_ArrayIndex = 0 ReDim arrSubPages(3, i_ArrayIndex) do while not rsAllPages.EOF i_PageID = rsAllPages("PageID") s_Heading = rsAllPages("Heading") s_FileName = rsAllPages("FileName") s_Redirect = rsAllPages("Redirect") i_ArrayIndex = i_ArrayIndex + 1 ReDim Preserve arrSubPages(3, i_ArrayIndex) arrSubPages(0, i_ArrayIndex - 1) = i_PageID if Not IsNull(s_Redirect) then arrSubPages(1, i_ArrayIndex - 1) = s_Redirect & " (" & s_Heading & ")" arrSubPages(2, i_ArrayIndex - 1) = 0 elseif Not IsNull(s_FileName) then arrSubPages(1, i_ArrayIndex - 1) = s_Heading & " (Doc)" arrSubPages(2, i_ArrayIndex - 1) = 0 else arrSubPages(1, i_ArrayIndex - 1) = s_Heading & " (Page)" arrSubPages(2, i_ArrayIndex - 1) = 1 end if rsAllPages.MoveNext Loop Set rsAllPages = Nothing i_SubLoopCounter = 0 do while not rsSubMenu.EOF i_SubMenuID = rsSubMenu("MenuID") i_SubMenuSectionID = rsSubMenu("MenuSectionID") s_SubMenuName = rsSubMenu("MenuName") i_SubMenuOrder = rsSubMenu("MenuOrder") i_SubMainMenuID = rsSubMenu("MainMenuID") i_SubPageID = rsSubMenu("PageID") s_SubFrame = rsSubMenu("Frame") b_SubSubs = rsSubMenu("Subs") arrTMP = Split(bRSEnd, ",") %> <%if b_ShowIcons then%> Edit <%else%> <%end if%>

<%if CInt(arrTMP(0)) = 1 then%> <%else%> <%end if%> <%For y = 1 to UBound(arrTMP) - 1%> <%if CInt(arrTMP(y)) = 1 then%> <%else%> <%end if%> <%Next%> <%rsSubMenu.movenext%> <%if rsSubMenu.EOF then%> <%else%> <%end if%> <%if CInt(b_SubSubs) = 1 then%> <%if InStr(Request("menuid"), "|" & i_SubMenuID & "|") > 0 then%> <%else%> "> <%end if%> <%else%> <%end if%> <%=s_SubMenuName%>

<% if b_SubSubs then Response.Write(" ") else if IsNull(i_SubPageID) then %> Not Linked <% else For x = 0 to UBound(arrSubPages, 2) if CLng(arrSubPages(0, x)) = CLng(i_SubPageID) then %> <% if CInt(arrSubPages(2, x)) <> 1 then Response.Write(" ") else %> &buster=<%=server.URLEncode(now)%>','_self');">Edit <% end if %> ', 150)" onClick="javascript:window.open('../../content.asp?PageID=<%=i_SubPageID%>','_blank');"> View <% Exit For end if Next end if end if %> <%for i = 1 to intMaxCount%> <%if i = (intLevel + 2) then%> <%if b_ShowIcons then%> <% if i_SubLoopCounter > 0 then %> &buster=<%=Server.URLEncode(Now())%>','_self');" > Move Up <% else %> <% end if if not rsSubMenu.EOF then %> &buster=<%=Server.URLEncode(Now())%>','_self');">Move Down <% else %> <% end if %> <%else%>   <%end if%> <%else%>   <%end if%> <%Next%> <%if b_ShowIcons then%> <%if CInt(b_SubSubs) = 0 then%> <%else%> <%end if%><%end if%> <% if rsSubMenu.EOF then b_SubMenuEOF = "0," else b_SubMenuEOF = "1," end if if InStr(Request("menuid"), "|" & i_SubMenuID & "|") > 0 then if CInt(b_SubSubs) = 1 then GetSubMenus i_SubMenuID, intLevel + 1, counterx, bRSEnd & b_SubMenuEOF, strMenuIDs & i_SubMenuID & "|" end if %> <%i_SubLoopCounter = i_SubLoopCounter + 1%> <%loop End Sub %>