<%@ Language=VBScript %> <%Option Explicit%> <% function Sugestion(paramentro) dim buff buff = buff & "
" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "
" buff = buff & "Sugestões de pesquisa" buff = buff & "
" buff = buff & "·Experimente outras palavras.
" & vbcrlf buff = buff & "·Varie os critérios de pesquisa.
" & vbcrlf buff = buff & "·Pesquise também " buff = buff & " na agenda" buff = buff & " e " buff = buff & " no fórum" buff = buff & ".
" & vbcrlf buff = buff & "
" Sugestion = buff end function ' displays recordset and navigation buttons ' Retorns: ' Date Created: 26-03-2001 ' Autor: Francisco Ribeiro function DisplayRecords(rst, byval npage, byval nPageSize, _ byval sparametro, byval SearchType, _ byval SearchRange, byval DateBegin, byval DateEnd, _ byval SearchLocal, byval IdSeccao, byval IdAutor, _ byval AutorName, byval SeccaoName, byval idEdicao) Dim buff Dim nPageCount dim totPages Dim nRecord dim FirstRecordNumber dim AbsolutRecord dim totRecords dim link dim qrystring dim aSearchType dim aSearchRange aSearchType = array("Todas as Palavras", "Qualquer palavra", "Texto") aSearchRange = array("Última Edição", _ "4 Últimas Edições", _ "Entre a Data "& DateBegin & " e a data " & DateEnd , _ "Todas as Edições") totRecords = rst.recordcount buff = "" if totRecords <= 0 then 'No records buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "
" buff = buff & "Critérios de Pesquisa" buff = buff & "
" if sparametro <> "" then buff = buff & "· Texto a pesquisar: " & server.HTMLEncode(sparametro) & "
" & vbcrlf end if if idautor <> 0 then buff = buff & "· Artigos do Autor: " & AutorName & "
" end if buff = buff & "· Com o Critério: " & aSearchType(SearchType) & "
" buff = buff & "
" buff = buff & "· Data de Publicação: " & aSearchRange(SearchRange) & "
" if idseccao <> 0 and idseccao <> "" then buff = buff & "· Secção: " & SeccaoName & "
" end if buff = buff & "
" buff = buff & "
" & getlink("Efectue outra pesquisa","index.asp") buff = buff & "

Não foram encontradas ocorrências no jornal de modo a satisfazer os seus critérios.
" buff = buff & Sugestion(sparametro) DisplayRecords = buff exit function end if rst.sort ="idNoticia desc" rst.PageSize = nPageSize rst.AbsolutePage = nPage totPages = rst.PageCount nPageCount = rst.PageCount FirstRecordNumber = rst.AbsolutePosition 'debug ' Response.Write "rst.PageCount" & rst.PageCount & "
" & _ ' "rst.recordcount" & rst.recordcount & "
" & _ ' "rst.PageSize=" & rst.PageSize & "
" & _ ' "rst.AbsolutePage=" & rst.AbsolutePage buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "" buff = buff & "
" buff = buff & "Critérios de Pesquisa" buff = buff & "
" if sparametro <> "" then buff = buff & "· Texto a pesquisar: " & server.HTMLEncode(sparametro) & "
" & vbcrlf end if if idautor <> 0 then buff = buff & "· Artigos do Autor: " & AutorName & "
" end if buff = buff & "· Com o Critério: " & aSearchType(SearchType) & "
" buff = buff & "
" buff = buff & "· Data de Publicação: " & aSearchRange(SearchRange) & "
" if idseccao <> 0 and idseccao <> "" then buff = buff & "· Secção: " & SeccaoName & "
" end if buff = buff & "
" buff = buff & "

" & getlink("Efectue outra pesquisa","/search/index.asp") & "

" qrystring = "Parametros=" & server.URLEncode(sParametro) & _ "&SearchType=" & SearchType & _ "&SearchRange=" & SearchRange & _ "&DateBegin=" & DateBegin & _ "&DateEnd=" & DateEnd & _ "&SearchLocal=" & SearchLocal & _ "&IdSeccao=" & IdSeccao & _ "&IdAutor=" & IdAutor & _ "&AutorName=" & AutorName & _ "&SeccaoName=" & SeccaoName 'ToolBox Pages Nagigation buff = buff & displayPagToolbox(0, nPageSize, 10, npage, totPages, "search.asp", qrystring) 'Loop Records buff = buff & "" For nRecord = 0 To nPageSize -1 'Falta critério - palavra a pesquisar AbsolutRecord = FirstRecordNumber + nRecord link = "../noticia.asp?idEdicao=" & rst("idEdicao") & "&id=" & rst("idNoticia") & "&idSeccao=" & rst("IdEdicaoSeccao") & "&Action=noticia" buff = buff & "" & vbcrlf buff = buff & "" & vbcrlf buff = buff & "" & vbcrlf rst.MoveNext If rst.EOF Then Exit For Next 'nRecord set rst = nothing buff = buff & "
" & AbsolutRecord & ". " & getlink(safehtml(rst("titulo")), link )& "" & safehtml(rst("Data")) & "
" & safehtml(rst("LeadPeq")) & "

