1 <% include('elements/svc_Common.html',
5 'html_foot' => $html_foot,
10 use Date::Parse 'str2time';
12 my $conf = new FS::Conf;
13 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
15 my $fields = FS::svc_port->table_info->{'fields'};
16 my %labels = map { $_ => ( ref($fields->{$_})
17 ? $fields->{$_}{'label'}
21 my @fields = keys %$fields;
23 my $start = $cgi->param('start');
24 my $end = $cgi->param('end');
27 my($start,$end,$label,$date_format) = (shift,shift,shift,shift);
28 $start = time2str($date_format,$start);
29 $end = time2str($date_format,$end);
30 return '<A HREF="javascript:void(0);" onclick="preset_range(\''
31 .$start.'\',\''.$end.'\')">'.$label.'</A>';
36 my $svcnum = $svc_port->svcnum;
37 my $default_end = time;
38 my $default_start = $default_end-86400;
41 my $nms = new FS::NetworkMonitoringSystem;
42 my $url = $nms->port_graphs_link($svc_port->serviceid);
43 my $link = $url ? qq(<A HREF="$url">Torrus Graphs</A><BR><BR>) : '';
46 $graph = "<BR><BR><IMG SRC=${p}/view/port_graph.html?svcnum=$svcnum;".
47 "start=".str2time("$start 00:00:00").";end=".str2time("$end 23:59:59").">";
51 <script type="text/javascript">
52 function preset_range(start,end){
53 document.getElementById(\'start_text\').value = start;
54 document.getElementById(\'end_text\').value = end;
57 <FORM ACTION=? METHOD="GET">
58 <INPUT TYPE="HIDDEN" NAME="svcnum" VALUE="'.$svcnum.'">
60 <B>Bandwidth Graph</B><BR>
61 '.preset_range($default_start,$default_end,'Last Day',$date_format)
62 .' | '.preset_range($default_end-86400*7,$default_end,'Last Week',$date_format)
63 .' | '.preset_range($default_end-86400*30,$default_end,'Last Month',$date_format)
64 .' | '.preset_range($default_end-86400*365,$default_end,'Last Year',$date_format)
67 . include('/elements/tr-input-date-field.html', {
69 'label' => 'Start Date',
72 . include('/elements/tr-input-date-field.html', {
74 'label' => 'End Date',
78 . '<TR><TD colspan="2"><input type="submit" value="Display"></TR>