%
dim alphaLetters(26)
alphaLetters(0) = "A"
alphaLetters(1) = "B"
alphaLetters(2) = "C"
alphaLetters(3) = "D"
alphaLetters(4) = "E"
alphaLetters(5) = "F"
alphaLetters(6) = "G"
alphaLetters(7) = "H"
alphaLetters(8) = "I"
alphaLetters(9) = "J"
alphaLetters(10) = "K"
alphaLetters(11) = "L"
alphaLetters(12) = "M"
alphaLetters(13) = "N"
alphaLetters(14) = "O"
alphaLetters(15) = "P"
alphaLetters(16) = "Q"
alphaLetters(17) = "R"
alphaLetters(18) = "S"
alphaLetters(19) = "T"
alphaLetters(20) = "U"
alphaLetters(21) = "V"
alphaLetters(22) = "W"
alphaLetters(23) = "X"
alphaLetters(24) = "Y"
alphaLetters(25) = "Z"
function writeCatSelect(parent_id,depth,selectedCat,dataFormat)
catSQL = ""&_
"SELECT c.*, "&_
"(SELECT count(cc.cat_id) FROM epcms_categories cc WHERE cc.cat_parentid = c.cat_id) as cat_children "&_
"FROM epcms_categories c "&_
"WHERE c.cat_parentid = " & parent_id & " ORDER BY c.cat_name"
Set rs = LoadRSFromDB(catSQL)
if not rs.EOF then
loopCount = 1
Do While not rs.EOF
thisCatID = rs("cat_id")
thisCatName = rs("cat_name")
if dataFormat = "All" then
response.write("" & VbCrLf)
call writeCatSelect(thisCatID, depth + 1, selectedCat, dataFormat)
rs.movenext
Loop
else
end if
end function
sub padThisDropDown(IA_Depth)
Dim j
j=0
Do Until j=IA_Depth
response.write(" ")
j=j+1
Loop
end sub
function sortSearchString(inputStr)
Dim strSearch
Dim strSearchArray
Dim displayStrSearch
Dim returnValue
Dim i
Dim j
Dim k
Dim ignoreWords
Dim ignoreWordsArray
Dim shouldIgnore
'-- Remove any quote marks
strSearch = replace(inputStr,"""","")
strSearch = replace(strSearch,"'","")
strSearch = trim(SQLSafe(strSearch))
strSearchArray = Split(strSearch," ")
ignoreWords = "a,an,and,i,the,of,it,if,but,because"
ignoreWordsArray = Split(ignoreWords,",")
shouldIgnore = false
if len(strSearch)<1 or strSearch = "Enter search term here" then
returnValue = "Please enter a valid search term"
else
returnValue = ""
k = 1
for i = 0 to ubound(strSearchArray)
for j = 0 to ubound(ignoreWordsArray)
if lcase(strSearchArray(i)) = ignoreWordsArray(j) then
shouldIgnore = true
end if
next
if shouldIgnore = false then
if k = 1 then
if i = 0 then
returnValue = returnValue & strSearchArray(i)
else
returnValue = returnValue & " " & strSearchArray(i)
end if
else
if i = 0 then
returnValue = returnValue & strSearchArray(i)
else
returnValue = returnValue & " " & strSearchArray(i)
end if
end if
k = k + 1
end if
shouldIgnore = false
next
if returnValue = "" then
returnValue = "Please enter a valid search term"
end if
end if
sortSearchString = returnValue
end function
function updateLookUpTable(table_name, primary_column, secondary_column, item_id, data)
'-- First delete all the reconds in this table for this product
strSQL = "DELETE from " & table_name & " where " & primary_column & " = " & item_id
RunSQL strSQL
dim dataArray
dataArray = split(data,",")
for i = 0 to ubound(dataArray)
if len(dataArray(i)) then
strSQL = ""&_
"INSERT INTO " & table_name & "("&_
primary_column & ", " & secondary_column &_
") VALUES (" &_
"'" & item_id & "', '" & dataArray(i) & "' "&_
")"
RunSQL strSQL
end if
next
end function
function IDisInArray(c_ID,c_array)
dim tempValue
tempValue = false
if isArray(c_array) then
for n=0 to ubound(c_array)
if len(c_array(n)) then
if cint(c_array(n)) = cint(c_ID) then
tempValue = true
end if
end if
next
end if
IDisInArray = tempValue
end function
'--------------------------------------------------------------------------------------------------------------
'-- FUNCTION TO NOTIFY EDITORS THAT A NEW REVIEW HAS BEEN POSTED
'--------------------------------------------------------------------------------------------------------------
function notifyAllEditors(cmsPageID, cmsPluginID, itemID)
dim nSQL
dim nRS
dim emailToAddress
dim emailFromAddress
dim emailSubject
dim emailMessage
emailFromAddress = "admin@" & websiteDomainName
emailSubject = "New Agency details submitted"
emailMessage = "New Agency details have been submitted for approval." & VbCrLf & VbCrLf
emailMessage = emailMessage & "Please log into the CMS and then follow this link to approve them for display: " & VbCrLf & VbCrLf
emailMessage = emailMessage & websiteURL & "admin/ia.asp?page_id=" & cmsPageId & "&mode=managePlugins&editType=manage&pluginID=" & cmsPluginId & "&pluginFunc=contactAddEdit&contact_id=" & itemID & VbCrLf & VbCrLf
nSQL = "Select * from epcms_users where security_level > 2"
set nRS = LoadRSFromDB(nSQL)
if not nRS.EOF then
do while not nRS.EOF
emailToAddress = nRS("email_address")
'response.write emailFromAddress & "
"
'response.write emailToAddress & "
"
'response.write emailSubject & "
"
'response.write emailMessage & "
"
'response.write "