Forum OpenACS Development: Re: ANN: tools::paginate

Collapse
13: Re: ANN: tools::paginate (response to 1)
Posted by Jon Griffin on
Robert,
I made the changes and pulled that query out of the .tcl (don't remember leaving that in there).
Thanks for your help and input. Let me know what you think and if you test it and it works I will put it in the OACS tree.
Collapse
14: Re: ANN: tools::paginate (response to 13)
Posted by Robert Locke on
Hi Jon,

Thanks! I think we're almost there. I will send you my version via email which has a few changes:

  • The URLs for the context markers include the current page number. However, if you click on a context marker (say, the letter "C") and that context has fewer pages than your current page (in say the "ALL" context), you will get a blank list. So, for generating context markers, I changed the call to build_url to exclude the ${name}_page variable.
  • The "-query" parameter to "tools::paginate" wasn't working properly (-queryname works fine). The problem was it calls:
    uplevel ... [db_string get_record_count_dynamic { *SQL* }]}
    But, at the template parse level, get_record_count_dynamic doesn't exist in any *.xql files. So, I changed this to do a db_map and then pass the query string directly to the uplevel'ed db_string call.
  • Made minor changes to the tools-*.xql files in support of the above changes.
  • The offset in tools-postgresql.xql should be [expr $start - 1], not $start (eg, if $start is the 11th, then you want to set the offset to 10 so that PG skips the first 10 records).
  • Your sample "index.tcl" file includes a call to "lset" which I think is a jongriffin.com(TM) Tcl proc. Perhaps change it to standard Tcl so folks don't trip on it and give up before they get to see how darn cool your paginator is. =)
  • Outstanding bug: If you click on a context marker, you lose all the other context markers. Here's an example from your sample page: http://jongriffin.com/static/openacs/paginate/sample/?objects%5fcontext=C Perhaps we should move the context logic into tools-procs.tcl? Will investigate.
  • I haven't tested anything under Oracle yet. Can you do that?
Your paginator rocks!