% include('elements/svc_Common.html',
'table' => 'svc_port',
'fields' => \@fields,
'labels' => \%labels,
'html_foot' => $html_foot,
)
%>
<%init>
use Date::Parse 'str2time';
my $conf = new FS::Conf;
my $date_format = $conf->config('date_format') || '%m/%d/%Y';
my $fields = FS::svc_port->table_info->{'fields'};
my %labels = map { $_ => ( ref($fields->{$_})
? $fields->{$_}{'label'}
: $fields->{$_}
);
} keys %$fields;
my @fields = keys %$fields;
my $start = $cgi->param('start');
my $end = $cgi->param('end');
sub preset_range {
my($start,$end,$label,$date_format) = (shift,shift,shift,shift);
$start = time2str($date_format,$start);
$end = time2str($date_format,$end);
return ''.$label.'';
}
my $html_foot = sub {
my $svc_port = shift;
my $svcnum = $svc_port->svcnum;
my $default_end = time;
my $default_start = $default_end-86400;
my $graph = '';
my $nms = new FS::NetworkMonitoringSystem;
my $url = $nms->port_graphs_link($svc_port->serviceid);
my $link = $url ? qq(Torrus Graphs
) : '';
if ( $start && $end ) {
my($s, $e) = ($start, $end);
if ( $date_format eq '%d/%m/%Y' ) {
$start =~ /^\s*(\d+)\D+(\d+)\D+(\d+)\s*$/ and $s = "$2/$1/$3";
$end =~ /^\s*(\d+)\D+(\d+)\D+(\d+)\s*$/ and $e = "$2/$1/$3";
}
$graph = "
";
}
return '