]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bweb/cgi/bweb.pl
ebl fix display_job_group, it works now !
[bacula/bacula] / gui / bweb / cgi / bweb.pl
index 9363a287213db3f2b9a2b8b52fab43ceca19757c..b6d1e97dfa99c86cc2c279f736b6ce7d35e4ecf8 100755 (executable)
@@ -3,22 +3,34 @@ use strict ;
 
 =head1 LICENSE
 
-    Copyright (C) 2006 Eric Bollengier
-        All rights reserved.
+   Bweb - A Bacula web interface
+   Bacula® - The Network Backup Solution
 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    any later version.
+   Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
 
-    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.
+   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.
 
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+   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.
+
+   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.
+
+   You should have received a copy of the GNU 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.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zurich,
+   Switzerland, email:ftf@fsfeurope.org.
 
 =head1 VERSION
 
@@ -42,7 +54,7 @@ if ($action eq 'restore') {
 }
 
 # loading config file
-my $conf = new Bweb::Config(config_file => '/etc/bweb/config');
+my $conf = new Bweb::Config(config_file => $Bweb::config_file);
 $conf->load();
 
 my $bweb = new Bweb(info => $conf);
@@ -67,15 +79,7 @@ if ($action eq 'begin') {            # main display
     $bweb->display_general(age => $arg->{age});
     $bweb->display_running_jobs(0);
     print "</td><td valign='top'>";
-    print "
-<div class='titlediv'>
-  <h1 class='newstitle'> Statistics (last 48 hours)</h1>
-</div>
-<div class='bodydiv'>
-<a href='?action=job;age=172800;jobtype=B'>
-<img src='bgraph.pl?age=172800;width=600;height=250;graph=job_size;limit=100;action=graph;legend=off' alt='Nothing to display'>
-</a>
-</div>";
+    $bweb->display({}, "stats.tpl");
     print "</td></tr></table></div>";
     $bweb->display_job(limit => 10); 
 
@@ -104,10 +108,19 @@ if ($action eq 'begin') {         # main display
     $bweb->location_add();
 
 } elsif ($action eq 'location_del') {
-    $bweb->del_location();
+    $bweb->location_del();
 
 } elsif ($action eq 'media') {
-    $bweb->display_media();
+    print "<div><table border='0'><tr><td valign='top'>\n";
+    my $fields = $bweb->get_form(qw/db_locations db_pools
+                                   qlocations qpools volstatus qre_media
+                                   limit  qmediatypes db_mediatypes/);
+    $bweb->display($fields, "display_form_media.tpl");
+
+    print "</td><td valign='top'>";
+    $bweb->display_media(offset => $arg->{offset},
+                        limit => $arg->{limit});
+    print "</td></tr></table></div>";
 
 } elsif ($action eq 'medias') {
     $bweb->display_medias();
@@ -173,8 +186,7 @@ if ($action eq 'begin') {           # main display
        my $b = new Bconsole(pref => $conf, timeout => 300, log_stdout => 1) ;
        # TODO : use template here
        print "<pre>\n";
-       $b->send_cmd_with_drive("mount slot=$arg->{slot} storage=\"" . $a->get_drive_name($arg->{drive}) . '"',
-                               $arg->{drive});
+       $b->send_cmd("mount slot=$arg->{slot} drive=$arg->{drive} storage=\"" . $a->get_drive_name($arg->{drive}) . '"');
        print "</pre>\n";
     } else {
        $bweb->error("Can't get drive, slot or ach");
@@ -190,9 +202,7 @@ if ($action eq 'begin') {           # main display
        my $b = new Bconsole(pref => $conf, timeout => 300, log_stdout => 1) ;
        # TODO : use template here
        print "<pre>\n";
-       $b->send_cmd_with_drive("umount storage=\"" . $a->get_drive_name($arg->{drive}) . '"',
-                               $arg->{drive});
-
+       $b->send_cmd("umount drive=$arg->{drive} storage=\"" . $a->get_drive_name($arg->{drive}) . '"');
        print "</pre>\n";
 
     } else {
@@ -211,14 +221,24 @@ if ($action eq 'begin') {         # main display
     $bweb->help_extern_compute();
 
 } elsif ($action eq 'extern') {
-    print "TODO : Eject ", join(",", CGI::param('media'));
+    print "<div style='float: left;'>";
+    my @achs = $bweb->eject_media();
+    for my $ach (@achs) {
+        CGI::param('ach', $ach);
+       $bweb->update_slots();
+    }
+    print "</div><div style='float: left;margin-left: 20px;'>";
     $bweb->move_media();
+    print "</div>";
+
+} elsif ($action eq 'move_email') {
+    $bweb->move_email();
 
 } elsif ($action eq 'change_location') {
-    $bweb->change_location();
+    $bweb->location_change();
 
 } elsif ($action eq 'location') {
-    $bweb->display_location();
+    $bweb->location_display();
 
 } elsif ($action eq 'about') {
     $bweb->display($bweb, 'about.tpl');
@@ -256,12 +276,29 @@ if ($action eq 'begin') {         # main display
 } elsif ($action eq 'disable_job') {
     $bweb->enable_disable_job(0);
 
+} elsif ($action eq 'groups') {
+    $bweb->display_groups();
+
+} elsif ($action eq 'groups_edit') {
+    $bweb->groups_edit();
+
+} elsif ($action eq 'groups_save') {
+    $bweb->groups_save();
+
+} elsif ($action eq 'groups_add') {
+    $bweb->groups_add();
+
+} elsif ($action eq 'groups_del') {
+    $bweb->groups_del();
+
 } elsif ($action eq 'job') {
 
     print "<div><table border='0'><tr><td valign='top'>\n";
     my $fields = $bweb->get_form(qw/status level db_clients db_filesets
                                    limit age offset qclients qfilesets
-                                   jobtype/);
+                                   jobtype qpools db_pools
+                                   db_client_groups qclient_groups/); # drop this to hide 
+
     $bweb->display($fields, "display_form_job.tpl");
 
     print "</td><td valign='top'>";
@@ -269,6 +306,22 @@ if ($action eq 'begin') {          # main display
                       offset => $arg->{offset},
                       limit => $arg->{limit});
     print "</td></tr></table></div>";
+} elsif ($action eq 'job_group') {
+
+    print "<div><table border='0'><tr><td valign='top'>\n";
+    my $fields = $bweb->get_form(qw/limit level age 
+                                    db_client_groups qclient_groups/); # drop this to hide 
+
+    $fields->{hide_status} = 1;
+    $fields->{hide_type} = 1;
+    $fields->{action} = 'job_group';
+
+    $bweb->display($fields, "display_form_job.tpl");
+
+    print "</td><td valign='top'>";
+    $bweb->display_job_group(age => $arg->{age},  # last 7 days
+                            limit => $arg->{limit});
+    print "</td></tr></table></div>";
 } elsif ($action eq 'client_stats') {
 
     foreach my $client (CGI::param('client')) {
@@ -278,6 +331,10 @@ if ($action eq 'begin') {          # main display
        }
     }
 
+} elsif ($action eq 'group_stats') {
+
+    $bweb->display_group_stats(age => $arg->{age});
+
 } elsif ($action eq 'running') {
     $bweb->display_running_jobs(1);
 
@@ -363,6 +420,7 @@ if ($action eq 'begin') {           # main display
 
 $bweb->display_end();
 
+$bweb->dbh_disconnect();
 
 __END__