+sub page
+{
+ my ( $cookie,
+ ) = @_;
+
+ # Returns a list.
+
+ my ( @html, $list, $item, $href );
+
+ push @html, breadcrumb( $cookie );
+
+ $list = "LIST_" . uc $cookie->{ 'PAGE' };
+
+ if ( $cookie->{ 'PAGE' } ne 'browse' )
+ {
+ push @html, Maasha::XHTML::h2( txt => "Select $cookie->{ 'PAGE' }", class => 'center' );
+
+ push @html, Maasha::XHTML::table_beg( summary => "Select table", align => 'center', cellpadding => '5px' );
+
+ foreach $item ( @{ $cookie->{ $list } } )
+ {
+ $cookie->{ uc $cookie->{ 'PAGE' } } = $item;
+
+ $href = page_href( $cookie, page_next( $cookie ) );
+
+ push @html, Maasha::XHTML::table_row_simple( tr => [ Maasha::XHTML::ln( txt => $item, href => $href ) ] );
+ }
+
+ push @html, Maasha::XHTML::table_end;
+ }
+ else
+ {
+ push @html, sec_navigate( $cookie );
+ push @html, sec_browse( $cookie );
+ }
+
+ return wantarray ? @html : \@html;
+}
+
+
+sub page_next
+{
+ my ( $cookie,
+ ) = @_;
+
+ my ( $i );
+
+ for ( $i = 0; $i < @{ $cookie->{ 'LIST_PAGES' } }; $i++ ) {
+ last if $cookie->{ 'PAGE' } eq $cookie->{ 'LIST_PAGES' }->[ $i ];
+ }
+
+ return $cookie->{ 'LIST_PAGES' }->[ $i + 1 ];
+}
+
+
+sub breadcrumb
+{
+ my ( $cookie,
+ ) = @_;
+
+ # Returns a list.
+
+ my ( @pages, $page, @row1, @row2, @html, $href, $txt );
+
+ @pages = @{ $cookie->{ 'LIST_PAGES' } };
+
+ pop @pages; # remove 'browse'
+
+ foreach $page ( @pages )
+ {
+ $href = page_href( $cookie, $page );
+
+ $txt = $cookie->{ uc $page } || "";
+
+ push @row1, Maasha::XHTML::ln( txt => $page, href => $href, class => 'inline' );
+ push @row2, Maasha::XHTML::p( txt => $txt, class => 'inline' );
+
+ last if $page eq $cookie->{ 'PAGE' };
+ }
+
+ push @html, Maasha::XHTML::table_beg( summary => "Taxonomy table", align => 'center', cellpadding => '5px' );
+ push @html, Maasha::XHTML::table_row_simple( tr => \@row1, align => 'center' );
+ push @html, Maasha::XHTML::table_row_simple( tr => \@row2, align => 'center' );
+ push @html, Maasha::XHTML::table_end;
+
+ return wantarray ? @html : \@html;
+}
+
+
+sub page_href
+{
+ my ( $cookie,
+ $page,
+ ) = @_;
+
+ # Returns a string.
+
+ my ( @href );
+
+ while ( 1 )
+ {
+ push @href, "$cookie->{ 'SCRIPT' }?page=$page";
+ push @href, "user=$cookie->{ 'USER' }" if $cookie->{ 'USER' };
+ last if $page eq 'user';
+ push @href, "clade=$cookie->{ 'CLADE' }" if $cookie->{ 'CLADE' };
+ last if $page eq 'clade';
+ push @href, "genome=$cookie->{ 'GENOME' }" if $cookie->{ 'GENOME' };
+ last if $page eq 'genome';
+ push @href, "assembly=$cookie->{ 'ASSEMBLY' }" if $cookie->{ 'ASSEMBLY' };
+ last if $page eq 'assembly';
+ push @href, "contig=$cookie->{ 'CONTIG' }" if $cookie->{ 'CONTIG' };
+ last if $page eq 'contig';
+ last;
+ }
+
+ return join "&", @href;
+}
+
+