%
'#################################################################################
'## Snitz Forums 2000 v3.4.05
'#################################################################################
'## Copyright (C) 2000-05 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## 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 (at your option) 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 our support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## manderson@snitz.com
'##
'#################################################################################
%>
<%
if Session(strCookieURL & "Approval") <> "15916941253" then
scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
if Request.QueryString <> "" then
Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname)) & "?" & Request.QueryString
else
Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname))
end if
end if
Response.Write "
" & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & getCurrentIcon(strIconFolderOpen,"","") & " All Forums " & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpen,"","") & " Admin Section " & vbNewLine & _
" " & getCurrentIcon(strIconBlank,"","") & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpenTopic,"","") & " Group Categories Configuration " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" " & vbNewLine
Response.Write " " & vbNewLine
strRqMethod = Request.QueryString("method")
Select Case strRqMethod
Case "Add"
if Request.Form("Method_Type") = "Write_Configuration" then
Err_Msg = ""
txtGroupName = chkString(Request.Form("strGroupName"),"SQLString")
txtGroupDescription = chkString(Request.Form("strGroupDescription"),"message")
txtGroupIcon = chkString(Request.Form("strGroupIcon"),"SQLString")
txtGroupTitleImage = chkString(Request.Form("strGroupTitleImage"),"SQLString")
if trim(txtGroupName) = "" then
Err_Msg = Err_Msg & "You Must Enter a Name for your New Group. "
end if
if trim(txtGroupDescription) = "" then
Err_Msg = Err_Msg & "You Must Enter a Description for your New Group. "
end if
if Err_Msg = "" then
'## Forum_SQL - Do DB Update
strSql = "INSERT INTO " & strTablePrefix & "GROUP_NAMES ("
strSql = strSql & "GROUP_NAME"
strSql = strSql & ", GROUP_DESCRIPTION"
strSql = strSql & ", GROUP_ICON"
strSql = strSql & ", GROUP_IMAGE"
strSql = strSql & ") VALUES ("
strSql = strSql & "'" & txtGroupName & "'"
strSql = strSql & ", '" & txtGroupDescription & "'"
strSql = strSql & ", '" & txtGroupIcon & "'"
strSql = strSql & ", '" & txtGroupTitleImage & "'"
strSql = strSql & ")"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
set rsCount = my_Conn.execute("SELECT MAX(GROUP_ID) AS maxGroupID FROM " & strTablePrefix & "GROUP_NAMES ")
newGroupCategories rsCount("maxGroupId")
set rsCount = nothing
Response.Write " New Group Added!
" & vbNewLine & _
" " & vbNewLine & _
" Congratulations!
" & vbNewLine & _
" Back To Group Categories Configuration
" & vbNewLine
else
Response.Write " There Was A Problem With Your Details
" & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" Go Back To Enter Data
" & vbNewLine
end if
else
Response.Write " " & vbNewLine & _
" Back To Group Categories Configuration
" & vbNewLine
end if
Case "Delete"
if Request.Form("Method_Type") = "Delete_Category" then
'## Forum_SQL
strSql = "DELETE FROM " & strTablePrefix & "GROUP_NAMES "
strSql = strSql & " WHERE GROUP_ID = " & cLng("0" & Request.Form("GroupID"))
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
strSql = "DELETE FROM " & strTablePrefix & "GROUPS "
strSql = strSql & " WHERE GROUP_ID = " & cLng("0" & Request.Form("GroupID"))
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
Response.Write " Category Group Deleted!
" & vbNewLine & _
" " & vbNewLine & _
" Back To Group Categories Configuration
" & vbNewLine
else
'## Forum_SQL
strSql = "SELECT GROUP_ID, GROUP_NAME "
strSql = strSql & " FROM " & strTablePrefix & "GROUP_NAMES "
strSql = strSql & " WHERE GROUP_ID <> 1 "
strSql = strSql & " AND GROUP_ID <> 2 "
strSql = strSql & " ORDER BY GROUP_NAME ASC "
Set rsgroups = Server.CreateObject("ADODB.Recordset")
rsgroups.Open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
If rsgroups.EOF then
recGroupCount = ""
Else
allGroupData = rsgroups.GetRows(adGetRowsRest)
recGroupCount = UBound(allGroupData, 2)
End if
rsgroups.Close
Set rsgroups = Nothing
Response.Write " " & vbNewLine
Response.Write " " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" " & vbNewLine & _
" Back To Group Categories Configuration
" & vbNewLine
end if
Case "Edit"
if Request.Form("Method_Type") = "Write_Configuration" then
txtGroupName = chkString(Request.Form("strGroupName"),"SQLString")
txtGroupDescription = chkString(Request.Form("strGroupDescription"),"message")
txtGroupIcon = chkString(Request.Form("strGroupIcon"),"SQLString")
txtGroupTitleImage = chkString(Request.Form("strGroupTitleImage"),"SQLString")
if trim(txtGroupName) = "" then
Err_Msg = Err_Msg & "You Must Enter a Name for your New Group. "
end if
if trim(txtGroupDescription) = "" then
Err_Msg = Err_Msg & "You Must Enter a Description for your New Group. "
end if
if Err_Msg = "" then
'## Forum_SQL - Do DB Update
strSql = "UPDATE " & strTablePrefix & "GROUP_NAMES "
strSql = strSql & " SET GROUP_NAME = '" & txtGroupName & "'"
strSql = strSql & ", GROUP_DESCRIPTION = '" & txtGroupDescription & "'"
strSql = strSql & ", GROUP_ICON = '" & txtGroupIcon & "'"
strSql = strSql & ", GROUP_IMAGE = '" & txtGroupTitleImage & "'"
strSql = strSql & " WHERE GROUP_ID = " & cLng("0" & Request.Form("GROUP_ID"))
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
updateGroupCategories(Request.Form("GROUP_ID"))
Response.Write " Category Group Updated!
" & vbNewLine & _
" " & vbNewLine & _
" Congratulations!
" & vbNewLine & _
" Back To Group Categories Configuration
" & vbNewLine
else
Response.Write " There Was A Problem With Your Details
" & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" Go Back To Correct The Problem
" & vbNewLine
end if
elseif Request.Form("Method_Type") = "Edit_Category" then
if Request.Form("GroupID") <> "" then
'## Forum_SQL
strSql = "SELECT GROUP_ID, GROUP_NAME, GROUP_DESCRIPTION, GROUP_ICON, GROUP_IMAGE "
strSql = strSql & " FROM " & strTablePrefix & "GROUP_NAMES "
strSql = strSql & " WHERE GROUP_ID = " & cLng("0" & Request.Form("GroupID"))
set rsGroups = Server.CreateObject("ADODB.Recordset")
rsGroups.open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
if rsGroups.EOF then
recGroupCnt = ""
else
allGroupData = rsGroups.GetRows(adGetRowsRest)
recGroupCnt = UBound(allGroupData,2)
gGROUP_ID = 0
gGROUP_NAME = 1
gGROUP_DESCRIPTION = 2
gGROUP_ICON = 3
gGROUP_IMAGE = 4
end if
rsGroups.close
set rsGroups = nothing
if recGroupCnt <> "" then
txtGroupID = allGroupData(gGROUP_ID,0)
txtGroupName = allGroupData(gGROUP_NAME,0)
txtGroupDescription = allGroupData(gGROUP_DESCRIPTION,0)
txtGroupIcon = allGroupData(gGROUP_ICON,0)
txtGroupTitleImage = allGroupData(gGROUP_IMAGE,0)
Response.Write " " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" Edit Existing Category Group " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" Group Name: " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" Group Description: " & vbNewLine & _
" " & txtGroupDescription & " " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" Group Icon: " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" Group Title Image: " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" Categories: " & vbNewLine
strSql = "SELECT CAT_ID, CAT_NAME "
strSql = strSql & " FROM " & strTablePrefix & "CATEGORY "
strSql = strSql & " ORDER BY CAT_NAME ASC "
set rsCats = Server.CreateObject("ADODB.Recordset")
rsCats.open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
if rsCats.EOF then
recCatCnt = ""
else
allCatData = rsCats.GetRows(adGetRowsRest)
recCatCnt = UBound(allCatData,2)
cCAT_ID = 0
cCAT_NAME = 1
end if
rsCats.close
set rsCats = nothing
tmpStrUserList = ""
strSql = "SELECT GROUP_CATID "
strSql = strSql & " FROM " & strTablePrefix & "GROUPS "
strSql = strSql & " WHERE GROUP_ID = " & cLng("0" & Request.Form("GroupID"))
set rsGroupCats = Server.CreateObject("ADODB.Recordset")
rsGroupCats.open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
if rsGroupCats.EOF then
recGroupCatCnt = ""
else
allGroupCatData = rsGroupCats.GetRows(adGetRowsRest)
recGroupCatCnt = UBound(allGroupCatData,2)
gGROUP_CATID = 0
end if
rsGroupCats.close
set rsGroupCats = nothing
if recGroupCatCnt <> "" then
for iGroupCats = 0 to recGroupCatCnt
GroupCatID = allGroupCatData(gGROUP_CATID,iGroupCats)
if tmpStrUserList = "" then
tmpStrUserList = GroupCatID
else
tmpStrUserList = tmpStrUserList & "," & GroupCatID
end if
next
end if
SelectSize = 6
Response.Write " " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" Available " & vbNewLine & _
" " & vbNewLine
'## Pick from list
if recCatCnt <> "" then
for iCat = 0 to recCatCnt
CategoryCatID = allCatData(cCAT_ID,iCat)
CategoryCatName = allCatData(cCAT_NAME,iCat)
if not(Instr("," & tmpStrUserList & "," , "," & CategoryCatID & ",") > 0) then
Response.Write " " & ChkString(CategoryCatName,"display") & " " & vbNewline
end if
next
end if
Response.Write " " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & getCurrentIcon(strIconPrivateRemAll,"","") & " " & vbNewLine & _
" " & getCurrentIcon(strIconPrivateRemove,"","") & " " & vbNewLine & _
" " & getCurrentIcon(strIconPrivateAdd,"","") & " " & vbNewLine & _
" " & getCurrentIcon(strIconPrivateAddAll,"","") & " " & vbNewLine & _
" " & vbNewLine & _
" Selected " & vbNewLine & _
" " & vbNewLine
if recGroupCatCnt <> "" then
for iGroupCats = 0 to recGroupCatCnt
GroupCatID = allGroupCatData(gGROUP_CATID,iGroupCats)
if GroupCatID <> "" then
Response.Write " " & ChkString(getCategoryName(GroupCatID),"display") & " " & vbNewline
end if
next
end if
Response.Write " " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" " & vbNewLine & _
" Back To Group Categories Configuration
" & vbNewLine
else
Response.Write " Invalid Group ID
" & vbNewLine & _
" Back To Group Categories Configuration
" & vbNewLine
end if
else
Response.Write " Invalid Group ID
" & vbNewLine & _
" Go back to correct the problem.
" & vbNewLine
end if
else
'## Forum_SQL
strSql = "SELECT GROUP_ID, GROUP_NAME "
strSql = strSql & " FROM " & strTablePrefix & "GROUP_NAMES "
strSql = strSql & " WHERE GROUP_ID <> 1 "
strSql = strSql & " ORDER BY GROUP_NAME ASC "
Set rsgroups = Server.CreateObject("ADODB.Recordset")
rsgroups.Open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
If rsgroups.EOF then
recGroupCount = ""
Else
allGroupData = rsgroups.GetRows(adGetRowsRest)
recGroupCount = UBound(allGroupData, 2)
End if
rsgroups.Close
Set rsgroups = Nothing
Response.Write " " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" " & vbNewLine & _
" Back To Group Categories Configuration
" & vbNewLine
end if
Case Else
Response.Write " " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" Group Categories Configuration " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" " & vbNewLine & _
" " & vbNewLine & _
"
" & vbNewLine & _
" " & vbNewLine
End Select
Response.Write " " & vbNewLine
WriteFooter
Response.End
sub newGroupCategories(fGroupID)
if Request.Form("GroupCat") = "" then
exit Sub
end if
Cats = split(Request.Form("GroupCat"),",")
for count = Lbound(Cats) to Ubound(Cats)
strSql = "INSERT INTO " & strTablePrefix & "GROUPS ("
strSql = strSql & " GROUP_ID, GROUP_CATID) VALUES ( "& fGroupID & ", " & Cats(count) & ")"
my_conn.execute (strSql),,adCmdText + adExecuteNoRecords
next
end sub
sub updateGroupCategories(fGroupID)
my_Conn.execute ("DELETE FROM " & strTablePrefix & "GROUPS WHERE GROUP_ID = " & fGroupId),,adCmdText + adExecuteNoRecords
newGroupCategories(fGroupID)
end sub
Function getCategoryName(fCat_ID)
set rsCatName = my_Conn.execute("SELECT CAT_NAME FROM " & strTablePrefix & "CATEGORY WHERE CAT_ID = " & fCat_ID)
getCategoryName = rsCatName("CAT_NAME")
set rsCatName = nothing
end function
%>