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

Collapse
10: Re: ANN: tools::paginate (response to 1)
Posted by Robert Locke on
Hi Jon,

Found time to experiment with your code today and found that I couldn't get it to work with OACS4.6.3/PG7.2.4 without making various changes (perhaps I picked up an old version from your web page?):

* In tools-procs.tcl, in the "::tools::paginate" proc, I had to alias the sub-selects in both "get_record_count" queries by adding "as x".  Otherwise, PG bombs.  I'm not sure if this breaks Oracle, but it certainly breaks our rule of not allowing queries in .tcl files. =)

* The "tools::paginate_sql.get_limit" PG query from tools-procs-postgresql.xql is broken.  It needs to alias the sub-select (using "as x") and it incorrectly uses the PG limit/offset clause.  I think it should read:

    select * from
    ($query) as x limit $max_display offset [expr $start -1]

* The "tools::paginate.get_context" PG query from the same file uses:
    substr(upper($context_field), 0, 1)
which by definition returns nothing in PG.  I'm assuming you wanted to return the 1st character or:
    substr(upper($context_field), 1, 1)
Also, it would be cool if you could pass in the number of letters for the context (for very large lists).

* The above fix produces a nifty alphabetical navigation bar, but clicking on the different letters doesn't do anything.  Should there be code in the sample ".tcl" file that uses "objects_context" to limit the query?  Or should that logic be added to "tools-procs.tcl"?

* In your sample ".tcl", you need to escape the double-quote at the beginning of \"edit-object...

* The sample ".xql" file does not use the "objects_orderby" clause and should probably read:

    select object_id,
    object_type,to_char(creation_date,'MM/DD/YYYY HH:MI') as creation_date
    from acs_objects a
    order by $objects_orderby

* Is reverse ordering supposed to work when clicking on a column header twice?

Other than those issues, the paginator is very cool and I would be willing to help out in any way.

Should I work on the above items and just send you a patch?