<% '################################################################################# '## Copyright (C) 2000 Michael Anderson and Pierre Gorissen '## '## This program is free software; you can redistribute it and/or '## modify it under the terms of the GNU General Public License '## as published by the Free Software Foundation; either version 2 '## of the License, or any later version. '## '## All copyright notices regarding Snitz Forums 2000 '## must remain intact in the scripts and in the outputted HTML '## The "powered by" text/logo with a link back to '## http://forum.snitz.com in the footer of the pages MUST '## remain visible when the pages are viewed on the internet or intranet. '## '## This program is distributed in the hope that it will be useful, '## but WITHOUT ANY WARRANTY; without even the implied warranty of '## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the '## GNU General Public License for more details. '## '## You should have received a copy of the GNU General Public License '## along with this program; if not, write to the Free Software '## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. '## '## Support can be obtained from support forums at: '## http://forum.snitz.com '## '## Correspondence and Marketing Questions can be sent to: '## reinhold@bigfoot.com '## '## or '## '## Snitz Communications '## C/O: Michael Anderson '## PO Box 200 '## Harpswell, ME 04079 '################################################################################# '################################################################################# '## Subscription_List.asp - This page will search through all subscriptions. '## If the user is an administrator, then it will loop '## through all the subscriptions, otherwise it will only '## look for those subscriptions which apply directly to '## them. '################################################################################# %> <% ' Admin's can look at ALL subscriptions. Mode = Request("MODE") If mlev <> 4 then Mode = "" end if ' -- Make sure user is logged on. if strDBNTUserName = "" then Response.redirect ("default.asp") else MemberID = getMemberNumber(strDBNTUserName) If Mode = "" then strPageTitle = "Subscriptions for " & strDBNTUserName & "" else strPageTitle = "Subscriptions for All Members" end if end if Response.Write "" & vbNewline & _ " " & vbNewline & _ " " & vbNewline & _ " " & vbNewline & _ "
" & vbNewline & _ " " & vbNewline & _ " " & _ " All Forums
" & vbNewline & _ " " & vbNewline & _ "  " & strPageTitle & "
" & vbNewline & _ "
" & vbNewline & _ "
" & vbNewline dim HeadBg, HeadFont, CellBg, CellFont, ForumBg, ForumFont, LoopCount, TotalSubCount ' -- Added to make CSS easier hopefully HeadBg = "bgcolor=" & strHeadCellColor HeadFont = "" ForumBg = "bgcolor=" & strCategoryCellColor ForumFont = "" CellBg = "bgcolor=" & strForumCellColor CellFont = "" ' Used for loops set rs = Server.CreateObject("ADODB.Recordset") set rsCatLoop = Server.CreateObject("ADODB.Recordset") set rsForumLoop = Server.CreateObject("ADODB.Recordset") set rsTopicLoop = Server.CreateObject("ADODB.Recordset") ' If no subscriptions allowed - exit if strSubscription = 0 then Go_Result Response.End else StrSql = "SELECT COUNT(*) as SUBCOUNT FROM " & strTablePrefix & "SUBSCRIPTIONS " if Mode = "" then StrSql = StrSql & " WHERE MEMBER_ID = " & MemberID end if set rsCount = my_Conn.Execute (StrSql) if rsCount.BOF or rsCount.EOF then ' No Subscriptions found, exit Go_Result rsCount.close set rsCount = nothing Response.End else rsSubCount = rsCount("SubCount") rsCount.Close set rsCount = nothing if rsSubCount = 0 then ' No Subscriptions found, exit TotalSubCount = 0 Go_Result Response.End else TotalSubCount = 1 end if end if end if ' -- Start to build the html. Response.Write "" & vbNewline ' Look for Board Level Subscriptions first StrSql = "SELECT MEMBER_ID FROM " & strTablePrefix & "SUBSCRIPTIONS " StrSql = StrSql & " WHERE CAT_ID = 0 " StrSql = StrSql & " AND FORUM_ID = 0 " StrSql = StrSql & " AND TOPIC_ID = 0 " if Mode = "" then StrSql = StrSql & " AND MEMBER_ID = " & MemberID end if set rsCount = my_Conn.Execute (StrSql) if not(rsCount.BOF or rsCount.EOF) then Response.Write " " Response.Write vbNewline & _ " " & vbNewline LookForSubscriptions 0, 0, 0 Response.Write " " & vbNewline end if rsCount.close set rsCount = nothing ' Loop through the Categories Next. Only select those categories with subscriptions StrSql = "SELECT DISTINCT S.CAT_ID, CAT_NAME, CAT_SUBSCRIPTION, CAT_ORDER " & _ " FROM " & strTablePrefix & "CATEGORY C, " & strTablePrefix & "SUBSCRIPTIONS S" & _ " WHERE C.CAT_ID = S.CAT_ID " if Mode = "" then StrSql = StrSql & " AND S.MEMBER_ID = " & MemberID end if StrSql = StrSql & " ORDER BY CAT_ORDER, CAT_NAME" rsCatLoop.Open StrSql, my_Conn, 3 if rsCatLoop.EOF or rsCatLoop.BOF then ' No Categories found - exit rsCatLoop.close set rsCatLoop = nothing Go_Result Response.End else do until rsCatLoop.EOF CatID = rsCatLoop("CAT_ID") CatName = rsCatLoop("CAT_NAME") CatSubscription = rsCatLoop("CAT_SUBSCRIPTION") if CatSubscription = 0 then ' Do Nothing - No subscriptions allowed else Response.Write " " Response.Write vbNewline & _ " " & vbNewline ' Check for Category Subscriptions first if strSubscription < 3 and CatSubscription > 0 then LookForSubscriptions CatID, 0, 0 end if ' Loop through the available forums for the category that have SOME type of subscription on them. StrSql = "SELECT DISTINCT S.FORUM_ID, F_SUBJECT, F_SUBSCRIPTION, F_ORDER " & _ " FROM " & strTablePrefix & "FORUM F, " & strTablePrefix & "SUBSCRIPTIONS S" & _ " WHERE S.FORUM_ID = F.FORUM_ID " & _ " AND S.CAT_ID = " & CatID if Mode = "" then StrSql = StrSql & " AND S.MEMBER_ID = " & MemberID end if StrSql = StrSql & " ORDER BY F_ORDER, F_SUBJECT " rsForumLoop.Open StrSql, my_Conn, 3 if rsForumLoop.EOF or rsForumLoop.BOF then ' Do nothing - No Forum or Topic Level Subscriptions found for this category " else do until (rsForumLoop.EOF or rsForumLoop.BOF) ForumID = rsForumLoop("FORUM_ID") FSubject = rsForumLoop("F_SUBJECT") FSubscription = rsForumLoop("F_SUBSCRIPTION") if FSubscription = 0 then ' No Subscriptions allowed for this forum else Response.Write " " Response.Write vbNewline & _ " " & vbNewline if strSubscription < 4 and CatSubscription < 3 and FSubscription = 1 then LookForSubscriptions CatID, ForumID, 0 Response.Write " " & vbNewline end if StrSql = "SELECT DISTINCT S.TOPIC_ID, T.T_SUBJECT " & _ " FROM " & strTablePrefix & "TOPICS T, " & _ " " & strTablePrefix & "SUBSCRIPTIONS S" & _ " WHERE S.TOPIC_ID = T.TOPIC_ID " & _ " AND S.FORUM_ID = " & ForumID & _ " AND S.CAT_ID = " & CatID if Mode = "" then StrSql = StrSql & " AND S.MEMBER_ID = " & MemberID end if StrSql = StrSql & " ORDER BY T_SUBJECT " rsTopicLoop.Open StrSql, my_Conn, 3 if rsTopicLoop.EOF or rsTopicLoop.BOF then ' Do Nothing -- No Topic Level Subscriptions found for this category/forum else Do until (rsTopicLoop.EOF or rsTopicLoop.BOF) TopicID = rsTopicLoop("TOPIC_ID") Response.Write vbNewline & "" & vbNewline & _ " " & vbNewline LookForSubscriptions CatID, ForumID, TopicID Response.Write " " & vbNewline rsTopicLoop.MoveNext loop end if rsTopicLoop.close end if rsForumLoop.MoveNext loop end if rsForumLoop.Close end if rsCatLoop.MoveNext loop end if rsCatLoop.Close Go_Result Response.End ' --- LookForSubscriptions will loop through the subscriptions table for a specific level of subscription ' --- if CatID = 0, looking for BoardWide subscriptions. If ForumID = 0, looking for category level subscriptions ' --- if TopicID = 0, looking for Forum Level Subscriptions. Otherwise, looking for specific subscriptions on a ' --- topic. Sub LookForSubscriptions(CatID, ForumID, TopicID) StrSql = "SELECT S.MEMBER_ID, M_NAME" & _ " FROM " & strTablePrefix & "SUBSCRIPTIONS S, " & _ strMemberTablePrefix & "MEMBERS M " & _ " WHERE S.MEMBER_ID = M.MEMBER_ID" & _ " AND S.CAT_ID = " & CatID & _ " AND S.FORUM_ID = " & ForumID & _ " AND S.TOPIC_ID = " & TopicID if Mode = "" then StrSql = StrSql & " AND S.MEMBER_ID = " & MemberID end if rs.open StrSql, my_Conn, 3 if rs.EOF or rs.BOF then ' No Subscriptions found, exit else LoopCount = 0 do until rs.EOF LoopCount = LoopCount + 1 if Mode <> "" or (Mode = "" and TopicID = 0) then Response.Write " " Response.Write vbNewline & _ " " & vbNewline & _ " " & vbNewline & _ " " & vbNewline & _ " " & vbNewline & _ " " & vbNewline end if if CatID = 0 then Level = "BOARD" elseif ForumID = 0 then Level = "CAT" elseif TopicID = 0 then Level = "FORUM" else Level = "TOPIC" end if Response.Write " " & vbNewline rs.MoveNext loop end if rs.Close end sub ' Go_Result - Closes connections, displays footer, etc sub Go_Result if TotalSubCount = 0 then Response.Write "

