%
function CheckNewsExists(intID, strTemp)
if not IsObject(con) then
set con = server.createobject("ADODB.Connection")
con.open Application("CString")
end if
if InStr(strTemp, ","& intID &" ") = 0 then
strSQL = "SELECT SubPageID FROM CMS_PageRelatedLinks WHERE MainPageID = "& intID
set rsCheck = con.execute(strSQL)
do while not rsCheck.EOF
i_SubPageID = rsCheck("SubPageID")
CheckNewsExists = CheckNewsExists & ","& i_SubPageID &" "
CheckNewsExists = CheckNewsExists & CheckNewsExists(i_SubPageID, strTemp & ","& intID &" ")
rsCheck.MoveNext()
loop
set rsCheck = nothing
end if
End Function
function CheckLinkExists(intID, strTemp)
if not IsObject(con) then
set con = server.createobject("ADODB.Connection")
con.open Application("CString")
end if
if InStr(strTemp, ","& intID &" ") = 0 then
strSQL = "SELECT SubPageID FROM CMS_PageEmbeddedLinks WHERE MainPageID = "& intID
set rsCheck = con.execute(strSQL)
do while not rsCheck.EOF
i_SubPageID = rsCheck("SubPageID")
CheckLinkExists = CheckLinkExists & ","& i_SubPageID &" "
CheckLinkExists = CheckLinkExists & CheckLinkExists(i_SubPageID, strTemp & ","& intID &" ")
rsCheck.MoveNext()
loop
set rsCheck = nothing
end if
End Function
%>
<%
timeout(1)
set con = server.createobject("ADODB.Connection")
con.open Application("CString")
strSQL = "SELECT DISTINCT p.PageID FROM CMS_Page p, CMS_Menu m WHERE p.PageID = m.PageID"
set rsTemp = con.execute(strSQL)
strExists = ""
strExists = strExists & CheckNewsExists(1, "")
strExists = strExists & CheckNewsExists(2, "")
strExists = strExists & CheckNewsExists(3, "")
if not rsTemp.EOF then
do while not rsTemp.EOF
strExists = strExists & ","& rsTemp("PageID")
strExists = strExists & CheckNewsExists(rsTemp("PageID"), "")
rsTemp.movenext()
loop
rsTemp.MoveFirst()
do while not rsTemp.EOF
strExists = strExists & CheckLinkExists(rsTemp("PageID"), "")
rsTemp.MoveNext()
loop
end if
set rsTemp = nothing
con.close
set con = nothing
strSQL = "SELECT PageID, Heading, UploadDate FROM CMS_Page WHERE FileName IS NOT NULL AND PageID NOT IN (1, 2, 3 "& strExists &") ORDER BY Heading"
set rsPages = server.createobject("ADODB.Recordset")
rsPages.open strSQL, Application("CString"), 3, 1
%>
Website Administration
Document Maintenance (Orphans)
<%if rsPages.EOF then%>
There are currently no orphaned documents!
<%else%>
<%
rsPages.PageSize = 15
intPageCount = rsPages.PageCount
if request("intPage") <> empty and IsNumeric(request("intPage")) then
intPage = CInt(request("intPage"))
else
intPage = 1
end if
if intPage > intPageCount then
intPage = intPageCount
elseif intPage < 1 then
intPage = 1
end if
rsPages.AbsolutePage = intPage
if intPagecount > 1 then
%>
<%
if CDbl(intPage) > 1 then
%>
<%else%>
<%
end if
%>
Pages:
<%
for i=1 to intPagecount
if i = CDbl(intPage) then
%>
<%=i%>
<%
else
%>
<%=i%>
<%
end if
next
%>
<%
if CDbl(intPage) <> intPagecount then
%>
<%else%>
<%
end if
%>
<%end if%>
<%
counterx=0
for i = 1 to rsPages.PageSize
i_PageID = rsPages("PageID")
s_Heading = rsPages("Heading")
s_UploadDate = rsPages("UploadDate")
%>