]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bweb/cgi/bgraph.pl
bweb: Update some GPL2 notice to AGPL
[bacula/bacula] / gui / bweb / cgi / bgraph.pl
index e232e5fdd2f90c433a5724158b3453e27342bd09..7407322dba4a5c3925973299c55d9a6b020ac373 100755 (executable)
@@ -11,25 +11,24 @@ use strict;
    The main author of Bweb is Eric Bollengier.
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
-
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   modify it under the terms of version three of the GNU Affero General Public
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-   General Public License for more details.
+   Affero General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Bacula® is a registered trademark of John Walker.
+   Bacula® is a registered trademark of Kern Sibbald.
    The licensor of Bacula is the Free Software Foundation Europe
-   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zurich,
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
    Switzerland, email:ftf@fsfeurope.org.
 
 =head1 VERSION
@@ -55,9 +54,9 @@ my $debug = $bweb->{debug};
 
 # Job table keep use Media or Job retention, so it's quite enought
 # for good statistics
-# CREATE TABLE job_old (LIKE Job);
-# INSERT INTO job_old
-#    (SELECT * FROM Job WHERE JobId NOT IN (SELECT JobId FROM job_old) );
+# CREATE TABLE JobHistory (LIKE Job);
+# INSERT INTO JobHistory
+#    (SELECT * FROM Job WHERE JobId NOT IN (SELECT JobId FROM JobHistory) );
 my $jobt = $bweb->get_stat_table();
 
 my $graph = CGI::param('graph') || 'job_size';
@@ -79,7 +78,7 @@ if ($arg->{status} and $arg->{status} ne 'Any') {
 }
     
 my $levelq='';
-if ($arg->{level} and $arg->{level} ne 'Any') {
+if ($arg->{level} and $arg->{level} !~ 'All|Any') {
     $levelq = " AND Job.Level = '$arg->{level}' ";
 } 
 
@@ -191,6 +190,8 @@ sub get_graph
 {
     my (@options) = @_;
     my $graph;
+    use GD::Graph::colour qw(:colours);
+
     if ($gtype eq 'lines') {
        use GD::Graph::lines;
        $graph = GD::Graph::lines->new ( $arg->{width}, $arg->{height} );
@@ -216,9 +217,20 @@ sub get_graph
                'x_number_format' => sub { strftime('%D', localtime($_[0])) },
                'x_tick_number' => 5*$arg->{width}/800,
                 'overwrite' => 1,
+                dclrs => [ "lred", add_colour("#008e8e"), 
+                           add_colour("#afd8f8"), add_colour("#f6bd0f"),
+                           add_colour("#8bba00"), add_colour("#ff8e46"),
+                           add_colour("#d64646"),
+                           add_colour("#8e468e"), add_colour("#588526"),
+                           add_colour("#b3aa00"), add_colour("#008ed6"),
+                           add_colour("#9d080d"), add_colour("#a186be"),
+                ],
                @options,
                );
-
+    if ($conf->{graph_font} && -f $conf->{graph_font}) {
+        $graph->set_title_font([$conf->{graph_font}], 12);
+        $graph->set_legend_font([$conf->{graph_font}], 11);
+    }
     return $graph;
 }
 
@@ -232,9 +244,12 @@ sub make_tab
     my $ret = {};
     
     foreach my $row (@$all_row) {
-       # Todo, add Level to label if option is set ->[4]
        my $label = $row->[1] . "/" . $row->[2] ; # client/backup name
 
+       if ($arg->{level} && $arg->{level} eq 'All') {  # can separate level
+           $label = $row->[4] . ': ' . $label;   # if users ask for
+       }
+
        $ret->{date}->[$i]   = $row->[0];       
        $ret->{$label}->[$i] = $row->[3];
        $i++;
@@ -350,7 +365,7 @@ $limitq
 }
 
 # it works only with postgresql at this time
-# we dont use $jobt because we use File, so job is in Job table
+# we don't use $jobt because we use File, so job is in Job table
 elsif ($graph eq 'file_histo' and $arg->{where}) {
     
     my $dir  = $dbh->quote(dirname($arg->{where}) . '/');