More minor library display fixes

This commit is contained in:
Deon George 2011-06-27 15:11:32 +10:00
parent c4ef5e2275
commit 183f9e3b74
4 changed files with 9 additions and 5 deletions

View File

@ -132,7 +132,7 @@ class Model_LIBRARY extends ORMTSM {
if (! isset($CACHE[__METHOD__]))
foreach (ORM::factory('volhistory')->where('TYPE','IN',Kohana::config('config.tsmdbtypes'))->find_all() as $vho)
$CACHE[__METHOD__][$vho->LIBVOLUME ? 'IN' : 'OUT'][] = $vho;
$CACHE[__METHOD__][$vho->LIBVOLUME->LIBRARY_NAME ? 'IN' : 'OUT'][] = $vho;
return isset($CACHE[__METHOD__][$inout]) ? $CACHE[__METHOD__][$inout] : array();
}

View File

@ -27,13 +27,17 @@ class Model_LIBVOLUME extends ORMTSM {
switch (strtolower($this->STATUS)) {
case 'scratch': return strtolower($this->STATUS);
case 'private':
if ($this->VOLUME->STATUS == 'EMPTY')
return 'empty';
switch (strtolower($this->LAST_USE)) {
case 'dbbackup':
case 'data':
return strtolower($this->LAST_USE);
default: return ($this->VOLUME->STATUS == 'EMPTY') ? 'empty' : 'unknown';
default: return 'unkown';
}
default: return 'notcheckedin';
}
}
@ -80,7 +84,7 @@ class Model_LIBVOLUME extends ORMTSM {
}
public function removable() {
return ($this->usage() == 'dbbackup' OR ($this->usage() != 'scratch' AND $this->VOLUME->STGPOOL->POOLTYPE != 'PRIMARY')) ? TRUE : FALSE;
return ($this->usage() == 'dbbackup' OR (! in_array($this->usage(),array('empty','scratch')) AND $this->VOLUME->STGPOOL->POOLTYPE != 'PRIMARY')) ? TRUE : FALSE;
}
}
?>

View File

@ -56,7 +56,7 @@ class Model_VOLUME extends ORMTSM {
// Age of a volume, based on last read/write access.
public function age() {
if (! $this->LAST_READ_DATE AND ! $this->LAST_WRITE_DATE)
if ((! $this->LAST_READ_DATE AND ! $this->LAST_WRITE_DATE) OR $this->STATUS == 'EMPTY')
return 0;
else
return (int)((time()-(strtotime(strtotime($this->LAST_READ_DATE) > strtotime($this->LAST_WRITE_DATE) ? $this->LAST_WRITE_DATE : $this->LAST_READ_DATE)))/86400);

View File

@ -241,7 +241,7 @@
</tr>
<?php $i=0; foreach ($lo->volsnotinlib() as $vo) { ?>
<tr class="<?php echo $i++%2 ? 'odd' : 'even'; ?>">
<td class="data"><?php echo $vo; ?></td>
<td class="data"><?php echo $vo.($vo->recycle() ? ' &sup1' : ''); ?></td>
<td class="data"><?php echo $vo->STGPOOL_NAME; ?></td>
<td class="data"><?php printf('%s/%s',$vo->display('STATUS'),$vo->display('ACCESS')); ?></td>
<td class="data"><?php echo $vo->display('PCT_UTILIZED'); ?></td>