<%
'#################################################################################
'## Copyright (C) 2000  Michael Anderson
'## 
'## 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.
'## 
'## 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.
'## 
'## Correspondence and Questions can be sent to:
'## reinhold@bigfoot.com
'## 
'## or
'## 
'## Snitz Communications 
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
%>
<% if Session("Approval") = "15916941253" then %>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_functions.asp"-->
<!--#INCLUDE FILE="inc_top.asp"-->
<table border="0" width="100%">
  <tr>
    <td width="33%" align="left" nowrap><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
    <img src="icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="default.asp">All Forums</a><br>
    <img src="icon_blank.gif" height=15 width=15 border="0"><img src="icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="admin_home.asp">Admin Section</a><br>
    <img src="icon_blank.gif" height=15 width=15 border="0"><img src="icon_blank.gif" height=15 width=15 border="0"><img src="icon_folder_open_topic.gif" height=15 width=15 border="0">&nbsp;Moderator Configuration<br>
    </font></td>
  </tr>
</table>
<%
	if request("Forum") = "" then
		txtMessage = "select a forum to edit moderators for that forum"
	else
		if request("userid") = "" then
			txtMessage = "Select a user to grant/revoke moderator powers for that user.	Users in bold are currently moderators of this forum."
		else
			if Request("action") = "" then
				txtMessage = "Select an action for this user"
			else
				txtMessage = "Action Successful"
			end if
		end if
	end if
%>
<table border="0" width="95%" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td bgcolor="<% =strTableBorderColor %>">
<table border="0" width="100%" cellspacing="1" cellpadding="4">
  <tr>
    <td bgcolor="<% =strCategoryCellColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" size"<% =strDefaultFontSize %>"><b>Moderator Configuration</b><%if txtMessage <> "" Then%><br><%=txtMessage%><%End If%></font></td>
  </tr>
  <tr>
    <td bgcolor="<% =strForumCellColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
<%	if Request("ForumID") = "" then %>
<UL>
<%

		'## Forum_SQL
		strSql = "SELECT " & strTablePrefix & "FORUM.CAT_ID, " & strTablePrefix & "FORUM.FORUM_ID, " & strTablePrefix & "FORUM.F_SUBJECT "
		strSql = strSql & " FROM " & strTablePrefix & "FORUM "
		strSql = strSql & " ORDER BY " & strTablePrefix & "FORUM.CAT_ID ASC, " & strTablePrefix & "FORUM.F_SUBJECT ASC;"

		set rs = my_Conn.Execute(strSql)

		do until rs.EOF
%>
<br>
<LI><a
href="admin_moderators.asp?ForumID=<%=rs("FORUM_ID")%>"><%=rs("F_SUBJECT")%></a></LI>
<%
rs.MoveNext
		loop
%>
</UL>
<%
	else

		if Request("action") = "" then
			if Request("UserID") = "" then

				'## Forum_SQL
				strSql = "SELECT " & strMemberTablePrefix & "Members.MEMBER_ID, " & strMemberTablePrefix & "Members.M_NAME "
				strSql = strSql & " FROM " & strMemberTablePrefix & "Members "
				strSql = strSql & " WHERE " & strMemberTablePrefix & "Members.M_LEVEL > 1 "
				strSql = strSql & " AND   " & strMemberTablePrefix & "MEMBERS.M_STATUS = " & 1
				strSql = strSql & " ORDER BY " & strMemberTablePrefix & "Members.M_NAME ASC;"

				set rs = my_Conn.Execute(strSql)

%>
<br>
<UL>
<%
				do until rs.EOF
%>
  <LI><% if chkForumModerator(Request("ForumID"), rs("M_NAME")) then %><b><% end if %><a href="admin_moderators.asp?ForumID=<%=Request("ForumID")%>&UserID=<%=rs("MEMBER_ID")%>"><%=rs("M_NAME")%></a><%If chkForumModerator(Request("ForumID"), rs("M_NAME")) Then%></b><%End If%></LI>
<%
				rs.MoveNext
				loop
%>
</UL>
<%
			else

				'## Forum_SQL
				strSql = "SELECT " & strTablePrefix & "Moderator.FORUM_ID, " & strTablePrefix & "Moderator.MEMBER_ID, " & strTablePrefix & "Moderator.MOD_TYPE "
				strSql = strSql & " FROM " & strTablePrefix & "Moderator "
				strSql = strSql & " WHERE " & strTablePrefix & "Moderator.MEMBER_ID = " & Request("UserID") & " "
				strSql = strSql & " AND " & strTablePrefix & "Moderator.FORUM_ID = " & Request("ForumID") & " "

				set rs = my_Conn.Execute(strSql)

				if rs.EOF then
%>
<center>
<br>
The selected user is not a moderator of the selected forum<br>
<br>
If you would like to make this user the moderator of this forum, <a href="admin_moderators.asp?ForumID=<%=Request("ForumID")%>&UserID=<%=Request("UserID")%>&action=1">click here</a>.
</center>
<br>
<%				else %>
<center>
<br>
The selected user is currently a moderator of the selected forum<br>
<br>
If you would like to remove this user's moderator status in this forum, <a href="admin_moderators.asp?ForumID=<%=Request("ForumID")%>&UserID=<%=Request("UserID")%>&action=2">click here</a>.
</center>
<br>
<%
				end if
			end if
		else
			select case Request("action")
				case 1

					'## Forum_SQL
					strSql = "INSERT INTO " & strTablePrefix & "MODERATOR "
					strSql = strSql & "(FORUM_ID"
					strSql = strSql & ", MEMBER_ID"
					strSql = strSql & ") VALUES (" 
					strSql = strSql & Request("ForumID")
					strSql = strSql & ", " & Request("UserID")
					strSql = strSql & ")"

					my_Conn.Execute strSql
%>
<br>
<center>
The selected user is now a moderator of the selected forum<br>
<br>
<a href="admin_moderators.asp">Back to Moderator Options</a>
</center><br>
<%
				case 2

					'## Forum_SQL
					strSql = "DELETE FROM " & strTablePrefix & "Moderator "
					strSql = strSql & " WHERE " & strTablePrefix & "Moderator.FORUM_ID = " & Request("ForumID") & " "
					strSql = strSql & " AND   " & strTablePrefix & "Moderator.MEMBER_ID = " & Request("UserID")

					my_Conn.Execute strSql

%>
<br>
<center>
The selected user's moderator status in the selected forum has been removed<br>
<br>
<a href="admin_moderators.asp">Back to Moderator Options</a>
</center>
<br>
<%
			end select
		end if
	end if
%>
    </font></td>
  </tr>
</table>
    </td>
  </tr>
</table>
<!--#INCLUDE FILE="inc_footer.asp"-->
<% else %>
<%	Response.Redirect "admin_login.asp" %>
<% end iF %>