} 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();
$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') {
<!-- <h1>Actions</h1> -->
<button type="submit" class="bp" name='action' value='job' title="Show last job"> <img src='/bweb/zoom.png' alt=''>Last jobs</button>
<button type="submit" class="bp" name='action' value='dsp_cur_job' title='Show current job'> <img src='/bweb/zoom.png' alt=''>Current jobs</button>
+ <button type="submit" class="bp" name='action' value='groups' title='View client groups'> <img src='/bweb/zoom.png' alt=''>View groups</button>
<button type="submit" class="bp" name='action' value='client_status' title='Show client status'> <img src='/bweb/zoom.png' alt=''>Status </button>
<button type="submit" class="bp" name='action' value='client_stats' title='Client stats'> <img src='/bweb/chart.png' alt=''>Stats </button>
+ <button type="submit" class="bp" name='action' value='client_edit' title='Client groups'> <img src='/bweb/edit.png' alt=''>Edit </button>
</div>
</form>
</select>
</td></tr><tr><td> Enabled: </td><td>
<select name='enabled' class='formulaire'>
- <option value='no'>no</option>
<option value='yes'>yes</option>
+ <option value='no'>no</option>
<option value='archived'>archived</option>
</select>
- </td><tr><td> User: </td><td>
+ </td></tr><tr><td> User: </td><td>
<input type='text' name='user' value='<TMPL_VAR loginname>' class='formulaire'>
</td></tr>
</td></tr><tr><td> Comment: </td><td>
}
);
<TMPL_IF enabled>
-ok=1;
-for (var i=0; ok && i < document.form1.enabled.length; ++i) {
- if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
- document.form1.enabled[i].selected = true;
- ok=0;
- }
-}
+//ok=1;
+//for (var i=0; ok && i < document.form1.enabled.length; ++i) {
+// if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
+// document.form1.enabled[i].selected = true;
+// ok=0;
+// }
+//}
</TMPL_IF>
</script>
<!-- <h1>Acciones</h1> -->
<button type="submit" class="bp" name='action' value='job' title="Mostrar últimos jobs"> <img src='/bweb/zoom.png' alt=''>Últimos Jobs</button>
<button type="submit" class="bp" name='action' value='dsp_cur_job' title='Mostrar job actual'> <img src='/bweb/zoom.png' alt=''>Current jobs</button>
+ <button type="submit" class="bp" name='action' value='groups' title='View client groups'> <img src='/bweb/zoom.png' alt=''>View groups</button>
<button type="submit" class="bp" name='action' value='client_status' title='Mostrar estado del cliente'> <img src='/bweb/zoom.png' alt=''>Estado </button>
<button type="submit" class="bp" name='action' value='client_stats' title='Estadísticas del Cliente'> <img src='/bweb/chart.png' alt=''>Estado </button>
+ <button type="submit" class="bp" name='action' value='client_edit' title='Client groups'> <img src='/bweb/edit.png' alt=''>Editar </button>
</div>
</form>
--- /dev/null
+<br/>
+<div class='titlediv' style='width: 300'>
+ <h1 class='newstitle'> Help ejecting media</h1>
+</div>
+<div class='bodydiv' style='width: 300'>
+
+You want to:
+<form name='form1' action='?'>
+<label><input type='radio' name='action' value='safe_set'> Made a safe backup set </label><br>
+<label><input type='radio' name='action' value='help_extern'> Eject media <br>
+<button name='bp' class="bp" value='next'><img src='/bweb/next.png'>Siguiente</button></label>
+</form>
+</div>
</select>
</td></tr><tr><td> Activado : </td><td>
<select name='enabled' class='formulaire'>
- <option value='no'>no</option>
<option value='yes'>yes</option>
+ <option value='no'>no</option>
<option value='archived'>archived</option>
</select>
- </td><tr><td> Usuario: </td><td>
+ </td></tr><tr><td> Usuario: </td><td>
<input type='text' name='user' value='<TMPL_VAR loginname>' class='formulaire'>
</td></tr>
</td></tr><tr><td> Comentario: </td><td>
}
);
<TMPL_IF enabled>
-ok=1;
-for (var i=0; ok && i < document.form1.enabled.length; ++i) {
- if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
- document.form1.enabled[i].selected = true;
- ok=0;
- }
-}
+//ok=1;
+//for (var i=0; ok && i < document.form1.enabled.length; ++i) {
+// if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
+// document.form1.enabled[i].selected = true;
+// ok=0;
+// }
+//}
</TMPL_IF>
</script>
<!-- <h1>Actions</h1> -->
<button type="submit" class="bp" name='action' value='job' title="Voir l'historique"> <img src='/bweb/zoom.png' alt=''>Historique</button>
<button type="submit" class="bp" name='action' value='dsp_cur_job' title='Voir les jobs en cours'> <img src='/bweb/zoom.png' alt=''>Jobs courants</button>
+ <button type="submit" class="bp" name='action' value='groups' title='View client groups'> <img src='/bweb/zoom.png' alt=''>View groups</button>
<button type="submit" class="bp" name='action' value='client_status' title='Statistiques'> <img src='/bweb/zoom.png' alt=''>Statut </button>
<button type="submit" class="bp" name='action' value='client_stats' title='Statistiques'> <img src='/bweb/chart.png' alt=''>Stats </button>
+ <button type="submit" class="bp" name='action' value='client_edit' title='Client groups'> <img src='/bweb/edit.png' alt=''>Modifier </button>
</div>
</form>
--- /dev/null
+<br/>
+<div class='titlediv' style='width: 300'>
+ <h1 class='newstitle'> Help ejecting media</h1>
+</div>
+<div class='bodydiv' style='width: 300'>
+
+You want to:
+<form name='form1' action='?'>
+<label><input type='radio' name='action' value='safe_set'> Made a safe backup set </label><br>
+<label><input type='radio' name='action' value='help_extern'> Eject media <br>
+<button name='bp' class="bp" value='next'><img src='/bweb/next.png'>Suivant</button></label>
+</form>
+</div>
</select>
</td></tr><tr><td> En ligne : </td><td>
<select name='enabled' class='formulaire'>
- <option value='no'>non</option>
<option value='yes'>oui</option>
+ <option value='no'>non</option>
<option value='archived'>archivé</option>
</select>
- </td><tr><td> Utilisateur : </td><td>
+ </td></tr><tr><td> Utilisateur : </td><td>
<input type='text' name='user' value='<TMPL_VAR loginname>' class='formulaire'>
</td></tr>
</td></tr><tr><td> Commentaire : </td><td>
}
);
<TMPL_IF enabled>
-ok=1;
-for (var i=0; ok && i < document.form1.enabled.length; ++i) {
- if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
- document.form1.enabled[i].selected = true;
- ok=0;
- }
-}
+//ok=1;
+//for (var i=0; ok && i < document.form1.enabled.length; ++i) {
+// if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
+// document.form1.enabled[i].selected = true;
+// ok=0;
+// }
+//}
</TMPL_IF>
</script>
}
}
+sub fdebug
+{
+ my ($self, $what) = @_;
+
+ my $old = $self->{debug};
+ $self->{debug}=1;
+ $self->debug($what);
+ $self->{debug} = $old;
+}
+
=head1 FUNCTION
error - display an error to the user
$self->display($self->{info}, "end.tpl");
}
+sub client_edit
+{
+ my ($self) = @_;
+ my $arg = $self->get_form("qclient");
+ my $f1 = $self->get_client_group_filter();
+ my $f2 = $self->get_client_filter();
+
+ my $query = "
+SELECT client_group_name, here
+ FROM client_group $f1
+ LEFT JOIN (SELECT 1 AS here, client_group_id
+ FROM Client JOIN client_group_member USING (ClientId) $f2
+ WHERE Name = $arg->{qclient}) AS temp USING (client_group_id)
+";
+
+ my $all = $self->dbh_selectall_hashref($query, 'client_group_name');
+
+ $self->display({ client_group => [ values %$all ], %$arg }, "client_edit.tpl");
+}
+
sub display_clients
{
my ($self) = @_;
}
my $query = "
-SELECT client_group_name AS name
+SELECT client_group_name AS name, comment AS comment
FROM client_group $filter
";
my $grps = $self->dbh_selectall_hashref($query, 'name');
if ($what{db_usernames}) {
my $query = "
-SELECT username
+SELECT username, comment
FROM bweb_user
";
my $users = $self->dbh_selectall_hashref($query, 'username');
if ($what{db_roles}) {
my $query = "
-SELECT rolename
+SELECT rolename, comment
FROM bweb_role
";
my $r = $self->dbh_selectall_hashref($query, 'rolename');
###########################################################
+sub client_save
+{
+ my ($self) = @_;
+ my $arg = $self->get_form(qw/jclient_groups qclient/);
+
+ unless ($arg->{qclient}) {
+ return $self->error("Can't get client name");
+ }
+
+ $self->can_do('r_group_mgnt');
+
+ my $f1 = $self->get_client_filter();
+ my $f2 = $self->get_client_group_filter();
+
+ $self->{dbh}->begin_work();
+
+ my $query = "
+DELETE FROM client_group_member
+ WHERE ClientId IN
+ (SELECT ClientId
+ FROM Client $f1
+ WHERE Client.Name = $arg->{qclient})
+";
+ $self->dbh_do($query);
+
+ if ($arg->{jclient_groups}) {
+ $query = "
+ INSERT INTO client_group_member (client_group_id, ClientId)
+ (SELECT client_group_id, (SELECT ClientId
+ FROM Client $f1
+ WHERE Name = $arg->{qclient})
+ FROM client_group $f2 WHERE client_group_name IN ($arg->{jclient_groups})
+ )
+";
+ $self->dbh_do($query);
+ }
+
+ $self->{dbh}->commit() or $self->error($self->{dbh}->errstr);
+
+ $self->display_clients();
+}
+
sub groups_edit
{
my ($self) = @_;
my $query = "
SELECT Name AS name
- FROM Client JOIN client_group_member using (clientid)
+ FROM Client JOIN client_group_member using (ClientId)
JOIN client_group using (client_group_id)
WHERE client_group_name = $grp->{qclient_group}
";
my ($self) = @_;
$self->can_do('r_group_mgnt');
- my $arg = $self->get_form(qw/qclient_group jclients qnewgroup/);
+ my $arg = $self->get_form(qw/qclient_group jclients qnewgroup qcomment/);
if (!$arg->{qclient_group} and $arg->{qnewgroup}) {
my $query = "
-INSERT INTO client_group (client_group_name)
-VALUES ($arg->{qnewgroup})
+INSERT INTO client_group (client_group_name, comment)
+VALUES ($arg->{qnewgroup}, $arg->{qcomment})
";
$self->dbh_do($query);
$arg->{qclient_group} = $arg->{qnewgroup};
if ($arg->{jclients}) {
$query = "
- INSERT INTO client_group_member (clientid, client_group_id)
- (SELECT Clientid,
+ INSERT INTO client_group_member (ClientId, client_group_id)
+ (SELECT ClientId,
(SELECT client_group_id
FROM client_group
WHERE client_group_name = $arg->{qclient_group})
if ($arg->{qclient_group} ne $arg->{qnewgroup}) {
$query = "
UPDATE client_group
- SET client_group_name = $arg->{qnewgroup}
+ SET client_group_name = $arg->{qnewgroup}, comment = $arg->{qcomment}
WHERE client_group_name = $arg->{qclient_group}
";
sum(Job.JobFiles) AS nb_files,
client_group.client_group_name AS clientname
FROM Job JOIN Client USING (ClientId)
- JOIN client_group_member ON (Client.ClientId = client_group_member.clientid)
+ JOIN client_group_member ON (Client.ClientId = client_group_member.ClientId)
JOIN client_group USING (client_group_id)
WHERE
client_group.client_group_name = $carg->{qclient_group}
--- /dev/null
+--- Form-original.pm 2005-12-07 09:32:27.000000000 -0500
++++ Form.pm 2007-05-08 13:26:16.000000000 -0400
+@@ -18,5 +18,4 @@
+ textarea => "TextInput",
+
+- button => "IgnoreInput",
+ "reset" => "IgnoreInput",
+
+@@ -25,4 +24,5 @@
+ option => "ListInput",
+
++ button => "SubmitInput",
+ submit => "SubmitInput",
+ image => "ImageInput",
+@@ -118,5 +118,5 @@
+ eval {
+ # optimization
+- $p->report_tags(qw(form input textarea select optgroup option keygen label));
++ $p->report_tags(qw(form input textarea select optgroup option keygen label button));
+ };
+
+@@ -184,4 +184,8 @@
+ $f->push_input($type, $attr);
+ }
++ elsif ($tag eq "button") {
++ my $type = delete $attr->{type} || "submit";
++ $f->push_input($type, $attr);
++ }
+ elsif ($tag eq "textarea") {
+ $attr->{textarea_value} = $attr->{value}
(
roleid serial not null,
rolename text not null,
--- comment text default '',
+ comment text default '',
primary key (roleid)
);
CREATE UNIQUE INDEX bweb_role_idx on bweb_role (rolename(255));
(
client_group_id serial not null,
client_group_name text not null,
+ comment text default '',
primary key (client_group_id)
);
CREATE TABLE client_group_member
(
client_group_id integer not null,
- clientid integer not null,
+ ClientId integer not null,
primary key (client_group_id, clientid)
);
(
roleid serial not null,
rolename text not null,
--- comment text default '',
+ comment text default '',
primary key (roleid)
);
CREATE UNIQUE INDEX bweb_role_idx on bweb_role (rolename);
(
client_group_id serial not null,
client_group_name text not null,
+ comment text default '',
primary key (client_group_id)
);
-- Upgrade from 2.2
-- --------------------------------------------------
+ALTER TABLE client_group ADD COLUMN comment text;
+ALTER TABLE client_group_member RENAME COLUMN clientid TO ClientId;
+
CREATE TABLE bweb_user
(
userid serial not null,
(
roleid serial not null,
rolename text not null,
--- comment text default '',
+ comment text default '',
primary key (roleid)
);
CREATE UNIQUE INDEX bweb_role_idx on bweb_role (rolename(255));
);
BEGIN;
+
+ALTER TABLE client_group ADD COLUMN comment text;
+
CREATE TABLE bweb_user
(
userid serial not null,
(
roleid serial not null,
rolename text not null,
--- comment text default '',
+ comment text default '',
primary key (roleid)
);
CREATE UNIQUE INDEX bweb_role_idx on bweb_role (rolename);
+13Feb08
+ebl Can modify client list group for a specific client
+ebl Disable use of Enabled flag in volume mgnt
+ebl Add comment field to client_group
+
09Jan08
ebl Adapt btime for bacula 2.2.7
<button type="submit" class="bp" name='action' value='groups' title='__View client groups__'> <img src='/bweb/zoom.png' alt=''>__View groups__</button>
<button type="submit" class="bp" name='action' value='client_status' title='__Show client status__'> <img src='/bweb/zoom.png' alt=''>__Status__ </button>
<button type="submit" class="bp" name='action' value='client_stats' title='__Client stats__'> <img src='/bweb/chart.png' alt=''>__Stats__ </button>
+ <button type="submit" class="bp" name='action' value='client_edit' title='__Client groups__'> <img src='/bweb/edit.png' alt=''>__Edit__ </button>
</div>
</form>
--- /dev/null
+<br/>
+<div class='titlediv' style='width: 300'>
+ <h1 class='newstitle'> __Help ejecting media__</h1>
+</div>
+<div class='bodydiv' style='width: 300'>
+
+__You want to:__
+<form name='form1' action='?'>
+<label><input type='radio' name='action' value='safe_set'> __Made a safe backup set__ </label><br>
+<label><input type='radio' name='action' value='help_extern'> __Eject media__ <br>
+<button name='bp' class="bp" value='next'><img src='/bweb/next.png'>__Next__</button></label>
+</form>
+</div>
</select>
</td></tr><tr><td> __Enabled:__ </td><td>
<select name='enabled' class='formulaire'>
- <option value='no'>__no__</option>
<option value='yes'>__yes__</option>
+ <option value='no'>__no__</option>
<option value='archived'>__archived__</option>
</select>
- </td><tr><td> __User:__ </td><td>
+ </td></tr><tr><td> __User:__ </td><td>
<input type='text' name='user' value='<TMPL_VAR loginname>' class='formulaire'>
</td></tr>
</td></tr><tr><td> __Comment:__ </td><td>
}
);
<TMPL_IF enabled>
-ok=1;
-for (var i=0; ok && i < document.form1.enabled.length; ++i) {
- if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
- document.form1.enabled[i].selected = true;
- ok=0;
- }
-}
+//ok=1;
+//for (var i=0; ok && i < document.form1.enabled.length; ++i) {
+// if (document.form1.enabled[i].value == '<TMPL_VAR enabled>') {
+// document.form1.enabled[i].selected = true;
+// ok=0;
+// }
+//}
</TMPL_IF>
</script>