No Subscriptions found!!!

" & vbNewline Response.Write "

Go Back To Forum

" end if ' -- Close all connections set rs = nothing set rsCatLoop = nothing set rsForumLoop = nothing set rsTopicLoop = nothing Response.write "
" & HeadFont & "" & StrForumTitle & "
" & HeadFont & "" & CatName & "
" & ForumFont & _ "   Forum: " & _ FSubject & "
"" then Response.write " colspan=""2"" " end if Response.Write ">" & CellFont & _ "     Topic: " & _ rsTopicLoop("T_Subject") & "
"") then Response.Write " colspan=""2"" >" & CellFont else Response.Write " >" & CellFont end if end if if LoopCount = 1 then if CatId = 0 then Response.Write "Board Wide Subscriptions" elseif ForumID = 0 then Response.Write "   Category Wide Subscriptions" elseif TopicID = 0 then Response.Write "     Forum Wide Subscriptions " end if if Mode <> "" then if (CatId = 0) or (ForumID = 0) or (TopicID = 0) then Response.Write "
" & CellFont end if end if end if If Mode <> "" then if CatID = 0 then Response.Write "   " elseif ForumID = 0 then Response.Write "     " elseif TopicID = 0 then Response.Write "      " else Response.Write "        " end if Response.Write rs("M_NAME") & "" & CellFont CheckSubscription Level & "NOTEXT", rs("MEMBER_ID"), CatID, ForumID, TopicID, "", "" Response.Write " 
" Response.write "

 

" WriteFooter end sub %>