<!-- volume/detail.phtml -->

<script type="text/javascript">
$(document).ready(function() {
    $('#ok').click(function() {
        $.blockUI({
            message: '<h2><?php print $this->translate->_("Please wait"); ?>...</h2>',
            css: { backgroundColor: '#f3fcf2' },
            centerX: true,
            centerY: true
        });
    });
});
</script>

<h1><?php echo $this->escape($this->title); ?></h1>

<?php
// Volume Status
$astatus = array(
    "Append"    => $this->translate->_("Append"),
    "Full"      => $this->translate->_("Full"),
    "Recycle"   => $this->translate->_("Recycle"),
    "Purged"    => $this->translate->_("Purged"),
    "Read-Only" => $this->translate->_("Read-Only"),
    "Disabled"  => $this->translate->_("Disabled"),
    "Error"     => $this->translate->_("Error"),
    "Busy"      => $this->translate->_("Busy"),
    "Used"      => $this->translate->_("Used"),
    "Cleaning"  => $this->translate->_("Cleaning"),
    "Archive"   => $this->translate->_("Archive")
);
// Pools
foreach($this->pools as $pool) {
    $apool[ $this->escape($pool['poolid']) ] = $this->escape($pool['name']);
}
// Recycle Flag
$arecucle = array(
    '0' => "-",
    '1' => "+"
);
// InChanger Flag
$ainchanger = array(
    '0' => "-",
    '1' => "+"
);
?>

<?php if ($this->result): ?>

<form action="<?php  echo $this->baseUrl.'/volume/update/';?>" method="post">

<!-- container -->
<table border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td>
<!-- part 1 -->

<table id="box-table-one-column">
    <colgroup><col class="col-first"></colgroup>
    <colgroup><col style="width: 20em;"></colgroup>
    <thead>
    </thead>
<tbody>
<?php foreach($this->result as $line) : ?>
    <?php echo $this->formHidden('mediaid', $this->escape($line['mediaid']), null); ?>
    <?php echo $this->formHidden('volumename', $this->escape($line['volumename']), null); ?>
<tr>
    <td> <?php print $this->translate->_("Media Id"); ?> </td>
    <td><?php echo $this->escape($line['mediaid']);?></td>
</tr><tr>
<tr>
    <td><b><?php print $this->translate->_("Volume Name"); ?></b></td>
    <td><?php echo $this->escape($line['volumename']);?></td>
</tr><tr>
<tr>
    <td><b><?php print $this->translate->_("Pool"); ?></b></td>
    <td>
        <?php echo $this->formSelect('poolid', $this->escape($line['poolid']), null, $apool); ?>
    </td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Status"); ?> </td>
    <td>
    <?php echo $this->formSelect('volstatus', $this->escape($line['volstatus']), null, $astatus); ?>
    </td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Bytes"); ?> </td>
    <td><?php echo $this->ConvBytes( $this->escape($line['volbytes']) );?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Max Bytes"); ?> </td>
    <td><?php echo $this->ConvBytes( $this->escape($line['maxvolbytes']) );?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Jobs"); ?> </td>
    <td><?php echo '<a href="', $this->baseUrl, '/job/find-volume-name/volname/', $this->escape($line['volumename']), '" ',
                'title="', $this->translate->_("List Jobs by Volume Name"), '">',
                number_format($this->escape($line['voljobs'])), '</a>'; ?>
    </td>
</tr><tr>
<tr>
    <td><?php echo $this->translate->_("Retention")," (",$this->translate->_("days"), ")"; ?> </td>
    <td>
    <?php echo $this->formText('volretention', $this->ConvSecondsToDays( $this->escape($line['volretention']) ),
        array('size' => 5)) ?>
    </td>
