[freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi view_port_graph.html, NONE, 1.1 view_usage.html, 1.7, 1.8 selfservice.cgi, 1.56, 1.57
Erik Levinson
levinse at wavetail.420.am
Fri Feb 4 00:23:48 PST 2011
Update of /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi
In directory wavetail.420.am:/tmp/cvs-serv11906/fs_selfservice/FS-SelfService/cgi
Modified Files:
view_usage.html selfservice.cgi
Added Files:
view_port_graph.html
Log Message:
torrus SS first pass, RT10574
Index: selfservice.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/selfservice.cgi,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -w -d -r1.56 -r1.57
--- selfservice.cgi 31 Jan 2011 06:30:36 -0000 1.56
+++ selfservice.cgi 4 Feb 2011 08:23:46 -0000 1.57
@@ -111,6 +111,8 @@
view_usage_details
view_cdr_details
view_support_details
+ view_port_graph
+ real_port_graph
change_password
process_change_password
customer_suspend_pkg
@@ -802,27 +804,35 @@
);
}
-sub view_usage_details {
+sub real_port_graph {
my $svcnum = $cgi->param('svcnum');
-
- # for svc_port graphs
- if($cgi->param($svcnum.'_start') && $cgi->param($svcnum.'_end')) {
- return port_graph(
+ my $res = port_graph(
'session_id' => $session_id,
'svcnum' => $svcnum,
- 'start' => str2time($cgi->param($svcnum.'_start')),
- 'end' => str2time($cgi->param($svcnum.'_end')),
+ 'beginning' => str2time($cgi->param('start')." 00:00:00"),
+ 'ending' => str2time($cgi->param('end')." 23:59:59"),
);
+ my @usage = @{$res->{'usage'}};
+ my $png = $usage[0]->{'png'};
+ { 'content' => $png, 'format' => 'png' };
}
- else {
- return list_svc_usage(
+
+sub view_port_graph {
+ my $svcnum = $cgi->param('svcnum');
+ { 'svcnum' => $svcnum,
+ 'start' => $cgi->param($svcnum.'_start'),
+ 'end' => $cgi->param($svcnum.'_end'),
+ }
+}
+
+sub view_usage_details {
+ list_svc_usage(
'session_id' => $session_id,
- 'svcnum' => $svcnum,
+ 'svcnum' => $cgi->param('svcnum'),
'beginning' => $cgi->param('beginning') || '',
'ending' => $cgi->param('ending') || '',
);
}
-}
sub view_cdr_details {
list_cdr_usage(
@@ -892,14 +902,6 @@
: {};
$fill_in->{$_} = $access_info->{$_} foreach keys %$access_info;
- my $source = "$template_dir/$name.html";
- #warn "creating template for $source\n";
- my $template = new Text::Template( TYPE => 'FILE',
- SOURCE => $source,
- DELIMITERS => [ '<%=', '%>' ],
- UNTAINT => 1,
- )
- or die $Text::Template::ERROR;
if($result && ref($result) && $result->{'format'} && $result->{'content'}
&& $result->{'format'} eq 'csv') {
@@ -918,7 +920,22 @@
),
$result->{'content'};
}
+ elsif($result && ref($result) && $result->{'format'} && $result->{'content'}
+ && $result->{'format'} eq 'png') {
+ print $cgi->header('-expires' => 'now',
+ '-Content-Type' => 'image/png',
+ ),
+ $result->{'content'};
+ }
else {
+ my $source = "$template_dir/$name.html";
+ my $template = new Text::Template( TYPE => 'FILE',
+ SOURCE => $source,
+ DELIMITERS => [ '<%=', '%>' ],
+ UNTAINT => 1,
+ )
+ or die $Text::Template::ERROR;
+
my $data = $template->fill_in(
PACKAGE => 'FS::SelfService::_selfservicecgi',
HASH => $fill_in,
Index: view_usage.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/fs_selfservice/FS-SelfService/cgi/view_usage.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -d -r1.7 -r1.8
--- view_usage.html 31 Jan 2011 06:30:36 -0000 1.7
+++ view_usage.html 4 Feb 2011 08:23:46 -0000 1.8
@@ -118,7 +118,7 @@
$OUT .= '<TR><TD>'. $svc_port->{'label'}. ': '. $svc_port->{'value'}.'</TD>';
$OUT .= qq! <TD><FORM ACTION="$url" METHOD="GET">
<INPUT TYPE="hidden" name="svcnum" value="$svcnum">
- <INPUT TYPE="hidden" name="action" value="view_usage_details">
+ <INPUT TYPE="hidden" name="action" value="view_port_graph">
<INPUT TYPE="hidden" name="session" value="$session_id"> !;
$OUT .= preset_range($default_start,$default_end,'Last Day',$date_format,$svcnum)
.' | '.preset_range($default_end-86400*7,$default_end,'Last Week',$date_format,$svcnum)
--- NEW FILE: view_port_graph.html ---
<%= $url = "$selfurl?session=$session_id;action="; ''; %>
<%= include('header', "Service usage details for $start - $end") %>
<%= if ( $error ) {
$OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">$error</FONT><BR><BR>!;
}
else {
$OUT .= qq! <IMG SRC="${url}real_port_graph;svcnum=$svcnum;start=$start;end=$end"> !;
}
$OUT .= '';
%>
<BR>
<%= include('footer') %>
More information about the freeside-commits
mailing list