summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorlevinse <levinse>2011-05-11 15:23:56 +0000
committerlevinse <levinse>2011-05-11 15:23:56 +0000
commit38eb380a88ea7a130e83b77ff9c51ef6967b707b (patch)
treeb6417e68499956b5bdb1aba6393dc749e819d816 /httemplate
parent9c6d500c5fc6704e6186caa8727e79e7c600bd8a (diff)
add summarized RADIUS report feature, RT11776
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/search/sqlradius.cgi42
-rw-r--r--httemplate/search/sqlradius.html6
2 files changed, 47 insertions, 1 deletions
diff --git a/httemplate/search/sqlradius.cgi b/httemplate/search/sqlradius.cgi
index cca121179..5363944e4 100644
--- a/httemplate/search/sqlradius.cgi
+++ b/httemplate/search/sqlradius.cgi
@@ -57,6 +57,7 @@
% 'svc_acct' => $cgi_svc_acct,
% 'ip' => $ip,
% 'prefix' => $prefix,
+% 'summarize' => $summarize,
% } )
% }
% ) {
@@ -96,6 +97,9 @@ 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, $ending ) = ( '', '' );
if ( $cgi->param('stoptime_beginning')
@@ -265,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',
@@ -322,6 +361,7 @@ tie my %fields, 'Tie::IxHash',
align => 'right',
},
;
+}
$fields{$_}->{fmt} ||= sub { length($_[0]) ? shift : '&nbsp'; }
foreach keys %fields;
diff --git a/httemplate/search/sqlradius.html b/httemplate/search/sqlradius.html
index 8c405982f..7b9fce310 100644
--- a/httemplate/search/sqlradius.html
+++ b/httemplate/search/sqlradius.html
@@ -8,6 +8,12 @@
<TD ALIGN="right">Username: </TD>
<TD><INPUT TYPE="text" NAME="username"></TD>
</TR>
+<% include( '/elements/tr-checkbox.html',
+ 'field' => 'summarize',
+ 'label' => 'Summarize',
+ 'value' => 'Y',
+ )
+%>
<TR>
<TD></TD>
<TD><FONT SIZE="-1"><I>(leave blank to show all users)</I></FONT></TD>