Added drive to library view
This commit is contained in:
parent
279eacd4ab
commit
2d7cfd3eb3
@ -11,17 +11,22 @@
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Database_TSM_Show extends Database_Result {
|
||||
private $data = array();
|
||||
|
||||
public function __construct($result, $sql, $as_object = FALSE, array $params = NULL) {
|
||||
parent::__construct($result, $sql, $as_object, $params);
|
||||
|
||||
$sql = strtolower($sql);
|
||||
|
||||
$start = FALSE;
|
||||
$barcodewarn = FALSE;
|
||||
foreach ($result as $line) {
|
||||
if (! trim($line))
|
||||
continue;
|
||||
|
||||
if (preg_match('/^show slots /',$sql))
|
||||
if (preg_match('/^show slots /',$sql)) {
|
||||
$library = strtoupper(preg_replace('/^show slots /','',$sql));
|
||||
|
||||
if (preg_match('/^Slot /',$line)) {
|
||||
if ($start)
|
||||
$this->_internal_row++;
|
||||
@ -39,10 +44,20 @@ class Database_TSM_Show extends Database_Result {
|
||||
elseif (preg_match('/^barcode\s+/',$val))
|
||||
$slot['barcode'] = preg_replace('/^barcode /','',$val);
|
||||
|
||||
$slot['library'] = preg_replace('/^show slots /','',$sql);
|
||||
$slot['library'] = $library;
|
||||
$this->_rows[$this->_internal_row] = new Slot($slot);
|
||||
$start = TRUE;
|
||||
|
||||
if (! $barcodewarn AND $slot['status'] == 'Allocated' AND $slot['barcode'] == 'not present') {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Missing Bar Code Labels'),
|
||||
'type'=>'warning',
|
||||
'body'=>sprintf(_('Some allocated slots do not have a bar code label, you may need to run "AUDIT LIBRARY %s CHECKLABEL=BARCODE"'),$library),
|
||||
));
|
||||
|
||||
$barcodewarn = TRUE;
|
||||
}
|
||||
|
||||
} elseif (preg_match('/busy.$/',$line)) {
|
||||
SystemMessage::add(array(
|
||||
'title'=>_('Library is Busy'),
|
||||
@ -51,11 +66,26 @@ class Database_TSM_Show extends Database_Result {
|
||||
));
|
||||
|
||||
return;
|
||||
|
||||
} elseif (preg_match('/:/',$line)) {
|
||||
$line = str_replace(' ','',$line);
|
||||
list($k,$v) = explode(':',$line,2);
|
||||
|
||||
$this->data[$k] = $v;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->_total_rows = $this->_internal_row;
|
||||
$this->_internal_row = 0;
|
||||
}
|
||||
|
||||
public function __get($key) {
|
||||
if (isset($this->data[$key]))
|
||||
return $this->data[$key];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
25
application/classes/model/drive.php
Normal file
25
application/classes/model/drive.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
*
|
||||
* @package PTA
|
||||
* @subpackage Drive
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_DRIVE extends ORMTSM {
|
||||
protected $_table_name = 'DRIVES';
|
||||
protected $_primary_key = 'DRIVE_NAME';
|
||||
protected $_sorting = array(
|
||||
'DRIVE_NAME'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_has_one = array(
|
||||
);
|
||||
protected $_has_many = array(
|
||||
'PATH'=>array('foreign_key'=>array('LIBRARY_NAME'=>'LIBRARY_NAME','DRIVE_NAME'=>'DESTINATION_NAME')),
|
||||
);
|
||||
}
|
||||
?>
|
@ -18,8 +18,8 @@ class Model_FILESPACE extends ORMTSM {
|
||||
);
|
||||
|
||||
protected $_has_many = array(
|
||||
'VOLUMEUSAGE'=>array('foreign_key'=>array('NODE_NAME','FILESPACE_NAME'),'far_key'=>'FILESPACE_NAME'),
|
||||
'OCCUPANCY'=>array('foreign_key'=>array('NODE_NAME','FILESPACE_NAME'),'far_key'=>'FILESPACE_NAME'),
|
||||
'VOLUMEUSAGE'=>array('foreign_key'=>array('NODE_NAME'=>'NODE_NAME','FILESPACE_NAME'=>'FILESPACE_NAME')),
|
||||
'OCCUPANCY'=>array('foreign_key'=>array('NODE_NAME'=>'NODE_NAME','FILESPACE_NAME'=>'FILESPACE_NAME')),
|
||||
);
|
||||
|
||||
protected $_display_filters = array(
|
||||
|
@ -19,6 +19,7 @@ class Model_LIBRARY extends ORMTSM {
|
||||
protected $_has_one = array(
|
||||
);
|
||||
protected $_has_many = array(
|
||||
'DRIVE'=>array('foreign_key'=>'LIBRARY_NAME','far_key'=>'LIBRARY_NAME'),
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
@ -19,8 +19,8 @@ class Model_MGMTCLASS extends ORMTSM {
|
||||
);
|
||||
|
||||
protected $_has_one = array(
|
||||
'COPYGROUP_BU'=>array('foreign_key'=>array('DOMAIN_NAME','SET_NAME','CLASS_NAME')),
|
||||
'COPYGROUP_AR'=>array('foreign_key'=>array('DOMAIN_NAME','SET_NAME','CLASS_NAME')),
|
||||
'COPYGROUP_BU'=>array('foreign_key'=>array('DOMAIN_NAME'=>'DOMAIN_NAME','SET_NAME'=>'SET_NAME','CLASS_NAME'=>'CLASS_NAME')),
|
||||
'COPYGROUP_AR'=>array('foreign_key'=>array('DOMAIN_NAME'=>'DOMAIN_NAME','SET_NAME'=>'SET_NAME','CLASS_NAME'=>'CLASS_NAME')),
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
24
application/classes/model/path.php
Normal file
24
application/classes/model/path.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
*
|
||||
* @package PTA
|
||||
* @subpackage Drive Paths
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 phpTSMadmin Development Team
|
||||
* @license http://phptsmadmin.sf.net/license.html
|
||||
*/
|
||||
class Model_PATH extends ORMTSM {
|
||||
protected $_table_name = 'PATHS';
|
||||
protected $_primary_key = 'DEVICE';
|
||||
protected $_sorting = array(
|
||||
'DESTINATION_NAME'=>'ASC',
|
||||
);
|
||||
|
||||
protected $_has_one = array(
|
||||
);
|
||||
protected $_has_many = array(
|
||||
);
|
||||
}
|
||||
?>
|
@ -34,5 +34,14 @@ class Slot {
|
||||
public function __toString() {
|
||||
return $this->slot;
|
||||
}
|
||||
|
||||
public function barcodelabel() {
|
||||
if ($this->status == 'Allocated' AND $this->barcode == 'not present')
|
||||
return _('No Label');
|
||||
elseif ($this->status == 'Unallocated')
|
||||
return _('Slot Empty');
|
||||
else
|
||||
return $this->barcodelabel;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -45,6 +45,7 @@ return array
|
||||
'CLIENTOPTS' => 1200,
|
||||
'DEVCLASSES' => 1200,
|
||||
'DOMAINS' => 1200,
|
||||
'DRIVES' => 1200,
|
||||
'EVENTS' => 1200,
|
||||
'FILESPACES' => 1200,
|
||||
'LIBRARIES' => 1200,
|
||||
@ -52,6 +53,7 @@ return array
|
||||
'MGMTCLASSES' => 1200,
|
||||
'NODES' => 1200,
|
||||
'OCCUPANCY' => 1200,
|
||||
'PATHS' => 1200,
|
||||
'SCHEMA' => 604800,
|
||||
'STGPOOLS' => 1200,
|
||||
'SUMMARY' => 180,
|
||||
@ -62,6 +64,7 @@ return array
|
||||
'cachepreload' => array(
|
||||
'DEVCLASSES' => 1200,
|
||||
'DOMAINS' => 1200,
|
||||
'DRIVES' => 1200,
|
||||
'LIBVOLUMES' => 1200,
|
||||
'LIBRARIES' => 1200,
|
||||
'NODES' => 1200,
|
||||
|
@ -10,7 +10,8 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 40%;">Name</td>
|
||||
<td style="width: 60%;" class="data"><?php echo $lo->display('LIBRARY_NAME'); ?></td>
|
||||
<td style="width: 60%;" class="data"><?php printf('%s (%s)',$lo->display('LIBRARY_NAME'),$slots->ProductId); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Serial Number</td>
|
||||
<td class="data"><?php echo $lo->display('LIBRARY_SERIAL'); ?></td>
|
||||
@ -19,6 +20,14 @@
|
||||
<td>Type</td>
|
||||
<td class="data"><?php echo $lo->display('LIBRARY_TYPE'); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Drives</td>
|
||||
<td class="data"><?php echo $slots->Drives; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Slots/Changers</td>
|
||||
<td class="data"><?php printf('%s/%s',$slots->Slots,$slots->Changers); ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shared</td>
|
||||
<td class="data"><?php echo $lo->display('SHARED'); ?></td>
|
||||
@ -34,7 +43,39 @@
|
||||
</table>
|
||||
</td>
|
||||
<td style="width: 50%; vertical-align: top;">
|
||||
|
||||
<table class="box-full">
|
||||
<tr>
|
||||
<td class="head" colspan="5">Drives in this Library</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="spacer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Serial Number</td>
|
||||
<td>Online</td>
|
||||
<td>State</td>
|
||||
<td>Volume</td>
|
||||
</tr>
|
||||
<?php $i=0;foreach ($lo->DRIVE->find_all() as $do) { ?>
|
||||
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
|
||||
<td class="data"><?php echo $do->display('DRIVE_NAME'); ?></td>
|
||||
<td class="data"><?php echo $do->display('DRIVE_SERIAL'); ?></td>
|
||||
<td class="data"><?php echo $do->display('ONLINE'); ?></td>
|
||||
<td class="data"><?php echo $do->display('DRIVE_STATE'); ?></td>
|
||||
<td class="data"><?php echo $do->display('VOLUME_NAME'); ?></td>
|
||||
</tr>
|
||||
<?php foreach ($do->PATH->find_all() as $po) { ?>
|
||||
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
|
||||
<td> </td>
|
||||
<td><?php echo $po->display('SOURCE_NAME'); ?></td>
|
||||
<td><?php echo $po->display('SOURCE_TYPE'); ?></td>
|
||||
<td><?php echo $po->display('DESTINATION_TYPE'); ?></td>
|
||||
<td><?php echo $po->display('DEVICE'); ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -60,7 +101,7 @@
|
||||
<?php $i=0; foreach ($slots as $slot) { ?>
|
||||
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
|
||||
<td class="data"><acronym title="<?php printf('%s: %s',_('Element'),$slot->element); ?>"><?php echo $slot; ?></acronym></td>
|
||||
<td class="data"><?php echo $slot->barcodelabel; ?></td>
|
||||
<td class="data"><?php echo HTML::nbsp($slot->barcodelabel()); ?></td>
|
||||
<td class="data"><?php echo $slot->LIBVOLUME->volusage(); ?></td>
|
||||
<td class="data"><?php echo HTML::nbsp($slot->LIBVOLUME->status()); ?></td>
|
||||
<td class="data"><?php echo HTML::nbsp($slot->LIBVOLUME->access()); ?></td>
|
||||
|
Reference in New Issue
Block a user