my $cmd;
if ($arg->{nb} > 0) {
+ $arg->{offset} = $arg->{offset}?$arg->{offset}:1;
$cmd = "add pool=\"$arg->{pool}\" storage=\"$arg->{storage}\"\n$arg->{nb}\n$arg->{media}\n$arg->{offset}\n";
} else {
$cmd = "add pool=\"$arg->{pool}\" storage=\"$arg->{storage}\"\n0\n$arg->{media}\n";
my $info = $b->send_cmd("show job=\"$job\"");
my $attr = $self->run_parse_job($info);
- my $arg = $self->get_form('pool', 'level', 'client', 'fileset', 'storage');
+ my $arg = $self->get_form(qw/pool level client fileset storage media/);
+
+ if (!$arg->{pool} and $arg->{media}) {
+ my $r = $self->dbh_selectrow_hashref("
+SELECT Pool.Name AS name
+ FROM Media JOIN Pool USING (PoolId)
+ WHERE Media.VolumeName = '$arg->{media}'
+ AND Pool.Name != 'Scratch'
+");
+ if ($r) {
+ $arg->{pool} = $r->{name};
+ }
+ }
+
my %job_opt = (%$attr, %$arg);
my $jobs = [ map {{ name => $_ }} $b->list_job() ];
<td><input size='3' type='text' name='nb' value='1' class='formulaire'></td>
</tr>
<tr><td>Starting number :</td>
- <td><input size='3' type='text' name='offset' class='formulaire' value='0'></td>
+ <td><input size='3' type='text' name='offset' class='formulaire' value='1'></td>
</tr>
<tr><td>Name :</td>
<td><input size='8' type='text' name='media' class='formulaire' value='Vol'></td>
</tr>
</table>
- <button type="submit" class="bp" name='action' value='add_media'
+ <button type="submit" class="bp" name='action' value='add_media'>
<img src='/bweb/add.png' alt=''>Add<button>
</form>
</div>
<img src='/bweb/inflag0.png' alt=''> Disable </button>
<input type='hidden' name='pool' value=''>
<input type='hidden' name='level' value=''>
+ <input type='hidden' name='media' value=''>
</form>
</div>
chkbox.onclick = function() {
document.form1.level.value = '<TMPL_VAR level>';
document.form1.pool.value = '<TMPL_VAR pool>';
+ document.form1.media.value = '<TMPL_VAR volume>';
} ;
data.push( new Array(