Updated Domain and Node views
This commit is contained in:
78
application/classes/controller/domain.php
Normal file
78
application/classes/controller/domain.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* This class provides information on TSM Nodes.
|
||||
*
|
||||
* @package PTA
|
||||
* @subpackage Domains
|
||||
* @category Controllers
|
||||
* @author Deon George
|
||||
* @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 <b>%s</b> domains.'),$do->count_all());
|
||||
$output .= '<br/>';
|
||||
$output .= '<br/>';
|
||||
|
||||
$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();
|
||||
|
||||
Script::add(array(
|
||||
'type'=>'stdin',
|
||||
'data'=>'
|
||||
$(document).ready(function () {$("#domain_name").change(function () {
|
||||
$("#domain_name").trigger("submit");
|
||||
});});'
|
||||
));
|
||||
|
||||
Block::add(array(
|
||||
'title'=>_('TSM Domains'),
|
||||
'body'=>$output,
|
||||
));
|
||||
}
|
||||
|
||||
public function action_detail($domain_name=NULL) {
|
||||
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.'),
|
||||
));
|
||||
|
||||
Request::current()->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),
|
||||
));
|
||||
|
||||
Request::current()->redirect('domain');
|
||||
}
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf(_('Node Information for Domain %s'),$do->DOMAIN_NAME),
|
||||
'body'=>View::factory('domain/detail')->set('do',$do)
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
@@ -29,7 +29,7 @@ class Controller_NODE extends Controller_TemplateDefault {
|
||||
$select[$node->NODE_NAME] = $node->NODE_NAME;
|
||||
|
||||
$output .= Form::open('/node/detail',array('id'=>'node_detail'));
|
||||
$output .= sprintf('%s: %s',_('Choose a new to view'),Form::select('node_name',$select,NULL,array('id'=>'node_name')));
|
||||
$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();
|
||||
|
||||
@@ -48,10 +48,26 @@ $(document).ready(function () {$("#node_name").change(function () {
|
||||
}
|
||||
|
||||
public function action_detail($node_name=NULL) {
|
||||
if (is_null($node_name) AND (empty($_POST['node_name']) OR ! $node_name = $_POST['node_name']))
|
||||
throw new Kohana_Exception('Missing NODE_NAME');
|
||||
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.'),
|
||||
));
|
||||
|
||||
Request::current()->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),
|
||||
));
|
||||
|
||||
Request::current()->redirect('node');
|
||||
}
|
||||
|
||||
Block::add(array(
|
||||
'title'=>sprintf('%s %s',_('Detailed Node Information for'),$no->NODE_NAME),
|
||||
@@ -73,15 +89,5 @@ $(document).ready(function () {$("#node_name").change(function () {
|
||||
'body'=>View::factory('nodes/detail_schedule')->set('node',$no),
|
||||
));
|
||||
}
|
||||
|
||||
public function action_summary() {
|
||||
$do = ORM::factory('domain');
|
||||
|
||||
foreach ($do->find_all() as $domain)
|
||||
Block::add(array(
|
||||
'title'=>_('Node Information by Domain'),
|
||||
'body'=>View::factory('nodes/summary')->set('do',$domain)
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@@ -23,20 +23,20 @@ class Controller_Tree extends Controller_lnApp_Tree {
|
||||
*/
|
||||
public function action_json($id=null,array $data=array()) {
|
||||
// @todo Our menu options
|
||||
array_push($data,array(
|
||||
'id'=>'domain',
|
||||
'name'=>'Domain Info',
|
||||
'state'=>'none',
|
||||
'attr_id'=>'1',
|
||||
'attr_href'=>URL::Site('domain'),
|
||||
));
|
||||
|
||||
array_push($data,array(
|
||||
'id'=>'node',
|
||||
'name'=>'Node Info',
|
||||
'state'=>'none',
|
||||
'attr_id'=>'1',
|
||||
'attr_href'=>URL::Site('/node'),
|
||||
));
|
||||
|
||||
array_push($data,array(
|
||||
'id'=>'node_summary',
|
||||
'name'=>'Node Summary',
|
||||
'state'=>'none',
|
||||
'attr_id'=>'1',
|
||||
'attr_href'=>URL::Site('/node/summary'),
|
||||
'attr_href'=>URL::Site('node'),
|
||||
));
|
||||
|
||||
array_push($data,array(
|
||||
@@ -44,7 +44,7 @@ class Controller_Tree extends Controller_lnApp_Tree {
|
||||
'name'=>'Server Activity Gantt',
|
||||
'state'=>'none',
|
||||
'attr_id'=>'1',
|
||||
'attr_href'=>URL::Site('/server/gantt'),
|
||||
'attr_href'=>URL::Site('server/gantt'),
|
||||
));
|
||||
|
||||
return parent::action_json($id,$data);
|
||||
|
Reference in New Issue
Block a user