diff options
author | levinse <levinse> | 2011-01-31 06:30:36 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-01-31 06:30:36 +0000 |
commit | ec681a87b33fe272276f367aea4da3ed4d689605 (patch) | |
tree | 238542a56494a3d9e8ef4d1e7766db77f06822bb /FS | |
parent | df6a0d9c94240a8d10a9ab02161beab92e8577e4 (diff) |
torrus various changes, RT10574
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 19 | ||||
-rw-r--r-- | FS/FS/svc_port.pm | 21 |
2 files changed, 38 insertions, 2 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index c82d37043..be1146e47 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -1084,9 +1084,12 @@ sub list_svcs { #@svc_x = sort { $a->domain cmp $b->domain || $a->username cmp $b->username } # @svc_x; + my $conf = new FS::Conf; + { 'svcnum' => $session->{'svcnum'}, 'custnum' => $custnum, + 'date_format' => $conf->config('date_format') || '%m/%d/%Y', 'svcs' => [ map { my $svc_x = $_->svc_x; @@ -1122,7 +1125,7 @@ sub list_svcs { # more... ); - } elsif ( $svcdb eq 'svc_phone' ) { + } elsif ( $svcdb eq 'svc_phone' || $svcdb eq 'svc_port' ) { %hash = ( %hash, ); @@ -1136,6 +1139,20 @@ sub list_svcs { } +sub port_graph { + my $p = shift; + _usage_details( \&_port_graph, $p, + 'svcdb' => 'svc_port', + ); +} + +sub _port_graph { + my($svc_port, $begin, $end) = @_; + my @usage = (); + push @usage, 999; + (@usage); +} + sub _list_svc_usage { my($svc_acct, $begin, $end) = @_; my @usage = (); diff --git a/FS/FS/svc_port.pm b/FS/FS/svc_port.pm index db1f539b8..afd412e59 100644 --- a/FS/FS/svc_port.pm +++ b/FS/FS/svc_port.pm @@ -9,6 +9,7 @@ use FS::Record qw( qsearch qsearchs use FS::cust_svc; use GD::Graph; use GD::Graph::mixed; +use GD; use Date::Format qw(time2str); use Data::Dumper; @@ -344,7 +345,7 @@ sub graph_png { $graph->set( types => ['area','lines'], dclrs => ['green','blue'], - x_label => "(In Out) Current: $in_curr $out_curr Average: $in_avg $out_avg Maximum: $in_max $out_max Minimum: $in_min $out_min", + x_label => ' ', x_tick_number => 'auto', x_number_format => sub { my $value = shift; @@ -365,6 +366,7 @@ sub graph_png { }, y_label => 'bps', legend_placement => 'BR', + lg_cols => 1, title => $self->serviceid, ) or return "can't create graph: ".$graph->error; @@ -372,9 +374,26 @@ sub graph_png { or return "can't set text colour: ".$graph->error; $graph->set_legend(('In','Out')) or return "can't set legend: ".$graph->error; + $graph->set_title_font(['verdana', 'arial', gdGiantFont], 16) + or return "can't set title font: ".$graph->error; + $graph->set_legend_font(['verdana', 'arial', gdMediumBoldFont], 12) + or return "can't set legend font: ".$graph->error; + $graph->set_x_axis_font(['verdana', 'arial', gdMediumBoldFont], 12) + or return "can't set font: ".$graph->error; + $graph->set_y_axis_font(['verdana', 'arial', gdMediumBoldFont], 12) + or return "can't set font: ".$graph->error; + $graph->set_y_label_font(['verdana', 'arial', gdMediumBoldFont], 12) + or return "can't set font: ".$graph->error; my $gd = $graph->plot(\@data); return "graph error: ".$graph->error unless($gd); + + my $black = $gd->colorAllocate(0,0,0); + $gd->string(gdMediumBoldFont,50,285, + "Current: $in_curr Average: $in_avg Maximum: $in_max Minimum: $in_min",$black); + $gd->string(gdMediumBoldFont,50,305, + "Current: $out_curr Average: $out_avg Maximum: $out_max Minimum: $out_min",$black); + return $gd->png; } |