<% ' UltraApps Portal - FREE edition, Version 1.5 ' (C) Copyright 2001 by UltraApps ' This program may be used and modified for your own use ' so long as this copyright notice and this comment remain intact. ' You are not permitted to sell or distribute modified version of this software ' View files/license.html for full Legal Information ' ' Filename:Forums.asp ' Generated with CodeCharge 2.0.1 '------------------------------- ' Forums CustomIncludes begin %> <% ' Forums CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "Forums.asp" sTemplateFileName = "Forums.html" '=============================== '=============================== ' Forums PageSecurity begin ' Forums PageSecurity end '=============================== '=============================== ' Forums Open Event begin ' Forums Open Event end '=============================== '=============================== ' Forums OpenAnyPage Event begin ' Forums OpenAnyPage Event end '=============================== '=============================== 'Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' Forums Show begin '=============================== ' Display page '------------------------------- ' Load HTML template for this page '------------------------------- LoadTemplate sAppPath & sTemplateFileName, "main" '------------------------------- ' Load HTML template of Header and Footer '------------------------------- LoadTemplate sHeaderFileName, "Header" LoadTemplate sFooterFileName, "Footer" '------------------------------- SetVar "FileName", sFileName '------------------------------- ' Step through each form '------------------------------- Header_Show Footer_Show Search_Show Forums_Show '------------------------------- ' Process page templates '------------------------------- Parse "Header", False Parse "Footer", False Parse "main", False '------------------------------- ' Output the page to the browser '------------------------------- Response.write PrintVar("main") ' Forums Show end '------------------------------- ' Destroy all object variables '------------------------------- ' Forums Close Event begin ' Forums Close Event end cn.Close Set cn = Nothing UnloadTemplate '=============================== '=============================== ' Display Grid Form '------------------------------- Sub Forums_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "" Dim HasParam : HasParam = false Dim iRecordsPerPage : iRecordsPerPage = 15 Dim iCounter : iCounter = 0 SetVar "TransitParams", "" SetVar "FormParams", "" '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select [f].[forum_description] as f_forum_description, " & _ "[f].[forum_id] as f_forum_id, " & _ "[f].[forum_name] as f_forum_name, " & _ "[f].[member_id_moderator] as f_member_id_moderator, " & _ "[m].[member_id] as m_member_id, " & _ "[m].[member_login] as m_member_login " & _ " from ([forums] f left join [members] m on [m].[member_id]=f.[member_id_moderator]) " '------------------------------- '------------------------------- ' Forums Open Event begin ' Forums Open Event end '------------------------------- '------------------------------- ' Assemble full SQL statement '------------------------------- sSQL = sSQL & sWhere & sOrder '------------------------------- SetVar "FormTitle", sFormTitle '------------------------------- ' Open the recordset '------------------------------- openrs rs, sSQL '------------------------------- '------------------------------- ' Process empty recordset '------------------------------- if rs.eof then set rs = nothing SetVar "DListForums", "" Parse "ForumsNoRecords", False Parse "FormForums", False exit sub end if '------------------------------- '------------------------------- ' Initialize page counter and records per page '------------------------------- iRecordsPerPage = 15 iCounter = 0 '------------------------------- '------------------------------- ' Display grid based on recordset '------------------------------- while not rs.EOF and iCounter < iRecordsPerPage '------------------------------- ' Create field variables based on database fields '------------------------------- fldforum_description = GetValue(rs, "f_forum_description") fldforum_id = GetValue(rs, "f_forum_id") fldforum_name_URLLink = "Discussions.asp" fldforum_name_forum_id = GetValue(rs, "f_forum_id") fldforum_name = GetValue(rs, "f_forum_name") fldmember_id_moderator = GetValue(rs, "m_member_login") '------------------------------- ' Forums Show begin '------------------------------- '------------------------------- ' Forums Show Event begin fldnthreads = DLookup("messages","count(*)","forum_id=" & fldforum_id & " AND (message_parent_id=0 OR message_parent_id IS NULL)") fldlastmsg = DLookup("messages","max(message_date_entered)","forum_id=" & fldforum_id) ' Forums Show Event end '------------------------------- '------------------------------- ' Replace Template fields with database values '------------------------------- SetVar "forum_id", ToHTML(fldforum_id) SetVar "forum_name", ToHTML(fldforum_name) SetVar "forum_name_URLLink", fldforum_name_URLLink SetVar "Prmforum_name_forum_id", ToURL(fldforum_name_forum_id) SetVar "forum_description", ToHTML(fldforum_description) SetVar "member_id_moderator", ToHTML(fldmember_id_moderator) SetVar "nthreads", ToHTML(fldnthreads) SetVar "lastmsg", ToHTML(fldlastmsg) Parse "DListForums", True '------------------------------- ' Forums Show end '------------------------------- '------------------------------- ' Move to the next record and increase record counter '------------------------------- rs.MoveNext iCounter = iCounter + 1 wend '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing SetVar "ForumsNoRecords", "" Parse "FormForums", False '------------------------------- ' Forums Close Event begin ' Forums Close Event end '------------------------------- End Sub '=============================== '=============================== ' Display Search Form '------------------------------- Sub Search_Show() Dim sFormTitle: sFormTitle = "Discussions" Dim sActionFileName: sActionFileName = "Discussions.asp" '------------------------------- ' Search Open Event begin ' Search Open Event end '------------------------------- SetVar "FormTitle", sFormTitle SetVar "ActionPage", sActionFileName '------------------------------- ' Set variables with search parameters '------------------------------- flds_text = GetParam("s_text") '------------------------------- ' Search Show begin '------------------------------- '------------------------------- ' Search Show Event begin ' Search Show Event end '------------------------------- SetVar "s_text", ToHTML(flds_text) '------------------------------- ' Search Show end '------------------------------- '------------------------------- ' Search Close Event begin ' Search Close Event end '------------------------------- Parse "FormSearch", False End Sub '=============================== %>