Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 put cag/group codes together as a new include
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

bjlt
Senior Member

1144 Posts

Posted - 07 November 2002 :  03:02:43  Show Profile
It seems that only active.asp and default.asp use the group/category codes, we can put them together as a new file and only include in those two files.

maybe name it as inc_func_groupcats.asp


If strGroupCategories = "1" Then
	Dim allGroupCatData, recGroupCatCount
	Call GetForumGroup()
End If

Sub GetForumGroup()

	if strGroupCategories = "1" then
	
		Dim intShowGroup
		intShowGroup = 0

		if lcase(Right(strScriptFileName, 10)) = "active.asp" Then
			intShowGroup = 1
			strLinkTo = strLocalForumURL & "active.asp"
		elseif lcase(Right(strScriptFileName, 11)) = "default.asp" then
			intShowGroup = 1
			strLinkTo = strLocalForumURL
		'elseif lcase(Right(strScriptFileName, 26)) = "admin_config_groupcats.asp" then
		'	intShowGroup = 2 'yx: seeme no need for this.
		else
			intShowGroup = 0
		end if

		IF intShowGroup <> 0 THEN

			Dim strQryGroup, strForumGroup, Group
			Dim strSql, rs2, allGroupCatData, iGroup, recGroupCatCount
			Dim GroupID, GroupName, blnFirst
			Dim rsgroups

			strQryGroup = trim(Request.QueryString("Group"))

			if  strQryGroup = "" then

				strForumGroup = Request.Cookies(strApplicationPrefix & "GROUP")
				if strForumGroup = "" Then
					Group = 2
				else 
					Group = cLng(strForumGroup)
				end if
			else
				Group = cLng(strQryGroup)
			end if

			'set default
			Session(strApplicationPrefix & "GROUP_ICON") = strImageURL & "icon_group_categories.gif"
			Session(strApplicationPrefix & "GROUP_IMAGE") = strTitleImage
			'Forum_SQL - Group exists ?
			strSql = "SELECT GROUP_ID, GROUP_NAME, GROUP_ICON, GROUP_IMAGE " 
			strSql = strSql & " FROM " & strTablePrefix & "GROUP_NAMES "
			strSql = strSql & " WHERE GROUP_ID = " & Group
			set rs2 = my_Conn.Execute (strSql)
			if rs2.EOF or rs2.BOF then
				Group = 2
				strSql = "SELECT GROUP_ID, GROUP_NAME, GROUP_ICON, GROUP_IMAGE " 
				strSql = strSql & " FROM " & strTablePrefix & "GROUP_NAMES "
				strSql = strSql & " WHERE GROUP_ID = " & Group
				set rs2 = my_Conn.Execute (strSql)
			end if	
			Session(strApplicationPrefix & "GROUP_NAME") = rs2("GROUP_NAME")
			if instr(rs2("GROUP_ICON"), ".") then
				Session(strApplicationPrefix & "GROUP_ICON") = rs2("GROUP_ICON")
			end if
			if instr(rs2("GROUP_IMAGE"), ".") then
				Session(strApplicationPrefix & "GROUP_IMAGE") = rs2("GROUP_IMAGE")
			end if
			rs2.Close  
			set rs2 = nothing  
			Response.Cookies(strApplicationPrefix & "GROUP") = Group
			Response.Cookies(strApplicationPrefix & "GROUP").Expires =  dateAdd("d", intCookieDuration, strForumTimeAdjust)
			if Session(strApplicationPrefix & "GROUP_IMAGE") <> "" then
				strTitleImage = Session(strApplicationPrefix & "GROUP_IMAGE") 
			end if 
'end if

