<% '--------------------------------------------------- ' 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("
" & VbCrLf) response.write("

View contacts

" & VbCrLf) if len(confirmMsg) then 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("
" & VbCrLf) if not cLetter = "all" and len(cLetter) then strSQL = "SELECT * from plugin_contacts WHERE contact_organisation like '" & cLetter & "%' OR contact_lastname like '" & cLetter & "%'" else strSQL = "SELECT * from plugin_contacts ORDER BY contact_organisation, contact_lastname" end if Set rs = LoadRSFromDB(strSQL) if not rs.EOF then rs.PageSize = contactsPerPageAdmin 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 paginationURL = "ia.asp?page_id=" & this_page_id & "&mode=managePlugins&editType=manage&pluginID=" & pluginID & "&cLetter=" & cLetter '-- 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 response.write("" & VbCrLf) response.write("" & VbCrLf) response.write(" " & VbCrLf) response.write(" " & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write(" " & VbCrLf) response.write(" " & VbCrLf) response.write(" " & VbCrLf) response.write(" " & VbCrLf) response.write("" & VbCrLf) for intRecord = 1 to rs.PageSize response.write("" & VbCrLf) response.write("" & VbCrLf) if rs("contact_status") = "draft" then thisIcon = "" elseif rs("contact_status") = "live" then thisIcon = "" else thisIcon = "" end if response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) if rowClass = "odd" then rowClass = "even" else rowClass = "odd" end if rs.movenext if rs.EOF then exit for next response.write("
Showing records: " & intStart & " - " & intFinish & " of " & rs.RecordCount & "" & paginationString & "
NameStatusEditDelete
" & rs("contact_organisation") & "" & thisIcon & "
" & VbCrLf) else response.write("

There are currently no contacts starting with this letter

" & VbCrLf) end if set rs = nothing response.write("
" & VbCrLf) response.write("
" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("
" & VbCrLf) response.write("
" & VbCrLf) end function function contactAddEdit() dim process dim actionLabel dim c_firstName dim c_lastName dim c_title dim c_organisation dim c_address1 dim c_address2 dim c_town dim c_county dim c_postcode dim c_country dim c_phone dim c_fax dim c_email1 dim c_email2 dim c_url dim c_desc dim c_webCategory dim c_openNodes dim c_status dim c_scope if len(contact_id) > 0 then process = "update" actionLabel = "Save" '-- ------------------------------------------------- '-- Set up the query strSQL = "SELECT * from plugin_contacts WHERE contact_id = " & contact_id '-- ------------------------------------------------- '-- Execute the query Set rs = LoadRSFromDB(strSQL) if not rs.EOF then c_firstName = rs("contact_firstName") c_lastName = rs("contact_lastName") c_title = rs("contact_title") c_organisation = rs("contact_organisation") c_address1 = rs("contact_address1") c_address2 = rs("contact_address2") c_town = rs("contact_town") c_county = rs("contact_county") c_postcode = rs("contact_postcode") c_country = rs("contact_country") c_phone = rs("contact_phone") c_fax = rs("contact_fax") c_email1 = rs("contact_email1") c_email2 = rs("contact_email2") c_url = rs("contact_url") c_desc = rs("contact_desc") c_webCategory = rs("contact_webCategory") c_openNodes = rs("contact_openNodes") c_status = rs("contact_status") c_scope = rs("contact_scope") end if set rs=nothing else process = "add" actionLabel = "Save" c_firstName = request.querystring("newcFirstName") c_lastName = request.querystring("newcLastName") c_title = request.querystring("newcTitle") c_organisation = request.querystring("newcOrg") c_address1 = request.querystring("newcAdd1") c_address2 = request.querystring("newcAdd2") c_town = request.querystring("newcTown") c_county = request.querystring("newcCounty") c_postcode = request.querystring("newcPostCode") c_country = request.querystring("newcCountry") c_phone = request.querystring("newcPhone") c_fax = request.querystring("newcFax") c_email1 = request.querystring("newcEmail1") c_email2 = request.querystring("newcEmail2") c_url = request.querystring("newcURL") c_desc = request.querystring("newcDesc") c_webCategory = request.querystring("newcCat") c_openNodes = request.querystring("newcOpenNodes") c_status = "draft" c_scope = request.querystring("newcScope") end if response.write("
" & VbCrLf) response.write("

Add / Edit contact

" & VbCrLf) if len(errorMsg) then call writeContactsErrorMessages() response.write("
" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("
 
" & VbCrLf) response.write("

 

" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("

 

" & VbCrLf) response.write("
" & VbCrLf) response.write("
" & VbCrLf) end function '--------------------------------------------------- ' FUNCTION TO ATTACH GLOSSARY TO A PAGE '--------------------------------------------------- function contactsSetup() response.write("" & VbCrLf) end function '--------------------------------------------------- ' WRITE OUT FRONTEND '--------------------------------------------------- function contactsOutput(blank,config) '-- Search contacts by theme response.write("

Search by theme

") response.write("
" & VbCrLf) if len(errorMsg) then call writeContactsErrorMessages() response.write("
" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("" & VbCrLf) response.write("
" & VbCrLf) response.write("
" & VbCrLf) response.write("

Search by letter

") 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("
" & VbCrLf) .write("

") if len(searchReport) then .write(searchReport) else .write("Showing all agency contacts") end if .write("

" & VbCrLf) .write("
" & VbCrLf) .write("

" & intStart & " - " & intFinish & " of " & rs.recordcount & "

" & VbCrLf) .write("

" & paginationString & "

" & VbCrLf) .write("
" & VbCrLf) end with dim listingClass listingClass = "Eodd" for intRecord = 1 to rs.PageSize response.write("
" & VbCrLf) response.write("

" & rs("contact_organisation") & "

" & VbCrLf) if len(rs("contact_firstName")) or len(rs("contact_lastName")) then response.write("

" & rs("contact_firstName") & " " & rs("contact_lastName") & "

" & VbCrLf) end if firstTextString = "" if len(rs("contact_address1")) then firstTextString = firstTextString & rs("contact_address1") & "
" & VbCrLf if len(rs("contact_address2")) then firstTextString = firstTextString & rs("contact_address2") & "
" & VbCrLf if len(rs("contact_town")) then firstTextString = firstTextString & rs("contact_town") & "
" & VbCrLf if len(rs("contact_county")) then firstTextString = firstTextString & rs("contact_county") & "
" & VbCrLf if len(rs("contact_postcode")) then firstTextString = firstTextString & rs("contact_postcode") & "
" & VbCrLf if len(rs("contact_country")) then firstTextString = firstTextString & rs("contact_country") & "
" & VbCrLf if len(firstTextString) then response.write("

" & VbCrLf) response.write(firstTextString) response.write("

" & VbCrLf) end if secondTextString = "" if len(rs("contact_phone")) then secondTextString = secondTextString & "Tel: " & rs("contact_phone") & "
" & VbCrLf if len(rs("contact_fax")) then secondTextString = secondTextString & "Fax: " & rs("contact_fax") & "
" & VbCrLf if len(rs("contact_email1")) then secondTextString = secondTextString & "Email: " & rs("contact_email1") & "
" & VbCrLf if len(rs("contact_email2")) then secondTextString = secondTextString & "Email2: " & rs("contact_email2") & "
" & VbCrLf if len(rs("contact_url")) then secondTextString = secondTextString & "URL: " & rs("contact_url") & "
" & VbCrLf if len(secondTextString) then response.write("

" & 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("
") if listingClass = "Eodd" then listingClass = "Eeven" else listingClass = "Eodd" end if rs.movenext if rs.EOF then exit for next with response .write("
" & VbCrLf) .write("

" & intStart & " - " & intFinish & " of " & rs.recordcount & "

" & VbCrLf) .write("

" & paginationString & "

" & VbCrLf) .write("
" & VbCrLf) end with response.write("
") else searchReport = replace(searchReport,"[VERBFORM]","are") searchReport = replace(searchReport,"[RESULTCOUNT]","no agencies") with response .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]", "
") descString = activateLinksInFlatText(descString) formatDesc = descString end function %>