<% OPTION EXPLICIT DIM count, CursorType, intMID, rst, strProvider, strQuery, StrSort, AbrirBD ' $Date: 10/20/97 4:17p $ ' $ModTime: $ ' $Revision: 17 $ ' $Workfile: noticias.asp $ If request.QueryString("noticia") <> "" Then intMID = request.QueryString("noticia") End If If request.QueryString("bd") <> "" Then AbrirBD = request.QueryString("bd") End If If request.Form("Codigo") <> "" Then intMID = request.Form("Codigo") End If if request.Form("noticias.asp") = "Página Principal" then intMID = "" End If If request.Form("next") <> "" OR request.Form("prev") <> "" Then Set rst = Session("rst") If request.Form("next") <> "" Then rst.MoveNext intMID = rst("Codigo") ElseIf request.Form("prev") <> "" Then rst.MovePrevious intMID = rst("Codigo") End If Else If intMID <> "" Then count = request.Querystring("Count") - 1 If AbrirBD <> "" Then ' strProvider = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("/sindijufe/db/noticias.mdb") & ";" strProvider = "DSN=sindij;UID=sindij;PWD=f4w5d3x6;" Set rst = Server.CreateObject("ADODB.recordset") rst.CursorType = 3 rst.CursorLocation = 3 rst.LockType = 3 strQuery = "SELECT * FROM Noticias WHERE Privativo = 0 ORDER BY Data DESC, Codigo DESC" rst.Open strQuery, strProvider Else Set rst = Session("rst") End If rst.MoveFirst rst.Move count Else call setVariables ' strProvider = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("banco.mdb") & ";" strProvider = "DSN=otesti;UID=otesti;PWD=d9e9c8k5;" Set rst = Server.CreateObject("ADODB.recordset") rst.CursorType = 3 rst.CursorLocation = 3 rst.LockType = 3 rst.Open strQuery, strProvider Set Session("rst") = rst End If End If %> <% Function Title( n) DIM strTitle DIM H If n <> "" AND Len(n) > 6 then H = 2 Else H = 1 End If strTitle = "Últimas Notícias" Title = strTitle End Function Sub Build_Table Dim strTable, num, field(), fieldname(5), sort(3) fieldname(0) = "Data:" fieldname(1) = "Assunto:" fieldname(2) = "Notícia:" num=0 strTable = "" If rst.EOF Then response.Write "Nenhuma notícia encontrada" ElseIf intMID <> "" Then REDIM field(6) field(0) = rst("Data") field(1) = rst("Assunto") field(2) = rst("Texto") field(3) = rst("Resumo") field(4) = rst("Privativo") field(5) = rst("Codigo") Dim cell_left, cell_right, row_break cell_left = "" cell_right = "" row_break = "" For num = 0 to 2 strTable = strTable & cell_right & "" & fieldname(num) & "" strTable = strTable & cell_left & field(num) & "" & row_break Next num=0 Else sort(0) = "classificar por data" sort(1) = "classificar por assunto" sort(2) = "classificar por resumo" For num = 0 to 2 strTable = strTable & "" Next num = 0 strTable = strTable & "" count = 1 Do UNTIL rst.EOF strTable = strTable & "" strTable = strTable & "" & rst("Data") & "" strTable = strTable & "" & rst("Assunto") & "" strTable = strTable & "" & rst("Resumo") & "" num = 0 strTable = strTable & "" 'quebrar a linha rst.MoveNext count = count + 1 Loop End If response.write strTable End Sub ' *** Cria botões de entrada. Function FormSubmit( t, name, value ) Dim btnSubmit btnSubmit = "" FormSubmit = btnSubmit End Function Sub navigationButtons If intMID <> "" Then response.write "

" response.write FormSubmit("SUBMIT", "noticias.asp", "Página Principal") ' response.write "
" rst.MovePrevious If not rst.BOF Then response.write FormSubmit("SUBMIT", "prev", " << ") Else response.write "        " End If rst.MoveNext response.write "       " rst.MoveNext If not rst.EOF Then response.write FormSubmit("SUBMIT", "next", " >> ") Else response.write "        " End If rst.MovePrevious response.write FormSubmit("HIDDEN", "Codigo", rst("Codigo"))_ & "

" Else response.write "
" End If ' response.write "
" End Sub Sub setVariables strQuery ="SELECT * FROM noticias WHERE Privativo = 0" StrSort = request.form("sort") Select Case StrSort Case "classificar por data" StrSort = "Data DESC, Codigo DESC" Case "classificar por assunto" StrSort = "Assunto" Case Else StrSort = "Data DESC, Codigo DESC" End Select strQuery= strquery & " ORDER BY " & StrSort End Sub %>
<% call navigationButtons %> <% call Build_Table %>