%@ LANGUAGE="VBSCRIPT" %> <% PageStrings = "1212, 1456, 1400, 1401, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, 1474, 1532, 1590, 1591, 1592, 1593" %> <% '=============================================== ' Parodia Internet Recruitment Software ' ©1998-2004 Cactusoft Ltd. www.parodia.net '=============================================== ' All rights reserved. ' Use of this code is covered by the terms and ' conditions in the license agreement. No ' unauthorized duplication or distribution is ' permitted. Cactusoft's copyright notices must ' remain in the ASP sections of the code. '=============================================== '--------------------------------------------- 'GET FORM VALUES '--------------------------------------------- strKeywords = Trim(Request("strKeywords")) strSearchMode = Trim(Request("strSearchMode")) numStartRecord = NumSafe(Request.Querystring("numStartRecord"), 0, 0) blnNewSearch = (Request.Querystring("numStartRecord") = "") SP_ID = NumSafe(Request.Querystring("SP_ID"), 0, 0) R_ID = NumSafe(Request.Querystring("R_ID"), 0, 0) '--------------------------------------------- ' IS IT A NEW SEARCH? ' If numStartRecord = 0, then it's a new search. ' Run the query with all the ranking, then store ' it in a cookie. If numStartRecord > 0 then we're ' looking through subsequent pages of a search ' so just pull out the results from the cookie '--------------------------------------------- if blnNewSearch then '--------------------------------------------- 'GET THE FORM VALUES '--------------------------------------------- strLocations = CommaListSafe(Request("strLocations")) strCategories = CommaListSafe(Request("strCategories")) strRoles = CommaListSafe(Request("strRoles")) strJobStatus = CommaListSafe(Request("strJobStatus")) strSearchType = CommaListSafe(Request("strSearchType")) numSalaryRange = NumSafe(Request("numSalaryRange"), 0, 0) numCompany = NumSafe(Request.Querystring("AG_ID"), 0, 0) numPosted = NumSafe(Request("numPosted"), 0, 0) numAppPageSize = NumSafe(Request("numAppPageSize"), 0, 0) '--------------------------------------------- 'GET THE SEARCH PROFILE 'If the user has come from a search profile, 'then all the data needs to come from there '--------------------------------------------- If SP_ID > 0 then strQuery = "SELECT SP_Name, SP_Keywords FROM tblCactusSearchProfiles WHERE SP_CandidateID = " & Candidate.CAND_ID & " AND SP_ID = " & SP_ID Call ExecuteSQL(strQuery, numCursorType, objRecordSet) If not (objRecordSet.BOF and objREcordset.EOF) then SP_Name = Trim(objRecordSet("SP_Name")) SP_Keywords = Trim(objRecordSet("SP_Keywords")) strKeywords = SP_Keywords 'Get all the link records Call executeSQL("SELECT SP_REG_RegionID FROM tblCactusSearchProfilesRegionsLink WHERE SP_REG_SearchProfileID = " & SP_ID, numCursorType, objRecordSet2) strLocations = ListIDs(objRecordSet2) objRecordSet2.Close Call executeSQL("SELECT SP_CAT_CategoryID FROM tblCactusSearchProfilesCategoriesLink WHERE SP_CAT_SearchProfileID = " & SP_ID, numCursorType, objRecordSet2) strCategories = ListIDs(objRecordSet2) objRecordSet2.Close If Application(LICENSENUMBER & "roles") = "y" then Call executeSQL("SELECT SP_ROL_RoleID FROM tblCactusSearchProfilesRolesLink WHERE SP_ROL_SearchProfileID = " & SP_ID, numCursorType, objRecordSet2) strRoles = ListIDs(objRecordSet2) objRecordSet2.Close End If Call executeSQL("SELECT SP_JSTAT_JobStatusID FROM tblCactusSearchProfilesJobStatusLink WHERE SP_JSTAT_SearchProfileID = " & SP_ID, numCursorType, objRecordSet2) strJobStatus = ListIDs(objRecordSet2) objRecordSet2.Close Else SP_ID = 0 End If objRecordSet.Close '--------------------------------------------- 'GET THE RESUME 'If the user has come from a cv/resume, 'then all the data needs to come from there. '--------------------------------------------- ElseIf R_ID > 0 then strQuery = "SELECT R_Title, R_JobStatusID, R_SalarySought, R_LanguageID FROM tblCactusResumes WHERE R_CandidateID = " & Candidate.CAND_ID & " AND R_ID = " & R_ID Call ExecuteSQL(strQuery, numCursorType, objRecordSet) If not (objRecordSet.BOF and objREcordset.EOF) then R_Title = objRecordSet("R_Title") R_JobStatusID = objREcordSet("R_JobStatusID") R_SalarySought = objRecordSet("R_SalarySought") R_LanguageID = objRecordSet("R_LanguageID") 'Set search fields strKeywords = "" strJobStatus = R_JobStatusID 'Get all the link records for search fields Call executeSQL("SELECT R_REG_RegionID FROM tblCactusResumesRegionsLink WHERE R_REG_ResumeID = " & R_ID, numCursorType, objRecordSet2) strLocations = ListIDs(objRecordSet2) objRecordSet2.Close Call executeSQL("SELECT R_CAT_CategoryID FROM tblCactusResumesCategoriesLink WHERE R_CAT_ResumeID = " & R_ID, numCursorType, objRecordSet2) strCategories = ListIDs(objRecordSet2) objRecordSet2.Close If Application(LICENSENUMBER & "roles") = "y" then Call executeSQL("SELECT R_ROL_RoleID FROM tblCactusResumesRolesLink WHERE R_ROL_ResumeID = " & R_ID, numCursorType, objRecordSet2) strRoles = ListIDs(objRecordSet2) objRecordSet2.Close End If Else R_ID = 0 End If objRecordSet.Close End If '--------------------------------------------- '--------------------------------------------- 'SPLIT, TRIM AND FORM KEYWORDS ARRAY '--------------------------------------------- strTempVal = SQLSafe(SearchPhraseSafe(strKeywords, GetString("ContentText_StripKeywordsJobSearch"))) strSearchedForKeywords = SafeHTMLEncode(strTempVal) '--------------------------------------------- '--------------------------------------------- 'SAVE SETTINGS IN COOKIES '--------------------------------------------- response.cookies(strSiteURL)("strKeywords") = strKeywords response.cookies(strSiteURL)("strSearchMode") = strSearchMode response.cookies(strSiteURL)("strLocations") = strLocations response.cookies(strSiteURL)("strCategories") = strCategories response.cookies(strSiteURL)("strRoles") = strRoles response.cookies(strSiteURL)("strJobStatus") = strJobStatus response.cookies(strSiteURL)("strSearchType") = strSearchType response.cookies(strSiteURL)("numSalaryRange") = numSalaryRange response.cookies(strSiteURL)("numAppPageSize") = numAppPageSize response.cookies(strSiteURL).expires = now()+365 response.cookies(strSiteURL)("strSearchPage") = request.servervariables("http_referer") '--------------------------------------------- '--------------------------------------------- 'SELECT HOW OLD JOBS COULD BE 'Either taken from config settings, of user selected 'via powersearch.asp form. '--------------------------------------------- if numPosted = 0 then numPosted = Application(LICENSENUMBER & "maximumsearchjobage") datCutOff = DateAdd("D",-numPosted,Now()) '--------------------------------------------- 'LOCATIONS '--------------------------------------------- If strLocations <>"" then strLocationsClause = " AND (VAC_REG_RegionID IN (" & SQLSafe(strLocations) & "))" end if '--------------------------------------------- '--------------------------------------------- 'JOB STATUS '--------------------------------------------- If strJobStatus <> "" then strJobStatusClause = " AND (VAC_JobStatusID IN (" & SQLSafe(strJobStatus) & "))" end if '--------------------------------------------- '--------------------------------------------- 'CATEGORY '--------------------------------------------- If strCategories <>"" then strCategoriesClause = " AND (VAC_CAT_CategoryID IN (" & SQLSafe(strCategories) & "))" end if '--------------------------------------------- '--------------------------------------------- 'ROLE '--------------------------------------------- If Application(LICENSENUMBER & "roles") = "y" and strRoles <> "" then strRolesClause = " AND (VAC_ROL_RoleID IN (" & SQLSafe(strRoles) & "))" end if '--------------------------------------------- '--------------------------------------------- 'KEYWORD QUERY TYPE: AND/OR '--------------------------------------------- If strSearchMode = "all" then strOperator = " AND " else strOperator = " OR" '--------------------------------------------- '--------------------------------------------- 'USE ARRAY TO FORM KEYWORD CLAUSES '--------------------------------------------- If strTempVal <> "" then If strSearchMode = "phrase" then aryKeyArray = Split(strTempVal, "|||", -1) else aryKeyArray = Split(strTempVal, " ", -1) blnIsFirst = True For Each strKeyword in aryKeyArray if not blnIsFirst then strWhereClause = strWhereClause & strOperator strWhereClause = strWhereClause & " ((VAC_Description LIKE '%" & SQLSafe(strKeyword) & "%') OR (VAC_Title LIKE '%" & SQLSafe(strKeyword) & "%') OR (VAC_DescriptionShort LIKE '%" & SQLSafe(strKeyword) & "%') OR (VAC_Location LIKE '%" & SQLSafe(strKeyword) & "%') OR (VAC_Keywords LIKE '%" & SQLSafe(strKeyword) & "%'))" blnIsFirst = False Next strWhereClause = "(" & Trim(strWhereClause) & ") " else strWhereClause="1=1 " 'Beginning clause so that ORs can go after it end if '--------------------------------------------- '--------------------------------------------- 'SALARY RANGE CLAUSE FOR VACANCIES '--------------------------------------------- If numSalaryRange = 0 then strSalaryClause = "" else strQuery2 = "SELECT SAL_AmountLow, SAL_AmountHigh FROM tblCactusSalaryRanges WHERE SAL_ID=" & numSalaryRange Call ExecuteSQL(strQuery2,numCursorType,objRecordSet2) numSalaryLow = objRecordSet2("SAL_AmountLow") numSalaryHigh = objRecordSet2("SAL_AmountHigh") objRecordSet2.Close strSalaryClause = " AND ((VAC_SalaryMin >= " & numSalaryLow & " AND VAC_SalaryMax <= " & numSalaryHigh & ") OR (VAC_SalaryMin=0 AND VAC_SalaryMax=0)) " end if '--------------------------------------------- '--------------------------------------------- 'FORMAT THE AGENCY QUERIES '--------------------------------------------- if numCompany > 0 then strCompanyClause = "AND ((VAC_AgencyID = " & numCompany & ") AND NOT (VAC_BlindPost = 'y')) " else strCompanyClause = "" end if '--------------------------------------------- '--------------------------------------------- 'IF CONFIG IS SET TO EXPIRE ACCOUNTS, HIDE THOSE SLOTS '--------------------------------------------- if Application(LICENSENUMBER & "ExpireAgencies")="y" then strExpiryClause = "AND (AG_Expiry >= " & strDateDelimiter & ReverseFormatYear(now()) & strDateDelimiter & ") " else strExpiryClause = "" end if '--------------------------------------------- '--------------------------------------------- 'BASE CLAUSE 'Checks it's live and is new enough, and it's 'in the right language '--------------------------------------------- strBaseClause = "AND (AG_Jobslive = 'y' AND AG_Live = 'y' AND VAC_Live = 'y' AND VAC_DateEntered > " & strDateDelimiter & ReverseFormatYear(datCutOff) & strDateDelimiter & ") AND (VAC_LanguageID = " & numLanguageID & ") " '--------------------------------------------- 'PULL MAIN RECORDSET OUT 'Rank it, store in cookie, then close '--------------------------------------------- strTableJoins = "((((tblCactusVacancies INNER JOIN tblCactusAgencies ON tblCactusVacancies.VAC_AgencyID = tblCactusAgencies.AG_ID) LEFT JOIN tblCactusVacanciesCategoriesLink ON tblCactusVacancies.VAC_ID = tblCactusVacanciesCategoriesLink.VAC_CAT_VacancyID) LEFT JOIN tblCactusVacanciesRegionsLink ON tblCactusVacancies.VAC_ID = tblCactusVacanciesRegionsLink.VAC_REG_VacancyID) LEFT JOIN tblCactusVacanciesRolesLink ON tblCactusVacancies.VAC_ID = tblCactusVacanciesRolesLink.VAC_ROL_VacancyID) INNER JOIN tblCactusConsultants ON tblCactusVacancies.VAC_ConsultantID = tblCactusConsultants.CON_ID" 'Run the compiled database query strQuery = "SELECT DISTINCT VAC_ID, VAC_Title, VAC_Description, VAC_DescriptionShort, VAC_Keywords, VAC_Location, VAC_DateEntered FROM " & strTableJoins & " WHERE " & strWhereClause & strBaseClause & strLocationsClause & strCategoriesClause & strRolesClause & strJobStatusClause & strSalaryClause & strCompanyClause & strExpiryClause & " ORDER BY VAC_DateEntered DESC" Call ExecuteSQL(strQuery,numCursorType,objRecordSet) numTotalRecs = objRecordSet.RecordCount 'Maximum of 250 results allowed If numTotalRecs > 250 then numTotalRecs = 250 'Sort everything in to rank and store in cookie aryFinalRank = CreateFinalrank(numTotalRecs,aryKeyArray,"VAC_ID","VAC_Title",5,"VAC_Description",3,"VAC_DescriptionShort",3,"VAC_Keywords",3,"VAC_Location",1) objRecordSet.close 'Save the result in the cookie Call WriteSearchStringCookie(aryFinalrank, strSiteURL & " jobsearch") '--------------------------------------------- '--------------------------------------------- 'STORE RECORD IN SEARCH LOG AND KEYORD LOG '--------------------------------------------- SCHLOG_Date = now() strQuery="INSERT INTO tblCactusSearchLog (SCHLOG_SearchMode, SCHLOG_Category1, SCHLOG_Category2, SCHLOG_ContractPerm, SCHLOG_Locations, SCHLOG_Type, SCHLOG_Date, SCHLOG_IP) VALUES ('" &_ SQLSafe(strSearchMode) & "','" &_ SQLSafe(category1) & "','" &_ SQLSafe(category2) & "','" &_ SQLSafe(status) & "','" &_ SQLSafe(Trim(locationloglist)) & "','" &_ SQLSafe(searchtype) & "'," &_ strDateDelimiter & ReverseFormatYear(SCHLOG_Date) & strDateDelimiter & ",'" &_ Request.ServerVariables("remote_addr") & "')" Set objRecordSet2 = Server.CreateObject("ADODB.Recordset") Call ExecuteSQL(strQuery,numCursorType,objRecordSet2) 'Grab the ID of the new record strQuery = "SELECT SCHLOG_ID FROM tblCactusSearchLog WHERE SCHLOG_Date=" & strDateDelimiter & ReverseFormatYear(SCHLOG_Date) & strDateDelimiter & " ORDER BY SCHLOG_ID DESC" Call ExecuteSQL(strQuery,numCursorType,objRecordSet2) SCHLOG_ID = objRecordSet2("SCHLOG_ID") objRecordSet2.close 'Log each search keword If strTempVal <> "" then For Each strKeyWord in aryKeyArray strQuery = "INSERT INTO tblCactusKeywordLog (KEY_SearchLogID, KEY_Keyword) VALUES (" & SCHLOG_ID & ",'" & SQLSafe(strKeyWord) & "')" Call ExecuteSQL(strQuery,numCursorType,objRecordSet2) Next end if '--------------------------------------------- else '--------------------------------------------- 'GET INFORMATION FROM COOKIES '--------------------------------------------- strKeywords = request.cookies(strSiteURL)("strKeywords") strSearchMode = request.cookies(strSiteURL)("strSearchMode") 'This is used in the highlighting strTempVal = SQLSafe(SearchPhraseSafe(strKeywords, GetString("ContentText_StripKeywordsJobSearch"))) strSearchedForKeywords = SafeHTMLEncode(strTempVal) '--------------------------------------------- '--------------------------------------------- 'RESTORE ARRAY '--------------------------------------------- Set objRecordSet = Server.CreateObject("ADODB.Recordset") Call ReadSearchStringCookie(strSiteURL & " jobsearch", aryFinalRank) numCurrentPos = numStartRecord numTotalRecs = Ubound(aryFinalRank)+1 '--------------------------------------------- end if '--------------------------------------------- 'SET UP PAGING '--------------------------------------------- 'Get the application settings regarding search results if numAppPageSize = 0 then numAppPageSize = NumSafe(request.cookies(strSiteURL)("numAppPageSize"), 0, 0) if numAppPageSize = 0 then numAppPageSize = NumSafe(Application(LICENSENUMBER & "pagesize"), 0, 0) numAppPageLimit = Application(LICENSENUMBER & "pagelim") 'If we've gone over the page limit, then set to the page limit If numTotalRecs > numAppPageLimit * numAppPageSize then numTotalRecs = numAppPageLimit * numAppPageSize End If 'Work out the current page numCurrentPage = (numStartRecord + numAppPageSize) / numAppPageSize 'Get the number of pages werd showing numTotalPages = CInt((numTotalRecs / numAppPageSize)+0.49) If numTotalPages > numAppPageLimit then numTotalPages = numAppPageLimit 'Relevant multiplier numPercentX = 1 '--------------------------------------------- '----------------------------------------------- 'READ PAGE TEMPLATE FROM FILE '----------------------------------------------- Call ReadFromTemplate(strTemplateLocation,aryPageTemplate,strHotJobHTML,strLoginStatusHTML) '----------------------------------------------- 'WRITE FIRST HALF OF PAGE HTML '----------------------------------------------- response.write(aryPageTemplate(0)) '----------------------------------------------- 'FIND WHAT SEARCH PAGE THIS SEARCH STARTED ON 'For the 'breadcrumb' trail '----------------------------------------------- strStartSearchPage = request.cookies(strSiteURL)("strSearchPage") If Instr(strStartSearchPage, "powersearch.asp") then strStartSearchPageName = GetString("ContentText_SearchTrailPower") else If Instr(strStartSearchPage, "agencyprofile.asp") then strStartSearchPageName = GetString("ContentText_SearchTrailAgency") else strStartSearchPageName = GetString("ContentText_SearcyTrailHome") end if end if %>
<% WriteString("PageTitle_SearchResults") %> | <%=strStartSearchPageName%> > <% WriteString("ContentText_SearchTrailSearchResults") %> |
<% WriteString("ContentText_SearchNoResults") %> << <% WriteString("ContentText_GoBack") %> |
|
<% WriteString("ContentText_SearchNumberMatching2")%>-<% =numCurrentPage%> <% WriteString("ContentText_SearchNumberMatching3")%> <% =numTotalPages %> | |