<% Class cPageCollection dim pc_pageChildren() dim pc_intStart dim pc_intFinish dim pc_recordCount dim pc_intPage dim pc_intPageCount dim pc_childCount dim pc_pageStartChild dim pc_pageEndChild dim j public function getPageCollection(page_id, language_id, displayMode, additionalWhereClause, orderByClause, cRecordsPerPage) dim page_id_string dim page_id_array page_id_string = "" page_id_array = split(page_id,"|") for p = 0 to ubound(page_id_array) if len(page_id_array(p)) then if p > 0 then page_id_string = page_id_string & " or " page_id_string = page_id_string & "ia.ia_parentid = " & page_id_array(p) end if next strSQL = "SELECT DISTINCT " &_ "ia.ia_childid, cd.dateRange_start "&_ "FROM ia "&_ "INNER JOIN page_info pi ON pi.page_id = ia.ia_childid "&_ "INNER JOIN page_version pv ON pv.page_id = pi.page_id "&_ "LEFT OUTER JOIN content_dates cd ON cd.page_version_id = pv.page_version_id "&_ "WHERE " & page_id_string & " AND (pi.language_ID = " & language_id & " " if displayMode = "preview" then strSQL = strSQL & "AND pi.page_status < 6 " else strSQL = strSQL & "AND pi.page_status >= 3 AND pi.page_status < 6 " end if if len(additionalWhereClause) then strSQL = strSQL & additionalWhereClause strSQL = strSQL & ") ORDER BY " & orderByClause 'response.write strSQL 'response.end set rs = LoadRSFromDB(strSQL) if not rs.EOF then me.pc_childCount = rs.RecordCount if rs.RecordCount > cRecordsPerPage then rs.PageSize = cRecordsPerPage else rs.PageSize = rs.RecordCount end if 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 me.pc_pageStartChild = (cRecordsPerPage * intPage) - (cRecordsPerPage - 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 me.pc_pageEndChild = intFinish end If me.pc_intPage = intPage me.pc_intPageCount = intPageCount me.pc_recordCount = rs.RecordCount me.pc_intStart = intStart me.pc_intFinish = intFinish dim c c = 0 redim pc_pageChildren(rs.PageSize) for intRecord = 1 to rs.PageSize set me.pc_pageChildren(c) = new cPage if displaymode = "preview" then call me.pc_pageChildren(c).getPage(rs("ia_childid"),3,language_id,"draft") else call me.pc_pageChildren(c).getPage(rs("ia_childid"),3,language_id,"live") end if c = c + 1 rs.movenext if rs.EOF then exit for next else redim pc_pageChildren(1) pc_pageChildren(1) = "empty" me.pc_childCount = 0 end if end function public function writeAnchorList() response.write("" & VbCrLf) end function public function writeChildrenInFull() for j = 0 to ubound(me.pc_pageChildren) if isObject(me.pc_pageChildren(j)) then response.write("" & VbCrLf) response.write("

" & me.pc_pageChildren(j).p_title & "

" & VbCrLf) call me.pc_pageChildren(j).getPageContent() call me.pc_pageChildren(j).writePageContent("") response.write("

Back to top

" & VbCrLf) end if next end function public function writeChildrenIntro(length, separate) dim textWritten dim imageWritten dim looper dim listingClass looper = 1 listingClass = "Eodd" for j = 0 to ubound(me.pc_pageChildren) textWritten = false imageWritten = false if isObject(me.pc_pageChildren(j)) then response.write(VbCrLf) if separate = true and not looper = 1 then response.write("
" & VbCrLf) response.write("
" & VbCrLf) response.write("

" & me.pc_pageChildren(j).p_title & "

" & VbCrLf) call me.pc_pageChildren(j).getPageContent() contentArray = me.pc_pageChildren(j).p_content_objects if isArray(contentArray) then if ubound(contentArray) > 0 then for i=0 to ubound(contentArray) select case contentArray(i,0) '--Image case 2 if imageWritten = false then set teaserImage = new cImage call teaserImage.makeImage(contentArray(i,1),contentArray(i,3),contentArray(i,4),contentArray(i,5),contentArray(i,6),"50","50","") call teaserImage.writeImage() imageWritten = true set teaserImage = nothing end if '--Text case 3 if textWritten = false then response.write writeCloseDL() set teaserText = new cText if length = "firstPara" then call teaserText.makeText(contentArray(i,1),contentArray(i,3),contentArray(i,4),true,"") call teaserText.writeText() else call teaserText.makeText(contentArray(i,1),contentArray(i,3),contentArray(i,4),false,length) response.write("

") call teaserText.writeText() response.write("

") end if set teaserText = nothing textWritten = true end if '-- Date case 6 if not length = "firstPara" then set dateObj = new cDates call dateObj.makeDate(contentArray(i,1),contentArray(i,3),contentArray(i,9),contentArray(i,10)) if dateObj.d_content_label = "Event dates" then call dateObj.writeDate("Full") else response.write("

Publication date: ") call dateObj.writeDate("Short") response.write("

") end if set dateObj = nothing end if '-- Definition list case 10 set DLObj = new cDefinitionList call DLObj.makeDL(contentArray(i,1),contentArray(i,3),contentArray(i,4),contentArray(i,5)) if DLObj.dl_content_label = "Location" then call DLObj.writeDL() end if set DLObj = nothing end select next end if end if response.write("
" & VbCrLf) looper = looper + 1 if listingClass = "Eodd" then listingClass = "Eeven" else listingClass = "Eodd" end if end if next end function public function writeLatestBox(introType, newsItem, textlength) dim latestDate dim latestImage dim latestText if isObject(me.pc_pageChildren(newsItem)) then response.write("

" & me.pc_pageChildren(newsItem).p_title & "

" & VbCrLf) call me.pc_pageChildren(newsItem).getPageContent() contentArray = me.pc_pageChildren(newsItem).p_content_objects if isArray(contentArray) then if ubound(contentArray) > 0 then for i=0 to ubound(contentArray) select case contentArray(i,0) '--Image case 2 if not isObject(latestImage) then set latestImage = new cImage call latestImage.makeImage(contentArray(i,1),contentArray(i,3),contentArray(i,4),contentArray(i,5),contentArray(i,6),"45","45","") end if '-- Text case 3 if not isObject(latestText) then set latestText = new cText call latestText.makeText(contentArray(i,1),contentArray(i,3),contentArray(i,4),false,textlength) end if '-- Date case 6 if not isObject(latestDate) then set latestDate = new cDates call latestDate.makeDate(contentArray(i,1),contentArray(i,3),contentArray(i,9),contentArray(i,10)) end if end select next end if end if if isObject(latestDate) then response.write("

Date: ") call latestDate.writeDate("Short") response.write("

") set latestDate = nothing response.write writeCloseDL() end if if isObject(latestImage) then call latestImage.writeImage() set latestImage = nothing end if if isObject(latestText) then response.write("

") call latestText.writeText() response.write("

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

Read full " & introType & "

" & VbCrLf) end if end function public function writePagingInfo() if not me.pc_childCount = 0 then response.write("

Displaying items " & me.pc_pageStartChild & " to " & me.pc_pageEndChild & " of " & me.pc_childCount & "

" & VbCrLf) end if end function public function writePagination(template,params,previousLabel,nextLabel) dim paginationString if cint(me.pc_intPage) > 1 then paginationString = "" & previousLabel & "" else paginationString = "" & previousLabel & "" end if paginationString = paginationString & " | " if cint(me.pc_intPage) < cint(me.pc_intPageCount) then paginationString = paginationString & "" & nextLabel & "" else paginationString = paginationString & "" & nextLabel & "" end if response.write("
" & VbCrLf) response.write("

" & me.pc_intStart & " - " & me.pc_intFinish & " of " & me.pc_recordCount & "

" & VbCrLf) response.write("

" & paginationString & "

" & VbCrLf) response.write("
" & VbCrLf) end function End Class %>