From 5675e5e9653424d1ab0cea5394373432c95718bb Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 27 Feb 2008 07:29:31 +0000 Subject: [PATCH] Updated mass deployment -Added reboot event. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9140 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/gotomasses/class_gotomasses.inc | 2 +- .../gotomasses/events/DaemonEvent_reboot.tpl | 63 +++++++++++++++++++ .../events/DaemonEvent_reinstall.tpl | 6 +- .../gotomasses/events/class_DaemonEvent.inc | 13 +++- .../events/class_DaemonEvent_reboot.inc | 45 +++++++++++++ .../events/class_DaemonEvent_reinstall.inc | 32 +++++++++- 6 files changed, 155 insertions(+), 6 deletions(-) create mode 100644 gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reboot.tpl create mode 100644 gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc diff --git a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc index 47d78b40f..22a91d117 100644 --- a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc +++ b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc @@ -533,7 +533,7 @@ class gotomasses extends plugin "plPriority" => 0, "plSection" => array("addon"), "plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))), - "plProvidedAcls" => array("Comment" => _("Description"), + "plProvidedAcls" => array("Comment" => _("Description")) )); } } diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reboot.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reboot.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reboot.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/DaemonEvent_reinstall.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tpl index 4e3fc127d..448c1f39a 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tpl +++ b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tpl @@ -35,9 +35,13 @@ {t}ID{/t} {$data.ID} + + {t}Progress{/t} + + {t}Status{/t} - {$data.STATUS} + {t}Result{/t} diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc index 0568bfeea..0945f6286 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc @@ -3,7 +3,7 @@ /* This code is part of GOsa (http://www.gosa-project.org) Copyright (C) 2008 Fabian Hickert - +G This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -36,7 +36,7 @@ class DaemonEvent protected $s_Menu_Image = "images/empty.png"; // Image displayed in Actions->New protected $s_List_Image = ""; // Image displayed in event listing - protected $config; // GOsa configuration object + public $config; // GOsa configuration object protected $data; // The event data, when edited protected $a_targets = array(); // The list of assigned Targets (When newly created) @@ -436,6 +436,15 @@ class DaemonEvent return($ids); } + /*! \brief Add a target MAC address + @param Array A List of all target that should be added. + */ + public function add_targets($targets) + { + foreach($targets as $target){ + $this->a_targets[] = $target; + } + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc new file mode 100644 index 000000000..38e391b2a --- /dev/null +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc @@ -0,0 +1,45 @@ +s_Menu_Name = _("Reboot"); + $this->s_Event_Name = _("Reboot a system"); + $this->s_New_Action = "job_trigger_action_reboot"; + $this->s_Edit_Action= "trigger_action_reboot"; + $this->s_Menu_Image = "images/list_reload.png"; + $this->s_List_Image = "images/list_reload.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_reboot.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 05989035f..59e3f5767 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc @@ -2,6 +2,9 @@ class DaemonEvent_reinstall extends DaemonEvent { + var $progress = -1; + var $status = "none"; + public function __construct($config,$data = array()) { DaemonEvent::__construct($config,$data); @@ -11,6 +14,15 @@ class DaemonEvent_reinstall extends DaemonEvent $this->s_Edit_Action= "trigger_action_reinstall"; $this->s_Menu_Image = "images/fai_small.png"; $this->s_List_Image = "images/fai_small.png"; + + if(!$this->is_new()){ + if(isset($data['PROGRESS'])){ + $this->progress = $data['PROGRESS']; + } + if(isset($data['STATUS'])){ + $this->progress = $data['STATUS']; + } + } } public function execute() @@ -27,6 +39,8 @@ class DaemonEvent_reinstall extends DaemonEvent } $smarty = get_smarty(); + $smarty->assign("status" , $this->status); + $smarty->assign("progress" , $this->progress); $smarty->assign("data" , $this->data); $smarty->assign("target_list" , $this->get_target_list()); $smarty->assign("is_new" , $this->is_new); @@ -38,8 +52,22 @@ class DaemonEvent_reinstall extends DaemonEvent public function save_object() { - DaemonEvent::save_object(); - } + $ret = DaemonEvent::save_object(); + foreach(array("progress","status") as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = get_post($attr); + } + } + } + + public function save() + { + $ret = DaemonEvent::save(); + foreach(array("progress","status") as $attr){ + $ret[$attr] = $this->$attr; + } + return($ret); + } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> -- 2.30.2