From f5582b7f18b2e0beb0b71bb912c099fbebb091f1 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 26 Feb 2008 08:47:49 +0000 Subject: [PATCH] Updated gotomasses. -Added reinstall, halt, wakeup, update. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9118 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/gotomasses/class_gotomasses.inc | 30 +++++---- .../gotomasses/events/DaemonEvent_halt.tlp | 63 +++++++++++++++++++ .../events/DaemonEvent_reinstall.tlp | 63 +++++++++++++++++++ .../gotomasses/events/DaemonEvent_update.tpl | 63 +++++++++++++++++++ .../events/class_DaemonEvent_halt.inc | 36 +++++++++-- .../events/class_DaemonEvent_reinstall.inc | 35 ++++++++++- .../events/class_DaemonEvent_update.inc | 36 ++++++++++- .../events/class_DaemonEvent_wakeup.inc | 2 +- 8 files changed, 305 insertions(+), 23 deletions(-) create mode 100644 gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tlp create mode 100644 gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tlp create mode 100644 gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl diff --git a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc index 9351fc9b4..d7043005a 100644 --- a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc +++ b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc @@ -115,9 +115,9 @@ class gotomasses extends plugin if(preg_match("/^add_event_/",$s_action)){ $type = preg_replace("/^add_event_/","",$s_action); - if(isset($this->events[$type])){ - $e_data = $this->events[$type]; - $this->dialog = new $e_data['NAME']($this->config); + if(isset($this->events['BY_CLASS'][$type])){ + $e_data = $this->events['BY_CLASS'][$type]; + $this->dialog = new $e_data['CLASS_NAME']($this->config); } } @@ -283,7 +283,7 @@ class gotomasses extends plugin $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); $divlist->AddHeader(array("string"=>""._("Target").$sort_img_1."")); $divlist->AddHeader(array("string"=>""._("Task").$sort_img_2."", - "attach"=>"style='width:80px;'")); + "attach"=>"style='width:120px;'")); $divlist->AddHeader(array("string"=>""._("Schedule").$sort_img_3."", "attach"=>"style='width:100px;'")); $divlist->AddHeader(array("string"=>""._("Status").$sort_img_4."", @@ -313,19 +313,25 @@ class gotomasses extends plugin $color = ""; $display = $task['MACADDRESS']; $display2= $task['HEADERTAG']; - - if( isset($this->events['BY_EDIT_ACTION'][$display2]['ListImage']) && - !empty($this->events['BY_EDIT_ACTION'][$display2]['ListImage'])){ - $display2 = $this->events['BY_EDIT_ACTION'][$display2]['ListImage']; - } + + /* Check if this event exists as Daemon class + * In this case, display a more accurate entry. + */ + if(isset($this->events['BY_EDIT_ACTION'][$task['HEADERTAG']]['s_Menu_Name'])){ + $event_type = $this->events['BY_EDIT_ACTION'][$task['HEADERTAG']]; + $display2= $event_type['s_Menu_Name']; + if(isset($event_type['ListImage']) && !empty($event_type['ListImage'])){ + $display2 = $event_type['ListImage']." ".$display2; + } + } /* Create each field */ - $field0 = array("string" => "" , + $field0 = array("string" => "" , "attach" => "style='width:20px;".$color."'"); $field1 = array("string" => $display, "attach" => "style='".$color."'"); $field1a= array("string" => $display2, - "attach" => "style='".$color.";width:80px; text-align:right;'"); + "attach" => "style='".$color.";width:120px;'"); $field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:100px;'"); $field3 = array("string" => $task['STATUS'],"attach" => "style='".$color.";width:80px;'"); $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'"); @@ -457,7 +463,7 @@ class gotomasses extends plugin $this->entries = array(); foreach($entries as $entry){ - $this->entries[]= $entry; + $this->entries[$entry['ID']]= $entry; } } diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tlp b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tlp new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tlp @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tlp b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tlp new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tlp @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc index 58961297a..502ce8844 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc @@ -1,16 +1,44 @@ s_Menu_Name = _("Shutdown"); - $this->s_Event_Name = _("Shutdown"); - $this->s_New_Action = "trigger_action_halt"; + $this->s_Menu_Name = _("Shutdown"); + $this->s_Event_Name = _("Shutdown"); + $this->s_New_Action = "job_trigger_action_halt"; + $this->s_Edit_Action= "trigger_action_halt"; $this->s_Menu_Image = "images/status_stopped.png"; + $this->s_List_Image = "images/status_stopped.png"; + } + + public function execute() + { + DaemonEvent::execute(); + + $display = $this->get_header(); + + $tmp = $this->data; + + /* Check if target add dialog is open */ + if($this->is_target_list_open() && $this->is_new){ + return($this->get_target_add_list()); + } + + $smarty = get_smarty(); + $smarty->assign("data" , $this->data); + $smarty->assign("target_list" , $this->get_target_list()); + $smarty->assign("is_new" , $this->is_new); + $smarty->assign("timestamp" , $this->get_time_select()); + $display.= $smarty->fetch(get_template_path('DaemonEvent_halt.tpl', TRUE, dirname(__FILE__))); + $display.= $this->get_footer(); + return($display); } + public function save_object() + { + DaemonEvent::save_object(); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc index 46f7d6428..b4340c1ec 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc @@ -5,12 +5,41 @@ class DaemonEvent_reinstall extends DaemonEvent public function __construct($config,$data = array()) { DaemonEvent::__construct($config,$data); - $this->s_Menu_Name = _("Reinstall"); + $this->s_Menu_Name = _("Reinstall"); $this->s_Event_Name = _("Reinstall"); - $this->s_New_Action = "trigger_action_reinstall"; - $this->s_Menu_Image = "images/fai_small.png"; + $this->s_New_Action = "job_trigger_action_reinstall"; + $this->s_Edit_Action= "trigger_action_reinstall"; + $this->s_Menu_Image = "images/fai_small.png"_small; + $this->s_List_Image = "images/fai_small.png"; } + public function execute() + { + DaemonEvent::execute(); + + $display = $this->get_header(); + + $tmp = $this->data; + + /* Check if target add dialog is open */ + if($this->is_target_list_open() && $this->is_new){ + return($this->get_target_add_list()); + } + + $smarty = get_smarty(); + $smarty->assign("data" , $this->data); + $smarty->assign("target_list" , $this->get_target_list()); + $smarty->assign("is_new" , $this->is_new); + $smarty->assign("timestamp" , $this->get_time_select()); + $display.= $smarty->fetch(get_template_path('DaemonEvent_reinstall.tpl', TRUE, dirname(__FILE__))); + $display.= $this->get_footer(); + return($display); + } + + public function save_object() + { + DaemonEvent::save_object(); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc index ca1b9e11e..03e589c4b 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc @@ -1,16 +1,46 @@ s_Menu_Name = _("Software update"); - $this->s_Event_Name = _("software update"); - $this->s_New_Action = "trigger_action_update"; + $this->s_Menu_Name = _("Software update"); + $this->s_Event_Name = _("software update"); + $this->s_New_Action = "job_trigger_action_update"; + $this->s_Edit_Action= "trigger_action_update"; $this->s_Menu_Image = "images/time.png"; + $this->s_List_Image = "images/time.png"; + } + + public function execute() + { + DaemonEvent::execute(); + + $display = $this->get_header(); + + $tmp = $this->data; + + /* Check if target add dialog is open */ + if($this->is_target_list_open() && $this->is_new){ + return($this->get_target_add_list()); + } + + $smarty = get_smarty(); + $smarty->assign("data" , $this->data); + $smarty->assign("target_list" , $this->get_target_list()); + $smarty->assign("is_new" , $this->is_new); + $smarty->assign("timestamp" , $this->get_time_select()); + $display.= $smarty->fetch(get_template_path('DaemonEvent_update.tpl', TRUE, dirname(__FILE__))); + $display.= $this->get_footer(); + return($display); } + public function save_object() + { + DaemonEvent::save_object(); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc index 9386ea1d1..69fb776d8 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc @@ -6,7 +6,7 @@ class DaemonEvent_wakeup extends DaemonEvent { DaemonEvent::__construct($config,$data); $this->s_Menu_Name = _("Wake up"); - $this->s_Event_Name = _("Wake up a system"); + $this->s_Event_Name = _("Start a system"); $this->s_New_Action = "job_trigger_action_wake"; $this->s_Edit_Action= "trigger_action_wake"; $this->s_Menu_Image = "images/status_running.png"; -- 2.30.2