2011-06-24 01:27:21 +00:00
|
|
|
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class provides information on TSM attached Libraries.
|
|
|
|
*
|
|
|
|
* @package PTA
|
|
|
|
* @subpackage Libraries
|
|
|
|
* @category Controllers
|
|
|
|
* @author Deon George
|
|
|
|
* @copyright (c) 2010 phpTSMadmin Development Team
|
|
|
|
* @license http://phptsmadmin.sf.net/license.html
|
|
|
|
*/
|
|
|
|
class Controller_LIBRARY extends Controller_TemplateDefault {
|
|
|
|
/**
|
|
|
|
* Default Index for Controller
|
|
|
|
*/
|
|
|
|
public function action_index() {
|
|
|
|
$lo = ORM::factory('library');
|
|
|
|
$output = '';
|
|
|
|
|
|
|
|
$output .= sprintf(_('This server has <b>%s</b> libraries.'),$lo->count_all());
|
|
|
|
$output .= '<br/>';
|
|
|
|
$output .= '<br/>';
|
|
|
|
|
|
|
|
$select = array();
|
|
|
|
$select[NULL] = '';
|
|
|
|
|
|
|
|
foreach ($lo->find_all() as $library)
|
|
|
|
$select[$library->LIBRARY_NAME] = $library->LIBRARY_NAME;
|
|
|
|
|
|
|
|
$output .= Form::open('/library/detail',array('id'=>'library_detail'));
|
|
|
|
$output .= sprintf('%s: %s',_('Choose a storage pool to view'),Form::select('library_name',$select,NULL,array('id'=>'library_name')));
|
|
|
|
$output .= Form::submit('form_submit',_('Go'));
|
|
|
|
$output .= Form::close();
|
|
|
|
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>_('TSM Libraries'),
|
|
|
|
'body'=>$output,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function action_detail($library=NULL) {
|
|
|
|
if (is_null($library) AND (empty($_POST['library_name']) OR ! $library = $_POST['library_name'])) {
|
|
|
|
SystemMessage::add(array(
|
|
|
|
'title'=>_('LIBRARY_NAME is required'),
|
|
|
|
'type'=>'error',
|
|
|
|
'body'=>_('The library pool name is required.'),
|
|
|
|
));
|
|
|
|
|
|
|
|
Request::current()->redirect('library');
|
|
|
|
}
|
|
|
|
|
|
|
|
$lo = ORM::factory('library',$library);
|
|
|
|
if (! $lo->loaded()) {
|
|
|
|
SystemMessage::add(array(
|
|
|
|
'title'=>_('Unknown LIBRARY_NAME'),
|
|
|
|
'type'=>'error',
|
|
|
|
'body'=>sprintf(_('The library pool [%s] does not exist?.'),$library),
|
|
|
|
));
|
|
|
|
|
|
|
|
Request::current()->redirect('library');
|
|
|
|
}
|
|
|
|
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>sprintf(_('Library Information for %s'),$lo->LIBRARY_NAME),
|
|
|
|
'body'=>View::factory('library/detail')
|
|
|
|
->set('lo',$lo)
|
2011-06-26 12:20:12 +00:00
|
|
|
->set('slots',$lo->slots())
|
2011-06-24 01:27:21 +00:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|