home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 December / INTERNET97.ISO / pc / software / windows / building / scriptworx / n4932.exe / aspnav.slf < prev    next >
Encoding:
Text File  |  2001-03-23  |  4.8 KB  |  173 lines

  1. <%
  2.  
  3. Recordset1_total = Recordset.RecordCount
  4.  
  5. If (Recordset1_numRows < 0) Then
  6.   Recordset1_numRows = Recordset1_total
  7. Elseif (Recordset1_numRows = 0) Then
  8.   Recordset1_numRows = 1
  9. End If
  10.  
  11. Recordset1_first = 1
  12. Recordset1_last  = Recordset1_first + Recordset1_numRows - 1
  13.  
  14. If (Recordset1_total <> -1) Then
  15.   If (Recordset1_first > Recordset1_total) Then Recordset1_first = Recordset1_total
  16.   If (Recordset1_last > Recordset1_total) Then Recordset1_last = Recordset1_total
  17.   If (Recordset1_numRows > Recordset1_total) Then Recordset1_numRows = Recordset1_total
  18. End If
  19. %>
  20. <%
  21.  
  22. Set DTBA_rs    = Recordset
  23. DTBA_rsCount   = Recordset1_total
  24. DTBA_size      = Recordset1_numRows
  25. DTBA_uniqueCol = ""
  26. DTBA_paramName = ""
  27. DTBA_offset = 0
  28. DTBA_atTotal = false
  29. DTBA_paramIsDefined = false
  30. If (DTBA_paramName <> "") Then
  31.   DTBA_paramIsDefined = (Request.QueryString(DTBA_paramName) <> "")
  32. End If
  33. %>
  34. <%
  35.  
  36. if (Not DTBA_paramIsDefined And DTBA_rsCount <> 0) then
  37.  
  38.   r = Request.QueryString("index")
  39.   If r = "" Then r = Request.QueryString("offset")
  40.   If r <> "" Then DTBA_offset = Int(r)
  41.  
  42.   If (DTBA_rsCount <> -1) Then
  43.     If (DTBA_offset >= DTBA_rsCount Or DTBA_offset = -1) Then
  44.       If ((DTBA_rsCount Mod DTBA_size) > 0) Then
  45.         DTBA_offset = DTBA_rsCount - (DTBA_rsCount Mod DTBA_size)
  46.       Else
  47.         DTBA_offset = DTBA_rsCount - DTBA_size
  48.       End If
  49.     End If
  50.   End If
  51.  
  52.   i = 0
  53.   While ((Not DTBA_rs.EOF) And (i < DTBA_offset Or DTBA_offset = -1))
  54.     DTBA_rs.MoveNext
  55.     i = i + 1
  56.   Wend
  57.   If (DTBA_rs.EOF) Then DTBA_offset = i
  58.  
  59. End If
  60. %>
  61. <%
  62.  
  63. If (DTBA_rsCount = -1) Then
  64.  
  65.   i = DTBA_offset
  66.   While (Not DTBA_rs.EOF And (DTBA_size < 0 Or i < DTBA_offset + DTBA_size))
  67.     DTBA_rs.MoveNext
  68.     i = i + 1
  69.   Wend
  70.  
  71.   If (DTBA_rs.EOF) Then
  72.     DTBA_rsCount = i
  73.     If (DTBA_size < 0 Or DTBA_size > DTBA_rsCount) Then DTBA_size = DTBA_rsCount
  74.   End If
  75.  
  76.   If (DTBA_rs.EOF And Not DTBA_paramIsDefined) Then
  77.     If (DTBA_offset > DTBA_rsCount - DTBA_size Or DTBA_offset = -1) Then
  78.       If ((DTBA_rsCount Mod DTBA_size) > 0) Then
  79.         DTBA_offset = DTBA_rsCount - (DTBA_rsCount Mod DTBA_size)
  80.       Else
  81.         DTBA_offset = DTBA_rsCount - DTBA_size
  82.       End If
  83.     End If
  84.   End If
  85.  
  86.   If (DTBA_rs.CursorType > 0) Then
  87.     DTBA_rs.MoveFirst
  88.   Else
  89.     DTBA_rs.Requery
  90.   End If
  91.  
  92.   i = 0
  93.   While (Not DTBA_rs.EOF And i < DTBA_offset)
  94.     DTBA_rs.MoveNext
  95.     i = i + 1
  96.   Wend
  97. End If
  98. %>
  99. <%
  100.  
  101. Recordset1_first = DTBA_offset + 1
  102. Recordset1_last  = DTBA_offset + DTBA_size
  103. If (DTBA_rsCount <> -1) Then
  104.   If (Recordset1_first > DTBA_rsCount) Then Recordset1_first = DTBA_rsCount
  105.   If (Recordset1_last > DTBA_rsCount) Then Recordset1_last = DTBA_rsCount
  106. End If
  107.  
  108. DTBA_atTotal = (DTBA_rsCount <> -1 And DTBA_offset + DTBA_size >= DTBA_rsCount)
  109. %>
  110. <%
  111.  
  112. DTBA_removeList = "&index="
  113. If (DTBA_paramName <> "") Then DTBA_removeList = DTBA_removeList & "&" & DTBA_paramName & "="
  114. DTBA_keepURL="":DTBA_keepForm="":DTBA_keepBoth="":DTBA_keepNone=""
  115.  
  116. For Each Item In Request.QueryString
  117.   NextItem = "&" & Item & "="
  118.   If (InStr(1,DTBA_removeList,NextItem,1) = 0) Then
  119.     DTBA_keepURL = DTBA_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
  120.   End If
  121. Next
  122.  
  123. For Each Item In Request.Form
  124.   NextItem = "&" & Item & "="
  125.   If (InStr(1,DTBA_removeList,NextItem,1) = 0) Then
  126.     DTBA_keepForm = DTBA_keepForm & NextItem & Server.URLencode(Request.Form(Item))
  127.   End If
  128. Next
  129.  
  130. DTBA_keepBoth = DTBA_keepURL & DTBA_keepForm
  131. if (DTBA_keepBoth <> "") Then DTBA_keepBoth = Right(DTBA_keepBoth, Len(DTBA_keepBoth) - 1)
  132. if (DTBA_keepURL <> "")  Then DTBA_keepURL  = Right(DTBA_keepURL, Len(DTBA_keepURL) - 1)
  133. if (DTBA_keepForm <> "") Then DTBA_keepForm = Right(DTBA_keepForm, Len(DTBA_keepForm) - 1)
  134.  
  135. Function DTBA_joinChar(firstItem)
  136.   If (firstItem <> "") Then
  137.     DTBA_joinChar = "&"
  138.   Else
  139.     DTBA_joinChar = ""
  140.   End If
  141. End Function
  142. %>
  143. <%
  144.  
  145. DTBA_keepMove = DTBA_keepBoth
  146. DTBA_moveParam = "index"
  147.  
  148. If (DTBA_size > 0) Then
  149.   DTBA_moveParam = "offset"
  150.   If (DTBA_keepMove <> "") Then
  151.     params = Split(DTBA_keepMove, "&")
  152.     DTBA_keepMove = ""
  153.     For i = 0 To UBound(params)
  154.       nextItem = Left(params(i), InStr(params(i),"=") - 1)
  155.       If (StrComp(nextItem,DTBA_moveParam,1) <> 0) Then
  156.         DTBA_keepMove = DTBA_keepMove & "&" & params(i)
  157.       End If
  158.     Next
  159.     If (DTBA_keepMove <> "") Then
  160.       DTBA_keepMove = Right(DTBA_keepMove, Len(DTBA_keepMove) - 1)
  161.     End If
  162.   End If
  163. End If
  164.  
  165. If (DTBA_keepMove <> "") Then DTBA_keepMove = DTBA_keepMove & "&"
  166. urlStr = Request.ServerVariables("URL") & "?" & DTBA_keepMove & DTBA_moveParam & "="
  167. DTBA_moveFirst = urlStr & "0"
  168. DTBA_moveLast  = urlStr & "-1"
  169. DTBA_moveNext  = urlStr & Cstr(DTBA_offset + DTBA_size)
  170. prev = DTBA_offset - DTBA_size
  171. If (prev < 0) Then prev = 0
  172. DTBA_movePrev  = urlStr & Cstr(prev)
  173. %>