<html>
<head>
<title>Alzabo: The Perl Data Modeling Tool</title>
<link rel=stylesheet href="<% $stylesheet %>" type="text/css">
</head>

<body bgcolor="#ffffff">

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

 <tr>
  <td colspan="5" align="center"><& .title, $s, $t, $c &></td>
 </tr>

% if ($s) {
<& schema_menubar, $s &>
%   if ($t) {
<& table_menubar, $t &>
%   }
% }
% if (@errors) {
 <tr>
  <td colspan="5">&nbsp;</td>
 </tr>
%   foreach (@errors) {
 <tr>
  <td colspan="5"><span class="red16"><% $_ %></span></td>
 </tr>
%   }
% }
</table>


<& $m->fetch_next, %args, %ARGS &>

</body>
</html>

<%args>
$schema => undef
$table => undef
$column => undef
$foreign_key_table_to => undef
$foreign_key_columns_from => undef
$foreign_key_columns_to => undef
@errors => ()
</%args>

<%init>
use Alzabo::Create;
use HTTP::BrowserDetect;

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

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

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

my $browser = HTTP::BrowserDetect->new( $ENV{USER_AGENT} );
my $stylesheet = 'styles_ns.css';
if ( $browser->major >= 4 &&
     $browser->ie &&
     ( $browser->mac || $browser->windows ) )
{
    $stylesheet = 'styles_ie.css';
}
</%init>

<%def .title>
<%init>
my ( $s, $t, $c ) = @_;

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

    if (defined $t)
    {
	push @t, $c ? $m->scomp( '../common/href',
				 text => $t->name,
				 path => 'view_table' . Alzabo::Config::mason_extension(),
				 query => { schema => $s->name,
					table => $t->name } ) : $t->name;
    }

    push @t, $c->name if defined $c;
}
</%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) {
  <span class="teal16bold"><% join ' : ', @t %></span>
% }
</div>
</%def>
<%flags>
inherit => 'syshandler'
</%flags>
