[freeside-commits] freeside/httemplate/search sqlradius.cgi, 1.17.2.1, 1.17.2.2 sqlradius.html, 1.8, 1.8.2.1
Ivan,,,
ivan at wavetail.420.am
Tue Oct 21 21:39:58 PDT 2008
Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv3337/httemplate/search
Modified Files:
Tag: FREESIDE_1_7_BRANCH
sqlradius.cgi sqlradius.html
Log Message:
fix error on open-ended RADIUS search with Pg, add options for open session search and search on start time, RT#4051
Index: sqlradius.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/sqlradius.cgi,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -u -d -r1.17.2.1 -r1.17.2.2
--- sqlradius.cgi 13 Jan 2008 20:57:38 -0000 1.17.2.1
+++ sqlradius.cgi 22 Oct 2008 04:39:55 -0000 1.17.2.2
@@ -48,8 +48,17 @@
</TR>
% 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,
+% } )
+% }
% ) {
% if ( $bgcolor eq $bgcolor1 ) {
% $bgcolor = $bgcolor2;
@@ -88,14 +97,13 @@
###
#sort of false laziness w/cust_pay.cgi
-my $beginning = '';
-my $ending = '';
-if ( $cgi->param('beginning')
- && $cgi->param('beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
+my( $beginning, $ending ) = ( '', '' );
+if ( $cgi->param('stoptime_beginning')
+ && $cgi->param('stoptime_beginning') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
$beginning = str2time($1);
}
-if ( $cgi->param('ending')
- && $cgi->param('ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
+if ( $cgi->param('stoptime_ending')
+ && $cgi->param('stoptime_ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
$ending = str2time($1); # + 86399;
}
if ( $cgi->param('begin') && $cgi->param('begin') =~ /^(\d+)$/ ) {
@@ -105,6 +113,21 @@
$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 = str2time($1);
+}
+if ( $cgi->param('starttime_ending')
+ && $cgi->param('starttime_ending') =~ /^([ 0-9\-\/\:\w]{0,54})$/ ) {
+ $starttime_ending = str2time($1); # + 86399;
+}
+
my $cgi_svc_acct = '';
if ( $cgi->param('svcnum') =~ /^(\d+)$/ ) {
$cgi_svc_acct = qsearchs( 'svc_acct', { 'svcnum' => $1 } );
Index: sqlradius.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/sqlradius.html,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -d -r1.8 -r1.8.2.1
--- sqlradius.html 3 Feb 2007 11:36:30 -0000 1.8
+++ sqlradius.html 22 Oct 2008 04:39:55 -0000 1.8.2.1
@@ -43,8 +43,72 @@
</TR>
% }
+ <TR>
+ <TD>Show:</TD>
+ <TD>
+ <INPUT TYPE="radio" NAME="open_sessions" VALUE="0" onClick="open_changed(this);" CHECKED>Completed sessions<BR>
+ <INPUT TYPE="radio" NAME="open_sessions" VALUE="1" onClick="open_changed(this);">Open sessions
+ </TD>
+ </TR>
-<% include( '/elements/tr-input-beginning_ending.html', 'input_time'=>1 ) %>
+ <TR>
+ <TH COLSPAN=2>Session start</TD>
+ </TR>
+
+ <% include( '/elements/tr-input-beginning_ending.html',
+ 'prefix' => 'starttime',
+ 'input_time' => 1,
+ )
+ %>
+
+ <SCRIPT TYPE="text/javascript">
+
+ function open_changed(what) {
+
+ var value=get_open_value(what);
+ if ( value == '1' ) {
+ what.form.stoptime_beginning_text.disabled = true;
+ what.form.stoptime_ending_text.disabled = true;
+ what.form.stoptime_beginning_text.style.backgroundColor = '#dddddd';
+ what.form.stoptime_ending_text.style.backgroundColor = '#dddddd';
+ what.form.stoptime_beginning_button.style.display = 'none';
+ what.form.stoptime_ending_button.style.display = 'none';
+ what.form.stoptime_beginning_disabled.style.display = '';
+ what.form.stoptime_ending_disabled.style.display = '';
+ } else if ( value == '0' ) {
+ what.form.stoptime_beginning_text.disabled = false;
+ what.form.stoptime_ending_text.disabled = false;
+ what.form.stoptime_beginning_text.style.backgroundColor = '#ffffff';
+ what.form.stoptime_ending_text.style.backgroundColor = '#ffffff';
+ what.form.stoptime_beginning_button.style.display = '';
+ what.form.stoptime_ending_button.style.display = '';
+ what.form.stoptime_beginning_disabled.style.display = 'none';
+ what.form.stoptime_ending_disabled.style.display = 'none';
+ }
+
+ }
+
+ function get_open_value(what) {
+ var rad_val = '';
+ for (var i=0; i < what.form.open_sessions.length; i++) {
+ if (what.form.open_sessions[i].checked) {
+ var rad_val = what.form.open_sessions[i].value;
+ }
+ }
+ return rad_val;
+ }
+
+ </SCRIPT>
+
+ <TR>
+ <TH COLSPAN=2>Session end</TD>
+ </TR>
+
+ <% include( '/elements/tr-input-beginning_ending.html',
+ 'prefix' => 'stoptime',
+ 'input_time' => 1,
+ )
+ %>
</TABLE>
<BR><INPUT TYPE="submit" VALUE="View sessions">
More information about the freeside-commits
mailing list