" buff = buff & vbcrlf 'Records Page summary buff = buff & "

Registos " & FirstRecordNumber & " a " & AbsolutRecord & " de " & totRecords & "

" & vbcrlf 'toolBox Previous Next Nagigation buff = buff & displayPagToolbox(0, nPageSize, 10, npage, totPages, "search.asp", qrystring) & vbcrlf DisplayRecords = buff End function function pesquisa(smodel, SearchType, SearchRange, _ rstNoticiasPesq, page, c_pagesize, _ parametro, SearchLocal, IdSeccao, _ IdAutor, AutorName, SeccaoName, idEdicao) dim DateBegin dim DateEnd if parametro <> "" or IdAutor <> 0 then set objNoticiasPesq = server.CreateObject("ArdinaSearch_dal.clsSearch") ' entre datas if SearchRange="2" then DateBegin = Request("DateBegin") if DateBegin = "" then DateBegin = Request("dateBegindd") & "-" & Request("dateBeginmm") & "-" & Request("dateBeginyyyy") DateEnd = Request("dateEnddd") & "-" & Request("dateEndmm") & "-" & Request("dateEndyyyy") else DateEnd = Request("DateEnd") end if end if ' Response.Write "SearchType" & SearchType ' Response.Write "
DateBegin:" & DateBegin ' Response.Write "
DateEnd:" & DateEnd ' Response.Write "(SearchType" & clng(SearchType) ' Response.Write "(SearchRange" & clng(SearchRange) ' Response.Write "(SearchLocal" & clng(SearchLocal) ' Response.Write "(IdSeccao" & clng(IdSeccao) ' Response.Write "(IdAutor" & clng(IdAutor) set rstNoticiasPesq = objNoticiasPesq.SearchExt(CONNECTIONSTRING, _ parametro, _ clng(SearchType), _ clng(SearchRange), _ clng(SearchLocal), _ clng(IdSeccao), _ clng(IdAutor), _ DateBegin, _ DateEnd) set objNoticiasPesq = nothing pesquisa = DisplayRecords(rstNoticiasPesq, page, c_pagesize, _ parametro, SearchType, SearchRange, _ DateBegin, DateEnd, SearchLocal, IdSeccao, _ IdAutor, AutorName, SeccaoName, idEdicao ) set rstNoticiasPesq = nothing end if end function dim sModel dim objNoticiasPesq dim rstNoticiasPesq dim idEdicao dim parametro dim page dim sSeccoes dim dadosEdicao dim SearchType dim SearchRange dim SearchLocal dim IdSeccao dim IdAutor dim AutorName dim SeccaoName dim conteudo dim QryStringNew ' parametros page = Request("Page") parametro = request("Parametros") SearchType = request("SearchType") SearchRange = request("SearchRange") SearchLocal = request("SearchLocal") IdSeccao = request("IdSeccao") IdAutor = request("IdAutor") AutorName = request("AutorName") SeccaoName = request("SeccaoName") if page = "" then page = 1 'Modelo exterior sModel = getModel(c_RootPath & "\modelos\modelo_int.htm") 'Edicão idEdicao = getEdicaoActual() sModel = replace (sModel, c_Noticias_Marca, "

Resultados da Pesquisa

" & c_Noticias_Marca) 'conteudo = "

 

" if parametro = "" and IdAutor = "" then QryStringNew = "" conteudo = conteudo & "" conteudo = conteudo & "" conteudo = conteudo & "" conteudo = conteudo & "" conteudo = conteudo & "" conteudo = conteudo & "" conteudo = conteudo & "" conteudo = conteudo & "
" conteudo = conteudo & "Critérios de Pesquisa" conteudo = conteudo & "
 
" conteudo = conteudo & getlink("Efectue outra pesquisa","/search/index.asp") conteudo = conteudo & "

Para se efectuar uma pesquisa é necessário preencher o texto ou o autor.
" conteudo = conteudo & "De momento não existe nenhum destes critérios preenchidos.
" conteudo = conteudo & "Efectue uma nova pesquisa.

" else QryStringNew = "parametros=" & parametro if SearchType="" then SearchType = 0 end if if SearchRange="" then SearchRange = 0 end if if IdAutor="" then IdAutor = 0 end if if IdSeccao="" then IdSeccao = 0 end if if SearchLocal="" then SearchLocal = 0 end if 'pesquisa conteudo = conteudo & pesquisa(smodel, SearchType, SearchRange, _ rstNoticiasPesq, page, c_pagesize, _ parametro, SearchLocal, IdSeccao, IdAutor, AutorName, SeccaoName, idEdicao) end if conteudo = conteudo & "

 

" smodel = replace(sModel, c_Noticias_Marca, showEstruturapes("jornal", conteudo , QryStringNew)) 'Dados existentes em todas as paginas call ShowDadosPagina(sModel, " Resultados da pesquisa ", IdEdicao, "../index.asp", "../", c_RootPath & "\pub\", 0) Response.Write sModel %>