added new 'limit' functionality to 'ntp' graph

This commit is contained in:
Jordi Sanfeliu 2014-06-20 10:31:11 +02:00
parent af3172c5fe
commit 1db83e9cfd
1 changed files with 5 additions and 33 deletions

View File

@ -191,8 +191,8 @@ sub ntp_cgi {
my ($package, $config, $cgi) = @_;
my $ntp = $config->{ntp};
my @rigid = split(',', $ntp->{rigid});
my @limit = split(',', $ntp->{limit});
my @rigid = split(',', ($ntp->{rigid} || ""));
my @limit = split(',', ($ntp->{limit} || ""));
my $tf = $cgi->{tf};
my $colors = $cgi->{colors};
my $graph = $cgi->{graph};
@ -341,15 +341,7 @@ sub ntp_cgi {
if($title) {
main::graph_header($title, 2);
}
undef(@riglim);
if(trim($rigid[0]) eq 1) {
push(@riglim, "--upper-limit=" . trim($limit[0]));
} else {
if(trim($rigid[0]) eq 2) {
push(@riglim, "--upper-limit=" . trim($limit[0]));
push(@riglim, "--rigid");
}
}
@riglim = @{setup_riglim($rigid[0], $limit[0])};
undef(@tmp);
undef(@tmpz);
undef(@CDEF);
@ -452,15 +444,7 @@ sub ntp_cgi {
print(" </td>\n");
print(" <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
}
undef(@riglim);
if(trim($rigid[1]) eq 1) {
push(@riglim, "--upper-limit=" . trim($limit[1]));
} else {
if(trim($rigid[1]) eq 2) {
push(@riglim, "--upper-limit=" . trim($limit[1]));
push(@riglim, "--rigid");
}
}
@riglim = @{setup_riglim($rigid[1], $limit[1])};
undef(@tmp);
undef(@tmpz);
undef(@CDEF);
@ -486,7 +470,6 @@ sub ntp_cgi {
"--width=$width",
"--height=$height",
@riglim,
"--lower-limit=0",
$zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@ -507,7 +490,6 @@ sub ntp_cgi {
"--width=$width",
"--height=$height",
@riglim,
"--lower-limit=0",
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},
@ -532,15 +514,7 @@ sub ntp_cgi {
}
}
undef(@riglim);
if(trim($rigid[2]) eq 1) {
push(@riglim, "--upper-limit=" . trim($limit[2]));
} else {
if(trim($rigid[2]) eq 2) {
push(@riglim, "--upper-limit=" . trim($limit[2]));
push(@riglim, "--rigid");
}
}
@riglim = @{setup_riglim($rigid[2], $limit[2])};
undef(@tmp);
undef(@tmpz);
undef(@CDEF);
@ -575,7 +549,6 @@ sub ntp_cgi {
"--width=$width",
"--height=$height",
@riglim,
"--lower-limit=0",
$zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@ -605,7 +578,6 @@ sub ntp_cgi {
"--width=$width",
"--height=$height",
@riglim,
"--lower-limit=0",
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},