From 311b225b6c08fb13bdd6f4d9746338712df1ffcb Mon Sep 17 00:00:00 2001 From: Manuel CISSÉ Date: Tue, 23 Feb 2010 17:09:07 +0100 Subject: autofill DS names when not specified --- type/Default.class.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'type') diff --git a/type/Default.class.php b/type/Default.class.php index f15ca32..0eab459 100644 --- a/type/Default.class.php +++ b/type/Default.class.php @@ -167,9 +167,27 @@ class Type_Default { # use data_sources as sources $sources = $this->data_sources; } + $this->fill_ds_names($sources); return $sources; } + function fill_ds_names($sources) { + $max = 0; + foreach ($sources as $source) { + if(strlen($source) > $max) { + $max = strlen($source); + } + } + if($max > 0) { + $fmt = sprintf("%%-%ds", $max); + foreach ($sources as $source) { + if(!isset($this->ds_names[$source])) { + $this->ds_names[$source] = sprintf($fmt, $source); + } + } + } + } + function rrd_gen_graph() { $rrdgraph = $this->rrd_options(); -- cgit v1.1