% '------------------------------- ' 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 & "