pa_pagination_context_ids (public)
pa_pagination_context_ids curr ids [ context ]
Defined in packages/photo-album/tcl/photo-album-procs.tcl
- Parameters:
- curr (required)
- ids (required)
- context (optional, defaults to
"4"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set out {} set n_ids [llength $ids] # if the list is short enough just return it. if {$n_ids < 13} { set i 1 foreach id $ids { lappend out $id $i incr i } return $out } # what is the range about which to bracket set start [expr {[lsearch -exact $ids $curr ] - $context}] if {($start + 2 * $context + 1) > $n_ids} { set start [expr {$n_ids - 2 * $context - 1}] } if {$start < 0} { set start 0 } # tack on 1 if {$start > 0} { lappend out [lindex $ids 0] 1 } # context foreach id [lrange $ids $start [expr {$start + 2 * $context}]] { incr start lappend out $id $start } # tack on last if {$start < $n_ids} { lappend out [lrange $ids end end] $n_ids } return $outGeneric XQL file: packages/photo-album/tcl/photo-album-procs.xql
PostgreSQL XQL file: packages/photo-album/tcl/photo-album-procs-postgresql.xql
Oracle XQL file: packages/photo-album/tcl/photo-album-procs-oracle.xql