Ir para conteúdo
Fórum Script Brasil

fabio_br

Membros
  • Total de itens

    13
  • Registro em

  • Última visita

Sobre fabio_br

fabio_br's Achievements

0

Reputação

  1. Após apanhar bastante para deixar o template Gallery_002 do Swishmax 3 de meu gosto, estou tendo trabalho para colocá-lo na net. Minha intenção é criar várias Galerias de fotos, uma para cada serviço que disponibilizarei em meu site. O problema é que quando altero o project template do SwishMax 3 para a criação de uma galeria de fotos (no caso a gallery_002), este cria automaticamente uma pasta gallery para armazenar as fotos e não estou sabendo como fazer com que ele crie uma pasta gallery de meu gosto. Tipo gallerybox, galleryvidros, etc. A fim de que as galerias não se confundam pois utilizaram fotos diferentes.
  2. Tenho esse script (ver abaixo), que por sinal é simples mas bem funcional. Ele irá rotacionar a cada entrada do visitante um banner em flash. &lt;script language="Javascript" type="text/Javascript"> hoje = new Date() numero_de_imagens = 3 segundos = hoje.getSeconds() numero = segundos % numero_de_imagens if (numero == 0){ banner = "meudominio/bannerentrada1.swf" } if (numero == 1){ banner = "meudominio/formaspag.swf" } if (numero == 2){ banner = "meudominio/bannerfretemontebiquini.swf" } document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="455" height="68" title="banner"><param name="movie" value="' + banner +'"/><param name="quality" value="high" /><param name="wmode" value="opaque" /><embed src="' + banner + '" quality="high" wmode="opaque" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="455" height="68"></embed></object>') </script> Gostaria de fazer com que esse codigo fosse mesclado com o do Adsense do google, para que ele rotacionasse entre os meus banners em flash e entre os do google, tentei uma alteração mas como não sei muita coisa não consegui alterar, seguindo o mesmo raciocínio fiz o seguinte, primeiro tentei fazer uma alteração para saber se conseguiria fazer o adsense mudar: &lt;script language="Javascript" type="text/Javascript"> hoje = new Date() numero_de_imagens = 3 segundos = hoje.getSeconds() numero = segundos % numero_de_imagens if (numero == 0){ adsense = "http://pagead2.googlesyndication.com/pagead/show_ads.js" ad1 = "pub-4318605327379953" ad2 = "0015027820" } if (numero == 1){ banner = "meudominio/formaspag.swf" } if (numero == 2){ banner = "meudominio/bannerfretemontebiquini.swf" } document.write ('&lt;script type="text/javascript"> google_ad_client = "' + ad1 + '"; google_ad_slot = "' + ad2 +'"; google_ad_width = 468; google_ad_height = 60; </script>&lt;script type="text/javascript"src="' + adsense + '"></script>') </script> Obtive o seguinte erro: Active Server Pages error 'ASP 0138' Nested Script Block /teste/teste.asp, line 26 Até entendo o erro, que é de colocar uma chamada javascript dentro da outra, mas como não sei muito, não sei como fazer para fazer isso funcionar. Se alguém puder ajudar Sem mais Obrigado Fabio
  3. 1 = é ProductDetailID é um campo auto numérico? Sim é autonumérico. quando você chama esse campo aqui <input name="produtoid" type="text" id="produtoid" value="<%=(rsOrder.Fields.Item("ProductDetailID").Value)%>" /></td> <td width="356"> 2 = ele aparece o numero do produto ou o nome? Aparece o número !!!
  4. Sim o campo ProductDetailsID é único . Como poderia fazer para fazer funcionar Deividy?? Estou tentando usar um tuturial que parece que ira servir ele usa um contador e depois monta o comando do update usando ele de uma olhada: <%@LANGUAGE="VBSCRIPT"%> <!--#include file="Connections/catvi.asp" --> <% Response.Buffer = True Dim iCount iCount = Request.Form("Count") Dim strLink, strID Dim strSQL Dim Command1 set Command1 = Server.CreateObject("ADODB.Connection") Command1.ConnectionString = MM_catvi_STRING Command1.Open Dim iLoop For iLoop = 0 to iCount strLink = Request.Form("qtidade") strID = Request(iLoop & ".ID") strSQL = "UPDATE Estoque SET Estoque = '" & strLink & "'" &_ " WHERE ProductDetailID = " & strID Command1.Execute strSQL Next Command1.Close Set Command1 = Nothing Até aproveitando a interação uma coisa que está dando erro aqui é na hora do update tenho o erro de mysmath data. Até sei onde é mas não sei resolver, no tuturial o código é: For iLoop = 0 to iCount strLink = Request(iLoop & ".Link") strID = Request(iLoop & ".ID") strSQL = "UPDATE dbo.YourTable SET sCatName = '" & strLink & "'" &_ " WHERE SCAT = " & strID onde ScatName é uma variavel de texto aí ele usa as comas assim: '" & strLink & "'" no meu código: For iLoop = 0 to iCount strLink = Request.Form("qtidade") strID = Request(iLoop & ".ID") strSQL = "UPDATE Estoque SET Estoque = '" & strLink & "'" &_ " WHERE ProductDetailID = " & strID a variavel Estoque é um número integer teria que alterar as comas dela mas não sei como elas deveriam ficar !!! Se puder ajudar Agradeceria
  5. Bom dia Estou tendo problemas para fazer um update quando o mesmo tem vários campos gerados por um repeat region. Quando tenho só um resultado consigo fazer o update, mas quando tenho vários dá erro. Veja o código: <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <!--#include file="Connections/catvi.asp" --> <% Dim MM_editAction MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString) End If ' boolean to abort record edit Dim MM_abortEdit MM_abortEdit = false %> <% ' IIf implementation Function MM_IIf(condition, ifTrue, ifFalse) If condition = "" Then MM_IIf = ifFalse Else MM_IIf = ifTrue End If End Function %> <% If (CStr(Request("MM_update")) = "form1") Then If (Not MM_abortEdit) Then ' execute the update Dim MM_editCmd Set MM_editCmd = Server.CreateObject ("ADODB.Command") MM_editCmd.ActiveConnection = MM_catvi_STRING MM_editCmd.CommandText = "UPDATE Estoque SET Estoque = ? WHERE ProductDetailID = ?" MM_editCmd.Prepared = true MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 5, 1, -1, MM_IIF(Request.Form("qtidade"), Request.Form("qtidade"), null)) ' adDouble MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble MM_editCmd.Execute MM_editCmd.ActiveConnection.Close ' append the query string to the redirect URL Dim MM_editRedirectUrl MM_editRedirectUrl = "stockcontrol.asp" If (Request.QueryString <> "") Then If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0) Then MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString Else MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString End If End If Response.Redirect(MM_editRedirectUrl) End If End If %> <% Dim rsOrder__MMColParam rsOrder__MMColParam = "1" If (Request.Form("numpedido") <> "") Then rsOrder__MMColParam = Request.Form("numpedido") End If %> <% Dim rsOrder Dim rsOrder_cmd Dim rsOrder_numRows Set rsOrder_cmd = Server.CreateObject ("ADODB.Command") rsOrder_cmd.ActiveConnection = MM_catvi_STRING rsOrder_cmd.CommandText = "SELECT OrderDetailsID, OrderID, estoque_final, ProductDetailID FROM orderDetails WHERE OrderID = ?" rsOrder_cmd.Prepared = true rsOrder_cmd.Parameters.Append rsOrder_cmd.CreateParameter("param1", 5, 1, -1, rsOrder__MMColParam) ' adDouble Set rsOrder = rsOrder_cmd.Execute rsOrder_numRows = 0 %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = -1 Repeat1__index = 0 rsOrder_numRows = rsOrder_numRows + Repeat1__numRows %> <% Dim estoque__numRows Dim estoque__index estoque__numRows = -1 estoque__index = 0 rsOrder_numRows = rsOrder_numRows + estoque__numRows %> <% Dim MM_paramName %> <% ' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters Dim MM_keepNone Dim MM_keepURL Dim MM_keepForm Dim MM_keepBoth Dim MM_removeList Dim MM_item Dim MM_nextItem ' create the list of parameters which should not be maintained MM_removeList = "&index=" If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "=" End If MM_keepURL="" MM_keepForm="" MM_keepBoth="" MM_keepNone="" ' add the URL parameters to the MM_keepURL string For Each MM_item In Request.QueryString MM_nextItem = "&" & MM_item & "=" If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item)) End If Next ' add the Form variables to the MM_keepForm string For Each MM_item In Request.Form MM_nextItem = "&" & MM_item & "=" If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item)) End If Next ' create the Form + URL string and remove the intial '&' from each of the strings MM_keepBoth = MM_keepURL & MM_keepForm If (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1) End If If (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1) End If If (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1) End If ' a utility function used for adding additional parameters to these strings Function MM_joinChar(firstItem) If (firstItem <> "") Then MM_joinChar = "&" Else MM_joinChar = "" End If End Function %> <% Dim numprodid numprodid = (rsOrder.Fields.Item("ProductDetailID").Value) %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- .style54 {font-family: Tahoma; font-weight: bold; font-size: 10px; } .style3 { font-size: 10px; font-family: Tahoma; width: 250px; } --> </style> </head> <body> <p>&nbsp;&nbsp; <p><strong>N&uacute;mero do pedido:</strong><%=Request.Form("numpedido")%> </p> <p>Detalhe do pedido: </p> <p>&nbsp;</p> <form ACTION="<%=MM_editAction%>" METHOD="POST" id="form1" name="form1"> <p>&nbsp;</p> <% While ((Repeat1__numRows <> 0) AND (NOT rsOrder.EOF)) %> <table width="705" border="0"> <tr> <td width="49">&nbsp;</td> <td width="278">Produto: <input name="produtoid" type="text" id="produtoid" value="<%=(rsOrder.Fields.Item("ProductDetailID").Value)%>" /></td> <td width="356">Quantidade : <input name="qtidade" type="text" id="qtidade" value="<%=(rsOrder.Fields.Item("estoque_final").Value)%>" size="5" /> <input type="hidden" name="MM_recordId" value="<%= rsOrder.Fields.Item("ProductDetailID").Value %>" /></td> </tr> </table> <% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 rsOrder.MoveNext() Wend %> <p> <input type="submit" name="Submit" value="Submit" /> </p> <input type="hidden" name="MM_update" value="form1"> </form> <p></p> <p>&nbsp;</p> <h5></h5></p> <p>&nbsp;</p> </body> </html> <% rsOrder.Close() Set rsOrder = Nothing %> Acredito que o problema é gerado porque o comando do update não consegue funcionar já que os campos gerados pelo repeat region tem o mesmo nome. Não sei como criar nomes diferentes para os campos criados com o repeat region para que o update funcione corretamente. Se alguém souber por favor me ajude. Sem mais Fábio
  6. fabio_br

    Ssl (https) E Sessões

    É exatamente o que ia fazer, mas os administradores de servidor aqui me mandaram um email dizendo que poderia sobrecarregar o servidor, porque se,às vezes o cliente quizesse adicionar algo a mais na compra iria rodar por toda a página em modo de página segura. Por isso quero ver se acho uma outra saída.
  7. Aew galera Gostaria de saber se vocês sabem onde posso arrumar um script para não perder as sessões quando saio de uma pagina http para um https. Vi em um outro fórum que seria ataves de um banco de dados, porem não da detalhes e nem explica. Obrigado
  8. fabio_br

    Sessões E Iis6

    Esse problema do código que citei é um problema que parece acontecer só com windows 2003 versão portugues junto com IIS6, testei o script em uma página gratuita da brinkster e lá rodou de boa, já no meu servidor teve que ser isolado em um pool de aplicativos para melhorar sua performance. Se alguém me puder explicar melhor o que seria isso e como otimizar esse problema Agradeceria
  9. Estou tento dificuldades após ter trocado meu site de hospedagem em rodar o código abaixo, não sei porque mas de vez em quando ele roda 3 a 4 x e aí para no erro Microsoft JScript runtime error '800a138f' 'Data' is null or not an object /sessaotesteservidor.asp, line 11 Andei pesquisando na net e a única coisa que achei é que poderia ser um problema no IIS6 para verificar sessões, não dá pra entender já que esse código rodava normalmente na antiga hospedagem . Se puderem ajudar ficaria grato !!! <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%> <% function MyCartObj(Name) { this.Data = null; this.Name = Name; // METHODS this.Persist = Persist; if (Session(Name) != null) { this.Data = Session(Name).Data; } else { this.Data = "My Data"; this.Persist(); } } function Persist() { var sObj = new Object(); sObj.Data = this.Data; Session(this.Name) = sObj; } Response.Write("Session ID: " + String(Session.SessionID) + "<br>"); // debug var UCII = new MyCartObj("MyTestSession"); var UCII__i = 0; if(String(Session("iCount")) != "undefined" ) { Session("iCount") += 1; } else { Session("iCount") = 1; } %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <meta http-equiv="refresh" content="1"> </head> <body> <p>My Session.Data equals: <%=UCII.Data%> </p> <p>How many times the page has run: <%=Session("iCount")%></p> </body> </html>
  10. fabio_br

    Sessões E Iis6

    Estou tendo o erro : Microsoft JScript runtime error '800a138f' 'Data' is null or not an object /sessaotesteservidor.asp, line 11 Pesquisando a net parece que no IIS6 pode acontecer de as vezes sessoes falharem para serem percebidas, maior estranho o que está acontecendo , hora meu servidor consegue atribuir valor da sessão e hora não. Se alguém puder ajudar, segue o código que está dando erro: <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%> <% function MyCartObj(Name) { this.Data = null; this.Name = Name; // METHODS this.Persist = Persist; if (Session(Name) != null) { this.Data = Session(Name).Data; } else { this.Data = "My Data"; this.Persist(); } } function Persist() { var sObj = new Object(); sObj.Data = this.Data; Session(this.Name) = sObj; } Response.Write("Session ID: " + String(Session.SessionID) + "<br>"); // debug var UCII = new MyCartObj("MyTestSession"); var UCII__i = 0; if(String(Session("iCount")) != "undefined" ) { Session("iCount") += 1; } else { Session("iCount") = 1; } %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <meta http-equiv="refresh" content="1"> </head> <body> <p>My Session.Data equals: <%=UCII.Data%> </p> <p>How many times the page has run: <%=Session("iCount")%></p> </body> </html>
  11. aí galera Dúvida da hora, SQL INJECTION, a adobe agora proprietária do Dream lançou um update disponível no link: http://www.adobe.com/cfusion/knowledgebase...cfm?id=300b670e que é para corrigir falhas de segurança como o SQL INJECTION e problemas na apresentação do Flash. Na maioria de minhas recordsets o Dream atualizou perfeitamente, porém em uma sql um pouco mais avançada ele zuou com o código, caso tenha alguém para me ajudar como arrumar o código para não ser vítima do SQL INJECTION, eu agradeceria. Segue abaixo meu código o qual gostaria da ajuda: <% Dim rsTeste Dim rsTeste_numRows Set rsTeste = Server.CreateObject("ADODB.Recordset") rsTeste.ActiveConnection = MM_testando_STRING If IsEmpty(Request.Querystring("forca_id")) Then If IsEmpty(Request.Querystring("maquina")) Then rsPresult.Source = "SELECT DISTINCT forca_id, nome_maquina, number, image, tamanhos, cores FROM mecatronica ORDER BY nome_maquina ASC" Else rsTeste.Source = "SELECT DISTINCT forca_id, nome_maquina, number, image, tamanhos, cores FROM mecatronica WHERE forca_id=" & Request.QueryString("forca_id") & " ORDER BY nome_produto ASC" End If Else rsTeste.Source = "SELECT DISTINCT maquina_id, nome_maquina, number, image, tamanhos, cores FROM mecatronica WHERE fitness_id=" & Request.QueryString("maquina_id") & " ORDER BY nome_produto ASC" End If rsTeste.CursorType = 0 rsTeste.CursorLocation = 2 rsTeste.LockType = 1 rsTeste.Open() rsTeste_numRows = 0 %> B)
  12. fabio_br

    Busca Avançada

    Eu já tentei retirar o codigo de mover para o proximo registro e colocar de novo e nada !!! Alterei um pedaço do códico sql para efetuar a busca: <% Dim rsBox__MMColParam rsBox__MMColParam = "%" If (Request.Form("procura") <> "") Then rsBox__MMColParam = Request.Form("procura") End If %> <% Dim rsBox Dim rsBox_numRows Set rsBox = Server.CreateObject("ADODB.Recordset") rsBox.ActiveConnection = MM_catvi_STRING rsBox.Source = "SELECT Assunto, Resumo, Thunbnail, Título, Codigo, Url, Data FROM News WHERE Resumo LIKE '%" + left(rsBox__MMColParam, 4) + "%'" rsBox.CursorType = 0 rsBox.CursorLocation = 2 rsBox.LockType = 1 rsBox.Open() rsBox_numRows = 0 %> pelo codigo abaixo: <% Dim rsBox Dim rsBox_numRows Set rsBox = Server.CreateObject("ADODB.Recordset") rsBox.ActiveConnection = MM_catvi_STRING rsBox.Source = "SELECT Assunto, Resumo, Thunbnail, Título, Codigo, Url, Data FROM News WHERE Resumo LIKE '%" + left(Request.Form("procura"), 4) + "%'" rsBox.CursorType = 0 rsBox.CursorLocation = 2 rsBox.LockType = 1 rsBox.Open() rsBox_numRows = 0 %> e não consegui sucesso O q mais posso estar fazendo para que o paginador funcione????
  13. Oi, bom dia Eu fiz um site de busca onde o usuário digita uma palavra em um text field para encontrar notícias do site. Eu programei o repeat region para 5 resultados por vez. O problema está ocorrendo quando temos mais q 5 resultados de pesquisa. Quando o usuário clica para ver os proximos resultados a busca retorna todos os resultados do banco de dados. O q pode estar acontecendo?? Vejam o código fonte: <% Dim rsBox__MMColParam rsBox__MMColParam = "%" If (Request.Form("procura") <> "") Then rsBox__MMColParam = Request.Form("procura") End If %> <% Dim rsBox Dim rsBox_numRows Set rsBox = Server.CreateObject("ADODB.Recordset") rsBox.ActiveConnection = MM_catvi_STRING rsBox.Source = "SELECT Assunto, Resumo, Thunbnail, Título, Codigo, Url, Data FROM News WHERE Resumo LIKE '%" + left(rsBox__MMColParam, 4) + "%'" rsBox.CursorType = 0 rsBox.CursorLocation = 2 rsBox.LockType = 1 rsBox.Open() rsBox_numRows = 0 %> <% Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = 5 Repeat1__index = 0 rsBox_numRows = rsBox_numRows + Repeat1__numRows %> <% ' *** Recordset Stats, Move To Record, and Go To Record: declare stats variables Dim rsBox_total Dim rsBox_first Dim rsBox_last ' set the record count rsBox_total = rsBox.RecordCount ' set the number of rows displayed on this page If (rsBox_numRows < 0) Then rsBox_numRows = rsBox_total Elseif (rsBox_numRows = 0) Then rsBox_numRows = 1 End If ' set the first and last displayed record rsBox_first = 1 rsBox_last = rsBox_first + rsBox_numRows - 1 ' if we have the correct record count, check the other stats If (rsBox_total <> -1) Then If (rsBox_first > rsBox_total) Then rsBox_first = rsBox_total End If If (rsBox_last > rsBox_total) Then rsBox_last = rsBox_total End If If (rsBox_numRows > rsBox_total) Then rsBox_numRows = rsBox_total End If End If %> <% ' *** Recordset Stats: if we don't know the record count, manually count them If (rsBox_total = -1) Then ' count the total records by iterating through the recordset rsBox_total=0 While (Not rsBox.EOF) rsBox_total = rsBox_total + 1 rsBox.MoveNext Wend ' reset the cursor to the beginning If (rsBox.CursorType > 0) Then rsBox.MoveFirst Else rsBox.Requery End If ' set the number of rows displayed on this page If (rsBox_numRows < 0 Or rsBox_numRows > rsBox_total) Then rsBox_numRows = rsBox_total End If ' set the first and last displayed record rsBox_first = 1 rsBox_last = rsBox_first + rsBox_numRows - 1 If (rsBox_first > rsBox_total) Then rsBox_first = rsBox_total End If If (rsBox_last > rsBox_total) Then rsBox_last = rsBox_total End If End If %> <% ' *** Recordset Stats: if we don't know the record count, manually count them If (rsBox_total = -1) Then ' count the total records by iterating through the recordset rsBox_total=0 While (Not rsBox.EOF) rsBox_total = rsBox_total + 1 rsBox.MoveNext Wend ' reset the cursor to the beginning If (rsBox.CursorType > 0) Then rsBox.MoveFirst Else rsBox.Requery End If ' set the number of rows displayed on this page If (rsBox_numRows < 0 Or rsBox_numRows > rsBox_total) Then rsBox_numRows = rsBox_total End If ' set the first and last displayed record rsBox_first = 1 rsBox_last = rsBox_first + rsBox_numRows - 1 If (rsBox_first > rsBox_total) Then rsBox_first = rsBox_total End If If (rsBox_last > rsBox_total) Then rsBox_last = rsBox_total End If End If %> <% Dim MM_paramName %> <% ' *** Move To Record and Go To Record: declare variables Dim MM_rs Dim MM_rsCount Dim MM_size Dim MM_uniqueCol Dim MM_offset Dim MM_atTotal Dim MM_paramIsDefined Dim MM_param Dim MM_index Set MM_rs = rsBox MM_rsCount = rsBox_total MM_size = rsBox_numRows MM_uniqueCol = "" MM_paramName = "" MM_offset = 0 MM_atTotal = false MM_paramIsDefined = false If (MM_paramName <> "") Then MM_paramIsDefined = (Request.QueryString(MM_paramName) <> "") End If %> <% ' *** Move To Record: handle 'index' or 'offset' parameter if (Not MM_paramIsDefined And MM_rsCount <> 0) then ' use index parameter if defined, otherwise use offset parameter MM_param = Request.QueryString("index") If (MM_param = "") Then MM_param = Request.QueryString("offset") End If If (MM_param <> "") Then MM_offset = Int(MM_param) End If ' if we have a record count, check if we are past the end of the recordset If (MM_rsCount <> -1) Then If (MM_offset >= MM_rsCount Or MM_offset = -1) Then ' past end or move last If ((MM_rsCount Mod MM_size) > 0) Then ' last page not a full repeat region MM_offset = MM_rsCount - (MM_rsCount Mod MM_size) Else MM_offset = MM_rsCount - MM_size End If End If End If ' move the cursor to the selected record MM_index = 0 While ((Not MM_rs.EOF) And (MM_index < MM_offset Or MM_offset = -1)) MM_rs.MoveNext MM_index = MM_index + 1 Wend If (MM_rs.EOF) Then MM_offset = MM_index ' set MM_offset to the last possible record End If End If %> <% ' *** Move To Record: if we dont know the record count, check the display range If (MM_rsCount = -1) Then ' walk to the end of the display range for this page MM_index = MM_offset While (Not MM_rs.EOF And (MM_size < 0 Or MM_index < MM_offset + MM_size)) MM_rs.MoveNext MM_index = MM_index + 1 Wend ' if we walked off the end of the recordset, set MM_rsCount and MM_size If (MM_rs.EOF) Then MM_rsCount = MM_index If (MM_size < 0 Or MM_size > MM_rsCount) Then MM_size = MM_rsCount End If End If ' if we walked off the end, set the offset based on page size If (MM_rs.EOF And Not MM_paramIsDefined) Then If (MM_offset > MM_rsCount - MM_size Or MM_offset = -1) Then If ((MM_rsCount Mod MM_size) > 0) Then MM_offset = MM_rsCount - (MM_rsCount Mod MM_size) Else MM_offset = MM_rsCount - MM_size End If End If End If ' reset the cursor to the beginning If (MM_rs.CursorType > 0) Then MM_rs.MoveFirst Else MM_rs.Requery End If ' move the cursor to the selected record MM_index = 0 While (Not MM_rs.EOF And MM_index < MM_offset) MM_rs.MoveNext MM_index = MM_index + 1 Wend End If %> <% ' *** Move To Record: update recordset stats ' set the first and last displayed record rsBox_first = MM_offset + 1 rsBox_last = MM_offset + MM_size If (MM_rsCount <> -1) Then If (rsBox_first > MM_rsCount) Then rsBox_first = MM_rsCount End If If (rsBox_last > MM_rsCount) Then rsBox_last = MM_rsCount End If End If ' set the boolean used by hide region to check if we are on the last record MM_atTotal = (MM_rsCount <> -1 And MM_offset + MM_size >= MM_rsCount) %> <% ' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters Dim MM_keepNone Dim MM_keepURL Dim MM_keepForm Dim MM_keepBoth Dim MM_removeList Dim MM_item Dim MM_nextItem ' create the list of parameters which should not be maintained MM_removeList = "&index=" If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "=" End If MM_keepURL="" MM_keepForm="" MM_keepBoth="" MM_keepNone="" ' add the URL parameters to the MM_keepURL string For Each MM_item In Request.QueryString MM_nextItem = "&" & MM_item & "=" If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item)) End If Next ' add the Form variables to the MM_keepForm string For Each MM_item In Request.Form MM_nextItem = "&" & MM_item & "=" If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item)) End If Next ' create the Form + URL string and remove the intial '&' from each of the strings MM_keepBoth = MM_keepURL & MM_keepForm If (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1) End If If (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1) End If If (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1) End If ' a utility function used for adding additional parameters to these strings Function MM_joinChar(firstItem) If (firstItem <> "") Then MM_joinChar = "&" Else MM_joinChar = "" End If End Function %> <% ' *** Move To Record: set the strings for the first, last, next, and previous links Dim MM_keepMove Dim MM_moveParam Dim MM_moveFirst Dim MM_moveLast Dim MM_moveNext Dim MM_movePrev Dim MM_urlStr Dim MM_paramList Dim MM_paramIndex Dim MM_nextParam MM_keepMove = MM_keepBoth MM_moveParam = "index" ' if the page has a repeated region, remove 'offset' from the maintained parameters If (MM_size > 1) Then MM_moveParam = "offset" If (MM_keepMove <> "") Then MM_paramList = Split(MM_keepMove, "&") MM_keepMove = "" For MM_paramIndex = 0 To UBound(MM_paramList) MM_nextParam = Left(MM_paramList(MM_paramIndex), InStr(MM_paramList(MM_paramIndex),"=") - 1) If (StrComp(MM_nextParam,MM_moveParam,1) <> 0) Then MM_keepMove = MM_keepMove & "&" & MM_paramList(MM_paramIndex) End If Next If (MM_keepMove <> "") Then MM_keepMove = Right(MM_keepMove, Len(MM_keepMove) - 1) End If End If End If ' set the strings for the move to links If (MM_keepMove <> "") Then MM_keepMove = Server.HTMLEncode(MM_keepMove) & "&" End If MM_urlStr = Request.ServerVariables("URL") & "?" & MM_keepMove & MM_moveParam & "=" MM_moveFirst = MM_urlStr & "0" MM_moveLast = MM_urlStr & "-1" MM_moveNext = MM_urlStr & CStr(MM_offset + MM_size) If (MM_offset - MM_size < 0) Then MM_movePrev = MM_urlStr & "0" Else MM_movePrev = MM_urlStr & CStr(MM_offset - MM_size) End If %>
×
×
  • Criar Novo...