</tr><tr>
<tr>
    <td><?php echo $this->translate->_("Use Duration")," (",$this->translate->_("seconds"), ")"; ?> </td>
    <td>
    <?php echo $this->formText('voluseduration', $this->escape($line['voluseduration'] ),
        array('size' => 10)) ?>
    </td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Recycle "); ?> </td>
    <td><?php echo $this->formSelect('recycle', $this->escape($line['recycle']), null, $arecucle); ?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Autochanger<br />Slot<br />number"); ?> </td>
    <td><?php echo $this->formText('slot', $this->escape($line['slot']), array('size' => 5)) ?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("In Changer"); ?> </td>
    <td><?php echo $this->formSelect('inchanger', $this->escape($line['inchanger']), null, $ainchanger); ?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Media Type"); ?> </td>
    <td><?php echo $this->escape($line['mediatype']);?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("First Written"); ?> </td>
    <td><?php echo $this->escape($line['firstwritten']);?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Last Written"); ?> </td>
    <td><?php echo $this->escape($line['lastwritten']);?></td>
</tr>
<tbody>
</table>

</td>
<td>
<!-- part 2 -->

<table id="box-table-one-column" style="margin-left:1em; margin-right:1em;">
    <colgroup><col class="col-first"></colgroup>
    <colgroup><col style="width: 20em;"></colgroup>
    <thead>
    </thead>
<tbody>
<tr>
    <td><?php print $this->translate->_("Label Date"); ?> </td>
    <td><?php echo $this->escape($line['labeldate']);?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Files"); ?> </td>
    <td><?php echo $this->escape($line['volfiles']);?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Blocks"); ?> </td>
    <td><?php echo $this->escape($line['volblocks']);?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Mounts"); ?> </td>
    <td><?php echo $this->escape($line['volmounts']);?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Errors"); ?> </td>
    <?php
        if ( $this->escape($line['volerrors']) == 0 )
            echo '<td></td>';
        else
            echo '<td class="err">' . $this->escape($line['volerrors']) . '</td>';
    ?>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Number of writes"); ?> </td>
    <td><?php echo $this->escape($line['volwrites']);?></td>
</tr><tr>
<tr>
    <td><?php echo $this->translate->_("Capacity"), ' ', $this->translate->_("Bytes"); ?> </td>
    <td><?php echo $this->ConvBytes( $this->escape($line['volcapacitybytes']) );?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Enabled"); ?> </td>
    <?php
        if ( $this->escape($line['enabled']) == 0 )
            echo '<td class="err">'.$this->translate->_("Disabled").'</td>';
        else
            echo '<td>+</td>';
    ?>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Max Volume Jobs"); ?> </td>
    <td><?php echo $this->formText('maxvoljobs', $this->escape($line['maxvoljobs']), array('size' => 9)) ?> </td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Max Volume Files"); ?> </td>
    <td><?php echo $this->formText('maxvolfiles', $this->escape($line['maxvolfiles']), array('size' => 9)) ?> </td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Read Time"); ?> </td>
    <td><?php
            if ( $this->escape($line['volreadtime']) != 0) {
                echo $this->escape($line['volreadtime']);
            } else {
                echo '&nbsp;';
            }
        ?>
    </td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Write Time"); ?> </td>
    <td><?php
            if ( $this->escape($line['volwritetime']) != 0) {
                echo $this->escape($line['volwritetime']);
            } else {
                echo '&nbsp;';
            }
        ?>
    </td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Recycle Count"); ?> </td>
    <td><?php echo $this->escape($line['recyclecount']);?></td>
</tr><tr>
<tr>
    <td><?php print $this->translate->_("Comment"); ?> </td>
    <td><?php echo $this->formTextarea('comment', $this->escape($line['comment']), array('cols' => "25", 'rows' => "2")); ?></td>
</tr>
<?php endforeach; ?>
<tbody>
</table>

</td>
</tr>

<tr>
<td colspan="2" align="center">
<?php echo $this->formSubmit('ok', $this->translate->_('Submit Form')); ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo $this->formReset('reset', $this->translate->_('Reset Form')); ?>
</td>
</tr>

</table>

<!-- end container -->
</form>


<?php else: ?>
	<p><b><?php print $this->translate->_("No Volumes found."); ?></b></p>
<?php endif; ?>