diff --git a/application/classes/Controller/Domain.php b/application/classes/Controller/Domain.php
index e1e6465..ab0116c 100644
--- a/application/classes/Controller/Domain.php
+++ b/application/classes/Controller/Domain.php
@@ -10,63 +10,9 @@
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
-class Controller_Domain extends Controller_TemplateDefault {
- /**
- * Default Index for Controller
- */
- public function action_index() {
- $do = ORM::factory('DOMAIN');
- $output = '';
-
- $output .= sprintf(_('This server has %s domains.'),$do->count_all());
- $output .= '
';
- $output .= '
';
-
- $select = array();
- $select[NULL] = '';
-
- foreach ($do->find_all() as $domain)
- $select[$domain->DOMAIN_NAME] = $domain->DOMAIN_NAME;
-
- $output .= Form::open('/domain/detail',array('id'=>'domain_detail'));
- $output .= sprintf('%s: %s',_('Choose a domain to view'),Form::select('domain_name',$select,NULL,array('id'=>'domain_name')));
- $output .= Form::submit('form_submit',_('Go'));
- $output .= Form::close();
-
- Block::add(array(
- 'title'=>_('TSM Domains'),
- 'body'=>$output,
- ));
- }
-
- public function action_detail() {
- $domain_name = $this->request->param('id');
-
- if (is_null($domain_name) AND (empty($_POST['domain_name']) OR ! $domain_name = $_POST['domain_name'])) {
- SystemMessage::add(array(
- 'title'=>_('DOMAIN_NAME is required'),
- 'type'=>'error',
- 'body'=>_('The domain name is required.'),
- ));
-
- HTTP::redirect('domain');
- }
-
- $do = ORM::factory('DOMAIN',$domain_name);
- if (! $do->loaded()) {
- SystemMessage::add(array(
- 'title'=>_('Unknown DOMAIN_NAME'),
- 'type'=>'error',
- 'body'=>sprintf(_('The domain [%s] does not exist?.'),$domain_name),
- ));
-
- HTTP::redirect('domain');
- }
-
- Block::add(array(
- 'title'=>sprintf(_('Node Information for Domain %s'),$do->DOMAIN_NAME),
- 'body'=>View::factory('domain/detail')->set('o',$do)
- ));
- }
+class Controller_Domain extends Controller_TemplateDefault_View {
+ protected $index_title = 'TSM Domains';
+ protected $detail_title = 'Information on Domain';
+ protected $orm = 'DOMAIN';
}
?>
diff --git a/application/classes/Controller/Library.php b/application/classes/Controller/Library.php
index 7e3b936..898d028 100644
--- a/application/classes/Controller/Library.php
+++ b/application/classes/Controller/Library.php
@@ -10,63 +10,9 @@
* @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 %s libraries.'),$lo->count_all());
- $output .= '
';
- $output .= '
';
-
- $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 = $this->request->param('id');
-
- 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.'),
- ));
-
- HTTP::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),
- ));
-
- HTTP::redirect('library');
- }
-
- Block::add(array(
- 'title'=>sprintf(_('Library Information for %s'),$lo->LIBRARY_NAME),
- 'body'=>View::factory('library/detail')->set('o',$lo)
- ));
- }
+class Controller_Library extends Controller_TemplateDefault_View {
+ protected $index_title = 'TSM Libraries';
+ protected $detail_title = 'Information on Library';
+ protected $orm = 'LIBRARY';
}
?>
diff --git a/application/classes/Controller/Node.php b/application/classes/Controller/Node.php
index dda1f3d..389ac1c 100644
--- a/application/classes/Controller/Node.php
+++ b/application/classes/Controller/Node.php
@@ -10,78 +10,9 @@
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
-class Controller_Node extends Controller_TemplateDefault {
- /**
- * Default Index for Controller
- */
- public function action_index() {
- $no = ORM::factory('NODE');
- $output = '';
-
- $output .= sprintf(_('This server has %s defined nodes.'),$no->count_all());
- $output .= '
';
- $output .= '
';
-
- $select = array();
- $select[NULL] = '';
-
- foreach ($no->find_all() as $node)
- $select[$node->NODE_NAME] = $node->NODE_NAME;
-
- $output .= Form::open('/node/detail',array('id'=>'node_detail'));
- $output .= sprintf('%s: %s',_('Choose a node to view'),Form::select('node_name',$select,NULL,array('id'=>'node_name')));
- $output .= Form::submit('form_submit',_('Go'));
- $output .= Form::close();
-
- Block::add(array(
- 'title'=>_('TSM Nodes'),
- 'body'=>$output,
- ));
- }
-
- public function action_detail() {
- $node_name = $this->request->param('id');
-
- if (is_null($node_name) AND (empty($_POST['node_name']) OR ! $node_name = $_POST['node_name'])) {
- SystemMessage::add(array(
- 'title'=>_('NODE_NAME is required'),
- 'type'=>'error',
- 'body'=>_('The node name is required.'),
- ));
-
- HTTP::redirect('node');
- }
-
- $no = ORM::factory('NODE',$node_name);
- if (! $no->loaded()) {
- SystemMessage::add(array(
- 'title'=>_('Unknown NODE_NAME'),
- 'type'=>'error',
- 'body'=>sprintf(_('The node [%s] does not exist?.'),$node_name),
- ));
-
- HTTP::redirect('node');
- }
-
- Block::add(array(
- 'title'=>sprintf('%s %s',_('Detailed Node Information for'),$no->NODE_NAME),
- 'body'=>View::factory('node/detail')->set('o',$no),
- ));
-
- Block::add(array(
- 'title'=>_('Protected File System Information'),
- 'body'=>View::factory('node/filesystems')->set('o',$no),
- ));
-
- Block::add(array(
- 'title'=>_('Sequential Volume Usage Information'),
- 'body'=>View::factory('node/volumes')->set('o',$no),
- ));
-
- Block::add(array(
- 'title'=>_('Schedule Information'),
- 'body'=>View::factory('node/schedule')->set('o',$no),
- ));
- }
+class Controller_Node extends Controller_TemplateDefault_View {
+ protected $index_title = 'TSM Nodes';
+ protected $detail_title = 'Information on Node';
+ protected $orm = 'NODE';
}
?>
diff --git a/application/classes/Controller/Stgpool.php b/application/classes/Controller/Stgpool.php
index ec2eca6..6e0032f 100644
--- a/application/classes/Controller/Stgpool.php
+++ b/application/classes/Controller/Stgpool.php
@@ -10,63 +10,9 @@
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
-class Controller_Stgpool extends Controller_TemplateDefault {
- /**
- * Default Index for Controller
- */
- public function action_index() {
- $so = ORM::factory('STGPOOL');
- $output = '';
-
- $output .= sprintf(_('This server has %s stgpool pools.'),$so->count_all());
- $output .= '
';
- $output .= '
';
-
- $select = array();
- $select[NULL] = '';
-
- foreach ($so->find_all() as $stgpool)
- $select[$stgpool->STGPOOL_NAME] = $stgpool->STGPOOL_NAME;
-
- $output .= Form::open('/stgpool/detail',array('id'=>'stgpool_detail'));
- $output .= sprintf('%s: %s',_('Choose a storage pool to view'),Form::select('stgpool_name',$select,NULL,array('id'=>'stgpool_name')));
- $output .= Form::submit('form_submit',_('Go'));
- $output .= Form::close();
-
- Block::add(array(
- 'title'=>_('TSM Storage Pools'),
- 'body'=>$output,
- ));
- }
-
- public function action_detail() {
- $stgpool = $this->request->param('id');
-
- if (is_null($stgpool) AND (empty($_POST['stgpool_name']) OR ! $stgpool = $_POST['stgpool_name'])) {
- SystemMessage::add(array(
- 'title'=>_('STGPOOL_NAME is required'),
- 'type'=>'error',
- 'body'=>_('The stgpool pool name is required.'),
- ));
-
- HTTP::redirect('stgpool');
- }
-
- $so = ORM::factory('STGPOOL',$stgpool);
- if (! $so->loaded()) {
- SystemMessage::add(array(
- 'title'=>_('Unknown STGPOOL_NAME'),
- 'type'=>'error',
- 'body'=>sprintf(_('The stgpool pool [%s] does not exist?.'),$stgpool),
- ));
-
- HTTP::redirect('stgpool');
- }
-
- Block::add(array(
- 'title'=>sprintf(_('Storage Pool Information for %s'),$so->STGPOOL_NAME),
- 'body'=>View::factory('stgpool/detail')->set('o',$so)
- ));
- }
+class Controller_Stgpool extends Controller_TemplateDefault_View {
+ protected $index_title = 'TSM Storage Pools';
+ protected $detail_title = 'Information on Storage Pool';
+ protected $orm = 'STGPOOL';
}
?>
diff --git a/application/classes/Controller/TemplateDefault.php b/application/classes/Controller/TemplateDefault.php
index b269e3f..1e4d300 100644
--- a/application/classes/Controller/TemplateDefault.php
+++ b/application/classes/Controller/TemplateDefault.php
@@ -10,7 +10,7 @@
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
-class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
+abstract class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
protected $auth_required = TRUE;
}
?>
diff --git a/application/classes/Controller/TemplateDefault/View.php b/application/classes/Controller/TemplateDefault/View.php
new file mode 100644
index 0000000..72e5d14
--- /dev/null
+++ b/application/classes/Controller/TemplateDefault/View.php
@@ -0,0 +1,77 @@
+orm);
+
+ $output = '';
+
+ $output .= sprintf(_('This server has %s %s.'),$o->count_all(),$o->table_name());
+ $output .= '
';
+ $output .= '
';
+
+ $select = array();
+ $select[NULL] = '';
+
+ foreach ($o->find_all() as $oo)
+ $select[$oo->pk()] = $oo->pk();
+
+ $output .= Form::open(sprintf('%s/detail',strtolower($this->request->controller())),array('id'=>'object_detail'));
+ $output .= sprintf('%s: %s',_('Choose to view'),Form::select('object_name',$select,NULL,array('id'=>'object_name')));
+ $output .= Form::submit('form_submit',_('Go'));
+ $output .= Form::close();
+
+ Block::add(array(
+ 'title'=>$this->index_title,
+ 'body'=>$output,
+ ));
+ }
+
+ public function action_detail() {
+ $object_name = $this->request->param('id');
+
+ if (is_null($object_name) AND (empty($_POST['object_name']) OR ! $object_name = $_POST['object_name'])) {
+ SystemMessage::add(array(
+ 'title'=>_('Missing required data'),
+ 'type'=>'error',
+ 'body'=>sprintf(_('The %s is required.'),$o->primary_key()),
+ ));
+
+ HTTP::redirect(strtolower($this->request->controller()));
+ }
+
+ $o = ORM::factory($this->orm,$object_name);
+
+ if (! $o->loaded()) {
+ SystemMessage::add(array(
+ 'title'=>_('Unknown Entry'),
+ 'type'=>'error',
+ 'body'=>sprintf(_('The %s [%s] does not exist?.'),$o->table_name(),$object_name),
+ ));
+
+ HTTP::redirect(strtolower($this->request->controller()));
+ }
+
+ Block::add(array(
+ 'title'=>$this->detail_title,
+ 'body'=>View::factory(sprintf('%s/detail',strtolower($this->request->controller())))->set('o',$o),
+ ));
+ }
+}
+?>
diff --git a/application/classes/Controller/Tree.php b/application/classes/Controller/Tree.php
index fee4f70..0da023f 100644
--- a/application/classes/Controller/Tree.php
+++ b/application/classes/Controller/Tree.php
@@ -63,6 +63,14 @@ class Controller_Tree extends lnApp_Controller_Tree {
'attr_href'=>URL::Site('stgpool'),
));
+ array_push($data,array(
+ 'id'=>'volume',
+ 'name'=>'Volume Info',
+ 'state'=>'none',
+ 'attr_id'=>'1',
+ 'attr_href'=>URL::Site('volume'),
+ ));
+
return parent::action_json($data);
}
}
diff --git a/application/classes/Controller/Volume.php b/application/classes/Controller/Volume.php
new file mode 100644
index 0000000..c9e2730
--- /dev/null
+++ b/application/classes/Controller/Volume.php
@@ -0,0 +1,18 @@
+
diff --git a/application/views/node/detail.php b/application/views/node/detail.php
index d69295d..20eaa7f 100644
--- a/application/views/node/detail.php
+++ b/application/views/node/detail.php
@@ -12,3 +12,6 @@
set('o',$o); ?> |
+set('o',$o); ?>
+set('o',$o); ?>
+set('o',$o); ?>
diff --git a/application/views/volume/detail.php b/application/views/volume/detail.php
new file mode 100644
index 0000000..912f56c
--- /dev/null
+++ b/application/views/volume/detail.php
@@ -0,0 +1,8 @@
+
+
+ set('o',$o); ?> |
+
+
+ set('o',$o); ?> |
+
+
diff --git a/application/views/volume/info.php b/application/views/volume/info.php
new file mode 100644
index 0000000..1de1a02
--- /dev/null
+++ b/application/views/volume/info.php
@@ -0,0 +1,65 @@
+
+
+
+ Volume Information |
+
+
+ |
+
+
+ Volume Name |
+ display('VOLUME_NAME'); ?> |
+
+
+ Storage Pool |
+ STGPOOL_NAME,$o->display('STGPOOL_NAME')); ?> |
+
+
+ Estimated Capacity |
+ display('EST_CAPACITY_MB'); ?> |
+
+
+ Utilisation |
+ display('PCT_UTILIZED'); ?> |
+
+
+ Status |
+ display('STATUS'); ?> |
+
+
+ Access |
+ display('ACCESS'); ?> |
+
+
+ Reclaimable |
+ display('PCT_RECLAIM'); ?> |
+
+
+ Scratch Volume |
+ display('SCRATCH'); ?> |
+
+
+ Times Mounted |
+ display('TIMES_MOUNTED'); ?> |
+
+
+ Write/Read Errors |
+ display('WRITE_ERRORS'),$o->display('READ_ERRORS')); ?> |
+
+
+ Last Write |
+ display('LAST_WRITE_DATE'); ?> |
+
+
+ Last Read |
+ display('LAST_READ_DATE'); ?> |
+
+
+ Pending |
+ display('PENDING_DATE'); ?> |
+
+
+ Location |
+ display('LOCATION'); ?> |
+
+
diff --git a/application/views/volume/nodes.php b/application/views/volume/nodes.php
new file mode 100644
index 0000000..81ebd27
--- /dev/null
+++ b/application/views/volume/nodes.php
@@ -0,0 +1,21 @@
+
+
+
+ Nodes with Data on this Volume |
+
+
+ |
+
+
+ Node |
+ Type |
+ File Space |
+
+ VOLUMEUSAGE->find_all() as $oo) { ?>
+
+ NODE_NAME,$oo->NODE_NAME); ?> |
+ display('COPY_TYPE'); ?> |
+ display('FILESPACE_NAME'); ?> |
+
+
+