push @html, Maasha::XHTML::body_end;
push @html, Maasha::XHTML::html_end;
-# push @html, Maasha::XHTML::hdump( [ $cgi->Vars ] ); # DEBUG
+# push @html, Maasha::XHTML::hdump( { $cgi->Vars } ); # DEBUG
# push @html, Maasha::XHTML::hdump( \%ENV ); # DEBUG
# push @html, Maasha::XHTML::hdump( $cookie ); # DEBUG
cookie_login( $cookie );
$cookie->{ 'PAGE' } ||= $cgi->param( 'page' ) || 'login';
+
+ if ( $cookie->{ 'LOGIN' } eq 'OK' )
+ {
+ if ( $cgi->param( 'genome' ) ) {
+ $cookie->{ 'PAGE' } = 'browse';
+ } else {
+ $cookie->{ 'PAGE' } = 'clade';
+ }
+ }
+
$cookie->{ 'CLADE' } = $cgi->param( 'clade' ) || '';
$cookie->{ 'GENOME' } = $cgi->param( 'genome' ) || '';
$cookie->{ 'ASSEMBLY' } = $cgi->param( 'assembly' ) || '';
$cookie->{ 'FEAT_MAX' } = 5000; # TODO: Reduntant?
$cookie->{ 'LIST_USER' } = Maasha::BGB::Track::list_users();
- $cookie->{ 'LIST_CLADE' } = Maasha::BGB::Track::list_clades( $cookie->{ 'USER' } );
- $cookie->{ 'LIST_GENOME' } = Maasha::BGB::Track::list_genomes( $cookie->{ 'USER' }, $cookie->{ 'CLADE' } );
- $cookie->{ 'LIST_ASSEMBLY' } = Maasha::BGB::Track::list_assemblies( $cookie->{ 'USER' }, $cookie->{ 'CLADE' }, $cookie->{ 'GENOME' } );
- $cookie->{ 'LIST_CONTIG' } = Maasha::BGB::Track::list_contigs( $cookie->{ 'USER' }, $cookie->{ 'CLADE' }, $cookie->{ 'GENOME' }, $cookie->{ 'ASSEMBLY' } );
- if ( $cookie->{ 'CONTIG' } )
+ if ( $cookie->{ 'USER' } )
{
- cookie_start( $cookie );
- cookie_end( $cookie );
- cookie_zoom( $cookie );
- cookie_move( $cookie );
- cookie_center( $cookie );
+ $cookie->{ 'LIST_CLADE' } = Maasha::BGB::Track::list_clades( $cookie->{ 'USER' } );
+ $cookie->{ 'LIST_GENOME' } = Maasha::BGB::Track::list_genomes( $cookie->{ 'USER' }, $cookie->{ 'CLADE' } );
+ $cookie->{ 'LIST_ASSEMBLY' } = Maasha::BGB::Track::list_assemblies( $cookie->{ 'USER' }, $cookie->{ 'CLADE' }, $cookie->{ 'GENOME' } );
+ $cookie->{ 'LIST_CONTIG' } = Maasha::BGB::Track::list_contigs( $cookie->{ 'USER' }, $cookie->{ 'CLADE' }, $cookie->{ 'GENOME' }, $cookie->{ 'ASSEMBLY' } );
+
+ if ( $cookie->{ 'CONTIG' } )
+ {
+ cookie_start( $cookie );
+ cookie_end( $cookie );
+ cookie_zoom( $cookie );
+ cookie_move( $cookie );
+ cookie_center( $cookie );
+ }
}
$cookie->{ 'STRAND' } = '+' if defined $cookie->{ 'STRAND' } and $cookie->{ 'STRAND' } eq ' '; # FIXME ugly HTML fix
# {
# if ( $cookie->{ 'SESSION_ID' } ne $ENV{ 'SSL_SESSION_ID' } ) {
# $cookie->{ 'PAGE' } = 'login';
- # print STDERR "HER1"; # DEBUG
+ # print STDERR "HER1\n"; # DEBUG
# }
# }
# else
# {
# $cookie->{ 'PAGE' } = 'login';
#
- # print STDERR "HER2"; # DEBUG
+ # print STDERR "HER2\n"; # DEBUG
# }
if ( exists $session->{ $cookie->{ 'USER' } } and $cookie->{ 'SESSION_ID' } )
{
if ( $session->{ $cookie->{ 'USER' } }->{ 'SESSION_ID' } ne $cookie->{ 'SESSION_ID' } ) {
$cookie->{ 'PAGE' } = 'login';
- print STDERR "HER3"; # DEBUG
+ print STDERR "HER3\n"; # DEBUG
}
}
else
{
$cookie->{ 'PAGE' } = 'login';
- print STDERR "HER4"; # DEBUG
- print STDERR "NO COOKIE SESSION ID\n" if not $cookie->{ 'SESSION_ID' }; # DEBUG
- print STDERR "NO COOKIE USER\n" if not $cookie->{ 'USER' }; # DEBUG
+ print STDERR "HER4\n"; # DEBUG
+ print STDERR "NO COOKIE SESSION ID\n" if not $cookie->{ 'SESSION_ID' }; # DEBUG
+ print STDERR "NO COOKIE USER\n" if not $cookie->{ 'USER' }; # DEBUG
print STDERR "NO SESSION USER\n" if not exists $session->{ $cookie->{ 'USER' } }; # DEBUG
}
}
$cookie->{ 'SESSION_ID' } = $session->{ $cookie->{ 'USER' } }->{ 'SESSION_ID' };
$cookie->{ 'LOGIN' } = "OK";
- $cookie->{ 'PAGE' } = 'clade';
Maasha::BGB::Session::session_store( "$cookie->{ 'SESSION_DIR' }/sessions.txt", $session );
}
push @html, section_taxonomy_table( $cookie );
push @html, section_navigate( $cookie );
push @html, section_browse( $cookie );
+ push @html, section_linkout( $cookie );
return wantarray ? @html : \@html;
}
push @html, Maasha::XHTML::table_row_simple( tr => [ "", $login ] );
push @html, Maasha::XHTML::table_end;
+ if ( defined $cookie->{ 'CLADE' } and
+ defined $cookie->{ 'GENOME' } and
+ defined $cookie->{ 'ASSEMBLY' } and
+ defined $cookie->{ 'CONTIG' } and
+ defined $cookie->{ 'NAV_START' } and
+ defined $cookie->{ 'NAV_END' }
+ )
+ {
+ push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "clade", value => $cookie->{ 'CLADE' } ) );
+ push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "genome", value => $cookie->{ 'GENOME' } ) );
+ push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "assembly", value => $cookie->{ 'ASSEMBLY' } ) );
+ push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "contig", value => $cookie->{ 'CONTIG' } ) );
+ push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "nav_start", value => $cookie->{ 'NAV_START' } ) );
+ push @html, Maasha::XHTML::p( txt => Maasha::XHTML::hidden( name => "nav_end", value => $cookie->{ 'NAV_END' } ) );
+ }
+
if ( $cookie->{ 'LOGIN' } and $cookie->{ 'LOGIN' } eq 'ERROR' ) {
push @html, Maasha::XHTML::h3( txt => "Bad user or password - please retry", class => 'error' );
}
}
+sub section_linkout
+{
+ # Martin A. Hansen, March 2010.
+
+ # Returns a HTML section for a static link based on information in the cookie.
+
+ my ( $cookie, # cookie hash
+ ) = @_;
+
+ # Returns a list.
+
+ my ( $link, @html );
+
+ $link = Maasha::XHTML::ln(
+ txt => 'link',
+ href => join( "&", "$cookie->{ 'SCRIPT' }?page=browse",
+ "clade=$cookie->{ 'CLADE' }",
+ "genome=$cookie->{ 'GENOME' }",
+ "assembly=$cookie->{ 'ASSEMBLY' }",
+ "contig=$cookie->{ 'CONTIG' }",
+ "nav_start=$cookie->{ 'NAV_START' }",
+ "nav_end=$cookie->{ 'NAV_END' }",
+ ),
+ title => "Static link to this view",
+ );
+
+ push @html, Maasha::XHTML::p( txt => $link, class => 'center' );
+
+ return wantarray ? @html : \@html;
+}
+
+
sub section_browse
{
my ( $cookie,
"user=$cookie->{ 'USER' }",
"clade=$cookie->{ 'CLADE' }",
"genome=$cookie->{ 'GENOME' }",
- "contig=$cookie->{ 'CONTIG' }",
"assembly=$cookie->{ 'ASSEMBLY' }",
+ "contig=$cookie->{ 'CONTIG' }",
"nav_start=$cookie->{ 'NAV_START' }",
"nav_end=$cookie->{ 'NAV_END' }",
"nav_center=$center",
"user=$cookie->{ 'USER' }",
"clade=$cookie->{ 'CLADE' }",
"genome=$cookie->{ 'GENOME' }",
- "contig=$cookie->{ 'CONTIG' }",
"assembly=$cookie->{ 'ASSEMBLY' }",
+ "contig=$cookie->{ 'CONTIG' }",
"s_beg=$cookie->{ 'S_BEG' }",
"s_end=$cookie->{ 'S_END' }",
"strand=$cookie->{ 'STRAND' }",
"user=$cookie->{ 'USER' }",
"clade=$cookie->{ 'CLADE' }",
"genome=$cookie->{ 'GENOME' }",
- "contig=$cookie->{ 'CONTIG' }",
"assembly=$cookie->{ 'ASSEMBLY' }",
+ "contig=$cookie->{ 'CONTIG' }",
"nav_start=$cookie->{ 'NAV_START' }",
"nav_end=$cookie->{ 'NAV_END' }",
),
"user=$cookie->{ 'USER' }",
"clade=$cookie->{ 'CLADE' }",
"genome=$cookie->{ 'GENOME' }",
- "contig=$cookie->{ 'CONTIG' }",
"assembly=$cookie->{ 'ASSEMBLY' }",
+ "contig=$cookie->{ 'CONTIG' }",
"s_beg=$cookie->{ 'S_BEG' }",
"s_end=$cookie->{ 'S_END' }",
"strand=$cookie->{ 'STRAND' }",