<% '************************************************************************* ' ASP Scripting: ' Filename: library_nav_functions.asp ' Written by: Wilbert Madarang ' Date: January 26, 2003 '************************************************************************* ' Description: Contains a list of common navigational functions ' used throughout the site. '************************************************************************* ' Revision History: '************************************************************************* %> <% '************************************************************************* ' Function: getURL ' Description: returns the URL of the requesting string minus any web paramters ' Parameters: none ' Returns: ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function getUrl() 'GetUrl without WebParameters '*********************************************************** ' Modified by Wilbert Madarang ' Commented out original Code, as a result of improved algorithm ' January 26, 2003 '*********************************************************** 'Dim strUrlRequest, strUrl, nDelimiterPos 'strUrlRequest = Request.ServerVariables("HTTP_REFERER") 'strDelimiter = "?" 'nDelimiterPos = InStr( strUrlRequest, strDelimiter ) 'If nDelimiterPos = 0 Then ' strUrl = strUrlRequest 'Else ' strUrl = Left( strUrlRequest, nDelimiterPos - 1 ) 'Do not include the delimiter 'End If 'getUrl = strUrl '*********************************************************** ' End of Modification by Wilbert Madarang ' January 26, 2003 '*********************************************************** getUrl = Request.ServerVariables( "PATH_INFO" ) End Function '************************************************************************* ' Function: getLastPage ' Description: get the last page of a Record Set that spans multiple pages ' Parameters: record count, number of items displayed per page ' Returns: the last page for displaying the record set '************************************************************************* ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function getLastPage( nRecordCount, nNumberEntriesPerPage ) If nRecordCount = 0 Then nLastPage = 1 Else 'div operation nLastPage = nRecordCount \ nNumberEntriesPerPage 'mod operation to increment last page If NOT ( (nRecordCount mod nNumberEntriesPerPage)=0 ) Then nLastPage = nLastPage + 1 End If End If getLastPage = nLastPage End Function '************************************************************************* ' Function: getPrevPage ' Description: validate the previous page when navigating through a ' multi-page document ' Parameters: none ' Returns: the last page of displaying the record set '************************************************************************* ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function getPrevPage( strCurrentPage ) nCurrentPage = CInt( strCurrentPage ) nPrevPage = nCurrentPage - 1 If nPrevPage <= 0 Then nPrevPage = 1 End If getPrevPage = nPrevPage End Function '************************************************************************* ' Function: getNextPage ' Description: validate the next page when navigating through a ' multi-page document ' Parameters: nCurrentPage, nLastPage ' Returns: the last page of displaying the record set '************************************************************************* ' Written by: Wilbert Madarang ' Date: January 25, 2003 '************************************************************************* Function getNextPage( strCurrentPage, strLastPage ) nCurrentPage = CInt( strCurrentPage ) nLastPage = CInt( strLastPage ) nNextPage = nCurrentPage + 1 If nNextPage > nLastPage Then nNextPage = nLastPage End If getNextPage = nNextPage End Function %>