X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Fsqlradius.cgi;h=5363944e47ce1bd08cd57acd029ff343b43a0d8d;hp=324729b6a7c117530ad96854f5d42b60f6fd85f3;hb=30f9308a0b5b482e1d1f11444078309834a66dd6;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1 diff --git a/httemplate/search/sqlradius.cgi b/httemplate/search/sqlradius.cgi index 324729b6a..5363944e4 100644 --- a/httemplate/search/sqlradius.cgi +++ b/httemplate/search/sqlradius.cgi @@ -1,10 +1,4 @@ -<% include( '/elements/header.html', 'RADIUS Sessions', - include('/elements/menubar.html', - 'Main menu' => $p, # popurl(2), - ), - - ) -%> +<% include( '/elements/header.html', 'RADIUS Sessions') %> % ### % # and finally, display the thing @@ -54,8 +48,18 @@ % foreach my $session ( -% @{ $part_export->usage_sessions( -% $beginning, $ending, $cgi_svc_acct, $ip, $prefix, ) } +% @{ $part_export->usage_sessions( { +% 'stoptime_start' => $beginning, +% 'stoptime_end' => $ending, +% 'open_sessions' => $open_sessions, +% 'starttime_start' => $starttime_beginning, +% 'starttime_end' => $starttime_ending, +% 'svc_acct' => $cgi_svc_acct, +% 'ip' => $ip, +% 'prefix' => $prefix, +% 'summarize' => $summarize, +% } ) +% } % ) { % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; @@ -93,16 +97,18 @@ die "access denied" # parse cgi params ### +my $summarize = 0; +$summarize = 1 if $cgi->param('summarize') eq 'Y'; + #sort of false laziness w/cust_pay.cgi -my $beginning = ''; -my $ending = ''; -if ( $cgi->param('beginning') - && $cgi->param('beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) { - $beginning = str2time($1); +my( $beginning, $ending ) = ( '', '' ); +if ( $cgi->param('stoptime_beginning') + && $cgi->param('stoptime_beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) { + $beginning = parse_datetime($1); } -if ( $cgi->param('ending') - && $cgi->param('ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) { - $ending = str2time($1); # + 86399; +if ( $cgi->param('stoptime_ending') + && $cgi->param('stoptime_ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) { + $ending = parse_datetime($1); # + 86399; } if ( $cgi->param('begin') && $cgi->param('begin') =~ /^(\d+)$/ ) { $beginning = $1; @@ -111,6 +117,21 @@ if ( $cgi->param('end') && $cgi->param('end') =~ /^(\d+)$/ ) { $ending = $1; } +my $open_sessions = ''; +if ( $cgi->param('open_sessions') =~ /^(\d*)$/ ) { + $open_sessions = $1; +} + +my( $starttime_beginning, $starttime_ending ) = ( '', '' ); +if ( $cgi->param('starttime_beginning') + && $cgi->param('starttime_beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) { + $starttime_beginning = parse_datetime($1); +} +if ( $cgi->param('starttime_ending') + && $cgi->param('starttime_ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) { + $starttime_ending = parse_datetime($1); # + 86399; +} + my $cgi_svc_acct = ''; if ( $cgi->param('svcnum') =~ /^(\d+)$/ ) { $cgi_svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $1 } ); @@ -248,7 +269,42 @@ my $octets_format = sub { # the fields ### -tie my %fields, 'Tie::IxHash', +my %fields; +if ( $summarize ) { +tie %fields, 'Tie::IxHash', + 'username' => { + name => 'User', + attrib => 'UserName', + fmt => $user_format, + align => 'left', + }, + 'dummy' => { + name => 'Customer', + attrib => '', + fmt => $customer_format, + align => 'left', + }, + 'acctsessiontime' => { + name => 'Duration', + attrib => 'Acct-Session-Time', + fmt => $duration_format, + align => 'right', + }, + 'acctinputoctets' => { + name => 'Upload', # (from user)', + attrib => 'Acct-Input-Octets', + fmt => $octets_format, + align => 'right', + }, + 'acctoutputoctets' => { + name => 'Download', # (to user)', + attrib => 'Acct-Output-Octets', + fmt => $octets_format, + align => 'right', + }, +; +} else { +tie %fields, 'Tie::IxHash', 'username' => { name => 'User', attrib => 'UserName', @@ -305,6 +361,7 @@ tie my %fields, 'Tie::IxHash', align => 'right', }, ; +} $fields{$_}->{fmt} ||= sub { length($_[0]) ? shift : ' '; } foreach keys %fields;