home *** CD-ROM | disk | FTP | other *** search
- <cfset Recordset_NumRows = 0>
- <cfset Recordset_Index = 1>
- <cfscript>
-
- Recordset_total = Recordset1.RecordCount;
-
- If (Recordset_NumRows LT 0 OR Recordset_NumRows GTE Recordset_total) {
- Recordset_NumRows = Recordset_total;
- } Else If (Recordset_NumRows EQ 0) {
- Recordset_NumRows = 1;
- }
-
- Recordset_first = Min(1, Recordset_total);
- Recordset_last = Min(Recordset_NumRows, Recordset_total);
- </cfscript>
- <cfscript> DTBA_paramName = "";
- </cfscript>
- <cfscript>
-
- DTBA_rs = Recordset1;
- DTBA_rsCount = Recordset_total;
- DTBA_size = Recordset_NumRows;
- DTBA_uniqueCol = "";
- DTBA_paramName = "";
- DTBA_offset = 1;
- DTBA_atTotal = false;
- DTBA_paramIsDefined = false;
- If (DTBA_paramName NEQ "") DTBA_paramIsDefined = IsDefined(DTBA_paramName);
- </cfscript>
- <cfscript>
-
- If (NOT DTBA_paramIsDefined AND DTBA_rsCount NEQ 0) {
-
- // use index parameter if defined, otherwise use offset parameter
- If (IsDefined("index")) {
- DTBA_offset = index;
- } Else If (IsDefined("offset")) {
- DTBA_offset = offset;
- }
-
- // check if we are past the end of the recordset
- If (DTBA_offset GT DTBA_rsCount OR DTBA_offset EQ 0) { // past end or move last
- If ((DTBA_rsCount MOD DTBA_size) NEQ 0) { // last page not a full repeat region
- DTBA_offset = DTBA_rsCount - (DTBA_rsCount MOD DTBA_size) + 1;
- } Else {
- DTBA_offset = DTBA_rsCount - DTBA_size + 1;
- }
- }
- }
- </cfscript>
- <cfscript>
-
- If (DTBA_size EQ 1) {
-
- // create a new query with one row
- DTBA_newQuery = QueryNew(DTBA_rs.ColumnList);
- QueryAddRow(DTBA_newQuery, 1);
-
- DTBA_columns = ListToArray(DTBA_rs.ColumnList,",");
- For (i=1; i LTE ArrayLen(DTBA_columns); i=i+1) {
- QuerySetCell(DTBA_newQuery, DTBA_columns[i], DTBA_rs[DTBA_columns[i]][DTBA_offset], 1);
- }
-
- Recordset1 = DTBA_newQuery;
- }
- </cfscript>
- <cfscript>
-
- Recordset_first = Min(DTBA_offset, DTBA_rsCount);
- Recordset_last = Min(DTBA_offset + DTBA_size - 1, DTBA_rsCount);
-
- Recordset_Index = DTBA_offset;
-
- DTBA_atTotal = (DTBA_offset + DTBA_size - 1 GTE DTBA_rsCount);
- </cfscript>
- <cfscript>
-
- DTBA_removeList = "&index=";
- If (DTBA_paramName NEQ "") DTBA_removeList = DTBA_removeList & "&" & DTBA_paramName & "=";
- DTBA_keepURL=""; DTBA_keepForm=""; DTBA_keepBoth=""; DTBA_keepNone="";
-
- DTBA_params=ListToArray(CGI.QUERY_STRING,"&");
- For (i=1; i LTE ArrayLen(DTBA_params); i=i+1) {
- If (FindNoCase("&" & GetToken(DTBA_params[i],1,"=") & "=",DTBA_removeList) Is 0)
- DTBA_keepURL = DTBA_keepURL & "&" & DTBA_params[i];
- }
-
- If (IsDefined("FORM.FieldNames")) {
- DTBA_params=ListToArray(FORM.FieldNames,",");
- For (i=1; i LTE ArrayLen(DTBA_params); i=i+1) {
- If (FindNoCase("&" & DTBA_params[i] & "=",DTBA_removeList) Is 0)
- DTBA_keepForm = DTBA_keepForm & "&" & LCase(DTBA_params[i]) & "=" & URLEncodedFormat(Evaluate("FORM." & DTBA_params[i]));
- }
- }
-
- DTBA_keepBoth = DTBA_keepURL & DTBA_keepForm;
- If (DTBA_keepURL NEQ "") DTBA_keepURL = RemoveChars(DTBA_keepURL,1,1);
- If (DTBA_keepForm NEQ "") DTBA_keepForm = RemoveChars(DTBA_keepForm,1,1);
- If (DTBA_keepBoth NEQ "") DTBA_keepBoth = RemoveChars(DTBA_keepBoth,1,1);
- </cfscript>
- <cfscript>
-
- DTBA_keepMove = DTBA_keepBoth;
- DTBA_moveParam = "index";
-
- if (DTBA_size GT 1) {
- DTBA_moveParam = "offset";
- DTBA_params = ListToArray(DTBA_keepMove,"&");
- DTBA_keepMove = "";
- For (i=1; i LTE ArrayLen(DTBA_params); i=i+1) {
- If (CompareNoCase(GetToken(DTBA_params[i],1,"="),DTBA_moveParam) IS NOT 0) {
- DTBA_keepMove = DTBA_keepMove & "&" & DTBA_params[i];
- }
- }
- If (DTBA_keepMove NEQ "") {
- DTBA_keepMove = RemoveChars(DTBA_keepMove,1,1);
- }
- }
-
- if (DTBA_keepMove NEQ "") DTBA_keepMove = DTBA_keepMove & "&";
- urlStr = CGI.SCRIPT_NAME & "?" & DTBA_keepMove & DTBA_moveParam & "=";
- DTBA_moveFirst = urlStr & "1";
- DTBA_moveLast = urlStr & "0";
- DTBA_moveNext = urlStr & (DTBA_offset + DTBA_size);
- DTBA_movePrev = urlStr & Max(DTBA_offset-DTBA_size,1);
- </cfscript>
-