]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bweb/cgi/bweb.pl
Rebuild configure
[bacula/bacula] / gui / bweb / cgi / bweb.pl
index 3b40b7aee58d9db8d331bb1cd1ca732a3cf813d3..8634bfa0183eb3c56d19a848e0001718a6e49c63 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
@@ -84,17 +83,41 @@ if ($action eq 'begin') {           # main display
     $bweb->display_job(limit => 10); 
 
 } elsif ($action eq 'view_conf') {
+    $bweb->can_do('r_configure');
     $conf->view()
 
 } elsif ($action eq 'edit_conf') {
+    $bweb->can_do('r_configure');
     $conf->edit();
 
 } elsif ($action eq 'apply_conf') {
+    $bweb->can_do('r_configure');
     $conf->modify();
 
+} elsif ($action eq 'user_del') {
+    $bweb->users_del();
+
+} elsif ($action eq 'user_add') {
+    $bweb->users_add();
+
+} elsif ($action eq 'user_edit') {
+    $bweb->display_user();
+
+} elsif ($action eq 'user_save') {
+    $bweb->users_add();
+
+} elsif ($action eq 'users') {
+    $bweb->display_users();
+
 } elsif ($action eq 'client') {        
     $bweb->display_clients();
 
+} elsif ($action eq 'client_edit') {
+    $bweb->client_edit();
+
+} elsif ($action eq 'client_save') {
+    $bweb->client_save();
+
 } elsif ($action eq 'pool') {
     $bweb->display_pool();
 
@@ -110,7 +133,12 @@ if ($action eq 'begin') {          # main display
 } elsif ($action eq 'location_del') {
     $bweb->location_del();
 
+} elsif ($action eq 'cmd_storage') {
+    $bweb->cmd_storage();
+
 } elsif ($action eq 'media') {
+    $bweb->can_do('r_view_media');
+
     print "<div><table border='0'><tr><td valign='top'>\n";
     my $fields = $bweb->get_form(qw/db_locations db_pools expired
                                    qlocations qpools volstatus qre_media
@@ -126,6 +154,8 @@ if ($action eq 'begin') {           # main display
     $bweb->display_allmedia();
 
 } elsif ($action eq 'eject') {
+    $bweb->can_do('r_autochanger_mgnt');
+
     my $arg = $bweb->get_form("ach");
     my $a = $bweb->ach_get($arg->{ach});
     
@@ -142,11 +172,15 @@ if ($action eq 'begin') {         # main display
 
        $a->display_content();
     }
+} elsif ($action eq 'add_media') {
+    $bweb->add_media();
 
 } elsif ($action eq 'eject_media') {
     $bweb->eject_media();
 
 } elsif ($action eq 'clear_io') {
+    $bweb->can_do('r_autochanger_mgnt');
+
     my $arg = $bweb->get_form('ach');
 
     my $a = $bweb->ach_get($arg->{ach});
@@ -163,6 +197,8 @@ if ($action eq 'begin') {           # main display
     $bweb->ach_del();
 
 } elsif ($action eq 'ach_view') {
+    $bweb->can_do('r_autochanger_mgnt');
+
     # TODO : get autochanger name and create it
     $bweb->connect_db();
     my $arg = $bweb->get_form('ach');
@@ -177,6 +213,8 @@ if ($action eq 'begin') {           # main display
     $bweb->ach_add();
 
 } elsif ($action eq 'ach_load') {
+    $bweb->can_do('r_autochanger_mgnt');
+
     my $arg = $bweb->get_form('ach', 'drive', 'slot');
     
     my $a = $bweb->ach_get($arg->{ach});
@@ -193,6 +231,8 @@ if ($action eq 'begin') {           # main display
     }
     
 } elsif ($action eq 'ach_unload') {
+    $bweb->can_do('r_autochanger_mgnt');
+
     my $arg = $bweb->get_form('drive', 'slot', 'ach');
 
     my $a = $bweb->ach_get($arg->{ach});
@@ -221,6 +261,9 @@ if ($action eq 'begin') {           # main display
     $bweb->help_extern_compute();
 
 } elsif ($action eq 'extern') {
+    $bweb->can_do('r_media_mgnt');
+    $bweb->can_do('r_autochanger_mgnt');
+
     print "<div style='float: left;'>";
     my @achs = $bweb->eject_media();
     for my $ach (@achs) {
@@ -228,7 +271,7 @@ if ($action eq 'begin') {           # main display
        $bweb->update_slots();
     }
     print "</div><div style='float: left;margin-left: 20px;'>";
-    $bweb->move_media('no');   # enabled = no
+    $bweb->move_media('yes');  # pb with enabled = no for restore
     print "</div>";
 
 } elsif ($action eq 'move_email') {
@@ -286,35 +329,38 @@ if ($action eq 'begin') {         # main display
 } 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') {
-
+    $bweb->can_do('r_view_job');
     print "<div><table border='0'><tr><td valign='top'>\n";
-    my $fields = $bweb->get_form(qw/status level db_clients db_filesets
+    my $fields = $bweb->get_form(qw/status level filter db_clients
+                                   db_filesets since
                                    limit age offset qclients qfilesets
                                    jobtype qpools db_pools
                                    db_client_groups qclient_groups/); # drop this to hide 
-
+    if (!CGI::param('since')) {
+       $fields->{hide_since}=1 ;
+       delete $fields->{since};
+    }
     $bweb->display($fields, "display_form_job.tpl");
 
     print "</td><td valign='top'>";
-    $bweb->display_job(age => $arg->{age},  # last 7 days
-                      offset => $arg->{offset},
-                      limit => $arg->{limit});
+    $bweb->display_job(age => $fields->{age},  # last 7 days
+                      since => $fields->{since},
+                      offset => $fields->{offset},
+                      limit => $fields->{limit});
     print "</td></tr></table></div>";
 } elsif ($action eq 'job_group') {
-
+    $bweb->can_do('r_view_job');
     print "<div><table border='0'><tr><td valign='top'>\n";
-    my $fields = $bweb->get_form(qw/limit level age 
+    my $fields = $bweb->get_form(qw/limit level age filter 
                                     db_client_groups qclient_groups/); # drop this to hide 
 
     $fields->{hide_status} = 1;
     $fields->{hide_type} = 1;
+    $fields->{hide_since}=1;
     $fields->{action} = 'job_group';
 
     $bweb->display($fields, "display_form_job.tpl");
@@ -326,15 +372,27 @@ if ($action eq 'begin') {         # main display
 } elsif ($action eq 'client_stats') {
 
     foreach my $client (CGI::param('client')) {
-       if ($client =~ m/$client_re/) {
+       if ($client =~ $client_re) {
            $bweb->display_client_stats(clientname => $1,
                                        age => $arg->{age});
        }
     }
-
 } elsif ($action eq 'group_stats') {
+    $bweb->can_do('r_view_stat');
+    print "<div><table border='0'><tr><td valign='top'>\n";
+    my $fields = $bweb->get_form(qw/since age 
+                                    db_client_groups qclient_groups/); 
+    $fields->{action}='group_stats';
+    $fields->{hide_level}=1;
+    $fields->{hide_type}=1;
+    $fields->{hide_status}=1;
 
-    $bweb->display_group_stats(age => $arg->{age});
+    $bweb->display($fields, "display_form_job.tpl");
+
+    print "</td><td valign='top'>";
+    $bweb->display_group_stats();
+
+    print "</td></tr></table></div>"
 
 } elsif ($action eq 'running') {
     $bweb->display_running_jobs(1);
@@ -343,6 +401,7 @@ if ($action eq 'begin') {           # main display
     $bweb->display_running_job();
 
 } elsif ($action eq 'update_from_pool') {
+    $bweb->can_do('r_media_mgnt');
     my $elt = $bweb->get_form(qw/media pool/);
     unless ($elt->{media} || $elt->{pool}) {
        $bweb->error("Can't get media or pool param");
@@ -359,9 +418,10 @@ if ($action eq 'begin') {          # main display
     $bweb->update_media();
 
 } elsif ($action eq 'client_status') {
+    $bweb->can_do('r_client_status');
     my $b;
     foreach my $client (CGI::param('client')) {
-       if ($client =~ m/$client_re/) {
+       if ($client =~ $client_re) {
            $client = $1;
            $b = new Bconsole(pref => $conf) 
                unless ($b) ;
@@ -380,6 +440,9 @@ if ($action eq 'begin') {           # main display
 } elsif ($action eq 'cancel_job') {
     $bweb->cancel_job();
 
+} elsif ($action eq 'cancel_future_job') {
+    $bweb->cancel_future_job();
+
 } elsif  ($action eq 'media_zoom') {
     $bweb->display_media_zoom();
 
@@ -415,8 +478,41 @@ if ($action eq 'begin') {          # main display
 } elsif ($action eq 'fileset_view') {
     $bweb->fileset_view();
 
+} elsif ($action eq 'next_job2') {
+    $bweb->display_next_job();
+
+} elsif ($action eq 'missing') {
+    $bweb->display_missing_job();
+
+} elsif ($action eq 'overview') {
+    $bweb->can_do('r_view_job');
+    print "<div><table border='0'><tr><td valign='top'>\n";
+    my $fields = $bweb->get_form(qw/level filter age jobtype since type
+                                   db_client_groups qclient_groups/); # drop this to hide 
+    $fields->{hide_status}=1;
+    $fields->{view_time_slice}=1;
+    $fields->{action}='overview';
+    $bweb->display($fields, "display_form_job.tpl");
+
+    print "</td><td valign='top'>";
+    $bweb->display_overview();
+    print "</td></tr></table></div>";
+
+} elsif ($action eq 'overview_zoom') {
+    $bweb->can_do('r_view_job');
+    print "<div><table border='0'><tr><td valign='top'>\n";
+    my $fields = $bweb->get_form(qw/level filter age jobtype since type
+                                db_client_groups qclient_groups/); # drop this to hide 
+    $fields->{hide_status}=1;
+    $fields->{view_time_slice}=1;
+    $fields->{action}='overview_zoom';
+    $bweb->display($fields, "display_form_job.tpl");
+    print "</td><td valign='top'>";
+    $bweb->display_overview_zoom();
+    print "</td></tr></table></div>";
+
 } else {
-    $bweb->error("Sorry, this action don't exist");
+    $bweb->error("Sorry, this action doesn't exist");
 }
 
 $bweb->display_end();
@@ -427,27 +523,8 @@ __END__
 
 TODO :
 
- o Affichage des job en cours, termines
- o Affichage du detail d'un job (status client)
- o Acces aux log d'une sauvegarde
- o Cancel d'un job
- o Lancement d'un job
-
- o Affichage des medias (pool, cf bacweb)
- o Affichage de la liste des cartouches
- o Affichage d'un autochangeur
- o Mise a jour des slots
- o Label barcodes
  o Affichage des medias qui ont besoin d'etre change
-
- o Affichage des stats sur les dernieres sauvegardes (cf bacula-web)
- o Affichage des stats sur un type de job
  o Affichage des infos de query.sql
 
  - Affichage des du TapeAlert sur le site
  - Recuperation des erreurs SCSI de /var/log/kern.log
-
- o update d'un volume
- o update d'un pool
-
- o Configuration des autochanger a la main dans un hash dumper