Sitemap
<%
if (session("Admin") <> "1") then%>
<%
end if%>
<%
' Variabelen declareren
dim rstLang, rst
dim sSQL
' Database openen
if not VWA_SQLConnect(cKey, true) then response.end%>
<%=session("SiteName" & iSiteID)%>: SiteMap
<%
' Recordset met talen openen
sSQL = "SELECT TOP 1 L.LangCode, L.Name, L.ImgSite"
sSQL = sSQL & " FROM tbllanguage AS L INNER JOIN tblsitelanguage AS A ON L.LangCode = A.LangCode"
sSQL = sSQL & " WHERE A.SiteID=" & iSiteID & " AND A.Disabled=0"
sSQL = sSQL & " ORDER BY " & VWA_SQLFuncIIf(cKey, "A.LangCode=" & VWA_SQLText(cKey, sLangCode), "0", "1")
sSQL = sSQL & ", " & VWA_SQLFuncIIf(cKey, "A." & VWA_SQLFuncObjectName(cKey, "Default") & "<>0", "0", "1")
sSQL = sSQL & ", L.Name"
if VWA_SQLOpenRecordset(cKey, sSQL, rstLang, true) then
do while not rstLang.eof%>
<%
' Alle menuus van land plaatsen
sSQL = "SELECT M.MenuID, M.Name, M.Disabled, M.SubMenuus"
sSQL = sSQL & " FROM tblmenu AS M INNER JOIN tblbutton AS B ON M.SiteID=B.SiteID AND M.MenuID=B.MenuID"
sSQL = sSQL & " WHERE M.SiteID=" & iSiteID
sSQL = sSQL & " AND B.ProtectTypeID=0" ' Alleen onbeveiligde subknoppen
sSQL = sSQL & " AND B.Recycle=0"
sSQL = sSQL & GetSQLEnabled("M") ' Validatie houdbaarheid
sSQL = sSQL & GetSQLEnabled("B") ' Validatie houdbaarheid
sSQL = sSQL & " AND B.LangCode=" & VWA_SQLText(cKey, rstLang("LangCode"))
sSQL = sSQL & " GROUP BY M.MenuID, M.Name, M.Disabled, M.SubMenuus, " & VWA_SQLFuncIIf(cKey, "M." & VWA_SQLFuncObjectName(cKey, "Default") & "<>0", "0", "1")
sSQL = sSQL & " ORDER BY " & VWA_SQLFuncIIf(cKey, "M." & VWA_SQLFuncObjectName(cKey, "Default") & "<>0", "0", "1") & ", M.Name"
if VWA_SQLOpenRecordset(cKey, sSQL, rst, true) then
do while not rst.eof%>
<%=replace(rst("Name"), " ", " ")%>
<%
call LoadMenu(rstLang("LangCode"), rst("MenuID"), 0, 0, "", rst("SubMenuus"))
rst.movenext
loop
rst.close
end if
set rst = nothing%>
<%
rstLang.movenext
loop
rstLang.close
end if
set rstLang = nothing
%>
<%
' Database sluiten
call VWA_SQLDisconnect(cKey)
' Stoppen met verwerken (hieronder alleen procedures)
response.end
' *********************************************************************************************
' Menu laden
function LoadMenu(byval sLangCode, byval iMenuID, byval iParentID, byval iLevel, byval sTDPrefix, byval iMaxLevel)
dim rst
dim sSQL, sSQL2, sURL
sSQL2 = "BC.Recycle=0"
sSQL2 = sSQL2 & GetSQLEnabled("BC") ' Validatie houdbaarheid
sSQL2 = sSQL2 & " AND BC.ProtectTypeID=0" ' Alleen onbeveiligde subknoppen
sSQL = "SELECT B.ButtonID, B.MenuID, B.Name, B.SortNr, B.DTChange, B.ButTypeID"
sSQL = sSQL & ", M.ModuleID, M.FrontURL, BF.URL, BF.Code, BF.ConnectID"
if (iLevel < iMaxLevel) or (iMaxLevel = 0) then
sSQL = sSQL & ", SUM(" & VWA_SQLFuncIIf(cKey, sSQL2, "1", "0") & ") AS Children"
else
sSQL = sSQL & ", 0 AS Children"
end if
if (iParentID <= 0) then
sSQL = sSQL & ", SUM(" & VWA_SQLFuncIIf(cKey, "BP.Recycle=0", "1", "0") & ") AS Parents"
sSQL = sSQL & " FROM ((((tblbutton AS B INNER JOIN tblbuttonframe AS BF ON B.SiteID=BF.SiteID AND B.ButtonID=BF.ButtonID)"
sSQL = sSQL & " INNER JOIN tblfsetframe AS F ON BF.Code=F.Code AND BF.SiteID=F.SiteID AND B.FrameSetID=F.FrameSetID AND B.SiteID=F.SiteID)"
sSQL = sSQL & " INNER JOIN tblmodule AS M ON BF.ModuleID = M.ModuleID)"
sSQL = sSQL & " LEFT JOIN tblbutton AS BP ON B.SiteID=BP.SiteID AND B.ParentID=BP.ButtonID)"
sSQL = sSQL & " LEFT JOIN tblbutton AS BC ON B.SiteID=BC.SiteID AND B.ButtonID=BC.ParentID"
sSQL = sSQL & " WHERE 1=1"
else
sSQL = sSQL & " FROM (((tblbutton AS B INNER JOIN tblbuttonframe AS BF ON B.SiteID=BF.SiteID AND B.ButtonID=BF.ButtonID)"
sSQL = sSQL & " INNER JOIN tblfsetframe AS F ON BF.Code=F.Code AND BF.SiteID=F.SiteID AND B.FrameSetID=F.FrameSetID AND B.SiteID=F.SiteID)"
sSQL = sSQL & " INNER JOIN tblmodule AS M ON BF.ModuleID = M.ModuleID)"
sSQL = sSQL & " LEFT JOIN tblbutton AS BC ON B.SiteID=BC.SiteID AND B.ButtonID=BC.ParentID"
sSQL = sSQL & " WHERE B.ParentID=" & iParentID
end if
sSQL = sSQL & " AND B.SiteID=" & iSiteID & " AND B.MenuID=" & iMenuID & " AND B.LangCode=" & VWA_SQLText(cKey, sLangCode)
sSQL = sSQL & GetSQLEnabled("B") ' Validatie houdbaarheid
sSQL = sSQL & " AND B.ProtectTypeID=0" ' Alleen onbeveiligde subknoppen
sSQL = sSQL & " AND B.Recycle=0"
sSQL = sSQL & " AND F.ExcludeSitemap=0" ' Alleen niet uitgesloten framesets
sSQL = sSQL & " AND B.ButTypeID<>3" ' Alleen knoppen met inhoud
sSQL = sSQL & " GROUP BY B.ButtonID, B.MenuID, B.Name, B.SortNr, B.DTChange, B.ButTypeID"
sSQL = sSQL & ", M.ModuleID, M.FrontURL, BF.URL, BF.Code, BF.ConnectID"
if (iParentID <= 0) then
sSQL = sSQL & " HAVING SUM(" & VWA_SQLFuncIIf(cKey, "BP.Recycle=0", "1", "0") & ")=0"
end if
sSQL = sSQL & " UNION "
sSQL = sSQL & "SELECT B.ButtonID, B.MenuID, B.Name, B.SortNr, B.DTChange, B.ButTypeID"
sSQL = sSQL & ", 0 AS ModuleID, NULL AS FrontURL, NULL AS URL, NULL AS Code, NULL AS ConnectID"
if (iLevel < iMaxLevel) or (iMaxLevel = 0) then
sSQL = sSQL & ", SUM(" & VWA_SQLFuncIIf(cKey, sSQL2, "1", "0") & ") AS Children"
else
sSQL = sSQL & ", 0 AS Children"
end if
if (iParentID <= 0) then
sSQL = sSQL & ", SUM(" & VWA_SQLFuncIIf(cKey, "BP.Recycle=0", "1", "0") & ") AS Parents"
sSQL = sSQL & " FROM (tblbutton AS B LEFT JOIN tblbutton AS BP ON B.SiteID=BP.SiteID AND B.ParentID=BP.ButtonID)"
sSQL = sSQL & " LEFT JOIN tblbutton AS BC ON B.SiteID=BC.SiteID AND B.ButtonID=BC.ParentID"
sSQL = sSQL & " WHERE 1=1"
else
sSQL = sSQL & " FROM tblbutton AS B LEFT JOIN tblbutton AS BC ON B.SiteID=BC.SiteID AND B.ButtonID=BC.ParentID"
sSQL = sSQL & " WHERE B.ParentID=" & iParentID
end if
sSQL = sSQL & " AND B.SiteID=" & iSiteID & " AND B.MenuID=" & iMenuID & " AND B.LangCode=" & VWA_SQLText(cKey, sLangCode)
sSQL = sSQL & GetSQLEnabled("B") ' Validatie houdbaarheid
sSQL = sSQL & " AND B.ProtectTypeID=0" ' Alleen onbeveiligde subknoppen
sSQL = sSQL & " AND B.Recycle=0"
sSQL = sSQL & " AND B.ButTypeID=3" ' Alleen knoppen met submenuus (zonder inhoud)
sSQL = sSQL & " GROUP BY B.ButtonID, B.MenuID, B.Name, B.SortNr, B.DTChange, B.ButTypeID"
if (iParentID <= 0) then
sSQL = sSQL & " HAVING SUM(" & VWA_SQLFuncIIf(cKey, "BP.Recycle=0", "1", "0") & ")=0"
end if
' Sortering
sSQL = sSQL & " ORDER BY 4, 3" 'SortNr, Name
if VWA_SQLOpenRecordset(cKey, sSQL, rst, true) then
sTDPrefix = sTDPrefix & "
"
do while not rst.eof
select case rst("ButTypeID")
case 3 ' Alleen subknoppen tonen%>
<%=sTDPrefix%>
<%=replace(rst("Name"), " ", " ")%>
<%
' Overslaan
case else
sURL = Nz(rst("FrontURL"), "")
if (len(sURL) = 0) then
sURL = Nz(rst("URL"), "")
' Controleren of content-bestand ingesteld is
if (len(sURL) > 0) and (replace(left(sURL, 1), "\", "/") <> "/") and (strcomp(left(sURL, 5), "http:", vbTextCompare) <> 0) then
sURL = "../" & replace(session("ContentDir" & iSiteID), "\", "/") & sURL
end if
end if
if (len(sURL) = 0) then sURL = "page.asp"
' Standaard directory voorvoegen
if (instr(1, sURL, "\") = 0) and (instr(1, sURL, "/") = 0) then sURL = "../asp/" & sURL
' Codes aan link toevoegen
if (instr(1, sURL, "&ButtonID=") = 0) and (instr(1, sURL, "?ButtonID=") = 0) then sURL = sURL & iif(instr(1, sURL, "?") > 0, "&", "?") & "ButtonID=" & rst("ButtonID") & "&FrameID=" & rst("Code")%>