=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
use CGI;
my $client_re = qr/^([\w\d\.-]+)$/;
-my $pool_re = $client_re;
my $action = CGI::param('action') || 'begin';
}
# 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);
$bweb->display_begin();
# if no configuration, we send edit_conf
-unless ($bweb->{info}->{dbi}) {
+if ($action ne 'apply_conf' and !$bweb->{info}->{dbi}) {
$action = 'edit_conf';
}
if ($action eq 'begin') { # main display
- print "<table border='0'><td valign='top' width='100%'>\n";
+ print "<div style='left=0;'><table border='0'><tr><td valign='top' width='100%'>\n";
$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=450;height=250;graph=job_size;limit=100;action=graph;legend=off' alt='Nothing to display'>
-</a>
-</div>";
- print "</td></table>";
+ $bweb->display({}, "stats.tpl");
+ print "</td></tr></table></div>";
$bweb->display_job(limit => 10);
} elsif ($action eq 'view_conf') {
} elsif ($action eq 'location_add') {
$bweb->location_add();
-#} elsif ($action eq 'del_location') {
-# $bweb->del_location();
-#
+} elsif ($action eq 'location_del') {
+ $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();
} elsif ($action eq 'eject') {
- my $a = Bweb::Autochanger::get('S1_L80', $bweb);
+ my $arg = $bweb->get_form("ach");
+ my $a = $bweb->ach_get($arg->{ach});
+
+ if ($a) {
+ $a->status();
+ foreach my $slot (CGI::param('slot')) {
+ print $a->{error} unless $a->send_to_io($slot);
+ }
- $a->status();
- foreach my $slot (CGI::param('slot')) {
- print $a->{error} unless $a->send_to_io($slot);
- }
+ foreach my $media (CGI::param('media')) {
+ my $slot = $a->get_media_slot($media);
+ print $a->{error} unless $a->send_to_io($slot);
+ }
- foreach my $media (CGI::param('media')) {
- my $slot = $a->get_media_slot($media);
- print $a->{error} unless $a->send_to_io($slot);
+ $a->display_content();
}
- $a->display_content();
-
} elsif ($action eq 'eject_media') {
$bweb->eject_media();
} elsif ($action eq 'clear_io') {
- my $a = Bweb::Autochanger::get('S1_L80', $bweb);
- $a->status();
- $a->clear_io();
- $a->display_content();
-
+ my $arg = $bweb->get_form('ach');
+
+ my $a = $bweb->ach_get($arg->{ach});
+ if (defined $a) {
+ $a->status();
+ $a->clear_io();
+ $a->display_content();
+ }
+
+} elsif ($action eq 'ach_edit') {
+ $bweb->ach_edit();
+
+} elsif ($action eq 'ach_del') {
+ $bweb->ach_del();
+
} elsif ($action eq 'ach_view') {
# TODO : get autochanger name and create it
$bweb->connect_db();
- my $a = Bweb::Autochanger::get('S1_L80', $bweb);
- $a->status();
- $a->display_content();
+ my $arg = $bweb->get_form('ach');
+
+ my $a = $bweb->ach_get($arg->{ach});
+ if ($a) {
+ $a->status();
+ $a->display_content();
+ }
+
+} elsif ($action eq 'ach_add') {
+ $bweb->ach_add();
} elsif ($action eq 'ach_load') {
my $arg = $bweb->get_form('ach', 'drive', 'slot');
+
+ my $a = $bweb->ach_get($arg->{ach});
- if (defined $arg->{ach} and defined $arg->{drive} and defined $arg->{slot})
+ if (defined $a and defined $arg->{drive} and defined $arg->{slot})
{
- my $a = Bweb::Autochanger::get('S1_L80', $bweb);
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");
} elsif ($action eq 'ach_unload') {
my $arg = $bweb->get_form('drive', 'slot', 'ach');
- if (defined $arg->{ach} and defined $arg->{drive} and defined $arg->{slot})
+ my $a = $bweb->ach_get($arg->{ach});
+
+ if (defined $a and defined $arg->{drive} and defined $arg->{slot})
{
- my $a = Bweb::Autochanger::get('S1_L80', $bweb);
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 {
$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');
} 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 "<table border='0'><td valign='top'>\n";
+ 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'>";
$bweb->display_job(age => $arg->{age}, # last 7 days
offset => $arg->{offset},
limit => $arg->{limit});
- print "</td></table>";
+ 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')) {
}
}
-
+} elsif ($action eq 'group_stats') {
+
+ $bweb->display_group_stats(age => $arg->{age});
} elsif ($action eq 'running') {
$bweb->display_running_jobs(1);
} elsif ($action eq 'delete') {
$bweb->delete();
+} elsif ($action eq 'fileset_view') {
+ $bweb->fileset_view();
+
} else {
$bweb->error("Sorry, this action don't exist");
}
$bweb->display_end();
+$bweb->dbh_disconnect();
__END__
o update d'un volume
o update d'un pool
- - Configuration des autochanger a la main dans un hash dumper
-
- {
- L10 => {
- name => 'L10',
- drive_name => ['SDLT-1', 'STLD-2'],
- login => 'bacula',
- host => 'storehost',
- device => '/dev/changer',
- },
- }
+ o Configuration des autochanger a la main dans un hash dumper