'yx: begin inc_groupjump_to.asp
'if strGroupCategories = "1" then

			Response.Write	"    <script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
			"    <!----- " & vbNewLine & _
			"    function jumpTo(s) {if (s.selectedIndex != 0) location.href = s.options[s.selectedIndex].value;return 1;}" & vbNewLine & _
			vbNewLine & _
			"    // -->" & vbNewLine & _
			"    </script>" & vbNewLine
			
	'if StrOK="OK" then
			Response.Write	"  <form name=""GroupStuff"">" & vbNewLine & _
				"  <table align=""center"" width=""100%"">" & vbNewLine & _
				"	<tr>" & vbNewLine & _
				"    <td valign=""top"" align=""left""><b>Change Category Group<br /></b>" & vbNewLine & _
				"    <select name=""SelectMenu"" size=""0"" onchange=""if(this.options[this.selectedIndex].value != '' ){ jumpTo(this) }"">" & vbNewLine & _
				"    	<option value="""">Select Other Categories Here!</option>" & vbNewLine

			'## Get all Forum Groups From DB
			strSql = "SELECT GROUP_ID, GROUP_NAME"
			strSql = strSql & " FROM " & strTablePrefix & "GROUP_NAMES"
			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
				recGroupCatCount = ""
	 		else
	 			allGroupCatData = rsgroups.GetRows(adGetRowsRest)
	 			recGroupCatCount = UBound(allGroupCatData, 2)
	 		end if
	 	
	 		rsgroups.Close
	 		set rsgroups = nothing 

			if recGroupCatCount <> "" then 
				const gGROUP_ID = 0
				const gGROUP_NAME = 1

				for iGroup = 0 to recGroupCatCount
					GroupID = allGroupCatData(gGROUP_ID,iGroup)
					GroupName = allGroupCatData(gGROUP_NAME,iGroup)

					if GroupID = 1 or GroupID = 2 then
						Response.Write "    	<option value=""" & strLinkTo & "?Group=" & GroupID & """" & chkSelect(cLng(Group), cLng(GroupID)) & ">" & GroupName & "</option>" & vbNewLine
					end if
				next
				blnFirst = 0
				for iGroup = 0 to recGroupCatCount
					GroupID = allGroupCatData(gGROUP_ID,iGroup)
					GroupName = allGroupCatData(gGROUP_NAME,iGroup)

					if GroupID = 1 OR GroupID = 2 then
						' do nothing
					else
						if blnFirst = 0 then
							Response.Write	"       <option value="""">----------------------------</option>" & vbNewLine
							blnFirst = 1
						end if
						Response.Write "    	<option value=""" & strLinkTo & "?Group=" & GroupID & """" & chkSelect(cLng(Group), cLng(GroupID)) & ">" & GroupName & "</option>" & vbNewLine
					end if
				next
			end if
			Response.Write	"    </select>" & vbNewLine & _
				"    <a href=""default_group.asp""><acronym title=""Group Categories links and Information"">Group Category Menu</acronym></a></td>" & vbNewLine & _
				"  </tr>" & vbNewLine & _
				"  </form>" & vbNewLine & _
				"  <tr>" & vbNewLine & _
				"    <td><span style=""font-size: 6px;""><br /></span></td>" & vbNewLine & _
				"  </tr></table>" & vbNewLine
	'end if
'end if
'end inc_groupjump_to.asp


'if strGroupCategories = "1" then
			if Session(strApplicationPrefix & "GROUP_NAME") = "" then
				GROUPNAME = " Default Groups "
			else
				GROUPNAME = Session(strApplicationPrefix & "GROUP_NAME")
			end if
			'Forum_SQL - Get Groups
			strSql = "SELECT GROUP_ID, GROUP_CATID " 
			strSql = strSql & " FROM " & strTablePrefix & "GROUPS "
			strSql = strSql & " WHERE GROUP_ID = " & Group
			set rsgroups = Server.CreateObject("ADODB.Recordset")
			rsgroups.Open strSql, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
			if rsgroups.EOF then
				recGroupCatCount = ""
			else
				allGroupCatData = rsgroups.GetRows(adGetRowsRest)
				recGroupCatCount = UBound(allGroupCatData, 2)
			end if
			rsgroups.Close
			set rsgroups = nothing


		END IF 'intShowGroup <> 0

	end if
End Sub

Edited by - bjlt on 07 November 2002 03:04:17

bjlt
Senior Member

1144 Posts

Posted - 07 November 2002 :  03:06:18  Show Profile
and there's no need for inc_groupjump_to.asp then.

Edited by - bjlt on 07 November 2002 03:07:04
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07