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
|
|
|
|
*/
|
2012-11-27 01:26:56 +00:00
|
|
|
class Controller_Library extends Controller_TemplateDefault {
|
2011-06-24 01:27:21 +00:00
|
|
|
/**
|
|
|
|
* Default Index for Controller
|
|
|
|
*/
|
|
|
|
public function action_index() {
|
2012-11-27 01:26:56 +00:00
|
|
|
$lo = ORM::factory('LIBRARY');
|
2011-06-24 01:27:21 +00:00
|
|
|
$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,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2012-11-27 05:46:43 +00:00
|
|
|
public function action_detail() {
|
|
|
|
$library = $this->request->param('id');
|
|
|
|
|
2011-06-24 01:27:21 +00:00
|
|
|
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.'),
|
|
|
|
));
|
|
|
|
|
2012-11-26 05:57:18 +00:00
|
|
|
HTTP::redirect('library');
|
2011-06-24 01:27:21 +00:00
|
|
|
}
|
|
|
|
|
2012-11-27 01:26:56 +00:00
|
|
|
$lo = ORM::factory('LIBRARY',$library);
|
2011-06-24 01:27:21 +00:00
|
|
|
if (! $lo->loaded()) {
|
|
|
|
SystemMessage::add(array(
|
|
|
|
'title'=>_('Unknown LIBRARY_NAME'),
|
|
|
|
'type'=>'error',
|
|
|
|
'body'=>sprintf(_('The library pool [%s] does not exist?.'),$library),
|
|
|
|
));
|
|
|
|
|
2012-11-26 05:57:18 +00:00
|
|
|
HTTP::redirect('library');
|
2011-06-24 01:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Block::add(array(
|
|
|
|
'title'=>sprintf(_('Library Information for %s'),$lo->LIBRARY_NAME),
|
2012-11-29 22:58:15 +00:00
|
|
|
'body'=>View::factory('library/detail')->set('o',$lo)
|
|
|
|
));
|
2011-06-24 01:27:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|