<%doc>

 Reports Section.

</%doc>
%
%
<%args>
$user => $ui->get_current_user($r);
</%args>
%
%
<%attr>
title   => 'Reports' 
section => 'Reports'
</%attr>
%
%
<%shared>
my $PAGE_ATTRIBUTE = "REPORTS_PAGE";
my $SECTION = "Reports";
</%shared>
%
%
<%init>

my $manager = $ui->get_permission_manager($r);
unless ( $manager && $manager->can($user, "access_section", 'reports') ){
    $m->comp('/generic/error.mhtml', error=>"You don't have permission to access this section");
}

my %caller_args = $m->caller_args(-1);
if (exists($caller_args{page})){
    $user->setAttribute($r, "$PAGE_ATTRIBUTE", $caller_args{page});
}
my $page = $user->getAttribute("$PAGE_ATTRIBUTE");
</%init>

<%method .section_meta_data>
    <%doc>
        Returns the meta data used to generate this sections header in section1.mhtml
    </%doc>
    <%init>
        return {  
	    section      => $SECTION,
	    page         => 'reports/',
	    title        => 'Reports',
	    attribute    => $PAGE_ATTRIBUTE,
	    sub_sections => [
		{ section => 'DEVICE',    title => 'Devices' },
		{ section => 'ASSET',     title => 'Assets' },
		{ section => 'IP',        title => 'IP' },
		{ section => 'MACS',      title => 'MAC Addresses' },
		{ section => 'TOPOLOGY',  title => 'Topology Graph' },
		{ section => 'POLLSTATS', title => 'Polling Stats' },
		{ section => 'DATABASE',  title => 'Database Reports' },
	    ]
        };
    </%init>
</%method>

<%perl>

if ( $page eq "POLLSTATS" ) {
</%perl>	
    <div class="container">
	<div class="containerhead">Device Polling Statistics</div>
	<div class="containerbody">
	<table border="0">
  	  <tr>
	    <td><a href="addr_poll_stats.html">Network Addresses</a></td>
	    <td>MAC and IP addresses active on the Network</td>
	  </tr>
  	  <tr>
	    <td><a href="dev_poll_stats.html">Devices</a></td>
	    <td>Devices being polled for ARP caches and forwarding tables</td>
	  </tr>
  	  <tr>
	    <td><a href="time_poll_stats.html">Poll Time</a></td>
	    <td>Device polling time</td>
	  </tr>
	</table>
	</div>
    </div>
 
<%perl>

}elsif ( $page eq "DEVICE" && $m->request_comp->name ne "device_inventory.html" ) {
	
	$m->comp('device_inventory.html');

}elsif($page eq "ASSET" && $m->request_comp->name ne "asset_inventory.html"){
	$m->comp('asset_inventory.html');

}elsif ( $page eq "IP" && $m->request_comp->name ne "ip_reports.html" ) {
	
	$m->comp('ip_reports.html');

}elsif ( $page eq "MACS" && $m->request_comp->name ne "macs_by_vendor.html" ) {

	$m->comp('macs_by_vendor.html');

}elsif ($page eq "DATABASE") {
</%perl>	
	<div class="container">
	<div class="containerhead">Database Reports</div>
	<div class="containerbody">
	
%    if ( Netdot->config->get('DB_TYPE') eq 'mysql' ){
	<br>
	<a href="mysql_stats.html">Table Information</a><br>
	Shows information about all the tables in the database including size, number of rows, and last update times.<br>

%    }else{
	<br>
	Sorry.  Only MySQL report available at this time.
%    }
	<br>
	
	</div>
	</div>
<%perl>
}elsif ( $page eq "TOPOLOGY" && $m->request_comp->name ne 'topology_graph.html' ) { 

    $m->comp('topology_graph.html');

}elsif ($page eq "CUSTOM") { 
  
}

if ( $m->fetch_next ){
    $m->call_next;
}


</%perl>
