% '--------------------------------------------------- ' FEATURE BOX QS VARIABLES '--------------------------------------------------- dim contact_id dim cSearch dim cSearchRegion dim cSearchTheme dim cType dim cSearchCatID dim cLetter dim cSearchForms dim contactsPerPageAdmin dim contactsPerPageWebsite cLetter = request("cLetter") contact_id = request("contact_id") cSearch = request("cSearch") cSearchRegion = request("cSearchRegion") cSearchTheme = request("cSearchTheme") cType = request("cType") cSearchCatID = 0 cSearchForms = request("cSearchForms") contactsPerPageAdmin = 15 contactsPerPageWebsite = 12 if len(cLetter)<1 or isNull(cLetter) then cLetter = "all" '--------------------------------------------------- ' WRITE OUT ALL FEATURE BOXES '--------------------------------------------------- function contactsManage() rowClass = "odd" response.write("
" & confirmMsg & "
") end if response.write("") if cLetter = "all" then response.write("All") else response.write("All") end if for t=0 to 25 response.write("" & alphaLetters(t) & "") next response.write("
") response.write("There are currently no contacts starting with this letter
" & VbCrLf) end if set rs = nothing response.write("") if cLetter = "all" and not cType="theme" then response.write("All") else response.write("All") end if for t=0 to 25 response.write("" & alphaLetters(t) & "") next response.write("
") if len(cSearch) then if cType = "letter" then if not cLetter = "all" then strSQL = "SELECT * from plugin_contacts WHERE (contact_organisation like '" & cLetter & "%' OR contact_lastname like '" & cLetter & "%') AND contact_status = 'live'" searchReport = "There [VERBFORM] [RESULTCOUNT] starting with '" & cLetter & "'" paginationURL = request.servervariables("URL") & "?cSearch=yes&cType=letter&cLetter=" & cLetter else strSQL = "SELECT * from plugin_contacts WHERE contact_status = 'live' ORDER BY contact_organisation, contact_lastname" paginationURL = request.servervariables("URL") & "?cSearch=yes" end if elseif cType="theme" then cSearchThemeParts = split(cSearchTheme,"||") cSearchCatID = cSearchThemeParts(0) strSQL = ""&_ "SELECT c.* FROM plugin_contacts c "&_ "INNER JOIN plugin_contacts_category_lu cc ON cc.contact_id = c.contact_id "&_ "WHERE cc.c_id = " & cSearchCatID & " AND c.contact_status = 'live'"&_ " ORDER BY c.contact_organisation, c.contact_lastName" searchReport = "There [VERBFORM] [RESULTCOUNT] involved in '" & cSearchThemeParts(1) & "'" paginationURL = request.servervariables("URL") & "?cSearch=yes&cType=theme&cSearchTheme=" & cSearchTheme else strSQL = "SELECT * from plugin_contacts WHERE contact_status = 'live' order by contact_organisation, contact_lastName" paginationURL = request.servervariables("URL") & "?cSearch=yes" end if else strSQL = "SELECT * from plugin_contacts WHERE contact_status = 'live' ORDER by contact_organisation, contact_lastName" paginationURL = request.servervariables("URL") & "?cSearch=yes" end if if len(strSQL) then Set rs = LoadRSFromDB(strSQL) rs.PageSize = contactsPerPageWebsite rs.CacheSize = rs.PageSize intPageCount = rs.PageCount intRecordCount = rs.RecordCount if cint(intPage) > cint(intPageCount) then intPage = intPageCount if cint(intPage) <= 0 then intPage = 1 if intRecordCount > 0 Then rs.AbsolutePage = intPage intStart = rs.AbsolutePosition if cint(intPage) = cint(intPageCount) then intFinish = intRecordCount else intFinish = intStart + (rs.PageSize - 1) end if end if '-- Concatenate the pagination string dim paginationString if cint(intPage) > 1 then paginationString = "Previous" else paginationString = "Previous" end if paginationString = paginationString & " | " if cint(intPage) < cint(intPageCount) then paginationString = paginationString & "Next" else paginationString = paginationString & "Next" end if if not rs.EOF then '-- Write out search report if len(searchReport) then if rs.recordcount > 1 then replaceStr1 = "are" replaceStr2 = "" & rs.recordcount & " agencies" else replaceStr1 = "is" replaceStr2 = "" & rs.recordcount & " agency" end if searchReport = replace(searchReport,"[VERBFORM]",replaceStr1) searchReport = replace(searchReport,"[RESULTCOUNT]",replaceStr2) end if with response .write("") if len(searchReport) then .write(searchReport) else .write("Showing all agency contacts") end if .write("
" & VbCrLf) .write("" & intStart & " - " & intFinish & " of " & rs.recordcount & "
" & VbCrLf) .write("" & paginationString & "
" & VbCrLf) .write("" & VbCrLf) response.write(firstTextString) response.write("
" & VbCrLf) end if secondTextString = "" if len(rs("contact_phone")) then secondTextString = secondTextString & "Tel: " & rs("contact_phone") & "" & VbCrLf) response.write(secondTextString) response.write("
" & VbCrLf) end if if len(rs("contact_desc")) then response.write("" & VbCrLf) response.write(formatDesc(rs("contact_desc"))) response.write("
" & VbCrLf) end if response.write("" & intStart & " - " & intFinish & " of " & rs.recordcount & "
" & VbCrLf) .write("" & paginationString & "
" & VbCrLf) .write("") if len(searchReport) then .write(searchReport) else .write("Showing all agency contacts") end if .write(" - please try searching again
" & VbCrLf) end with end if set rs = nothing end if end function '----------------------------------------------------------- '-- FUNCTION TO WRITE ERROR MESSAGES '----------------------------------------------------------- function writeContactsErrorMessages() select case errorMsg case "cNameZeroLength" response.write("You must enter a person or organisation for this agency
" & VbCrLf) case "gDescZeroLength" response.write("You must enter a description
" & VbCrLf) case "cCatsZeroLength" response.write("You must select at least one category
" & VbCrLf) case "invalidSearchTerm" response.write("Please enter a valid search term
" & VbCrLf) case "noRegion" response.write("Please select a region
" & VbCrLf) case "noTheme" response.write("Please select a theme
" & VbCrLf) end select end function function formatDesc(descString) descString = replace(descString, VbCrLf, "[BR]") descString = replace(descString, "[BR][BR]", "[BR]") descString = replace(descString, "[BR]", "