X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fport_graph.html;fp=httemplate%2Fview%2Fport_graph.html;h=fc5d0db3fa8194fb3ab79bd5bd25e992a512af99;hb=6877b0f1447c211f1a992487eeaf9bda787c4b71;hp=0000000000000000000000000000000000000000;hpb=7a30043712c15f9db1604ea1c3acd7db203d14c2;p=freeside.git diff --git a/httemplate/view/port_graph.html b/httemplate/view/port_graph.html new file mode 100644 index 000000000..fc5d0db3f --- /dev/null +++ b/httemplate/view/port_graph.html @@ -0,0 +1,40 @@ +% if ($error) { warn $error; } +% else { +<% $png %> +% } +<%init> + +# NOTE: the weird warn/die stuff here is because this file is accessed as +# IMG SRC="port_graph.html" - easier than hacking an uglier solution + +unless ( $FS::CurrentUser::CurrentUser->access_right('View customer services') ) { + warn "access denied"; + die; +} + +my $svcnum = $cgi->param('svcnum'); +unless ( $svcnum =~ /^\d+$/ ) { + warn 'invalid svcnum'; + die; +} + +my $start = $cgi->param('start'); +my $end = $cgi->param('end'); +unless ( $start =~ /^\d+$/ && $end =~ /^\d+$/ ) { + warn 'invalid start and/or end times'; + die; +} + +my $svc_port = qsearchs('svc_port', { 'svcnum' => $svcnum }); +unless($svc_port) { + warn 'invalid svc_port'; + die; +} + +my $error = ''; +my $png = $svc_port->graph_png('start' => $start, 'end' => $end); +$error = 'error from graph_png: '.$png if length($png) < 200; + +http_header('Content-Type' => 'image/png') unless($error); + +