diff options
| author | levinse <levinse> | 2011-02-03 06:18:41 +0000 | 
|---|---|---|
| committer | levinse <levinse> | 2011-02-03 06:18:41 +0000 | 
| commit | 088428e5937c8dff49bafeddd52c1c64a8d6cec6 (patch) | |
| tree | fbc152446f7c7030e41025dea5c296a8da47e089 | |
| parent | 54fd27780c3b48eb1a05be892f65f26b0daab197 (diff) | |
torrus misc fixes, RT10574
| -rw-r--r-- | FS/FS/svc_port.pm | 19 | ||||
| -rw-r--r-- | httemplate/view/svc_port.cgi | 10 | 
2 files changed, 17 insertions, 12 deletions
| diff --git a/FS/FS/svc_port.pm b/FS/FS/svc_port.pm index 129fb078b..ad92e68f6 100644 --- a/FS/FS/svc_port.pm +++ b/FS/FS/svc_port.pm @@ -254,6 +254,8 @@ sub graph_png {          $start = $opt{start} if $opt{start};          $end = $opt{end} if $opt{end}; +	$end = $now if $end > $now; +          return 'Invalid date range' if ($start < 0 || $start >= $end               || $end <= $start || $end < 0 || $end > $now || $start > $now              || $end-$start > 86400*366 ); @@ -292,8 +294,8 @@ sub graph_png {          foreach my $rec ( @records ) {              push @times, $rec->_date                   unless grep { $_ eq $rec->_date } @times; -            push @in, $rec->value if $rec->serviceid =~ /_IN$/; -            push @out, $rec->value if $rec->serviceid =~ /_OUT$/; +            push @in, $rec->value*8 if $rec->serviceid =~ /_IN$/; +            push @out, $rec->value*8 if $rec->serviceid =~ /_OUT$/;          }          my $timediff = $times[-1] - $times[0]; # they're sorted ascending @@ -340,8 +342,14 @@ sub graph_png {        my @data = ( \@times, \@in, \@out ); +              # hardcoded size, colour, etc. -      my $graph = new GD::Graph::mixed(600,360);  #600,400 + +      # don't change width/height other than through here; breaks legend otherwise +      my $width = 600; +      my $height = 360; + +      my $graph = new GD::Graph::mixed($width,$height);          $graph->set(          types => ['area','lines'],          dclrs => ['green','blue'], @@ -364,6 +372,7 @@ sub graph_png {              my $value = shift;              $self->_format_bandwidth($value,1);          }, +	y_tick_number => 'auto',          y_label => 'bps',          legend_placement => 'BR',  	lg_cols => 1, @@ -389,9 +398,9 @@ sub graph_png {        return "graph error: ".$graph->error unless($gd);        my $black = $gd->colorAllocate(0,0,0);        -      $gd->string(gdMediumBoldFont,50,285, +      $gd->string(gdMediumBoldFont,50,$height-35,  	    "Current: $in_curr   Average: $in_avg   Maximum: $in_max   Minimum: $in_min",$black); -      $gd->string(gdMediumBoldFont,50,305, +      $gd->string(gdMediumBoldFont,50,$height-15,  	    "Current: $out_curr   Average: $out_avg   Maximum: $out_max   Minimum: $out_min",$black);        return $gd->png; diff --git a/httemplate/view/svc_port.cgi b/httemplate/view/svc_port.cgi index 0df826366..eec803d5a 100644 --- a/httemplate/view/svc_port.cgi +++ b/httemplate/view/svc_port.cgi @@ -30,12 +30,8 @@ if ( $cgi->param('svcnum') ) {    $svcnum = $1;  } -my $start = ''; -my $end = ''; -if ( $cgi->param('start') && $cgi->param('end') ) { -    $start = $cgi->param('start'); -    $end = $cgi->param('end'); -} +my $start = $cgi->param('start'); +my $end = $cgi->param('end');  sub preset_range {      my($start,$end,$label,$date_format) = (shift,shift,shift,shift); @@ -52,7 +48,7 @@ my $html_foot = sub {      if($start && $end) {  	$graph = "<BR><BR><IMG SRC=${p}/view/port_graph.html?svcnum=$svcnum;". -		"start=".str2time($start).";end=".str2time($end).">"; +		"start=".str2time("$start 00:00:00").";end=".str2time("$end 23:59:59").">";      }      return ' | 
