<% '------------------------------- ' Default CustomIncludes begin %> <% ' Default CustomIncludes end '------------------------------- '=============================== ' Save Page and File Name available into variables '------------------------------- sFileName = "Defaul2.asp" sTemplateFileName = "Defaul2.html" '=============================== '=============================== ' Default PageSecurity begin ' Default PageSecurity end '=============================== '=============================== ' Default Open Event begin ' Default Open Event end '=============================== '=============================== ' Default OpenAnyPage Event begin ' Default OpenAnyPage Event end '=============================== '=============================== 'Save the name of the form and type of action into the variables '------------------------------- sAction = GetParam("FormAction") sForm = GetParam("FormName") '=============================== ' Default 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 Events_Show Disc_Show Links_Show Articles_Show Classifieds_Show News_Show Styles_Show '------------------------------- ' Process page templates '------------------------------- Parse "Header", False Parse "Footer", False Parse "main", False '------------------------------- ' Output the page to the browser '------------------------------- Response.write PrintVar("main") ' Default Show end '------------------------------- ' Destroy all object variables '------------------------------- ' Default Close Event begin ' Default Close Event end cn.Close Set cn = Nothing UnloadTemplate '=============================== '=============================== ' Display Grid Form '------------------------------- Sub Articles_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "" Dim HasParam : HasParam = false Dim iSort : iSort = "" Dim iSorted : iSorted = "" Dim sDirection : sDirection = "" Dim sSortParams : sSortParams = "" SetVar "TransitParams", "" SetVar "FormParams", "" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by a.article_order Asc" iSort = GetParam("FormArticles_Sorting") iSorted = GetParam("FormArticles_Sorted") sDirection = "" if IsEmpty(iSort) then SetVar "Form_Sorting", "" else if iSort = iSorted then SetVar "Form_Sorting", "" sDirection = " DESC" sSortParams = "FormArticles_Sorting=" & iSort & "&FormArticles_Sorted=" & iSort & "&" else SetVar "Form_Sorting", iSort sDirection = " ASC" sSortParams = "FormArticles_Sorting=" & iSort & "&FormArticles_Sorted=" & "&" end if if iSort = 1 then sOrder = " order by a.[article_desc]" & sDirection end if '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select [a].[article_desc] as a_article_desc, " & _ "[a].[article_id] as a_article_id, " & _ "[a].[article_title] as a_article_title " & _ " from [articles] a " '------------------------------- '------------------------------- ' Articles Open Event begin ' Articles Open Event end '------------------------------- '------------------------------- ' Assemble full SQL statement '------------------------------- sSQL = sSQL & sWhere & sOrder '------------------------------- SetVar "FormTitle", sFormTitle '------------------------------- ' Process the parameters for sorting '------------------------------- SetVar "SortParams", sSortParams '------------------------------- '------------------------------- ' Open the recordset '------------------------------- openrs rs, sSQL '------------------------------- '------------------------------- ' Process empty recordset '------------------------------- if rs.eof then set rs = nothing SetVar "DListArticles", "" Parse "ArticlesNoRecords", False Parse "FormArticles", False exit sub end if '------------------------------- '------------------------------- ' Display grid based on recordset '------------------------------- while not rs.EOF '------------------------------- ' Create field variables based on database fields '------------------------------- fldarticle_desc = GetValue(rs, "a_article_desc") fldarticle_id = GetValue(rs, "a_article_id") fldarticle_title = GetValue(rs, "a_article_title") '------------------------------- ' Articles Show begin '------------------------------- '------------------------------- ' Articles Show Event begin ' Articles Show Event end '------------------------------- '------------------------------- ' Replace Template fields with database values '------------------------------- SetVar "article_id", ToHTML(fldarticle_id) SetVar "article_title", ToHTML(fldarticle_title) SetVar "article_desc", fldarticle_desc '------------------------------- ' Process the record separator '------------------------------- if rs.EOF then SetVar "ArticlesRecordSeparator", "" else Parse "ArticlesRecordSeparator", false end if '------------------------------- Parse "DListArticles", True '------------------------------- ' Articles Show end '------------------------------- '------------------------------- ' Move to the next record '------------------------------- rs.MoveNext wend '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing SetVar "ArticlesNoRecords", "" Parse "FormArticles", False '------------------------------- ' Articles Close Event begin ' Articles Close Event end '------------------------------- End Sub '=============================== '=============================== ' Display Search Form '------------------------------- Sub Search_Show() Dim sFormTitle: sFormTitle = "" Dim sActionFileName: sActionFileName = "SearchResults.asp" '------------------------------- ' Search Open Event begin ' Search Open Event end '------------------------------- SetVar "FormTitle", sFormTitle SetVar "ActionPage", sActionFileName '------------------------------- ' Set variables with search parameters '------------------------------- fldsearch_criteria = GetParam("search_criteria") '------------------------------- ' Search Show begin '------------------------------- '------------------------------- ' Search Show Event begin ' Search Show Event end '------------------------------- SetVar "search_criteria", ToHTML(fldsearch_criteria) '------------------------------- ' Search Show end '------------------------------- '------------------------------- ' Search Close Event begin ' Search Close Event end '------------------------------- Parse "FormSearch", False End Sub '=============================== '=============================== ' Display Grid Form '------------------------------- Sub Links_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "" Dim HasParam : HasParam = false Dim iSort : iSort = "" Dim iSorted : iSorted = "" Dim sDirection : sDirection = "" Dim sSortParams : sSortParams = "" Dim iRecordsPerPage : iRecordsPerPage = 10 Dim iCounter : iCounter = 0 SetVar "TransitParams", "" SetVar "FormParams", "" sWhere = " WHERE link_is_approved=1" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by l.link_date_added Desc" iSort = GetParam("FormLinks_Sorting") iSorted = GetParam("FormLinks_Sorted") sDirection = "" if IsEmpty(iSort) then SetVar "Form_Sorting", "" else if iSort = iSorted then SetVar "Form_Sorting", "" sDirection = " DESC" sSortParams = "FormLinks_Sorting=" & iSort & "&FormLinks_Sorted=" & iSort & "&" else SetVar "Form_Sorting", iSort sDirection = " ASC" sSortParams = "FormLinks_Sorting=" & iSort & "&FormLinks_Sorted=" & "&" end if if iSort = 1 then sOrder = " order by l.[link_name]" & sDirection end if '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select [l].[link_name] as l_link_name, " & _ "[l].[link_url] as l_link_url " & _ " from [links] l " '------------------------------- '------------------------------- ' Links Open Event begin ' Links Open Event end '------------------------------- '------------------------------- ' Assemble full SQL statement '------------------------------- sSQL = sSQL & sWhere & sOrder '------------------------------- SetVar "FormTitle", sFormTitle '------------------------------- ' Process the parameters for sorting '------------------------------- SetVar "SortParams", sSortParams '------------------------------- '------------------------------- ' Open the recordset '------------------------------- openrs rs, sSQL '------------------------------- '------------------------------- ' Process empty recordset '------------------------------- if rs.eof then set rs = nothing SetVar "DListLinks", "" Parse "LinksNoRecords", False Parse "FormLinks", False exit sub end if '------------------------------- '------------------------------- ' Initialize page counter and records per page '------------------------------- iRecordsPerPage = 10 iCounter = 0 '------------------------------- '------------------------------- ' Display grid based on recordset '------------------------------- while not rs.EOF and iCounter < iRecordsPerPage '------------------------------- ' Create field variables based on database fields '------------------------------- fldlink_name_URLLink = GetValue(rs, "l_link_url") fldlink_name = GetValue(rs, "l_link_name") '------------------------------- ' Links Show begin '------------------------------- '------------------------------- ' Links Show Event begin ' Links Show Event end '------------------------------- '------------------------------- ' Replace Template fields with database values '------------------------------- SetVar "link_name", ToHTML(fldlink_name) SetVar "link_name_URLLink", fldlink_name_URLLink Parse "DListLinks", True '------------------------------- ' Links Show end '------------------------------- '------------------------------- ' Move to the next record and increase record counter '------------------------------- rs.MoveNext iCounter = iCounter + 1 wend '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing SetVar "LinksNoRecords", "" Parse "FormLinks", False '------------------------------- ' Links Close Event begin ' Links Close Event end '------------------------------- End Sub '=============================== '=============================== ' Display Grid Form '------------------------------- Sub Events_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "" Dim HasParam : HasParam = false Dim iRecordsPerPage : iRecordsPerPage = 5 Dim iCounter : iCounter = 0 SetVar "TransitParams", "" SetVar "FormParams", "" sWhere = " WHERE event_is_approved=1 and event_date_start>=now()" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by e.event_date_start Asc" '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select [e].[event_date_start] as e_event_date_start, " & _ "[e].[event_id] as e_event_id, " & _ "[e].[event_name] as e_event_name " & _ " from [events] e " '------------------------------- '------------------------------- ' Events Open Event begin ' Events 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 "DListEvents", "" Parse "EventsNoRecords", False Parse "FormEvents", 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 '------------------------------- fldevent_date_start = GetValue(rs, "e_event_date_start") fldevent_name_URLLink = "EventView.asp" fldevent_name_event_id = GetValue(rs, "e_event_id") fldevent_name = GetValue(rs, "e_event_name") '------------------------------- ' Events Show begin '------------------------------- '------------------------------- ' Events Show Event begin fldevent_date_start = "" & fldevent_date_start & "" 'fldevent_name = fldevent_name & "
" ' Events Show Event end '------------------------------- '------------------------------- ' Replace Template fields with database values '------------------------------- SetVar "event_date_start", fldevent_date_start SetVar "event_name", fldevent_name SetVar "event_name_URLLink", fldevent_name_URLLink SetVar "Prmevent_name_event_id", ToURL(fldevent_name_event_id) Parse "DListEvents", True '------------------------------- ' Events Show end '------------------------------- '------------------------------- ' Move to the next record and increase record counter '------------------------------- rs.MoveNext iCounter = iCounter + 1 wend '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing SetVar "EventsNoRecords", "" Parse "FormEvents", False '------------------------------- ' Events Close Event begin ' Events Close Event end '------------------------------- End Sub '=============================== '=============================== ' Display Grid Form '------------------------------- Sub News_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "" Dim HasParam : HasParam = false SetVar "TransitParams", "" SetVar "FormParams", "" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by n.news_id Desc" '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select [n].[news_html] as n_news_html " & _ " from [news] n " '------------------------------- '------------------------------- ' News Open Event begin ' News Open Event end '------------------------------- '------------------------------- ' Assemble full SQL statement '------------------------------- sSQL = sSQL & sWhere & sOrder '------------------------------- SetVar "FormTitle", sFormTitle '------------------------------- ' Open the recordset '------------------------------- openStaticRS rs, sSQL '------------------------------- '------------------------------- ' Process empty recordset '------------------------------- if rs.eof then set rs = nothing SetVar "DListNews", "" Parse "NewsNoRecords", False Parse "FormNews", False exit sub end if '------------------------------- '------------------------------- ' Display grid based on recordset '------------------------------- while not rs.EOF '------------------------------- ' Create field variables based on database fields '------------------------------- fldnews_html = GetValue(rs, "n_news_html") '------------------------------- ' News Show begin '------------------------------- '------------------------------- ' News Show Event begin ' News Show Event end '------------------------------- '------------------------------- ' Replace Template fields with database values '------------------------------- SetVar "news_html", fldnews_html '------------------------------- ' Process the record separator '------------------------------- if rs.EOF then SetVar "NewsRecordSeparator", "" else Parse "NewsRecordSeparator", false end if '------------------------------- Parse "DListNews", True '------------------------------- ' News Show end '------------------------------- '------------------------------- ' Move to the next record '------------------------------- rs.MoveNext wend '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing SetVar "NewsNoRecords", "" Parse "FormNews", False '------------------------------- ' News Close Event begin ParsedBlocks("FormNews")=replace(ParsedBlocks("FormNews"),"{","{") ParsedBlocks("FormNews")=replace(ParsedBlocks("FormNews"),"}","}") ' News Close Event end '------------------------------- End Sub '=============================== '=============================== ' Display Grid Form '------------------------------- Sub Classifieds_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "" Dim HasParam : HasParam = false Dim iRecordsPerPage : iRecordsPerPage = 10 Dim iCounter : iCounter = 0 SetVar "TransitParams", "" SetVar "FormParams", "" sWhere = " AND ad_active=1 and ad_date_expires > now()" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by a.ad_date_posted Desc" '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select [a].[ad_category_id] as a_ad_category_id, " & _ "[a].[ad_id] as a_ad_id, " & _ "[a].[ad_title] as a_ad_title, " & _ "[a1].[ad_category_id] as a1_ad_category_id, " & _ "[a1].[ad_category] as a1_ad_category " & _ " from [ads] a, [ad_categories] a1" & _ " where [a1].[ad_category_id]=a.[ad_category_id] " '------------------------------- '------------------------------- ' Classifieds Open Event begin ' Classifieds 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 "DListClassifieds", "" Parse "ClassifiedsNoRecords", False Parse "FormClassifieds", False exit sub end if '------------------------------- '------------------------------- ' Initialize page counter and records per page '------------------------------- iRecordsPerPage = 10 iCounter = 0 '------------------------------- '------------------------------- ' Display grid based on recordset '------------------------------- while not rs.EOF and iCounter < iRecordsPerPage '------------------------------- ' Create field variables based on database fields '------------------------------- fldad_category_id = GetValue(rs, "a1_ad_category") fldad_title_URLLink = "AdView.asp" fldad_title_ad_id = GetValue(rs, "a_ad_id") fldad_title = GetValue(rs, "a_ad_title") '------------------------------- ' Classifieds Show begin '------------------------------- '------------------------------- ' Classifieds Show Event begin fldad_category_id = "" & fldad_category_id & "" ' Classifieds Show Event end '------------------------------- '------------------------------- ' Replace Template fields with database values '------------------------------- SetVar "ad_category_id", fldad_category_id SetVar "ad_title", fldad_title SetVar "ad_title_URLLink", fldad_title_URLLink SetVar "Prmad_title_ad_id", ToURL(fldad_title_ad_id) Parse "DListClassifieds", True '------------------------------- ' Classifieds Show end '------------------------------- '------------------------------- ' Move to the next record and increase record counter '------------------------------- rs.MoveNext iCounter = iCounter + 1 wend '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing SetVar "ClassifiedsNoRecords", "" Parse "FormClassifieds", False '------------------------------- ' Classifieds Close Event begin ' Classifieds Close Event end '------------------------------- End Sub '=============================== '=============================== ' Display Grid Form '------------------------------- Sub Disc_Show() '------------------------------- ' Initialize variables '------------------------------- Dim rs Dim sWhere : sWhere = "" Dim sOrder : sOrder = "" Dim sSQL : sSQL = "" Dim sFormTitle: sFormTitle = "" Dim HasParam : HasParam = false Dim iRecordsPerPage : iRecordsPerPage = 10 Dim iCounter : iCounter = 0 SetVar "TransitParams", "" SetVar "FormParams", "" sWhere = " WHERE message_parent_id is null or message_parent_id=0" '------------------------------- ' Build ORDER BY statement '------------------------------- sOrder = " order by m.message_last_reply_date Desc" '------------------------------- ' Build base SQL statement '------------------------------- sSQL = "select [m].[forum_id] as m_forum_id, " & _ "[m].[message_author] as m_message_author, " & _ "[m].[message_child_count] as m_message_child_count, " & _ "[m].[message_id] as m_message_id, " & _ "[m].[message_last_reply_date] as m_message_last_reply_date, " & _ "[m].[message_topic] as m_message_topic " & _ " from [messages] m " '------------------------------- '------------------------------- ' Disc Open Event begin ' Disc 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 "DListDisc", "" Parse "DiscNoRecords", False Parse "FormDisc", False exit sub end if '------------------------------- '------------------------------- ' Initialize page counter and records per page '------------------------------- iRecordsPerPage = 10 iCounter = 0 '------------------------------- '------------------------------- ' Display grid based on recordset '------------------------------- while not rs.EOF and iCounter < iRecordsPerPage '------------------------------- ' Create field variables based on database fields '------------------------------- fldmauthor = GetValue(rs, "m_message_author") fldmcount = GetValue(rs, "m_message_child_count") fldmid = GetValue(rs, "m_message_id") fldmdate = GetValue(rs, "m_message_last_reply_date") fldmtopic_URLLink = "DiscView.asp" fldmtopic_mid = GetValue(rs, "m_message_id") fldmtopic_forum_id = GetValue(rs, "m_forum_id") fldmtopic = GetValue(rs, "m_message_topic") '------------------------------- ' Disc Show begin '------------------------------- '------------------------------- ' Disc Show Event begin if fldmcount > 0 then fldField1 = "" else fldField1="" ' Disc Show Event end '------------------------------- '------------------------------- ' Replace Template fields with database values '------------------------------- SetVar "Field1", fldField1 SetVar "mid", ToHTML(fldmid) SetVar "mtopic", ToHTML(fldmtopic) SetVar "mtopic_URLLink", fldmtopic_URLLink SetVar "Prmmtopic_mid", ToURL(fldmtopic_mid) SetVar "Prmmtopic_forum_id", ToURL(fldmtopic_forum_id) SetVar "mauthor", ToHTML(fldmauthor) SetVar "mdate", ToHTML(fldmdate) SetVar "mcount", ToHTML(fldmcount) Parse "DListDisc", True '------------------------------- ' Disc Show end '------------------------------- '------------------------------- ' Move to the next record and increase record counter '------------------------------- rs.MoveNext iCounter = iCounter + 1 wend '------------------------------- '------------------------------- ' Finish form processing '------------------------------- set rs = nothing SetVar "DiscNoRecords", "" Parse "FormDisc", False '------------------------------- ' Disc Close Event begin ' Disc Close Event end '------------------------------- End Sub '=============================== '=============================== ' Display Menu Form '------------------------------- Sub Styles_Show() Dim sFormTitle: sFormTitle = "" '------------------------------- ' Styles Open Event begin ' Styles Open Event end '------------------------------- '------------------------------- ' Set URLs '------------------------------- '------------------------------- ' Styles Show begin '------------------------------- SetVar "FormTitle", sFormTitle '------------------------------- ' Styles BeforeShow Event begin ' Styles BeforeShow Event end '------------------------------- '------------------------------- ' Show fields '------------------------------- Parse "FormStyles", False '------------------------------- ' Styles Show end '------------------------------- End Sub '=============================== %>