<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>n e t  d i s c o <& SELF:title &> </TITLE>
<STYLE TYPE="text/css" MEDIA="screen">
<!--
    A { text-decoration:none; }
    H3 { font-family:arial,helvetica,sans-serif; font-size:12pt; text-indent:5px;
         background-color:#191970; color:#f5deb3; margin:5px 0px 5px 0px;}
    H4 { font-family:arial,helvetica,sans-serif; font-size:11pt; margin-bottom:5px;}
    TH { font-family:arial,helvetica,sans-serif; font-size:12pt; text-align:center;}
    TD { font-family:arial,helvetica,sans-serif; font-size:10pt; }
    INPUT { font-family:monospace; font-size:9pt; }
    BODY { position:absolute; top:0; left:0; }
    BODY, #page { margin:0; padding:0; width:100%; height:100%; }
    FORM { margin-bottom:0; margin-top:0; }
    UL,DL,OL { margin-top:0; margin-bottom:0; }
    .topbar { background-color:#8b7e66; color:#eed8ae; height:16pt;
              font-family:arial,helvetica,serif; font-size:14pt; border:black; } 
    .botbar { background-color:#8b7e66; color:#eed8ae;  height:22px; 
              vertical-align:bottom; font-family:arial,helvetica,serif; font-size:8pt; }
    .sidebar-bg { background-color:darkblue; border:black; }
    .sidebar-0 { text-align:center; background-color:#eed8ae;}
    .sidebar-1 { text-align:center; background-color:#ffe7ba;}
    .match-1 { text-align:center; background-color:#eed8ae;}
    .match-0 { text-align:center; background-color:#ffe7ba;}
    .box     { background-color:#eed8ae; border:thin solid; border-color:#191970; }
    .port-up { color:black;}
    .port-off { color:red;}
    .port-down { color:#a0a0a0; }
    .port-block { color:#33ccff; }
    .dead-link { color:white; background-color:red;}
    .ip-phone {color: white; background-color:blue;}
    .device-link { color:blue; }
    .tr-head   { text-align:left; font:normal normal 12pt monospace;}
    .tr-data-1 { text-align:left; font-family:monospace; background-color:#eed8ae; }
    .tr-data-0 { text-align:left; font-family:monospace; background-color:#ffe7ba; }
    .highlight { color:red;}

//-->
</STYLE>
<& SELF:html_head &>
</HEAD>
<BODY bgcolor="#f5deb3" text="black" LINK="#000099" ALINK="#000099" VLINK="#000099">
<TABLE width="95%" HEIGHT="95%" CELLSPACING=0 CELLPADDING=0 BORDER=0 id="page">
<TR VALIGN=TOP>
    <TD COLSPAN=3 class="topbar" height="20">
        <IMG SRC="<%$path%>/corner-tl.png" BORDER=0 ALIGN=TOP ALT="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;N e t  d i s c o 
    </TD>
</TR>
<TR VALIGN=TOP>
    <TD ALIGN=LEFT WIDTH="15%">
        <& sidebar.html &>
    </TD>
    <TD>&nbsp;</TD>
    <TD VALIGN=TOP ALIGN=LEFT WIDTH="85%">
%       $m->call_next;
    </TD>
</TR>
<TR>
    <TD VALIGN=BOTTOM colspan=3 class="botbar" ALIGN=CENTER>
        Netdisco <%$netdisco::VERSION%> 
    </TD>
</TR>
</TABLE>
</BODY>
</HTML>
<%init>
my $cfgupdate = netdisco::updateconfig();
my $session_timeout = $netdisco::CONFIG{websession} || 60; # min

my $ok = 0;
# Authentication - Logged in and not expired?
if (defined $m->session->{_logged_in} and $m->session->{_logged_in} ){
    if (defined $m->session->{start}) {
        my $age = time - $m->session->{start};
        $ok = $age < 60*$session_timeout;
    } 
}

# Redirect to Login page unless we're ok
my $path   = $netdisco::CONFIG{webpath};
my $target = $m->fetch_next->name;
unless ($ok or $target =~ /(apache_)?login.html/) {
    my $target_uri = $r->uri;
    my $target_args = $r->args;
    my $url = $target_uri;
    $url .= "?$target_args" if (defined $target_args and length($target_args));
    HTML::Mason::Escapes::url_escape(\$url);
    my $page = $netdisco::CONFIG{apache_auth} ? "apache_login" : "login";
    $m->redirect("$path/$page.html?done=$url");
} 

# For Logging, tell apache what user is in:
$r->connection->user($m->session->{user}) if ($ok && defined($m->session->{user}));
</%init>
<%method html_head>
\
</%method>
<%method title>
\
</%method>
%# $Id: autohandler,v 1.21 2006/03/29 04:31:16 fenner Exp $
%# vim:syntax=mason
