<head>
<title>Alzabo: The Perl Data Modeling Tool</title>
</head>

<body>

<table width="100%" cellspacing="0">

 <tr>
  <td colspan="5" align="center"><& .title, $s, $t, $user, $password, $host, $port &></td>
 </tr>

% if ($s) {
<& schema_menubar, $s, $user, $password, $host, $port &>
% }
</table>

<% $m->call_next(%args) %>

</body>
</html>

<%args>
$schema => undef
$table => undef
$user => undef
$password => undef
$host => undef
$port => undef
</%args>

<%init>

my $s;
my %args;
my ($comp, @args);
if ($schema)
{
    eval{ $s = Alzabo::Runtime::Schema->load_from_file( name => $schema ); };
    $m->comp( '../common/exception', $@ ) if $@;
    $args{s} = $s;

    my %c;
    $c{user} = $user if defined $user;
    $c{password} = $password if defined $password;
    $c{host} = $host if defined $host;
    $c{port} = $port if defined $port;
    $s->connect(%c);
}

my $t;
if ($table)
{
    eval{ $t = $s->table($table); };
    $m->comp( '../common/exception', $@ ) if $@;
    $args{t} = $t;
}

</%init>
<%flags>
inherit => undef
</%flags>

<%def .title>
<%init>
use Alzabo::Config;
use Alzabo::Runtime;

my ( $s, $t, $user, $password, $host, $port ) = @_;

my @t;
if (defined $s)
{
    push @t, $m->scomp( '../common/href',
			text => $s->name,
			path => 'browse_schema' . Alzabo::Config::mason_extension(),
			query => { schema => $s->name,
				   user => $user,
				   password => $password,
				   host => $host,
				   port => $port,
				 } );

    push @t, $m->scomp( '../common/href',
			text => $t->name,
			path => 'browse_table' . Alzabo::Config::mason_extension(),
			query => { schema => $s->name,
				   table => $t->name,
				   user => $user,
				   password => $password,
				   host => $host,
				   port => $port,
				 } ) if defined $t;
}
</%init>
<div align="center">
<a href="index.mhtml"><!--<img src="/alzabo/images/alzabo-logo.jpg" alt="return to index" border="0" width="75" height="50" hspacing="0" vspacing="0">-->Top level</a>
<hr width="25%" />
% if (@t) {
  <h2><% join ' : ', @t %></h2>
% }
</div>
</%def>
