pa_pagination_bar (public)

 pa_pagination_bar cur_id all_ids link [ what ]

Defined in packages/photo-album/tcl/photo-album-procs.tcl

given a current photo_id and an ordered list of all the photo_id in an album creates an html fragment that allows user to navigate to any photo by number next/previous

Parameters:
cur_id (required)
all_ids (required)
link (required)
what (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 packages/photo-album/www/album.tcl packages/photo-album/ www/album.tcl pa_pagination_bar pa_pagination_bar packages/photo-album/www/album.tcl->pa_pagination_bar packages/photo-album/www/base-photo.tcl packages/photo-album/ www/base-photo.tcl packages/photo-album/www/base-photo.tcl->pa_pagination_bar packages/photo-album/www/photo.tcl packages/photo-album/ www/photo.tcl packages/photo-album/www/photo.tcl->pa_pagination_bar packages/photo-album/www/photos-edit.tcl packages/photo-album/ www/photos-edit.tcl packages/photo-album/www/photos-edit.tcl->pa_pagination_bar _ _ (public) pa_pagination_bar->_ pa_pagination_context_ids pa_pagination_context_ids (public) pa_pagination_bar->pa_pagination_context_ids

Testcases:
No testcase defined.
Source code:
    if { $cur_id eq "" || [llength $all_ids] < 2 } {
    return ""
    }

    set cur_index [lsearch -exact $all_ids $cur_id]
    set prev_id [lindex $all_ids $cur_index-1]
    set next_id [lindex $all_ids $cur_index+1]
    set photo_nav_html ""
    if {$what ne ""} { 
        set what "&nbsp;$what"
    }
    # append the 'prev' link
    append photo_nav_html "<div class=\"photo_album_nav\">\n"
    if { $prev_id ne "" } {
    append photo_nav_html [subst {
        <div style="text-align: left; float: left; margin-right: 1em; margin-bottom: 1em">
        <a href="[ns_quotehtml ${link}$prev_id]">&lt;&lt;&nbsp;[_ photo-album.Prev]$what</a>
        </div>
    }]
    }
    # append the 'next' link
    if { $next_id ne "" } {
    append photo_nav_html [subst {
        <div style="text-align: right; float: right; margin-left: 1em; margin-bottom: 1em">
        <a href="[ns_quotehtml ${link}$next_id]">[_ photo-album.Netx]$what&nbsp;&gt;&gt;</a>
        </div>
    }]
    }

    # append page number links for all pages except for this page
    append photo_nav_html "\t<div style=\"text-align: center\">\n"
    set i 0
    set last {}
    foreach {id i} [pa_pagination_context_ids $cur_id $all_ids 4] {
        if {$last ne "" && ($last + 1) != $i} {
            append photo_nav_html "&#8226;"
        } 
        set last $i
    if { $cur_id == $id } {
        append photo_nav_html "\t\t<strong>$i</strong>\n"
    } else {
        append photo_nav_html [subst {<a href="[ns_quotehtml ${link}$id]">$i</a>}]
    }
    
    }
    append photo_nav_html "\t</div>\n"

    append photo_nav_html "</div>\n"
    return $photo_nav_html
Generic 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

[ hide source ] | [ make this the default ]
Show another procedure: