\n"; # Show table $width = 500; print "
\n"; if (&can_edit_templates()) { my $job = &find_bandwidth_job(); if (!$job || !$config{'bw_active'}) { print &text('bwgraph_enable', &ui_link('edit_newbw.cgi', $text{'newbw_title'})), "
\n"; } } } if ($parent) { push(@rets, "bwgraph.cgi?dom=$parent->{'id'}", $text{'bwgraph_returnparent'}); } if ($in{'dom'}) { push(@rets, &domain_footer_link($d)); } if (&can_edit_templates() && $in{'dom'}) { push(@rets, "bwgraph.cgi", $text{'bwgraph_return'}); } push(@rets, "", $text{'index_return'}); &ui_print_footer(@rets); # usage_colours(&domain, &usage) sub usage_colours { local ($d, $usage) = @_; local ($f, $total); foreach $f (@bandwidth_features) { local $fusage = $usage->{$f}->{$d->{'id'}}; if ($fusage) { printf "", int($width*$fusage/$max)+($f eq "web" ? 1 : 0); $donecolour{$f} += $fusage; $total += $fusage; } } if (!$total) { print ""; } } # minimum_day(&bandwidth) sub minimum_day { local $min = undef; foreach $k (keys %{$_[0]}) { if ($k =~ /^(\S+)_(\d+)$/ && (!defined($min) || $2 < $min)) { $min = $2; } } return $min; } # usage_for_days(start, end, feature, &bandwidth, ...) sub usage_for_days { local ($start, $end, $f, @bands) = @_; local $usage = 0; local ($i, $band); for($i=int($start); $i<=int($end); $i++) { foreach $band (@bands) { $usage += $band->{$f.'_'.$i}; } } return $usage; }