Updated Domain and Node views

This commit is contained in:
Deon George
2011-06-01 00:51:15 +10:00
parent ae2c1440ed
commit d7822a03e8
12 changed files with 426 additions and 184 deletions

View File

@@ -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)
));
}
}
?>