summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: abc0500)
raw | patch | inline | side by side (parent: abc0500)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 2 Dec 2008 09:12:21 +0000 (09:12 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 2 Dec 2008 09:12:21 +0000 (09:12 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13106 594d385d-05f5-0310-b6e9-bd551577e9d8
98 files changed:
diff --git a/gosa-plugins/fai/addons/goto/class_gotoLogView.inc b/gosa-plugins/fai/addons/goto/class_gotoLogView.inc
--- /dev/null
@@ -0,0 +1,215 @@
+<?php
+
+class gotoLogView extends plugin
+{
+
+ var $mac;
+ var $logs;
+ var $event;
+ var $parent;
+ var $config;
+
+ var $o_queue;
+
+ var $selected_date;
+ var $selected_file = 0;
+
+ var $attributes = array("macAddress");
+ var $macAddress = "";
+
+ var $sort_by = "time";
+ var $sort_dir = 1; // 1 => up, 0 => down
+
+ var $ignore_account = TRUE;
+ var $standalone = FALSE;
+
+ function __construct(&$config,$dn,$parent)
+ {
+ $this->config = $config;
+ $this->parent = $parent;
+
+ /* Try to fetch logs for the given event (mac)
+ */
+ $this->o_queue = new gosaSupportDaemon();
+
+ /* Load ldap object if given
+ and use this macAddress.
+ */
+ if(is_object($parent) && $dn != "" && $dn != "new"){
+ plugin::plugin($config,$dn,$parent);
+ }
+
+ /* Get correct macAddress.
+ Check if an event is given or a ldap object.
+ */
+ if(is_array($this->parent) && isset($this->parent['MACADDRESS'])){
+ $this->mac = $this->parent['MACADDRESS'];
+ $this->standalone = TRUE;
+ }elseif(isset($parent->attrs['macAddress'][0])){
+ $this->mac = $parent->attrs['macAddress'][0];
+ $this->standalone = FALSE;
+ }
+
+ /* Query for log files
+ */
+ $res = $this->o_queue->get_log_info_for_mac($this->mac);
+ if($this->o_queue->is_configured() && $this->o_queue->is_error()){
+ msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
+ }
+
+ /* Check if there is at least one log file
+ */
+ if(!isset($res[$this->mac]) || !is_array($res[$this->mac])){
+ $this->logs = array();
+ }else{
+ $this->selected_date = key($res[$this->mac]);
+ $this->logs = $res;
+ }
+
+ }
+
+
+ function execute()
+ {
+ $smarty = get_smarty();
+ $smarty->assign("logs",$this->logs);
+ $smarty->assign("logs_available", isset($this->logs[$this->mac]));
+ $smarty->assign("mac",$this->mac);
+ $smarty->assign("selected_file",$this->selected_file);
+ $smarty->assign("selected_date",$this->selected_date);
+ $smarty->assign("log_file", $this->get_log($this->mac,$this->selected_date,$this->selected_file));
+ $smarty->assign("standalone",$this->standalone);
+
+ if (isset($this->logs[$this->mac])){
+ $date = date("d.m.Y H:i:s",$this->logs[$this->mac][$this->selected_date]['REAL_DATE']);
+ }
+ $file = $this->selected_file;
+ $smarty->assign("selected_log",_("none"));
+ if(!empty($file)){
+ $smarty->assign("selected_log",$file.", ".$date);
+ }
+
+ $divlist = new divlist("log_view");
+
+ /* Create sort direction images
+ */
+ if($this->sort_dir){
+ $img = "<img src='images/lists/sort-down.png' border='0' alt='\\/'>";
+ }else{
+ $img = "<img src='images/lists/sort-up.png' border='0' alt='/\\'";
+ }
+ if($this->sort_by == "file"){
+ $img1 = $img;
+ $img2 = "";
+ }else{
+ $img1 = "";
+ $img2 = $img;
+ }
+
+
+ /* Create list header
+ */
+ $divlist->SetHeader(array(
+ array("string"=>"<a href='?plug=".$_GET['plug']."&sort_by=file'>"._("File")." ".$img1."</a>",
+ "attach"=>"width='200px;'"),
+ array("string"=>"<a href='?plug=".$_GET['plug']."&sort_by=time'>"._("Date")." ".$img2."</a>",
+ "attach" => "style='border-right:none;'"),
+ ));
+
+ /* Create divlist list
+ */
+ $divlist->SetEntriesPerPage(0);
+ $divlist->SetHeight(150);
+
+ /* Create sortable array
+ */
+ $link = "<a href='?plug=".$_GET['plug']."&time=%time%&file=%file%&mac=%mac%'>%str%</a>";
+ $to_add = array();
+ $sort_by = $this->sort_by;
+ foreach($this->logs as $mac => $times){
+ foreach($times as $time => $data){
+ $rtime = $data['REAL_DATE'];
+ foreach($data['FILES'] as $file){
+
+ $highlight = "";
+ if($file == $this->selected_file && $time == $this->selected_date && $mac == $this->mac){
+ $highlight = "background-color:#CCCCCC";
+ }
+
+ $use_link = preg_replace(array("/%mac%/","/%time%/","/%file%/"),array($mac,$time,$file),$link);
+ $to_add[$$sort_by.$file.$time] = array(
+ array("string" => preg_replace("/%str%/",$file,$use_link),
+ "attach" => "style='width:200px; $highlight'"),
+ array("string" => preg_replace("/%str%/",date("d.m.Y H:i:s",$rtime),$use_link),
+ "attach" => "style='border-right:none; $highlight'"),
+ );
+ }
+ }
+ }
+
+ /* Sort entries
+ */
+ if(!$this->sort_dir){
+ uksort($to_add, "strnatcasecmp");
+ }else{
+ uksort($to_add, "strnatcasecmp");
+ $to_add = array_reverse($to_add);
+ }
+
+ /* Append entries to list
+ */
+ foreach($to_add as $entry){
+ $divlist->AddEntry($entry);
+ }
+
+ $smarty->assign("ACL",preg_match("/r/",$this->getacl("")));
+ $smarty->assign("divlist",$divlist->DrawList());
+ return($smarty->fetch(get_template_path('log_view.tpl', TRUE,dirname(__FILE__))));
+ }
+
+
+ function get_log($mac,$date,$file)
+ {
+ $res = $this->o_queue->get_log_file($mac,$date,$file);
+ if($this->o_queue->is_configured() && $this->o_queue->is_error()){
+ msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
+ }
+ $res = nl2br(htmlentities($res));
+ return($res);
+ }
+
+
+ function save_object()
+ {
+ foreach(array("time"=>"selected_date","file"=>"selected_file") as $attr => $dest){
+ if(isset($_GET[$attr])){
+ $this->$dest = $_GET[$attr];
+ }
+ }
+ if(isset($_GET['sort_by']) && in_array($_GET['sort_by'],array("file","time"))){
+ if($_GET['sort_by'] == $this->sort_by){
+ $this->sort_dir = !$this->sort_dir;
+ }
+ $this->sort_by = $_GET['sort_by'];
+ }
+ }
+
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Log view"),
+ "plDescription" => _("GOto log view"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 30,
+ "plSection" => array("administration"),
+ "plCategory" => array("workstation","server"),
+
+ "plProvidedAcls"=> array()
+ ));
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/class_goto_import_file.inc b/gosa-plugins/fai/addons/goto/class_goto_import_file.inc
--- /dev/null
@@ -0,0 +1,179 @@
+<?php
+
+class goto_import_file extends plugin
+{
+
+ var $events = array();
+ var $csv_fields = array();
+ var $import_successful = FALSE; // Indicates that we have successfully imported everything.
+
+ public function __construct($config,&$parent)
+ {
+ plugin::plugin($config,NULL);
+ $this->parent = $parent;
+ $this->daemon_events = DaemonEvent::get_event_types( SYSTEM_EVENT | HIDDEN_EVENT);
+
+ $this->csv_fields = array(
+ "0"=>"TIMESTAMP","1" => "MAC", "2" => "HEADER", "3" => "OGROUP",
+ "4" => "BASE", "5" => "FQDN", "6" => "IP", "7" => "DHCP");
+ }
+
+
+ private function parse_csv($str)
+ {
+
+ /* Some file checks
+ */
+ $lines = split("\n",$str);
+ if(empty($str) || !count($lines)){
+ msg_dialog::display(_("Import"), msgPool::incorrectUpload(_("file is empty")),ERROR_DIALOG);
+ return;
+ }
+
+ /* Reset current events
+ */
+ $this->events = array();
+
+ /* Parse each line of the given file
+ */
+ foreach($lines as $line){
+
+ // Skip empty lines.
+ if(empty($line)) continue;
+
+ /* Load values from file
+ */
+ $fields = split(";",$line);
+ $event = array();
+ foreach($this->csv_fields as $key => $val) {
+ $event[$val] = "";
+ if(isset($fields[$key])){
+ $event[$val] = $fields[$key];
+ }
+ }
+ $this->events[] = $event;
+ }
+ $this->check_fields();
+ }
+
+
+ public function execute()
+ {
+ /* Import file
+ */
+ if(isset($_POST['import']) && isset($_FILES['file'])) {
+ if(isset($_FILES['file']['tmp_name'])){
+ $str = file_get_contents($_FILES['file']['tmp_name']);
+ $this->parse_csv($str);
+ }
+ }
+
+ /* Import started
+ */
+ $confirmed = FALSE;
+ foreach($_POST as $name => $value){
+ if(preg_match("/^MSG_OK/",$name)){
+ $confirmed = TRUE;
+ }
+ }
+ if(isset($_POST['start_import']) || $confirmed){
+ $error = FALSE;
+ if(!$confirmed){
+ foreach($this->events as $event){
+ if(!empty($event['ERROR'])){
+ $error = TRUE;
+ break;
+ }
+ }
+ if($error){
+ msg_dialog::display(_("Import"),
+ _("Selected entries will be skipped because of errors. Do you want to proceed?"),CONFIRM_DIALOG);
+ }
+ }
+ if(!$error){
+
+ $success = 0;
+ $fail = 0;
+
+ foreach($this->events as $key => $event){
+ if(!empty($event['ERROR'])){
+ $fail ++;
+ continue;
+ }
+
+ /* Create event
+ */
+ $class= $this->daemon_events['QUEUED'][$event['HEADER']];
+ $o_data = $this->daemon_events['BY_CLASS'][$class];
+ $object = new $class($this->config);
+ $object->add_targets(array($event['MAC']));
+ if($o_data['s_Schedule_Action'] == $event['HEADER']){
+ $object->set_type(SCHEDULED_EVENT);
+ }else{
+ $object->set_type(TRIGGERED_EVENT);
+ }
+
+ /* Update values like fqdn a.s.o
+ */
+ foreach($this->csv_fields as $name){
+ if($name == "TIMESTAMP" && empty($event[$name])) continue;
+ $object->set_value($name,$event[$name]);
+ }
+
+ if(!$this->parent->o_queue->append($object)){
+ msg_dialog::display(_("Service infrastructure"),msgPool::siError($this->parent->o_queue->get_error()),ERROR_DIALOG);
+ $fail ++;
+ }else{
+ unset($this->events[$key]);
+ $success ++;
+ }
+ }
+ msg_dialog::display(_("Import"),sprintf(_("Import complete: %s events successfully send, %s failed"),$success,$fail),INFO_DIALOG);
+ $this->import_successful = count($this->events) == 0;
+ }
+ }
+
+
+ /* Prepare output
+ */
+ $evts = $this->events;
+ foreach($this->events as $id => $evt){
+ foreach($evt as $key => $val){
+ if(in_array($key,$this->csv_fields)){
+ $evts[$id][$key] = "<span style=\"white-space: nowrap;\">".strip_tags($val)."</span>";
+ }
+ }
+ }
+
+ $smarty = get_smarty();
+ $smarty->assign("info",$evts);
+ $smarty->assign("count",count($evts));
+ return($smarty->fetch(get_template_path('goto_import_file.tpl', TRUE)));
+ }
+
+
+ public function check()
+ {
+ $message = plugin::check();
+ $this->check_fields();
+ return($message);
+ }
+
+
+ private function check_fields()
+ {
+ foreach($this->events as $key => $event){
+ $this->events[$key]['ERROR'] = "";
+ if(empty($event['MAC']) || !tests::is_mac($event['MAC'])){
+ $this->events[$key]['ERROR'] .= msgPool::invalid(_("MAC")).", ";
+ }
+ if(empty($event['HEADER']) || !isset($this->daemon_events['QUEUED'][$event['HEADER']])){
+ $this->events[$key]['ERROR'] .= msgPool::invalid(_("Event")).", ";
+ }
+ $this->events[$key]['ERROR'] = trim($this->events[$key]['ERROR'],", ");
+ }
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/class_gotomasses.inc b/gosa-plugins/fai/addons/goto/class_gotomasses.inc
--- /dev/null
@@ -0,0 +1,922 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class gotomasses extends plugin
+{
+ /* Definitions */
+ var $plHeadline = "Deployment status";
+ var $plDescription = "System deployment status";
+ var $plIcon = "plugins/goto/images/goto.png";
+
+ /* attribute list for save action */
+ var $attributes= array();
+ var $objectclasses= array();
+
+ /* Queue tasks */
+ var $current = FALSE;
+ var $dialog = FALSE;
+ var $ids_to_remove = array();
+ var $divlist = NULL;
+
+ var $events = array();
+ var $event_tags = array();
+
+ var $sort_by = "Schedule";
+ var $sort_dir = "up";
+ var $entries = array();
+ var $range = 25;
+ var $start = 0;
+
+ var $recently_removed = array();
+
+ function gotomasses(&$config, $dn= NULL)
+ {
+ /* Include config object */
+ $this->config= &$config;
+ $this->o_queue = new gosaSupportDaemon(TRUE,5);
+ $this->events = DaemonEvent::get_event_types( SYSTEM_EVENT);
+
+ /* Get tags that will be used in queue searches */
+ $this->event_tags = array("none");
+ foreach($this->events['SCHEDULED'] as $evt){
+ $this->event_tags[] = $evt['s_Queued_Action'];
+ }
+
+ /* Load filter settings */
+ if(!session::is_set("gotomasses_filter")){
+ $gotomasses_filter =
+ array(
+ "range" => $this->range,
+ "sort_by" => $this->sort_by,
+ "sort_dir" => $this->sort_dir);
+ session::set("gotomasses_filter",$gotomasses_filter);
+ }
+ $gotomasses_filter = session::get("gotomasses_filter");
+ foreach(array("range","sort_by","sort_dir") as $attr) {
+ $this->$attr = $gotomasses_filter[$attr];
+ }
+ }
+
+
+ function execute()
+ {
+ $smarty = get_smarty();
+
+ /************
+ * Handle posts
+ ************/
+
+ $s_entry = $s_action = "";
+ $arr = array(
+
+ "/^pause_/" => "pause",
+ "/^resume_/" => "resume",
+ "/^execute_process_/" => "execute_process",
+ "/^abort_process_/" => "abort_process",
+
+ "/^prio_up_/" => "prio_up",
+ "/^prio_down_/" => "prio_down",
+
+ "/^edit_task_/" => "edit",
+ "/^log_view_/" => "logview",
+ "/^remove_task_/" => "remove",
+ "/^new_task_/" => "new_task");;
+
+ foreach($arr as $regex => $action){
+ foreach($_POST as $name => $value){
+ if(preg_match($regex,$name)){
+ $s_action = $action;
+ $s_entry = preg_replace($regex,"",$name);
+ $s_entry = preg_replace("/_(x|y)$/","",$s_entry);
+ }
+ }
+ }
+
+ /* Menu actions */
+ if(isset($_POST['menu_action']) && !empty($_POST['menu_action'])){
+ $s_action = $_POST['menu_action'];
+ }
+
+ /* Edit posted from list link */
+ if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id']) && isset($this->tasks[$_GET['id']])){
+ $s_action = "edit";
+ $s_entry = $_GET['id'];
+ }
+
+
+ /************
+ * Import CSV file
+ ************/
+
+ if($s_action == "import_file" && $this->acl_is_writeable("")){
+ $this->dialog = new goto_import_file($this->config,$this);
+ }
+
+ if(isset($_POST['import_abort'])){
+ $this->dialog = FALSE;
+ }
+
+
+ /************
+ * Handle Priority modifications
+ ************/
+
+ if(preg_match("/^prio_/",$s_action) && $this->acl_is_writeable("")){
+ switch($s_action){
+ case 'prio_down' : $this->update_priority($s_entry,"down");break;
+ case 'prio_up' : $this->update_priority($s_entry,"up");break;
+ }
+ }
+
+ /************
+ * Handle pause/resume/execute modifications
+ ************/
+
+ if(preg_match("/^resume/",$s_action) ||
+ preg_match("/^pause/",$s_action) ||
+ preg_match("/^abort_process/",$s_action) ||
+ preg_match("/^execute_process/",$s_action)){
+
+ if($this->acl_is_writeable("")){
+ switch($s_action){
+ case 'resume' : $this->resume_queue_entries (array($s_entry));break;
+ case 'pause' : $this->pause_queue_entries (array($s_entry));break;
+ case 'execute_process': $this->execute_queue_entries (array($s_entry));break;
+ case 'abort_process' : $this->abort_queue_entries (array($s_entry));break;
+ case 'resume_all' : $this->resume_queue_entries ($this->list_get_selected_items());break;
+ case 'pause_all' : $this->pause_queue_entries ($this->list_get_selected_items());break;
+ case 'execute_process_all': $this->execute_queue_entries ($this->list_get_selected_items());break;
+ case 'abort_process_all' : $this->abort_queue_entries ($this->list_get_selected_items());break;
+
+ default : trigger_error("Undefined action setting used (".$s_action.").");
+ }
+ }
+ if($this->o_queue->is_error()){
+ msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
+ }
+ }
+
+ /************
+ * ADD
+ ************/
+
+ if(preg_match("/^add_event_/",$s_action) && $this->acl_is_writeable("")){
+ $type = preg_replace("/^add_event_/","",$s_action);
+ if(isset($this->events['BY_CLASS'][$type])){
+ $e_data = $this->events['BY_CLASS'][$type];
+ $this->dialog = new $e_data['CLASS_NAME']($this->config);
+ }
+ }
+
+ /************
+ * EDIT
+ ************/
+
+ if($s_action == "edit" && $this->acl_is_writeable("")){
+ $id = $s_entry;
+ $type = FALSE;
+ if(isset($this->entries[$id])){
+ $event = $this->entries[$s_entry];
+ if($event['STATUS'] == "waiting" && isset($this->events['QUEUED'][$event['HEADERTAG']])){
+ $evt_name = $this->events['QUEUED'][$event['HEADERTAG']];
+ $type = $this->events['BY_CLASS'][$evt_name];
+ $this->dialog = new $type['CLASS_NAME']($this->config,$event);
+ }
+ }
+ }
+
+
+ /************
+ * LOG VIEW
+ ************/
+
+ if($s_action == "logview" && $this->acl_is_readable("")){
+ $id = $s_entry;
+ $type = FALSE;
+ if(isset($this->entries[$id])){
+ $event = $this->entries[$s_entry];
+ $this->dialog = new gotoLogView($this->config,"",$event,$this);
+ }
+ }
+
+
+ /************
+ * REMOVE
+ ************/
+
+ /* Remove multiple */
+ if($s_action == "remove_multiple" || $s_action == "remove"){
+
+ if(!$this->acl_is_removeable()){
+ msg_dialog::display(_("Permission"), msgPool::permDelete(), ERROR_DIALOG);
+ }else{
+
+ if($s_action == "remove"){
+ $ids = array($s_entry);
+ }else{
+ $ids = $this->list_get_selected_items();
+ }
+
+ $this->ids_to_remove = array();
+
+ if(count($ids)){
+ $ret = $this->o_queue->ids_exist($ids);
+ $ret = $this->o_queue->get_entries_by_id($ret);
+ $tmp = "";
+
+ $deleteable_jobs = array();
+ $not_deleteable_jobs = array();
+ foreach($ret as $task){
+
+ /* Create a printable job name/description */
+ if(isset($this->events['QUEUED'][$task['HEADERTAG']])){
+ $evt_name = $this->events['QUEUED'][$task['HEADERTAG']];
+ $evt = $this->events['BY_CLASS'][$evt_name];
+ $j_name = $task['ID']." - ".$evt['s_Menu_Name']." ".$task['MACADDRESS'];
+ }else{
+ $j_name = $task['ID']." - ".$task['HEADERTAG']." ".$task['MACADDRESS'];
+ }
+
+ /* Only remove WAITING or ERROR entries */
+ if(in_array($task['STATUS'],array("waiting","error","processed")) ||
+ ($task['STATUS'] == "processing" && !preg_match("/install/",$task['HEADERTAG'])) ){
+ $this->ids_to_remove[] = $task['ID'];
+ $deleteable_jobs[] = $j_name;
+ }else{
+ $not_deleteable_jobs[] = $j_name;
+ }
+ }
+ if(count($not_deleteable_jobs)){
+ msg_dialog::display(_("Remove"),
+ sprintf(_("The following jobs couldn't be deleted, they have to be aborted: %s"),
+ "<br>".msgPool::buildList($not_deleteable_jobs)),INFO_DIALOG);
+ }
+
+ if(count($this->ids_to_remove)){
+ $smarty->assign("multiple", TRUE);
+ $smarty->assign("info",msgPool::deleteInfo($deleteable_jobs));
+ $this->current = $s_entry;
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
+ }
+ }
+ }
+
+ /* Remove specified tasks */
+ if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
+
+ /* Reboot hosts with not yet startet installations and timestamps in the past
+ */
+ if($this->acl_is_removeable("")){
+ timezone::get_default_timezone();
+ foreach($this->ids_to_remove as $id){
+ $entry = $this->o_queue->get_entries_by_id(array($id));
+ if(isset($entry['ANSWER1'])){
+ $entry = $entry['ANSWER1'];
+ if( $entry['STATUS'] == "waiting" &&
+ $entry['HEADERTAG'] == "trigger_action_reinstall"){
+ $evt = new DaemonEvent_reinstall($this->config,$entry);
+ if($evt->get_timestamp(FALSE) < time()){
+ $r_evt = new DaemonEvent_localboot($this->config);
+ $r_evt->add_targets(array($entry['MACADDRESS']));
+ $r_evt->set_type(TRIGGERED_EVENT);
+ $this->o_queue->append($r_evt);
+ }
+ }
+ }
+ }
+
+ $this->o_queue->remove_entries($this->ids_to_remove);
+ $this->save();
+ }
+ }
+
+ /* Remove aborted */
+ if(isset($_POST['delete_cancel'])){
+ $this->ids_to_remove = array();;
+ }
+
+
+ /************
+ * EDIT
+ ************/
+
+ /* Close dialog */
+ if(isset($_POST['save_event_dialog'])){
+ if(is_object($this->dialog)){
+ $this->dialog->save_object();
+ if(!$this->o_queue->append($this->dialog)){
+ msg_dialog::display(_("Service infrastructure"),msgPool::siError($this->o_queue->get_error()),ERROR_DIALOG);
+ }else{
+ $this->dialog = FALSE;
+ $this->current = -1;
+ }
+ }
+ }
+
+
+ /* Close dialog */
+ if(isset($_POST['abort_event_dialog'])){
+ $this->dialog = FALSE;
+ $this->current = -1;
+ }
+
+ /* Display dialogs if currently opened */
+ if(is_object($this->dialog)){
+ $this->dialog->save_object();
+ $display = $this->dialog->execute();
+
+ if($this->dialog instanceOf goto_import_file && $this->dialog->import_successful){
+ $this->dialog = FALSE;
+ }else{
+ return($display);
+ }
+ }
+
+ /************
+ * Handle Divlist
+ ************/
+
+ $divlist = new MultiSelectWindow($this->config,"gotoMasses",array("gotomasses"));
+ $divlist->SetInformation(_("This menu allows you to remove and change the properties of GOsa tasks."));
+ $divlist->SetSummary(_("List of queued jobs"));
+ $divlist->EnableCloseButton(FALSE);
+ $divlist->EnableSaveButton(FALSE);
+ $divlist->SetHeadpageMode();
+ $s = ".|"._("Actions")."|\n";
+ $s.= "..|<img src='images/lists/new.png' alt='' border='0' class='center'> "._("Create")."\n";
+
+ if($this->acl_is_writeable("")){
+ foreach($this->events['SCHEDULED'] as $name => $event){
+ $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n";
+ }
+ }
+ if($this->acl_is_removeable()){
+ $s.= "..|---|\n";
+ $s.= "..|<img src='images/lists/import.png' alt='' border='0' class='center'> "._("Import")."|import_file\n";
+ $s.= "..|<img src='images/lists/trash.png' alt='' border='0' class='center'> "._("Remove")."|remove_multiple\n";
+ }
+ if(preg_match("/w/",$this->getacl(""))){
+ $s.= "..|---|\n";
+ $s.= "..|<img alt='"._("Resume")."' src='images/status_start.png' border='0' class='center'> "._("Resume")."|resume_all\n";
+ $s.= "..|<img alt='"._("Pause")."' src='images/status_pause.png' border='0' class='center'> "._("Pause")."|pause_all\n";
+ $s.= "..|<img alt='"._("Abort")."' src='images/small_error.png' border='0' class='center'> "._("Abort")."|abort_process_all\n";
+ $s.= "..|<img alt='"._("Execute")."' src='images/rocket.png' border='0' class='center'> "._("Execute")."|execute_process_all\n";
+ }
+
+ $divlist->SetDropDownHeaderMenu($s);
+
+ if($this->sort_dir == "up"){
+ $sort_img = "<img src='images/lists/sort-up.png' alt='/\' border=0>";
+ }else{
+ $sort_img = "<img src='images/lists/sort-down.png' alt='\/' border=0>";
+ }
+
+ if($this->sort_by == "TargetName"){ $sort_img_1 = $sort_img; } else { $sort_img_1 = "" ;}
+ if($this->sort_by == "TaskID"){ $sort_img_2 = $sort_img; } else { $sort_img_2 = "" ;}
+ if($this->sort_by == "Schedule"){ $sort_img_3 = $sort_img; } else { $sort_img_3 = "" ;}
+ if($this->sort_by == "Action"){ $sort_img_4 = $sort_img; } else { $sort_img_4 = "" ;}
+
+ /* Create divlist */
+ $divlist->SetListHeader("<input type='image' src='images/lists/reload.png' title='"._("Reload")."'>");
+
+ $plug = $_GET['plug'];
+ $chk = "<input type='checkbox' id='select_all' name='select_all'
+ onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+ /* set Page header */
+ $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
+ $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TargetName'>"._("Target").$sort_img_1."</a>"));
+ $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TaskID'>"._("Task").$sort_img_2."</a>",
+ "attach"=>"style='width:120px;'"));
+ $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Schedule'>"._("Schedule").$sort_img_3."</a>",
+ "attach"=>"style='width:140px;'"));
+ $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Action'>"._("Status").$sort_img_4."</a>",
+ "attach"=>"style='width:80px;'"));
+ $divlist->AddHeader(array("string"=>_("Action"),
+ "attach"=>"style='border-right:0px;width:140px;'"));
+
+
+ /* Reload the list of entries */
+ $this->reload();
+
+ foreach($this->entries as $key => $task){
+
+ $prio_actions="";
+ $action = "";
+
+
+ /* If WAITING add priority action
+ */
+ if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){
+ $prio_actions.= "<input class='center' type='image' src='plugins/goto/images/prio_increase.png'
+ title='"._("Move up")."' name='prio_up_".$key."'> ";
+ $prio_actions.= "<input class='center' type='image' src='plugins/goto/images/prio_decrease.png'
+ title='"._("Move down")."' name='prio_down_".$key."'> ";
+ }
+
+ /* If WAITING add pause action
+ */
+ if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){
+ $prio_actions.= "<input class='center' type='image' src='images/status_pause.png'
+ title='"._("Pause job")."' name='pause_".$key."'> ";
+ }
+
+ /* If PAUSED add resume action
+ */
+ if(in_array($task['STATUS'],array("paused")) && $this->acl_is_writeable("")){
+ $prio_actions.= "<input class='center' type='image' src='images/status_start.png'
+ title='"._("Resume job")."' name='resume_".$key."'> ";
+ }
+
+ /* If PAUSED or WAITING add execution action
+ */
+ if(in_array($task['STATUS'],array("paused","waiting")) && $this->acl_is_writeable("")){
+ $prio_actions.= "<input class='center' type='image' src='images/rocket.png'
+ title='"._("Execute now")."' name='execute_process_".$key."'> ";
+ }
+
+ /* Add logview button, currently ever.
+ */
+ if($this->acl_is_readable("")){
+ $action .= "<input type='image' src='plugins/goto/images/view_logs.png' name='log_view_".$key."'
+ class='center' title='"._("View logs")."' alt='"._("View logs")."'> ";
+ }
+
+ /* If PAUSED or WAITING add edit action
+ */
+ if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){
+ $action.= "<input type='image' src='images/lists/edit.png' name='edit_task_".$key."'
+ class='center' title='"._("Edit")."' alt='"._("Edit")."'>";
+ }
+
+ /* If PROCESSING add abort action
+ */
+ if(in_array($task['STATUS'],array("processing")) && preg_match("/install/",$task['HEADERTAG']) && $this->acl_is_writeable("")){
+ $action.= "<img src='images/empty.png' alt=''>";
+ $action.= "<input class='center' type='image' src='images/small_error.png'
+ title='"._("Abort job")."' name='abort_process_".$key."'>";
+ }
+
+ /* If WAITING or ERROR add remove action
+ */
+ if( $this->acl_is_removeable() && in_array($task['STATUS'],array("waiting","error","processed"))){
+ $action.= "<input type='image' src='images/lists/trash.png' name='remove_task_".$key."'
+ class='center' title='"._("Remove")."' alt='"._("Remove")."'>";
+ }
+ if($this->acl_is_writeable("") && in_array($task['STATUS'],array("processing")) && !preg_match("/install/",$task['HEADERTAG'])){
+ $action.= "<input type='image' src='images/lists/trash.png' name='remove_task_".$key."'
+ class='center' title='"._("Remove")."' alt='"._("Remove")."'>";
+ }
+
+ /* Create entry display name and tooltip */
+ $color = "";
+ $display = $task['MACADDRESS'];
+ $tooltip = "";
+ if(isset($task['PLAINNAME']) && !preg_match("/none/i",$task['PLAINNAME'])){
+ $display = $task['PLAINNAME'];
+ $tooltip = " title='".$task['MACADDRESS']."' ";
+ }
+ $display2= $task['HEADERTAG'];
+
+ /* Check if this event exists as Daemon class
+ * In this case, display a more accurate entry.
+ */
+ if(isset($this->events['QUEUED'][$task['HEADERTAG']])){
+ $evt_name = $this->events['QUEUED'][$task['HEADERTAG']];
+ $event_type = $this->events['BY_CLASS'][$evt_name];
+ $display2 = $event_type['s_Menu_Name'];
+
+ if(strlen($display2) > 20){
+ $display2 = substr($display2,0,18)."...";
+ }
+
+ if(isset($event_type['ListImage']) && !empty($event_type['ListImage'])){
+ $display2 = $event_type['ListImage']." ".$display2;
+ }
+ }
+
+ $status = $task['STATUS'];
+
+ if($status == "waiting"){
+ $status = "<img class='center' src='plugins/goto/images/clock.png' alt=''> "._("Waiting");
+ }
+ if($status == "error"){
+ $status = "<img class='center' src='images/false.png' alt=''> "._("Error");
+ }
+ if($status == "processed"){
+ $status = "<img class='center' src='images/true.png' alt=''> "._("Processed");
+ }
+
+ /* Special handling for all entries that have
+ STATUS == "processing" && PROGRESS == NUMERIC
+ */
+ if($status == "processing" && isset($task['PROGRESS'])){
+ $percent = $task['PROGRESS'];
+
+ /* Show activation? */
+ if ($percent == "goto-activation"){
+ $status = "<img class='center' src='images/lists/off.png' alt=''> "._("Locked");
+
+ /* Show hardware detect? */
+ } elseif ($percent == "goto-hardware-detection") {
+ $status = "<img class='center' src='plugins/goto/images/hardware.png' alt=''> "._("Detection");
+
+ /* Real percent */
+ } else {
+ if (preg_match('/install/', $task['HEADERTAG'])){
+ $status = "<img src='progress.php?x=80&y=13&p=".$task['PROGRESS']."' alt=''
+ id='progress_".preg_replace("/:/","_",$task['MACADDRESS'])."'>";
+ } else {
+ $status = preg_replace('/ /', ' ', _("in progress"));
+ }
+ }
+ }
+
+ /* Create each field */
+ $field0 = array("string" => "<input type='checkbox' id='item_selected_".$task['ID']."' name='item_selected_".$key."'>" ,
+ "attach" => "style='width:20px;".$color."'");
+ $field1 = array("string" => $display,
+ "attach" => $tooltip."style='".$color."'");
+ $field1a= array("string" => $display2,
+ "attach" => "style='".$color.";width:120px;'");
+ if ($task['TIMESTAMP'] == "19700101000000"){
+ $field2 = array("string" => _("immediately"),"attach" => "style='".$color.";width:140px;'");
+ } else {
+ $field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:140px;'");
+ }
+ $field3 = array("string" => $status,"attach" => "style='".$color.";width:80px;'");
+ $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:140px;border-right:0px;'");
+ $divlist->AddElement(array($field0,$field1,$field1a,$field2,$field3,$field4));
+ }
+
+ $smarty = get_smarty();
+ $smarty->assign("events",$this->events);
+ $smarty->assign("start",$this->start);
+ $smarty->assign("start_real", ($this->start + 1));
+ $smarty->assign("ranges", array("10" => "10",
+ "20" => "20",
+ "25" => "25",
+ "50" => "50",
+ "100"=> "100",
+ "200"=> "200",
+ "9999" => "*"));
+
+ $count = $this->o_queue->number_of_queued_entries($this->event_tags);
+ if(!$count) $count = $this->range;
+ $divlist->SetListFooter(range_selector($count, $this->start, $this->range,"range"));
+ $smarty->assign("range",$this->range);
+ $smarty->assign("div",$divlist->Draw());
+ return($smarty->fetch (get_template_path('gotomasses.tpl', TRUE, dirname(__FILE__))));
+ }
+
+
+ /*! \brief Move an entry up or down in the queue, by updating its execution timestamp
+ @param $id Integer The ID of the entry which should be updated.
+ @param $type String "up" / "down"
+ @return boolean TRUE in case of success else FALSE
+ */
+ public function update_priority($id,$type = "up")
+ {
+ if($type == "up"){
+ $tmp = $this->o_queue->get_queued_entries($this->event_tags,-1,-1,"timestamp DESC");
+ }else{
+ $tmp = $this->o_queue->get_queued_entries($this->event_tags,-1,-1,"timestamp ASC");
+ }
+ $last = array();
+ foreach($tmp as $entry){
+ if($entry['ID'] == $id){
+ if(count($last)){
+ $time = strtotime($last['TIMESTAMP']);
+ if($type == "up"){
+ $time ++;
+ }else{
+ $time --;
+ }
+ $time_str = date("YmdHis",$time);
+ return($this->o_queue->update_entries(array($id),array("timestamp" => $time_str)));
+ }else{
+ return(FALSE);
+ }
+ }
+ $last = $entry;
+ }
+ return(FALSE);
+ }
+
+
+ /*! \brief Resumes to status 'waiting'.
+ * @return Boolean TRUE in case of success, else FALSE.
+ */
+ private function resume_queue_entries($ids)
+ {
+ if(!count($ids)){
+ return;
+ }
+
+ /* Entries are resumed by setting the status to
+ * 'waiting'
+ */
+ $data = array("status" => "waiting");
+
+ /* Check if given ids are valid and check if the status
+ * allows resuming.
+ */
+ $update_ids = array();
+ foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+ if(isset($entry['STATUS']) && preg_match("/paused/",$entry['STATUS'])){
+ $update_ids[] = $entry['ID'];
+ }
+ }
+
+ /* Tell the daemon that we have entries to update.
+ */
+ if(count($update_ids)){
+ if(!$this->o_queue->update_entries($update_ids,$data)){
+ msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
+ return(FALSE);
+ }
+ }
+ return(TRUE);
+ }
+
+
+ /*! \brief Force queue job to be done as far as possible.
+ * @return Boolean TRUE in case of success, else FALSE.
+ */
+ private function execute_queue_entries($ids)
+ {
+ if(!count($ids)){
+ return;
+ }
+
+ /* Execution is forced by updating the status to
+ * waiting and setting the timestamp to current time.
+ */
+ $data = array( "timestamp" => date("YmdHis",time()),
+ "status" => "waiting");
+
+ /* Only allow execution of paused or waiting entries
+ */
+ $update_ids = array();
+ foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+ if(in_array($entry['STATUS'],array("paused","waiting"))){
+ $update_ids[] = $entry['ID'];
+ }
+ }
+
+ /* Tell the daemon that we want to update some entries
+ */
+ if(count($update_ids)){
+ if(!$this->o_queue->update_entries($update_ids,$data)){
+ msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entries.")) , ERROR_DIALOG);
+ return(FALSE);
+ }
+ }
+ return(TRUE);
+ }
+
+
+ /*! \brief Force queue job to be done as far as possible.
+ * @return Boolean TRUE in case of success, else FALSE.
+ */
+ private function abort_queue_entries($ids)
+ {
+ if(!count($ids)){
+ return;
+ }
+
+ /* Entries are paused by setting the status to
+ * something different from 'waiting'.
+ * We simply use 'paused'.
+ */
+ $data = array("status" => "paused");
+
+ /* Detect if the ids we got are valid and
+ * check if the status allows pausing.
+ */
+ $update_ids = array();
+ foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+ if(isset($entry['STATUS']) && preg_match("/processing/",$entry['STATUS'])){
+ if(isset($entry['MACADDRESS'])){
+ $update_ids[] = $entry['MACADDRESS'];
+ }else{
+ trigger_error("No mac address found in event.");
+ }
+ }
+ }
+
+ if(class_available("DaemonEvent_faireboot")){
+ $tmp = new DaemonEvent_faireboot($this->config);
+ $tmp->add_targets($update_ids);
+ $tmp->set_type(TRIGGERED_EVENT);
+ $this->recently_removed = $update_ids;
+
+ if(!$this->o_queue->append($tmp)){
+ msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
+ return(FALSE);
+ }
+ }else{
+ msg_dialog::display(_("Error"),
+ sprintf(_("The job could not be aborted, the required class '%s' was not found."),
+ "DaemonEvent_faireboot") , ERROR_DIALOG);
+ }
+ }
+
+
+ /*! \brief Pauses the specified queue entry from execution.
+ * @return Boolean TRUE in case of success, else FALSE.
+ */
+ private function pause_queue_entries($ids)
+ {
+ if(!count($ids)){
+ return;
+ }
+
+ /* Entries are paused by setting the status to
+ * something different from 'waiting'.
+ * We simply use 'paused'.
+ */
+ $data = array("status" => "paused");
+
+ /* Detect if the ids we got are valid and
+ * check if the status allows pausing.
+ */
+ $update_ids = array();
+ foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+ if(isset($entry['STATUS']) && preg_match("/waiting/",$entry['STATUS'])){
+ $update_ids[] = $entry['ID'];
+ }
+ }
+
+ /* Tell the daemon that we want to update some entries
+ */
+ if(count($update_ids)){
+ if(!$this->o_queue->update_entries($update_ids,$data)){
+ msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
+ return(FALSE);
+ }
+ }
+ return(TRUE);
+ }
+
+
+ /*! \brief Request list of queued jobs.
+ * @return Returns an array of all queued jobs.
+ */
+ function reload()
+ {
+
+ /* Sort map html-post-name => daemon-col-name
+ */
+ $map = array(
+ "QueuePosition" => "id",
+ "Action" => "status",
+ "TaskID" => "headertag",
+ "TargetName" => "macaddress",
+ "Schedule" => "timestamp");
+
+ /* Create sort header
+ */
+ if(!isset($map[$this->sort_by])){
+ $sort = "id DESC";
+ }else{
+ $sort = $map[$this->sort_by];
+ if($this->sort_dir == "up"){
+ $sort.= " ASC";
+ }else{
+ $sort.= " DESC";
+ }
+ }
+
+ /* Get entries. */
+ $start = $this->start;
+ $stop = $this->range;
+ $entries = $this->o_queue->get_queued_entries($this->event_tags,$start,$stop,$sort);
+ if ($this->o_queue->is_error()){
+ msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "<br><br>".$this->o_queue->get_error()), ERROR_DIALOG);
+ }
+
+ /* Assign entries by id.
+ */
+ $this->entries = array();
+
+ foreach($entries as $entry){
+
+ /* Skip entries which will be removed within the next seconds */
+ if(isset($entry['MACADDRESS']) && in_array($entry['MACADDRESS'],$this->recently_removed)){
+ continue;
+ }
+ $this->entries[$entry['ID']]= $entry;
+ }
+ $this->recently_removed = array();
+ }
+
+
+ /*! \brief Handle post jobs, like sorting.
+ */
+ function save_object()
+ {
+ /* Check for sorting changes
+ */
+ $sort_vals = array("Action","QueuePosition","TargetName","Schedule","TaskID");
+ if(isset($_GET['sort']) && in_array($_GET['sort'],$sort_vals)){
+ $sort = $_GET['sort'];
+ if($this->sort_by == $sort){
+ if($this->sort_dir == "up"){
+ $this->sort_dir = "down";
+ }else{
+ $this->sort_dir = "up";
+ }
+ }
+ $this->sort_by = $sort;
+ }
+
+ /* Range selection used? */
+ if(isset($_POST['range']) && is_numeric($_POST['range'])){
+ $this->range = $_POST['range'];
+ }
+
+ /* Save filter settings */
+ $gotomasses_filter = session::get("gotomasses_filter");
+ foreach(array("range","sort_by","sort_dir") as $attr){
+ $gotomasses_filter[$attr] = $this->$attr;
+ }
+ session::set("gotomasses_filter",$gotomasses_filter);
+
+ /* Page changed. */
+ if(isset($_GET['start'])){
+ $start = $_GET['start'];
+ if(is_numeric($start) || $start == 0){
+ $this->start = $start;
+ }
+ }
+
+ /* Check start stop and reset if necessary */
+ $count = $this->o_queue->number_of_queued_entries($this->event_tags);
+ if($this->start >= $count){
+ $this->start = $count -1;
+ }
+ if($this->start < 0){
+ $this->start = 0;
+ }
+ }
+
+
+ function save()
+ {
+ // We do not save anything here.
+ }
+
+
+ /*! \brief Return a list of all selected items.
+ @return Array Returns an array containing all selected item ids.
+ */
+ function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^item_selected_[0-9]*$/",$name)){
+ $id = preg_replace("/^item_selected_/","",$name);
+ $ids[$id] = $id;
+ }
+ }
+ return($ids);
+ }
+
+
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("System mass deployment"),
+ "plDescription" => _("Provide a mechanism to automatically activate a set of systems"),
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 0,
+ "plSection" => array("addon"),
+ "plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))),
+ "plProvidedAcls" => array("Comment" => _("Description"))
+ ));
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/class_target_list.inc b/gosa-plugins/fai/addons/goto/class_target_list.inc
--- /dev/null
@@ -0,0 +1,334 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class target_list extends MultiSelectWindow
+{
+ var $config;
+ var $list =array();
+ var $Targets_used =array();
+
+ /* Current base */
+ var $selectedBase = "";
+ var $departments = array();
+
+ /* Regex */
+ var $Regex = "*";
+ var $IP_start = "0.0.0.0";
+ var $IP_end = "255.255.255.255";
+
+ /* CheckBoxes, to change default values modify $this->AddCheckBox */
+ var $ogroups ;
+ var $servers ;
+ var $workstations ;
+ var $incoming ;
+
+
+ /* Subsearch checkbox */
+ var $SubSearch ;
+ var $IPMatch ;
+ var $parent ;
+ var $ui ;
+
+
+ function target_list(&$config,$Targets_used)
+ {
+ MultiSelectWindow::MultiSelectWindow($config, "Targetselection", array("ogroup","server","incoming","workstation","gotomasses"));
+
+ $this->Targets_used = $Targets_used;
+
+ $this->SetInformation( _("Select the target objects for your scheduled action."));
+ $this->SetTitle( _("Available targets"));
+ $this->SetSummary( _("Available targets"));
+ $this->SetHeadpageMode(FALSE);
+
+ /* set Page header */
+ $chk = "<input type='checkbox' id='select_all' name='select_all'
+ onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+ $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
+
+ $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
+ $this->AddHeader(array("string" => _("Object name"), "attach" => "style=''"));
+
+ /* Text ,Value, Name, Is selected */
+ $this->AddCheckBox("ogroups", _("Select to see object groups"), _("Show object groups"), true);
+ $this->AddCheckBox("servers", _("Select to see servers") , _("Show servers"), true);
+ $this->AddCheckBox("workstations", _("Select to see workstations"),_("Show workstations"), true);
+ $this->AddCheckBox("incoming", _("Select to see incoming objects") , _("Show new objects"), true);
+
+ /* Add SubSearch checkbox */
+ $this->AddCheckBox(SEPERATOR);
+ $this->AddCheckBox("SubSearch", msgPool::selectToView("","subsearch"), msgPool::selectToView("","subsearch_small"), false);
+ $this->AddCheckBox("IPMatch", _("Select to search for a specific IP range only"), _("Match IP range"), false);
+
+ /* Name,Text,Default , Connect with alphabet */
+ $this->AddRegex ("Regex", _("Regular expression for matching group names"), "*" , true);
+ $this->AddRegex ("IP_start", _("IP range start"), "0.0.0.0" , true);
+ $this->AddRegex ("IP_end", _("IP range end"), "255.255.255.255" , true);
+ $this->EnableAplhabet(TRUE);
+ }
+
+
+ function GenHeader()
+ {
+ $options= "";
+
+ /* Get all departments within this subtree */
+ $ui= get_userinfo();
+ $first = "";
+ $found = FALSE;
+ $base = $this->config->current['BASE'];
+
+ /* Add base */
+ $tmp = array();
+ $tmp[] = array("dn"=>$this->config->current['BASE']);
+ $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+ array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+ $deps = array();
+ foreach($tmp as $tm){
+ $deps[$tm['dn']] = $tm['dn'];
+ }
+
+ /* Load possible departments */
+ $ui= get_userinfo();
+ $tdeps= $ui->get_module_departments("ogroups");
+ $ids = $this->config->idepartments;
+ $first = "";
+ $found = FALSE;
+ foreach($ids as $dep => $name){
+ if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
+
+ /* Keep first base dn in mind, we could need this
+ * info if no valid base was found
+ */
+ if(empty($first)) {
+ $first = $dep['dn'];
+ }
+
+ $value = $ids[$dep];
+ if ($this->selectedBase == $dep){
+ $found = TRUE;
+ $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+ } else {
+ $options.= "<option value='".$dep."'>$value</option>";
+ }
+ }
+ }
+
+ /* The currently used base is not visible with your acl setup.
+ * Set base to first useable base.
+ */
+ if(!$found){
+ $this->selectedBase = $first;
+ }
+
+ /* Get copy & paste icon */
+ $acls = $ui->get_permissions($this->selectedBase,"ogroups/ogroup");
+ $acl_all= $ui->has_complete_category_acls($this->selectedBase,"ogroups");
+
+ /* Add default header */
+ $listhead = MultiSelectWindow::get_default_header();
+
+ /* Add department selector */
+ $listhead .= _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+ " <input class='center' type='image' src='images/lists/submit.png' align='middle'
+ title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ";
+ $listhead .="</div>";
+
+ $this->SetListHeader($listhead);
+ }
+
+
+ function execute()
+ {
+ $this->ClearElementsList();
+ $this->GenHeader();
+ $this->reload();
+ $this->SetEntries($this->list);
+ return($this->Draw());
+ }
+
+
+ function SetEntries($list)
+ {
+ /* Add Copy & Paste buttons if copy&paste is enabled
+ */
+ // Defining Links
+ $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
+
+ $ui = get_userinfo();
+
+ // Assigning ogroups
+ foreach($list as $key => $val){
+
+ if(in_array($val['cn'][0],$this->Targets_used) ||
+ isset($val['macAddress'][0]) && in_array($val['macAddress'][0],$this->Targets_used)) continue;
+
+ $title = "title='".preg_replace('/ /', ' ', LDAP::fix($val['dn']))."'";
+ if(!isset($val['description'][0])){
+ $desc = "";
+ }else{
+ $desc = " - [ ".$val['description'][0]." ]";
+ }
+ if(!isset($val['ipHostNumber'][0])){
+ $desc.= "";
+ }else{
+ $desc.= " - ".$val['ipHostNumber'][0]."";
+ }
+
+
+ $img ="Hmm";
+ if(in_array("goServer",$val['objectClass'])){
+ $img = "<img src='plugins/systems/images/select_server.png' alt='"._("Server")."' ".$title.">";
+ }elseif(in_array("gotoWorkstation",$val['objectClass'])){
+ $img = "<img src='plugins/systems/images/select_workstation.png' alt='"._("Workstation")."' ".$title.">";
+ }elseif(in_array("gosaGroupOfNames",$val['objectClass'])){
+ $img = "<img src='plugins/ogroups/images/list_ogroup.png' alt='"._("Object group")."' ".$title.">";
+ }
+
+ /* Create each field */
+ $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+ "attach" => "style='width:20px;'");
+ $field1 = array("string" => $img,
+ "attach" => "style='text- align:center;width: 20px;'");
+ $field2 = array("string" => $val['cn'][0].$desc,
+ "attach" => "style='border-right:0px;' ".$title);
+
+ $this->AddElement(array($field0,$field1,$field2));
+ }
+ }
+
+
+ function save()
+ {
+ $ret = array();
+ $items = $this->list_get_selected_items();
+ foreach($items as $item){
+ $ret[] = $this->list[$item];
+ }
+ return($ret);
+ }
+
+
+ function save_object()
+ {
+ MultiSelectWindow::save_object();
+ }
+
+
+ function reload()
+ {
+ /* Set base for all searches && initialise some vars */
+ $this->list= array();
+ $base = $this->selectedBase;
+ $filter = "";
+ $Regex = $this->Regex;
+ $IP_start = $this->IP_start;
+ $IP_end = $this->IP_end;
+
+ if($this->IPMatch){
+ if(!tests::is_ip($IP_start)){
+ msg_dialog::display(_("Error"), msgPool::invalid(_("IP range")), ERROR_DIALOG);
+ return;
+ }
+ if(!tests::is_ip($IP_end)){
+ msg_dialog::display(_("Error"), msgPool::invalid(_("IP range")), ERROR_DIALOG);
+ return;
+ }
+ }
+
+
+ $chk = array(
+ "ogroups" => "(&(objectClass=gosaGroupOfNames)(|(gosaGroupObjects=*S*)(gosaGroupObjects=*W*)))" ,
+ "servers" => "(objectClass=goServer)" ,
+ "incoming" => "(objectClass=GOhard)" ,
+ "workstations" => "(objectClass=gotoWorkstation)");
+
+ /* Create filter */
+ foreach($chk as $chkBox => $FilterPart){
+ if($this->$chkBox){
+ $filter .= $FilterPart;
+ }
+ }
+ $filter= "(&(cn=".$Regex.")(|".$filter."))";
+
+ if($this->SubSearch){
+ $res= get_list($filter, array("ogroups","workstations","servers"), $base,
+ array("cn","objectClass","gosaGroupObjects","ipHostNumber","description"), GL_SIZELIMIT | GL_SUBSEARCH);
+ }else{
+ $res= get_list($filter, "ogroups", get_groups_ou().$base,
+ array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT );
+ $res= array_merge($res,get_list($filter, "workstation", get_ou('workstationRDN').$base,
+ array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT ));
+ $res= array_merge($res,get_list($filter, "server", get_ou('serverRDN').$base,
+ array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT ));
+
+ $deps_a = array(
+ get_ou("workstationRDN"),
+ get_ou("incominou"),
+ get_ou("serverRDN"),
+ get_ou("ogroupRDN"));
+
+ $res = get_sub_list($filter,array("server","incoming","workstation","ogroup"),
+ $deps_a,get_ou("systemRDN").$base,array("cn","objectClass","ipHostNumber","description"),GL_SIZELIMIT);
+ }
+
+ $this->list= $res;
+ ksort ($this->list);
+ reset ($this->list);
+ $tmp=array();
+ foreach($this->list as $tkey => $val ){
+
+ if($this->IPMatch){
+ if(isset($val['ipHostNumber'][0])){
+ if(tests::is_ip_range($IP_start,$val['ipHostNumber'][0]) && tests::is_ip_range($val['ipHostNumber'][0],$IP_end)){
+ $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+ }
+ }
+ }else{
+ $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+ }
+ }
+ ksort($tmp);
+ $this->list=array();
+ foreach($tmp as $val){
+ $this->list[]=$val;
+ }
+ reset ($this->list);
+ }
+
+ function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^item_selected_[0-9]*$/",$name)){
+ $id = preg_replace("/^item_selected_/","",$name);
+ $ids[$id] = $id;
+ }
+ }
+ return($ids);
+ }
+}
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_activate.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_activate.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_faireboot.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_faireboot.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_goto_reload.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_goto_reload.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_halt.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_halt.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_installation_activation.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_installation_activation.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_localboot.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_localboot.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_lock.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_lock.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_memcheck.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_memcheck.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_notify.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_notify.tpl
--- /dev/null
@@ -0,0 +1,93 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <b>{t}Message settings{/t}</b>
+ <table style="width:100%;">
+ <tr>
+ <td>{t}Sender{/t}</td>
+ <td><input type='text' name="from" value="{$from}" style="width:100%;"></td>
+ </tr>
+ <tr>
+ <td>{t}Subject{/t}</td>
+ <td><input type='text' name="subject" value="{$subject}" style="width:100%;"></td>
+ </tr>
+ <tr>
+ <td colspan="2">{t}Message{/t} :</td>
+ </tr>
+ <tr>
+ <td colspan="2" style="width:100%;">
+ <textarea style="width:100%;height:250px;" name="message" style="100%;">{$message}</textarea>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <b>{t}Time schedule{/t}</b>
+ <table>
+ <tr>
+ <td colspan="2" style='vertical-align:top'>{$timestamp}<br><br></td>
+ </tr>
+ </table>
+ <table style='width:100%;'>
+ <tr>
+ <td style="width:50%;">
+ <b>{t}Target users{/t}</b>
+ <br>
+ <select style="height:180px;width:100%" name="user[]" multiple size=4>
+ {html_options options=$user}
+ </select>
+ </td>
+ <td>
+ <b>{t}Target groups{/t}</b>
+ <br>
+ <select style="height:180px;width:100%" name="group[]" multiple size=4>
+ {html_options options=$group}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <input type="submit" name="open_target_list" value="{$add_str}">
+ <input type="submit" name="del_any_target" value="{$del_str}">
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_reboot.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_reboot.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_reinstall.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_reinstall.tpl
--- /dev/null
@@ -0,0 +1,67 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Progress{/t}</td>
+ <td>{$progress}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$status}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_reload_ldap_config.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_reload_ldap_config.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_rescan.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_rescan.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_sysinfo.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_sysinfo.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_update.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_update.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_wakeup.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_wakeup.tpl
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
+ <table>
+ <tr>
+ <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
+ {$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table style='width:100%;'>
+ <tr>
+ <td>
+ <b>{t}System list{/t}</b>
+ <br>
+ {$target_list}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+ <tr>
+ <td style='width:50%; vertical-align:top;'>
+ <table>
+ <tr>
+ <td>{t}ID{/t}</td>
+ <td>{$data.ID}</td>
+ </tr>
+ <tr>
+ <td>{t}Status{/t}</td>
+ <td>{$data.STATUS}</td>
+ </tr>
+ <tr>
+ <td>{t}Result{/t}</td>
+ <td>{$data.RESULT}</td>
+ </tr>
+ <tr>
+ <td>{t}Target{/t}</td>
+ <td>{$data.MACADDRESS}</td>
+ </tr>
+ <tr>
+ <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+ <td>{$timestamp}</td>
+ </tr>
+ </table>
+ </td>
+ <td style='width:50%; vertical-align:top;'>
+ <table >
+ </table>
+ </td>
+ </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent.inc
--- /dev/null
@@ -0,0 +1,511 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+define("SCHEDULED_EVENT",1);
+define("TRIGGERED_EVENT",2);
+
+define("HIDDEN_EVENT",1);
+define("SYSTEM_EVENT",2);
+define("USER_EVENT" ,4);
+
+
+/*! \brief This is the event base class
+ \author Fabian Hickert <hickert@gonicus.de>
+ \version 1.00
+ \date 26.02.2008
+
+ This is the base class for all new daemon events.
+ It implements most of the required functionality.
+ */
+class DaemonEvent
+{
+ /* Menu Strings */
+ protected $s_Menu_Name = "s_Menu_Name not set"; // Diplayed in the ActionsMenu->CreateNew
+ protected $s_Event_Name = "s_Event_Name not set"; // Will be displayed in the Management list.
+ protected $s_Menu_Image = "images/empty.png"; // Image displayed in Actions->New
+ protected $s_List_Image = ""; // Image displayed in event listing
+
+ public $config; // GOsa configuration object
+ protected $data; // The event data, when edited
+
+ protected $a_targets = array(); // The list of assigned Targets (When newly created)
+ protected $s_Schedule_Action = ""; // The deamon command name when newly created. (e.g. job_trigger_action_halt)
+ protected $s_Trigger_Action= ""; // The deamon command name when edited. (e.g. trigger_action_halt)
+ protected $s_Queued_Action= ""; // The deamon command name when edited. (e.g. trigger_action_halt)
+ protected $timestamp = 0; // Event execution time;
+ protected $id = -1; // The Table ID
+ protected $status = "unknown";// The current event status
+ protected $is_new = TRUE; // Is TRUE if this is a new event
+
+ protected $mode = SCHEDULED_EVENT; // Default action is sheduled.
+
+ /* Sub dialog hanlding */
+ protected $target_divlist = NULL; // The divlist used by the target add dialog
+ protected $target_add_list_used = FALSE; // Indicates that the target add list was used.
+ protected $time_select_used = FALSE; // Indicates that we have used the timestamp select boxes.
+ protected $target_list_used = FALSE; // Target list was diaplayed?
+ protected $_target_list = array(); // Object Cache of those objects displayed in the target add dialog
+ protected $workstation_list = array(); // Used as cache in the target list.
+ protected $server_list = array(); // Used as cache in the target list.
+
+ protected $visible_for = HIDDEN_EVENT;
+
+ protected $attributes = array("timestamp");
+
+ function set_type($type)
+ {
+ $this->mode = $type;
+ }
+
+
+ function get_type()
+ {
+ return($this->mode);
+ }
+
+ /*! \brief Class contructor.
+ @param Array GOsa configuration object.
+ @param Array Event data, only given when edited.
+ */
+ public function __construct($config,$data = array())
+ {
+ $this->data = $data;
+ $this->config = $config;
+ timezone::get_default_timezone();
+ $this->timestamp = time();
+
+ /* Load values from given data */
+ if(count($data)){
+ $this->is_new = FALSE;
+
+ $attrs = array("id" => "ID");
+ foreach($attrs as $to => $from){
+ $this->$to = $data[$from];
+ }
+ if(isset($data['TIMESTAMP'])){
+ $this->timestamp = $this->_event_to_timestamp($data['TIMESTAMP']);
+ }
+ }
+ }
+
+
+ /*! \brief Create the HTML output for the plugin.
+ @return String The generated HTML output.
+ */
+ public function execute()
+ {
+ $this->time_select_used = FALSE;
+ $this->target_list_used = FALSE;
+
+ $str = "<h2>"._("This job has no template.")."</h2>";
+ $str.= "<p class='seperator'></p>";
+ $str.= "<div style='text-align:right;width:100%;padding:3px;'>
+ <input type='submit' name='abort_event_dialog' value='".msgPool::cancelButton()."'>
+ </div>";
+ return($str);
+ }
+
+ /*! \brief Returns the plugin header, displayed in the template.
+ @return String HTML header part.
+ */
+ public function get_header()
+ {
+ if($this->target_add_list_used){
+ return("");
+ }
+ $str = "<h2>".sprintf(_("Create '%s' job"),$this->s_Event_Name)."</h2>";
+ return($str);
+ }
+
+
+ /*! \brief Returns the plugin footer (save cancel), displayed in the template.
+ @return String HTML footer part.
+ */
+ public function get_footer()
+ {
+ if($this->target_add_list_used){
+ return("");
+ }
+ $str = "<p class='seperator'></p>";
+ $str.= "<div style='text-align:right;width:99%;padding:5px;'>
+ <input type='submit' name='save_event_dialog' value='".msgPool::saveButton()."'>
+ <input type='submit' name='abort_event_dialog' value='".msgPool::cancelButton()."'>
+ </div>";
+ return($str);
+ }
+
+
+ /*! \brief Returns HTML representation of a timestamp using <select> boxes.
+ @return Returns HTML content.
+ */
+ public function get_time_select()
+ {
+ $this->time_select_used = TRUE;
+
+ $smarty = get_smarty();
+
+ $year = date("Y",$this->timestamp);
+ $month = date("m",$this->timestamp);
+ $day = date("d",$this->timestamp);
+
+ $hour = date("H",$this->timestamp);
+ $minute = date("i",$this->timestamp);
+ $second = date("s",$this->timestamp);
+
+ $years = array();
+ for($i = date("Y",time()); $i <= 2037 ;$i ++){
+ $years[$i] = $i;
+ }
+ $months = array();
+ for($i = 1; $i <= 12; $i ++){
+ $e = str_pad($i,2,"0",STR_PAD_LEFT);
+ $months[$e] = $e;
+ }
+ $days = array();
+ for($i = 1; $i <= cal_days_in_month(CAL_GREGORIAN,$month,$year); $i ++){
+ $e = str_pad($i,2,"0",STR_PAD_LEFT);
+ $days[$e] = $e;
+ }
+ $hours = array();
+ for($i = 0; $i < 24; $i ++){
+ $e = str_pad($i,2,"0",STR_PAD_LEFT);
+ $hours[$e] = $e;
+ }
+ $minutes = array();
+ for($i = 0; $i < 60; $i ++){
+ $e = str_pad($i,2,"0",STR_PAD_LEFT);
+ $minutes[$e] = $e;
+ }
+ $seconds = array();
+ for($i = 0; $i < 60; $i ++){
+ $e = str_pad($i,2,"0",STR_PAD_LEFT);
+ $seconds[$e] = $e;
+ }
+
+ $smarty->assign("years", $years);
+ $smarty->assign("months", $months);
+ $smarty->assign("days", $days);
+ $smarty->assign("hours", $hours);
+ $smarty->assign("minutes", $minutes);
+ $smarty->assign("seconds", $seconds);
+ $smarty->assign("time_year",$year);
+ $smarty->assign("time_month",$month);
+ $smarty->assign("time_day",$day);
+ $smarty->assign("time_hour",$hour);
+ $smarty->assign("time_minute",$minute);
+ $smarty->assign("time_second",$second);
+ return($smarty->fetch(get_template_path('timestamp_select.tpl', TRUE, dirname(__FILE__))));
+ }
+
+
+ /*! \brief HTML representation of all currently assigned targets using (divSelectBox).
+ @return String Returns a listbox with all used targets.
+ */
+ public function get_target_list()
+ {
+ $this->target_list_used = TRUE;
+ $divlist = new divSelectBox("EventTargets");
+ foreach($this->a_targets as $key => $target){
+ $divlist->AddEntry(array(
+ array("string" => $target),
+ array("string" => "<input type='image' src='images/lists/trash.png' title='"._("Remove")."' name='del_target_".$key."'>",
+ "attach" => "style='width:20px; border-right:0px;'")
+ ));
+ }
+ $list_footer = "<input type='submit' name='open_target_list' value='"._("Add")."'>";
+ return($divlist->DrawList().$list_footer);
+ }
+
+
+ /*! \brief Returns HTML content, displaying a dialog which allows to add new targets.
+ @return String HTML content. (EventTargetAddList)
+ */
+ public function get_target_add_list()
+ {
+ $this->target_add_list_used = TRUE;
+
+ if($this->target_divlist == NULL){
+ $this->target_divlist = new EventTargetAddList($this->config,$this);
+ }
+ $this->target_divlist->execute();
+
+ $smarty = get_smarty();
+ $smarty->assign("divlist",$this->target_divlist->Draw());
+ return($smarty->fetch(get_template_path('target_list.tpl', TRUE, dirname(__FILE__))));
+ }
+
+
+ /*! \brief Handles all posted HTML data, including target add,remove...
+ */
+ public function save_object()
+ {
+ if(isset($_POST['open_target_list'])){
+ $this->target_add_list_used =TRUE;
+ }
+ if($this->target_divlist != NULL){
+ $this->target_divlist->save_object();
+ }
+ if($this->target_add_list_used){
+ if(isset($_POST['abort_target_dialog'])){
+ $this->target_add_list_used =FALSE;
+ $this->target_divlist = NULL;
+ }
+ if(isset($_POST['save_target_dialog'])){
+ $this->target_add_list_used =FALSE;
+ $this->add_targets($this->target_divlist->get_selected_targets());
+ $this->target_divlist = NULL;
+ }
+ }
+
+ if($this->time_select_used){
+ $time_stamp_values_found = TRUE;
+ foreach(array("time_year","time_month","time_day","time_hour","time_minute","time_second") as $attr){
+ $time_stamp_values_found &= isset($_POST[$attr]);
+ }
+ if($time_stamp_values_found){
+ $this->timestamp = mktime(
+ $_POST['time_hour'],
+ $_POST['time_minute'],
+ $_POST['time_second'],
+ $_POST['time_month'],
+ $_POST['time_day'],
+ $_POST['time_year']);
+ }
+ }
+
+ if($this->target_list_used){
+ foreach($_POST as $name => $value){
+ if(preg_match("/^del_target_/",$name)){
+ $id = preg_replace("/^del_target_([0-9]*)_.*/","\\1",$name);
+ if(isset($this->a_targets[$id])){
+ unset($this->a_targets[$id]);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+
+ /*! \brief Converts a daemon timestamp into an unix timestamp. \
+ e.g. 20080101125959 -> 1199188799
+ @param A daemon timestamp YYYYddmmHHiiss
+ @return Integer A unix timestamp.
+ */
+ public function _event_to_timestamp($str)
+ {
+ return(strtotime($str));
+ }
+
+
+ /*! \brief Converts a unix timestamp in to a gosa-si timestamp. \
+ e.g. 1199188799 -> 20080101125959
+ @param A unix timestamp (e.g. 1199188799)
+ @return Integer A daemon timestamp (e.g. 20080101125959).
+ */
+ public function _timestamp_to_event($stamp)
+ {
+ return(date("YmdHis",$stamp));
+ }
+
+
+ /*! \brief Returns event information, like menu strings, images ...
+ @return Array Event informations.
+ */
+ public function get_event_info()
+ {
+ $data =array();
+ $data['CLASS_NAME'] = get_class($this);
+ $data['s_Menu_Name'] = $this->s_Menu_Name;
+ $data['s_Event_Name'] = $this->s_Event_Name;
+ foreach(array("s_Queued_Action","s_Schedule_Action","s_Trigger_Action") as $attr){
+ if(!empty($this->$attr)){
+ $data[$attr] = $this->$attr;
+ }
+ }
+ $data['MenuImage'] = "<img src='".$this->s_Menu_Image."' alt='".$this->s_Menu_Name."' border='0' class='center'>";
+ $data['ListImage'] = "<img src='".$this->s_List_Image."' title='".$this->s_Event_Name."'
+ alt='".$this->s_Event_Name."' border='0' class='center'>";
+ return($data);
+ }
+
+
+ /*! \brief Check if we have opened the target add dialog.
+ @return Boolean TRUE if we have opened the target add dialog else FALSE.
+ */
+ protected function is_target_list_open()
+ {
+ return($this->target_add_list_used);
+ }
+
+
+ /*! \brief Returns a complete list of all available events.
+ @return Array Containing $this->get_event_info() for all available events.
+ */
+ static function get_event_types($type)
+ {
+ global $class_mapping,$config;
+ $list = array();
+ $list['BY_CLASS'] = array();
+ $list['TRIGGERED'] = array();
+ $list['SCHEDULED'] = array();
+ $list['QUEUED'] = array();
+
+ foreach($class_mapping as $name => $path){
+ if(preg_match("/^DaemonEvent_/",$name)){
+ $tmp = new $name($config);
+ if($tmp->visible_for & $type){
+ $evt = $tmp->get_event_info();
+ $list['BY_CLASS'][$name] = $evt;
+ if(isset($evt['s_Trigger_Action'])){
+ $list['TRIGGERED'][$name] = $evt;
+ $list['QUEUED'][$evt['s_Trigger_Action']] = $name;
+ }
+ if(isset($evt['s_Schedule_Action'])){
+ $list['SCHEDULED'][$name] = $evt;
+ $list['QUEUED'][$evt['s_Schedule_Action']] = $name;
+ }
+ if(isset($evt['s_Queued_Action'])){
+ $list['QUEUED'][$evt['s_Queued_Action']] = $name;
+ }
+ }
+ }
+ }
+ return($list);
+ }
+
+
+ /*! \brief Returns TRUE if this event is new. (Not edited)
+ @return Boolean TRUE if new, else FALSE.
+ */
+ public function is_new()
+ {
+ return($this->is_new);
+ }
+
+
+ /*! \brief Returns the event tag to schedule a new action
+ @param Returns the event e.g. 'job_trigger_action_wake'
+ */
+ public function get_schedule_action()
+ {
+ return($this->s_Schedule_Action);
+ }
+
+
+ /*! \brief Returns the event tag to schedule a new action
+ @param Returns the event e.g. 'trigger_action_wake'
+ */
+ public function get_trigger_action()
+ {
+ return($this->s_Trigger_Action);
+ }
+
+
+ /*! brief Returns an array containig all attributes \
+ That should be written.
+ @return Array e.g. 'status' => 'bla blub'
+ */
+ public function save()
+ {
+ $ret = array();
+ foreach($this->attributes as $attr){
+ $ret[$attr] = $this->$attr;
+ }
+ $ret['timestamp'] = $this->_timestamp_to_event($this->timestamp);
+ return($ret);
+ }
+
+
+ /*! \brief Returns the event targets
+ @return Array All selected targets.
+ */
+ public function get_targets()
+ {
+ return($this->a_targets);
+ }
+
+
+ /*! \brief Returns the event timestamp in GOsa daemon format.
+ @return Returns the event timestamp (20081231120000)
+ */
+ public function get_timestamp($si_type = TRUE)
+ {
+ if($si_type){
+ return($this->_timestamp_to_event($this->timestamp));
+ }else{
+ return($this->timestamp);
+ }
+ }
+
+
+ /*! \brief Returns the event ID
+ @return Returns the event ID
+ */
+ public function get_id()
+ {
+ if($this->is_new){
+ return(-1);
+ }else{
+ return($this->data['ID']);
+ }
+ }
+
+
+ /*! \brief Add a target MAC address
+ @param Array A List of all target that should be added.
+ */
+ public function set_timestamp($stamp)
+ {
+ $this->timestamp = $stamp;
+ }
+
+
+ /*! \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;
+ }
+ }
+
+ public function check()
+ {
+ return(array());
+ }
+
+
+ /*! \brief Update a class variable from outside
+ */
+ public function set_value($name,$value)
+ {
+ $name = strtolower($name);
+ if(isset($this->$name) && in_array($name,$this->attributes)){
+ $this->$name = $value;
+ }
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_activate.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_activate.inc
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_activate extends DaemonEvent
+{
+ var $visible_for = SYSTEM_EVENT;
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Unlock");
+ $this->s_Event_Name = _("Unlock");
+ $this->s_Schedule_Action = "job_trigger_action_activate";
+ $this->s_Trigger_Action= "gosa_trigger_action_activate";
+ $this->s_Queued_Action= "trigger_action_activate";
+ $this->s_Menu_Image = "images/lists/unlocked.png";
+ $this->s_List_Image = "images/lists/unlocked.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_activate.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/fai/addons/goto/events/class_DaemonEvent_activate_new.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_activate_new.inc
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id: class_DaemonEvent_activate_new.inc 10977 2008-05-21 08:25:46Z cajus $$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_activate_new extends DaemonEvent
+{
+ var $visible_for = HIDDEN_EVENT;
+
+ var $attributes = array("dhcp","ip","fqdn","ogroup","base","mac");
+
+ var $dhcp = "";
+ var $ip = "";
+ var $fqdn = "";
+ var $ogroup ="";
+ var $base = "";
+ var $mac ="";
+
+
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Activate new");
+ $this->s_Event_Name = _("Activate new");
+ $this->s_Schedule_Action = "job_trigger_activate_new";
+ $this->s_Trigger_Action = "gosa_trigger_activate_new";
+ $this->s_Queued_Action = "trigger_activate_new";
+ $this->s_Menu_Image = "images/lists/unlocked.png";
+ $this->s_List_Image = "images/lists/unlocked.png";
+ }
+
+ public function execute()
+ {
+ DaemonEvent::execute();
+ return("");
+
+ $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_activate_new.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/fai/addons/goto/events/class_DaemonEvent_faireboot.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_faireboot.inc
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_faireboot extends DaemonEvent
+{
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Abort installation");
+ $this->s_Event_Name = _("Abort installation");
+ $this->s_Schedule_Action = "job_trigger_action_faireboot";
+ $this->s_Trigger_Action= "gosa_trigger_action_faireboot";
+ $this->s_Queued_Action= "trigger_action_faireboot";
+ $this->s_Menu_Image = "images/small_error.png";
+ $this->s_List_Image = "images/small_error.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_faireboot.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/fai/addons/goto/events/class_DaemonEvent_goto_reload.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_goto_reload.inc
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id: class_DaemonEvent_wakeup.inc 10484 2008-04-16 06:24:25Z cajus $$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_goto_reload extends DaemonEvent
+{
+ var $visible_for = HIDDEN_EVENT;
+ var $mac = array();
+ protected $attributes = array("mac");
+
+ public function set_macs($macs)
+ {
+ $this->mac = $macs;
+ }
+
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Goto reload");
+ $this->s_Event_Name = _("Reload goto settings");
+ $this->s_Schedule_Action= "job_trigger_goto_settings_reload";
+ $this->s_Trigger_Action = "gosa_trigger_goto_settings_reload";
+ $this->s_Queued_Action = "trigger_action_goto_settings_reload";
+ $this->s_Menu_Image = "images/lists/reload.png";
+ $this->s_List_Image = "images/lists/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_goto_reload.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/fai/addons/goto/events/class_DaemonEvent_halt.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_halt.inc
--- /dev/null
@@ -0,0 +1,69 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_halt extends DaemonEvent
+{
+
+ var $visible_for = SYSTEM_EVENT;
+
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Switch off");
+ $this->s_Event_Name = _("Switch off");
+ $this->s_Schedule_Action = "job_trigger_action_halt";
+ $this->s_Trigger_Action= "gosa_trigger_action_halt";
+ $this->s_Queued_Action= "trigger_action_halt";
+ $this->s_Menu_Image = "images/lists/off.png";
+ $this->s_List_Image = "images/lists/off.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/fai/addons/goto/events/class_DaemonEvent_installation_activation.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_installation_activation.inc
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_installation_activation extends DaemonEvent
+{
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Installation activation");
+ $this->s_Event_Name = _("Installation activation");
+ $this->s_Schedule_Action = "job_set_activated_for_installation";
+ $this->s_Trigger_Action = "gosa_set_activated_for_installation";
+ $this->s_Queued_Action = "set_activated_for_installation";
+ $this->s_Menu_Image = "images/true.png";
+ $this->s_List_Image = "images/true.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_installation_activation.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/fai/addons/goto/events/class_DaemonEvent_localboot.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_localboot.inc
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_localboot extends DaemonEvent
+{
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Force localboot");
+ $this->s_Event_Name = _("Force localboot");
+ $this->s_Schedule_Action = "job_trigger_action_localboot";
+ $this->s_Trigger_Action= "gosa_trigger_action_localboot";
+ $this->s_Queued_Action= "trigger_action_localboot";
+ $this->s_Menu_Image = "plugins/goto/images/localboot.png";
+ $this->s_List_Image = "plugins/goto/images/localboot.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_localboot.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/fai/addons/goto/events/class_DaemonEvent_lock.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_lock.inc
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_lock extends DaemonEvent
+{
+ var $visible_for = SYSTEM_EVENT;
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Lock");
+ $this->s_Event_Name = _("Lock");
+ $this->s_Schedule_Action = "job_trigger_action_lock";
+ $this->s_Trigger_Action= "gosa_trigger_action_lock";
+ $this->s_Queued_Action= "trigger_action_lock";
+ $this->s_Menu_Image = "images/lists/locked.png";
+ $this->s_List_Image = "images/lists/locked.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_lock.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/fai/addons/goto/events/class_DaemonEvent_memcheck.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_memcheck.inc
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_memcheck extends DaemonEvent
+{
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Memory test");
+ $this->s_Event_Name = _("Memory test");
+ $this->s_Schedule_Action= "job_trigger_action_memcheck";
+ $this->s_Trigger_Action = "gosa_trigger_action_memcheck";
+ $this->s_Queued_Action = "trigger_action_memcheck";
+ $this->s_Menu_Image = "plugins/goto/images/memcheck.png";
+ $this->s_List_Image = "plugins/goto/images/memcheck.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_memcheck.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/fai/addons/goto/events/class_DaemonEvent_notify.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_notify.inc
--- /dev/null
@@ -0,0 +1,211 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_notify extends DaemonEvent
+{
+ var $visible_for = USER_EVENT;
+
+ var $user = array();
+ var $group= array();
+
+ var $message = "";
+ var $subject = "";
+ var $from = "";
+
+ var $attributes = array("from","user","group","message","subject");
+
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+
+ $ui = get_userinfo();
+ $this->from = $ui->cn;
+
+ $this->message = base64_decode($this->message);
+ $this->subject = base64_decode($this->subject);
+
+ $this->s_Menu_Name = _("Send message");
+ $this->s_Event_Name = _("Send message");
+
+ $this->s_Schedule_Action = "job_send_user_msg";
+ $this->s_Trigger_Action= "gosa_send_user_msg";
+ $this->s_Queued_Action= "trigger_action_notify";
+ $this->s_Menu_Image = "plugins/goto/images/notify.png";
+ $this->s_List_Image = "plugins/goto/images/notify.png";
+ $this->a_targets = array("GOSA"); // Required to get the event send. Maybe this is a wrong value.
+ }
+
+ public function execute()
+ {
+ DaemonEvent::execute();
+
+ /* Check if target add dialog is open */
+ if($this->is_target_list_open() && $this->is_new){
+ return($this->get_target_add_list());
+ }
+
+
+ $display = $this->get_header();
+ $tmp = $this->data;
+ $smarty = get_smarty();
+ $smarty->assign("data" , $this->data);
+ $smarty->assign("is_new" , $this->is_new);
+ $smarty->assign("timestamp" , $this->get_time_select());
+
+ $smarty->assign("user" , $this->user);
+ $smarty->assign("group" , $this->group);
+
+ $smarty->assign("add_str", msgPool::addButton(_("Target")));
+ $smarty->assign("del_str", msgPool::delButton(_("Target")));
+
+ $smarty->assign("from", xmlentities($this->from));
+ $smarty->assign("subject", xmlentities($this->subject));
+ $smarty->assign("message", xmlentities($this->message));
+
+ $display.= $smarty->fetch(get_template_path('DaemonEvent_notify.tpl', TRUE, dirname(__FILE__)));
+ $display.= $this->get_footer();
+ return($display);
+ }
+
+
+ public function check()
+ {
+ $msgs = DaemonEvent::check();
+ if(empty($this->subject)){
+ $msgs[] = msgPool::required(_("Subject"));
+ }
+ if(empty($this->message)){
+ $msgs[] = msgPool::required(_("Message"));
+ }
+ if(empty($this->from)){
+ $msgs[] = msgPool::required(_("From"));
+ }
+ if(!count($this->group) && !count($this->user)){
+ $msgs[] = msgPool::required(_("Target"));
+ }
+ return($msgs);
+ }
+
+
+ public function save_object()
+ {
+ DaemonEvent::save_object();
+
+ if(isset($_POST['del_any_target']) && isset($_POST['group'])){
+ foreach($_POST['group'] as $id){
+ if(isset($this->group[$id])){
+ unset($this->group[$id]);
+ }
+ }
+ }
+ if(isset($_POST['del_any_target']) && isset($_POST['user'])){
+ foreach($_POST['user'] as $id){
+ if(isset($this->user[$id])){
+ unset($this->user[$id]);
+ }
+ }
+ }
+
+ if(isset($_POST['subject'])){
+ $this->subject = get_post('subject');
+ }
+ if(isset($_POST['message'])){
+ $this->message = get_post('message');
+ }
+ if(isset($_POST['from'])){
+ $this->from = get_post('from');
+ }
+ }
+
+ public function add_users($targets)
+ {
+ $add = $targets;
+ if(!is_array($add)){
+ $add = array($add);
+ }
+ foreach($add as $target){
+ if(!in_array($target,$this->user)){
+ $this->user[] = $target;
+ }
+ }
+ }
+
+
+ public function add_groups($targets)
+ {
+ $add = $targets;
+ if(!is_array($add)){
+ $add = array($add);
+ }
+ foreach($add as $target){
+ if(!in_array($target,$this->group)){
+ $this->group[] = $target;
+ }
+ }
+ }
+
+
+ /*! \brief Returns HTML content, displaying a dialog which allows to add new targets.
+ @return String HTML content. (EventTargetAddList)
+ */
+ public function get_target_add_list()
+ {
+ $this->target_add_list_used = TRUE;
+
+ if($this->target_divlist == NULL){
+ $this->target_divlist = new EventTargetAddUserList($this->config,$this);
+ }
+ $this->target_divlist->execute();
+
+ $smarty = get_smarty();
+ $smarty->assign("divlist",$this->target_divlist->Draw());
+ return($smarty->fetch(get_template_path('target_list.tpl', TRUE, dirname(__FILE__))));
+ }
+
+
+ /*! \brief Add a target MAC address
+ @param Array A List of all target that should be added.
+ */
+ public function add_targets($targets)
+ {
+ if(isset($targets['USERS'])){
+ $this->add_users($targets['USERS']);
+ }
+ if(isset($targets['GROUPS'])){
+ $this->add_groups($targets['GROUPS']);
+ }
+ }
+
+
+ public function save()
+ {
+ $ret = DaemonEvent::save();
+ $ret['delivery_time'] = $ret['timestamp'];
+ $ret['user'] = array_values( $ret['user']);
+ $ret['group'] = array_values( $ret['group']);
+ $ret['subject'] = base64_encode($ret['subject']);
+ $ret['message'] = base64_encode($ret['message']);
+ return($ret);
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_reboot.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_reboot.inc
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_reboot extends DaemonEvent
+{
+ var $visible_for = SYSTEM_EVENT;
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Reboot");
+ $this->s_Event_Name = _("Reboot");
+ $this->s_Schedule_Action = "job_trigger_action_reboot";
+ $this->s_Trigger_Action= "gosa_trigger_action_reboot";
+ $this->s_Queued_Action= "trigger_action_reboot";
+ $this->s_Menu_Image = "images/lists/reload.png";
+ $this->s_List_Image = "images/lists/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/fai/addons/goto/events/class_DaemonEvent_recreate_fai_release_db.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_recreate_fai_release_db.inc
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id: class_DaemonEvent_reload_ldap_config.inc 9815 2008-03-14 09:54:45Z cajus $$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_recreate_fai_release_db extends DaemonEvent
+{
+ var $visible_for = HIDDEN_EVENT;
+
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Reload fai release db");
+ $this->s_Event_Name = _("Reload fai release db");
+ $this->s_Schedule_Action= "gosa_recreate_fai_release_db";
+ $this->s_Trigger_Action = "gosa_recreate_fai_release_db";
+ $this->s_Queued_Action = "recreate_fai_release_db";
+ $this->s_Menu_Image = "images/edit.png";
+ $this->s_List_Image = "images/edit.png";
+ }
+
+ public function execute()
+ {
+ DaemonEvent::execute();
+ return("Cannot be displayed");
+ }
+
+ public function save_object()
+ {
+ DaemonEvent::save_object();
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_recreate_fai_server_db.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_recreate_fai_server_db.inc
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id: class_DaemonEvent_reload_ldap_config.inc 9815 2008-03-14 09:54:45Z cajus $$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_recreate_fai_server_db extends DaemonEvent
+{
+ var $visible_for = HIDDEN_EVENT;
+
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Reload fai server db");
+ $this->s_Event_Name = _("Reload fai server db");
+ $this->s_Schedule_Action= "gosa_recreate_fai_server_db";
+ $this->s_Trigger_Action = "gosa_recreate_fai_server_db";
+ $this->s_Queued_Action = "recreate_fai_release_db";
+ $this->s_Menu_Image = "images/edit.png";
+ $this->s_List_Image = "images/edit.png";
+ }
+
+ public function execute()
+ {
+ DaemonEvent::execute();
+ return("Cannot be displayed");
+ }
+
+ public function save_object()
+ {
+ DaemonEvent::save_object();
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_reinstall.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_reinstall.inc
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_reinstall extends DaemonEvent
+{
+ var $progress = 0;
+ var $status = "";
+ var $visible_for = SYSTEM_EVENT;
+
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Reinstall");
+ $this->s_Event_Name = _("Reinstall");
+ $this->s_Schedule_Action = "job_trigger_action_reinstall";
+ $this->s_Trigger_Action= "job_trigger_action_reinstall";
+ $this->s_Queued_Action= "trigger_action_reinstall";
+ $this->s_Menu_Image = "plugins/goto/images/reinstall.png";
+ $this->s_List_Image = "plugins/goto/images/reinstall.png";
+
+ if(!$this->is_new()){
+ if(isset($data['PROGRESS'])){
+ $this->progress = $data['PROGRESS'];
+ }
+ if(isset($data['STATUS'])){
+ $this->status = $data['STATUS'];
+ }
+ }
+ }
+
+ 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("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);
+ $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);
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_reload_ldap_config.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_reload_ldap_config.inc
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_reload_ldap_config extends DaemonEvent
+{
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Reload ldap config");
+ $this->s_Event_Name = _("Reload ldap config");
+ $this->s_Schedule_Action= "job_trigger_reload_ldap_config";
+ $this->s_Trigger_Action = "gosa_trigger_reload_ldap_config";
+ $this->s_Queued_Action = "reload_ldap_config";
+ $this->s_Menu_Image = "images/lists/edit.png";
+ $this->s_List_Image = "images/lists/edit.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_wakeup.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/fai/addons/goto/events/class_DaemonEvent_rescan.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_rescan.inc
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_rescan extends DaemonEvent
+{
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Rescan hardware");
+ $this->s_Event_Name = _("Rescan hardware");
+ $this->s_Schedule_Action= "job_detect_hardware";
+ $this->s_Trigger_Action = "gosa_detect_hardware";
+ $this->s_Queued_Action = "detect_hardware";
+ $this->s_Menu_Image = "plugins/goto/images/rescan.png";
+ $this->s_List_Image = "plugins/goto/images/rescan.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_rescan.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/fai/addons/goto/events/class_DaemonEvent_sysinfo.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_sysinfo.inc
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_sysinfo extends DaemonEvent
+{
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("System analysis");
+ $this->s_Event_Name = _("System analysis");
+ $this->s_Schedule_Action= "job_trigger_action_sysinfo";
+ $this->s_Trigger_Action = "gosa_trigger_action_sysinfo";
+ $this->s_Queued_Action = "trigger_action_sysinfo";
+ $this->s_Menu_Image = "plugins/goto/images/sysinfo.png";
+ $this->s_List_Image = "plugins/goto/images/sysinfo.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_sysinfo.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/fai/addons/goto/events/class_DaemonEvent_update.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_update.inc
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_update extends DaemonEvent
+{
+ var $visible_for = SYSTEM_EVENT;
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Software update");
+ $this->s_Event_Name = _("Software update");
+ $this->s_Schedule_Action = "job_trigger_action_update";
+ $this->s_Trigger_Action= "job_trigger_action_update";
+ $this->s_Queued_Action= "trigger_action_update";
+ $this->s_Menu_Image = "plugins/goto/images/update.png";
+ $this->s_List_Image = "plugins/goto/images/update.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/fai/addons/goto/events/class_DaemonEvent_wakeup.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_wakeup.inc
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class DaemonEvent_wakeup extends DaemonEvent
+{
+ var $visible_for = SYSTEM_EVENT;
+ public function __construct($config,$data = array())
+ {
+ DaemonEvent::__construct($config,$data);
+ $this->s_Menu_Name = _("Wake up");
+ $this->s_Event_Name = _("Start a system");
+ $this->s_Schedule_Action= "job_trigger_action_wake";
+ $this->s_Trigger_Action = "gosa_trigger_action_wake";
+ $this->s_Queued_Action = "trigger_action_wake";
+ $this->s_Menu_Image = "images/lists/on.png";
+ $this->s_List_Image = "images/lists/on.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_wakeup.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/fai/addons/goto/events/class_EventTargetAddList.inc b/gosa-plugins/fai/addons/goto/events/class_EventTargetAddList.inc
--- /dev/null
@@ -0,0 +1,288 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class EventTargetAddList extends MultiSelectWindow
+{
+ public $display_server = TRUE;
+ public $display_workstation = TRUE;
+ public $display_ogroup = TRUE;
+ public $filter_iprange = FALSE;
+
+ public $regex = "*";
+ public $ipfrom = "0.0.0.0";
+ public $ipto = "*";
+ public $_target_list = array();
+
+ public $workstation_list = array();
+ public $server_list = array();
+
+
+ function __construct(&$config,$parent)
+ {
+ MultiSelectWindow::MultiSelectWindow($config, "EventTargetAddList",
+ array("server",
+ "workstation",
+ "ogroups"));
+
+ $this->parent = $parent;
+ $this->ui = get_userinfo();
+
+
+ $this->target_divlist = new MultiSelectWindow($this->config,"EventAddTargedtList","gotomasses");
+ $this->SetSummary(_("Targets"));
+ $this->EnableCloseButton(FALSE);
+ $this->EnableSaveButton(FALSE);
+
+ $this->SetInformation(_("This dialog shows all available targets for your event, check the targets you want to add and use the 'Use' button to accept."));
+
+ /* Toggle all selected / deselected */
+ $chk = "<input type='checkbox' id='select_all' name='select_all'
+ onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+ $this->EnableAplhabet(TRUE);
+
+ /* set Page header */
+ $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
+ $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
+ $this->AddHeader(array("string"=>_("System / Department")));
+
+ //$name,$string,$value,$conn,$image="images/lists/search.png")
+ $this->AddRegex("regex" ,"regex" ,"*" , TRUE);
+ $this->AddRegex("ipfrom","ipfrom" ,"0.0.0.0" , FALSE);
+ $this->AddRegex("ipto" ,"ipto" ,"255.255.255.255" , FALSE);
+
+ $this->AddCheckBox("display_server","1" ,_("Display server"),TRUE);
+ $this->AddCheckBox("display_workstation","1",_("Display workstation"),TRUE);
+ $this->AddCheckBox("display_ogroup","1" ,_("Display object groups"),TRUE);
+ $this->AddCheckBox("filter_iprange","1" ,_("Filter by IP range"),FALSE);
+
+
+
+ /* Create a list of servers
+ */
+ $tmp = get_sub_list("(&(macAddress=*)(objectClass=goServer))",
+ "server",get_ou("serverRDN"),$config->current['BASE'],
+ array("cn","objectClass","description","ipHostNumber","macAddress"),GL_SUBSEARCH);
+ foreach($tmp as $server){
+ $this->server_list[$server['dn']] = $server;
+ }
+
+ /* Create a list of workstations
+ */
+ $tmp = get_sub_list("(&(macAddress=*)(objectClass=gotoWorkstation))",
+ "server",get_ou("workstationRDN"),$config->current['BASE'],
+ array("cn","objectClass","description","ipHostNumber","macAddress"),GL_SUBSEARCH);
+ foreach($tmp as $server){
+ $this->workstation_list[$server['dn']] = $server;
+ }
+
+ }
+
+
+ function execute()
+ {
+ $this->ClearElementsList();
+ $this->AddDepartments($this->selectedBase,2,1);
+ $this->setEntries();
+ $this->GenHeader();
+ }
+
+
+ function GenHeader()
+ {
+ $modules = array("server","workstation");
+
+ /* Add base */
+ $tmp = array();
+ $base = $this->config->current['BASE'];
+ $tmp[] = array("dn"=>$this->config->current['BASE']);
+ $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $modules, $base,
+ array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+ $deps = array();
+ foreach($tmp as $tm){
+ $deps[$tm['dn']] = $tm['dn'];
+ }
+
+ $department = $departments = array();
+ $ui= get_userinfo();
+ $d = $ui->get_module_departments($modules);
+ foreach($d as $department){
+ $departments[$department] = $department;
+ }
+
+ /* Load possible departments */
+ $ids = $this->config->idepartments;
+ $first = "";
+ $found = FALSE;
+ $options = array();
+ foreach($ids as $dep => $name){
+ if(isset($deps[$dep]) && in_array_ics($dep, $departments)){
+
+ /* Keep first base dn in mind, we could need this
+ * info if no valid base was found
+ */
+ if(empty($first)) {
+ $first = $dep['dn'];
+ }
+
+ $value = $ids[$dep];
+ if ($this->selectedBase == $dep){
+ $found = TRUE;
+ $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+ } else {
+ $options.= "<option value='".$dep."'>$value</option>";
+ }
+ }
+ }
+
+ $listhead = $this->get_default_header();
+
+ /* Add base selection */
+ $listhead .= _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+ " <input class='center' type='image' src='images/lists/submit.png' align='middle'
+ title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ";
+
+ $this->SetListHeader($listhead);
+
+ }
+
+
+ function get_selected_targets()
+ {
+ $a_targets = array();
+ foreach($this->list_get_selected_items() as $id){
+ if(in_array("gosaGroupOfNames",$this->_target_list[$id]['objectClass'])){
+ foreach($this->_target_list[$id]['member'] as $mem_dn){
+ if(isset($this->workstation_list[$mem_dn])){
+ $a_targets[] = $this->workstation_list[$mem_dn]['macAddress'][0];
+ }
+ if(isset($this->server_list[$mem_dn])){
+ $a_targets[] = $this->server_list[$mem_dn]['macAddress'][0];
+ }
+ }
+ }else{
+ if(isset($this->_target_list[$id]['macAddress'][0])){
+ $a_targets[] = $this->_target_list[$id]['macAddress'][0];
+ }
+ }
+ }
+ return($a_targets);
+ }
+
+
+ function setEntries()
+ {
+ $_target_list = array();
+ if($this->display_server){
+ $_target_list = array_merge($_target_list,
+ get_list("(&(cn=".$this->regex.")(objectClass=goServer))",
+ "server",get_ou("serverRDN").$this->selectedBase,
+ array("cn","objectClass","description","ipHostNumber","macAddress"),GL_NONE));
+ }
+ if($this->display_workstation){
+ $_target_list = array_merge($_target_list,
+ get_list("(&(cn=".$this->regex.")(objectClass=gotoWorkstation))",
+ "workstation",get_ou("workstationRDN").$this->selectedBase,
+ array("cn","objectClass","description","ipHostNumber","macAddress"),GL_NONE));
+ }
+ if($this->display_ogroup){
+ $_target_list = array_merge($_target_list,
+ get_list("(&(cn=".$this->regex.")(member=*)(objectClass=gosaGroupOfNames))",
+ "ogroups",get_ou("ogroupRDN").$this->selectedBase,
+ array("cn","objectClass","description","member"),GL_NONE));
+ }
+ $this->_target_list = $_target_list;
+
+ $tmp = array();
+ foreach($this->_target_list as $key => $object){
+ $tmp[$key] = $object['cn'][0];
+ }
+ natcasesort($tmp);
+
+ foreach($tmp as $key => $obj){
+
+ $obj = $this->_target_list[$key];
+ $name = $obj['cn'][0];
+ if(isset($obj['description'])){
+ $name .= " [".$obj['description'][0]."]";
+ }
+ if(isset($obj['macAddress'])){
+ $name .= " - ".$obj['macAddress'][0]."";
+ }
+ if(isset($obj['ipHostNumber'])){
+ $name .= " - ".$obj['ipHostNumber'][0]."";
+ }
+
+ $img ="";
+ if(in_array("goServer",$obj['objectClass'])){
+ $img = '<img class="center" src="plugins/systems/images/select_server.png" alt="S" title="'._("Server").'">';
+
+ if($this->filter_iprange){
+ if(!isset($obj['ipHostNumber']) || !tests::is_in_ip_range($this->ipfrom,$this->ipto, $obj['ipHostNumber'][0])) {
+ continue;
+ }
+ }
+ if(!isset($this->server_list[$obj['dn']])){
+ continue;
+ }
+ }elseif(in_array("gotoWorkstation",$obj['objectClass'])){
+ $img = '<img class="center" src="plugins/systems/images/select_workstation.png" alt="W" title="'._("Workstation").'">';
+ if($this->filter_iprange){
+ if(!isset($obj['ipHostNumber']) || !tests::is_in_ip_range($this->ipfrom,$this->ipto,$obj['ipHostNumber'][0])) {
+ continue;
+ }
+ }
+ if(!isset($this->workstation_list[$obj['dn']])){
+ continue;
+ }
+ }elseif(in_array("gosaGroupOfNames",$obj['objectClass'])){
+ $img = '<img class="center" src="plugins/ogroups/images/select_ogroup.png" alt="O" title="'._("Object group").'">';
+ }
+
+ $field1 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>",
+ "attach" => "style='width:20px;'");
+ $field2 = array("string" => $img,
+ "attach" => "style='width:20px;'");
+ $field3 = array("string" => $name , "attach" => "title='".$obj['dn']."'");
+ $this->AddElement(array($field1,$field2,$field3));
+ }
+ }
+
+
+ /*! \brief Returns a set of elements selected in a MultiSelectWindow
+ @return Array[integer]=integer
+ */
+ protected function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^item_selected_[0-9]*$/",$name)){
+ $id = preg_replace("/^item_selected_/","",$name);
+ $ids[$id] = $id;
+ }
+ }
+ return($ids);
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/events/class_EventTargetAddUsersList.inc b/gosa-plugins/fai/addons/goto/events/class_EventTargetAddUsersList.inc
--- /dev/null
@@ -0,0 +1,220 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id: class_EventTargetAddUserList.inc 9597 2008-03-10 14:16:59Z hickert $$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+class EventTargetAddUserList extends MultiSelectWindow
+{
+ public $display_server = TRUE;
+ public $display_workstation = TRUE;
+ public $display_ogroup = TRUE;
+ public $filter_iprange = FALSE;
+
+ public $regex = "*";
+ public $ipfrom = "0.0.0.0";
+ public $ipto = "*";
+ public $_target_list = array();
+
+ function __construct(&$config,$parent)
+ {
+ MultiSelectWindow::MultiSelectWindow($config, "EventTargetAddUserList",
+ array("users","groups"));
+
+ $this->parent = $parent;
+ $this->ui = get_userinfo();
+
+
+ $this->target_divlist = new MultiSelectWindow($this->config,"EventAddTargetUserList","gotomasses");
+ $this->SetSummary(_("Targets"));
+ $this->EnableCloseButton(FALSE);
+ $this->EnableSaveButton(FALSE);
+
+ $this->SetInformation(_("This dialog shows all available targets for your event, check the targets you want to add and use the 'Use' button to accept."));
+
+ /* Toggle all selected / deselected */
+ $chk = "<input type='checkbox' id='select_all' name='select_all'
+ onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
+ $this->EnableAplhabet(TRUE);
+
+ /* set Page header */
+ $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
+ $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
+ $this->AddHeader(array("string"=>_("System / Department")));
+
+ //$name,$string,$value,$conn,$image="images/lists/search.png")
+ $this->AddRegex("regex" ,"regex" ,"*" , TRUE);
+
+ $this->AddCheckBox("display_users" ,"1", _("Display users"),TRUE);
+ $this->AddCheckBox("display_groups" ,"1", _("Display groups"),TRUE);
+ }
+
+
+ function execute()
+ {
+ $this->ClearElementsList();
+ $this->AddDepartments($this->selectedBase,2,1);
+ $this->setEntries();
+ $this->GenHeader();
+ }
+
+
+ function GenHeader()
+ {
+ $modules = array("users","groups");
+
+ /* Add base */
+ $tmp = array();
+ $base = $this->config->current['BASE'];
+ $tmp[] = array("dn"=>$this->config->current['BASE']);
+ $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $modules, $base,
+ array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
+
+ $deps = array();
+ foreach($tmp as $tm){
+ $deps[$tm['dn']] = $tm['dn'];
+ }
+
+ $department = $departments = array();
+ $ui= get_userinfo();
+ $d = $ui->get_module_departments($modules);
+ foreach($d as $department){
+ $departments[$department] = $department;
+ }
+
+ /* Load possible departments */
+ $ids = $this->config->idepartments;
+ $first = "";
+ $found = FALSE;
+ $options = array();
+ foreach($ids as $dep => $name){
+ if(isset($deps[$dep]) && in_array_ics($dep, $departments)){
+
+ /* Keep first base dn in mind, we could need this
+ * info if no valid base was found
+ */
+ if(empty($first)) {
+ $first = $dep['dn'];
+ }
+
+ $value = $ids[$dep];
+ if ($this->selectedBase == $dep){
+ $found = TRUE;
+ $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+ } else {
+ $options.= "<option value='".$dep."'>$value</option>";
+ }
+ }
+ }
+
+ $listhead = $this->get_default_header();
+
+ /* Add base selection */
+ $listhead .= _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+ " <input class='center' type='image' src='images/lists/submit.png' align='middle'
+ title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ";
+
+ $this->SetListHeader($listhead);
+
+ }
+
+
+ function setEntries()
+ {
+ $_target_list = array();
+
+ if($this->display_users){
+ $_target_list = array_merge($_target_list,
+ get_sub_list("(&(objectClass=person)(objectClass=gosaAccount))","users",get_people_ou(),get_people_ou().$this->selectedBase,
+ array("cn","objectClass","description","uid"),GL_NONE));
+ }
+ if($this->display_groups){
+ $_target_list = array_merge($_target_list,
+ get_sub_list("(objectClass=posixGroup)","groups",get_groups_ou(),get_groups_ou().$this->selectedBase,
+ array("cn","objectClass","description"),GL_NONE));
+ }
+ $this->_target_list = $_target_list;
+
+ $tmp = array();
+ foreach($this->_target_list as $key => $object){
+ $tmp[$key] = $object['cn'][0];
+ }
+ natcasesort($tmp);
+
+ foreach($tmp as $key => $obj){
+
+ $obj = $this->_target_list[$key];
+ $name = $obj['cn'][0];
+ if(isset($obj['description'])){
+ $name .= " [".$obj['description'][0]."]";
+ }
+
+ $img ="";
+ if(in_array("gosaAccount",$obj['objectClass'])){
+ $img = '<img class="center" src="plugins/users/images/select_user.png" alt="U" title="'._("User").'">';
+ }elseif(in_array("posixGroup",$obj['objectClass'])){
+ $img = '<img class="center" src="plugins/groups/images/groups.png" alt="G" title="'._("Group").'">';
+ }
+
+ $field1 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>",
+ "attach" => "style='width:20px;'");
+ $field2 = array("string" => $img,
+ "attach" => "style='width:20px;'");
+ $field3 = array("string" => $name , "attach" => "title='".$obj['dn']."'");
+ $this->AddElement(array($field1,$field2,$field3));
+ }
+ }
+
+
+ function get_selected_targets()
+ {
+ $a_targets = array("USERS" => array(),"GROUPS" => array());
+
+ foreach($this->list_get_selected_items() as $id){
+ $obj = $this->_target_list[$id];
+ if(in_array("posixGroup",$obj['objectClass'])){
+ $a_targets['GROUPS'][] = $obj['cn'][0];
+ }
+ if(in_array("gosaAccount",$obj['objectClass'])){
+ $a_targets['USERS'][] = $obj['uid'][0];
+ }
+ }
+
+ return($a_targets);
+ }
+
+
+ /*! \brief Returns a set of elements selected in a MultiSelectWindow
+ @return Array[integer]=integer
+ */
+ protected function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^item_selected_[0-9]*$/",$name)){
+ $id = preg_replace("/^item_selected_/","",$name);
+ $ids[$id] = $id;
+ }
+ }
+ return($ids);
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/fai/addons/goto/events/target_list.tpl b/gosa-plugins/fai/addons/goto/events/target_list.tpl
--- /dev/null
@@ -0,0 +1,7 @@
+{$divlist}
+
+<p class='seperator'></p>
+<div style='text-align:right;width:100%;padding-top:5px;padding-right:5px;padding-bottom:5px;'>
+ <input type='submit' name='save_target_dialog' value='{t}Apply{/t}'>
+ <input type='submit' name='abort_target_dialog' value='{t}Cancel{/t}'>
+</div>
diff --git a/gosa-plugins/fai/addons/goto/events/timestamp_select.tpl b/gosa-plugins/fai/addons/goto/events/timestamp_select.tpl
--- /dev/null
@@ -0,0 +1,45 @@
+<table cellspacing="0" cellpadding="0">
+ <tr>
+ <td>{t}Year{/t}</td>
+ <td>{t}Month{/t}</td>
+ <td>{t}Day{/t}</td>
+ <td> </td>
+ <td>{t}Hour{/t}</td>
+ <td>{t}Minute{/t}</td>
+ <td>{t}Second{/t}</td>
+ </tr>
+ <tr>
+ <td>
+ <select name="time_year" onChange="document.mainform.submit();">
+ {html_options values=$years options=$years selected=$time_year}
+ </select>
+ </td>
+ <td>
+ <select name="time_month" onChange="document.mainform.submit();">
+ {html_options values=$months options=$months selected=$time_month}
+ </select>
+ </td>
+ <td>
+ <select name="time_day">
+ {html_options values=$days options=$days selected=$time_day}
+ </select>
+ </td>
+ <td> </td>
+ <td>
+ <select name="time_hour">
+ {html_options values=$hours options=$hours selected=$time_hour}
+ </select>
+ </td>
+ <td>
+ <select name="time_minute">
+ {html_options values=$minutes options=$minutes selected=$time_minute}
+ </select>
+ </td>
+ <td>
+ <select name="time_second">
+ {html_options values=$seconds options=$seconds selected=$time_second}
+ </select>
+ </td>
+ </tr>
+</table>
+
diff --git a/gosa-plugins/fai/addons/goto/goto_import_file.tpl b/gosa-plugins/fai/addons/goto/goto_import_file.tpl
--- /dev/null
@@ -0,0 +1,87 @@
+<h2>{t}Import jobs{/t}</h2>
+<p>
+{t}You can import a list of jobs into the GOsa job queue. This should be a semicolon seperated list of items in the following format:{/t}
+</p>
+<i>{t}timestamp{/t} ; {t}MAC-address{/t} ; {t}job type{/t} ; {t}object group{/t} [ ; {t}import base{/t} ; {t}full hostname{/t} ; {t}IP-address{/t} ; {t}DHCP group{/t} ]</i>
+<br>
+<br>
+{if !$count}
+{t}Example{/t}:
+<br>
+20080626162556 <b>;</b> 00:0C:29:99:1E:37 <b>;</b> job_trigger_activate_new <b>;</b> goto-client <b>;</b> dc=test,dc=gonicus,dc=de
+<br>
+<br>
+{/if}
+
+<p class="seperator"></p>
+
+<table>
+ <tr>
+ <td>
+ {t}Select list to import{/t}
+ </td>
+ <td>
+ <input type='file' name='file' value="{t}Browse{/t}">
+ <input type='submit' name='import' value='{t}Upload{/t}'>
+ </td>
+ </tr>
+</table>
+
+ {if $count}
+ <p class="seperator"> </p>
+ <br>
+ <br>
+ <div style='width:100%; height:300px; overflow: scroll;'>
+ <table cellpadding="3" cellspacing="0" style='width:100%; background-color: #CCCCCC; border: solid 1px #CCCCCC;'>
+ <tr>
+ <td><b>{t}Timestamp{/t}</b></td>
+ <td><b>{t}MAC{/t}</b></td>
+ <td><b>{t}Event{/t}</b></td>
+ <td><b>{t}Object group{/t}</b></td>
+ <td><b>{t}Base{/t}</b></td>
+ <td><b>{t}FQDN{/t}</b></td>
+ <td><b>{t}IP{/t}</b></td>
+ <td><b>{t}DHCP{/t}</b></td>
+ </tr>
+ {foreach from=$info item=item key=key}
+ {if $item.ERROR}
+ <tr style='background-color: #F0BBBB;'>
+ <td>{$item.TIMESTAMP}</td>
+ <td>{$item.MAC}</td>
+ <td>{$item.HEADER}</td>
+ <td>{$item.OGROUP}</td>
+ <td>{$item.BASE}</td>
+ <td>{$item.FQDN}</td>
+ <td>{$item.IP}</td>
+ <td>{$item.DHCP}</td>
+ </tr>
+ <tr style='background-color: #F0BBBB;'>
+ <td colspan="7"><b>{$item.ERROR}</b></td>
+ </tr>
+ {else}
+ {if ($key % 2)}
+ <tr class="rowxp0">
+ {else}
+ <tr class="rowxp1">
+ {/if}
+ <td>{$item.TIMESTAMP}</td>
+ <td style='border-left: solid 1px #BBBBBB;'>{$item.MAC}</td>
+ <td style='border-left: solid 1px #BBBBBB;'>{$item.HEADER}</td>
+ <td style='border-left: solid 1px #BBBBBB;'>{$item.OGROUP}</td>
+ <td style='border-left: solid 1px #BBBBBB;'>{$item.BASE}</td>
+ <td style='border-left: solid 1px #BBBBBB;'>{$item.FQDN}</td>
+ <td style='border-left: solid 1px #BBBBBB;'>{$item.IP}</td>
+ <td style='border-left: solid 1px #BBBBBB;'>{$item.DHCP}</td>
+ </tr>
+ {/if}
+ {/foreach}
+ </table>
+ </div>
+ {/if}
+<br>
+<p class='seperator'></p>
+<div style='text-align:right;width:99%; padding-right:5px; padding-top:5px;'>
+ <input type='submit' name='start_import' value='{t}Import{/t}' >
+ <input type='submit' name='import_abort' value='{msgPool type=backButton}'>
+</div>
+<br>
diff --git a/gosa-plugins/fai/addons/goto/gotomasses.tpl b/gosa-plugins/fai/addons/goto/gotomasses.tpl
--- /dev/null
@@ -0,0 +1,141 @@
+
+
+{$div}
+
+<!--
+JS to reload the progress bars.
+
+-->
+{literal}
+<script type="text/javascript">
+
+/* Get request object handler for this type of browser
+ */
+if (typeof XMLHttpRequest != 'undefined')
+{
+ xmlHttpObject = new XMLHttpRequest();
+}
+if (!xmlHttpObject)
+{
+ try
+ {
+ xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+ catch(e)
+ {
+ try
+ {
+ xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ catch(e)
+ {
+ xmlHttpObject = null;
+ }
+ }
+}
+
+var fai_status = new Array();
+
+function loadContent()
+{
+ var c = 0;
+
+ /* Create array of available progress images once
+ */
+ if(!fai_status.length){
+ for (var i = 0; i < document.images.length; i++) {
+ var img = document.images[i];
+ var id = img.id;
+ if(id.match(/^progress_/)){
+ var mac = id.replace(/^progress_/,'');
+ mac = mac.replace(/_/g,':');
+ fai_status[c] = new Object();
+ fai_status[c]['MAC'] = mac;
+ fai_status[c]['PROGRESS'] = -1;
+ c ++;
+ }
+ }
+ }
+
+ /* Create string of macs used as parameter for getFAIstatus.php
+ to retrieve all progress values.
+ */
+ var macs = "";
+ for (var i = 0; i < fai_status.length; i++) {
+ macs += fai_status[i]['MAC'] + ","
+ }
+
+ /* Send request
+ */
+ xmlHttpObject.open('get','getFAIstatus.php?mac=' + macs);
+ xmlHttpObject.onreadystatechange = handleContent;
+ xmlHttpObject.send(null);
+ return false;
+}
+
+
+function handleContent()
+{
+ if (xmlHttpObject.readyState == 4)
+ {
+ /* Get text and split by newline
+ */
+ var text = xmlHttpObject.responseText;
+ var data = text.split("\n");
+
+ /* Walk through progress images and check if the
+ progress status has changed
+ */
+ for (var e = 0; e < fai_status.length; e++) {
+
+ /* Walk through returned values and parse out
+ mac and progress value */
+ var found = false;
+
+ /* Create object id out of mac address
+ 12:34:56:12:34:56 => progress_12_34_56_12_34_56
+ */
+ var id = fai_status[e]["MAC"].replace(/:/g,"_");
+ id = "progress_" + id;
+ var img = document.getElementById(id);
+
+ /* Continue if there is no image object iwth this id
+ */
+ if(!img){
+ continue;
+ }
+
+ for (var i = 0; i < data.length; i++) {
+ var mac = data[i].replace(/\|.*$/,"");
+ var progress= data[i].replace(/^.*\|/,"");
+
+ /* Match mac returned by the support daemon and
+ the one out of our list */
+ if(fai_status[e]["MAC"] == mac){
+ found = true;
+
+ /* Check if progress has changed
+ */
+ if(fai_status[e]["PROGRESS"] != progress){
+ img.src = "progress.php?x=80&y=13&p=" + progress;
+ fai_status[e]["PROGRESS"] = progress;
+ }
+ break;
+ }
+ }
+ //document.getElementById("text1").value += "\n ";
+
+ /* There was no status send for the current mac.
+ This means it was removed from the queue.
+ */
+ if(!found){
+ document.mainform.submit();
+ }
+ }
+ timer=setTimeout('loadContent()',3000);
+ }
+}
+
+timer=setTimeout('loadContent()',3000);
+</script>
+{/literal}
diff --git a/gosa-plugins/fai/addons/goto/log_view.tpl b/gosa-plugins/fai/addons/goto/log_view.tpl
--- /dev/null
@@ -0,0 +1,29 @@
+{if !$ACL}
+
+ <h2>{msgPool type=permView}</h2>
+
+{else}
+ {if $logs_available}
+ <h2>{t}Available logs{/t}</h2>
+
+ <div style="width:99%;border: solid 1px #CCCCCC;">{$divlist}</div>
+ <br>
+ <p class="seperator"></p>
+ <h2>{t}Selected log{/t}: {$selected_log}</h2>
+ <div style="width:99%;height:350px;padding:3px;background-color:white; overflow-y: scroll;border: solid 1px;">
+ {$log_file}
+ </div>
+ {else}
+ <h2>{t}No logs for this host available!{/t}</h2>
+ {/if}
+{/if}
+
+{if $standalone}
+<br>
+<input type="hidden" name="ignore" value="1">
+<p class='seperator'></p>
+<div style='text-align:right;width:99%; padding-right:5px; padding-top:5px;'>
+ <input type='submit' name='abort_event_dialog' value='{msgPool type=backButton}'>
+</div>
+<br>
+{/if}
diff --git a/gosa-plugins/fai/addons/goto/main.inc b/gosa-plugins/fai/addons/goto/main.inc
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+if (!$remove_lock){
+
+ /* Create gotomasses object on demand */
+ if (!session::is_set('gotomasses') || (isset($_GET['reset']) && $_GET['reset'] == 1) || isset($_POST['reload_gotomass_data'])){
+ $gotomasses= new gotomasses ($config);
+ $gotomasses->set_acl_category("gotomasses");
+
+ /* Check root dn and user dn for acl informations */
+ $gotomasses->set_acl_base($config->current['BASE']);
+ if($gotomasses->getacl("") == ""){
+ $gotomasses->set_acl_base($ui->dn);
+ }
+
+ /* Check if we have acl on our own base */
+ if($gotomasses->getacl("") == ""){
+ $gotomasses->set_acl_base(dn2base($ui->dn));
+ }
+ session::set("gotomasses",$gotomasses);
+ }
+ $gotomasses = session::get('gotomasses');
+
+ /* Execute formular */
+ $display= $gotomasses->save_object();
+ if(isset($_POST['save_gotomass_changes'])){
+ $gotomasses->save();
+ }
+ $display= $gotomasses->execute ();
+
+ /* Page header*/
+ $display= print_header(get_template_path('plugins/goto/images/goto.png'), _("System deployment status")).$display;
+
+ /* Store changes in session */
+ session::set('gotomasses',$gotomasses);
+}
diff --git a/gosa-plugins/fai/addons/goto/remove.tpl b/gosa-plugins/fai/addons/goto/remove.tpl
--- /dev/null
@@ -0,0 +1,20 @@
+<div style="font-size:18px;">
+ <img alt="" src="images/warning.png" align=top> {t}Warning{/t}
+</div>
+<p>
+ {$info}
+</p>
+
+<p>
+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
+</p>
+
+<p class="plugbottom">
+{if $multiple}
+ <input type=submit name="delete_multiple_confirm" value="{msgPool type=delButton}">
+{else}
+ <input type=submit name="delete_confirm" value="{msgPool type=delButton}">
+{/if}
+ <input type=submit name="delete_cancel" value="{msgPool type=cancelButton}">
+</p>
+
diff --git a/gosa-plugins/goto/addons/goto/class_gotoLogView.inc b/gosa-plugins/goto/addons/goto/class_gotoLogView.inc
+++ /dev/null
@@ -1,215 +0,0 @@
-<?php
-
-class gotoLogView extends plugin
-{
-
- var $mac;
- var $logs;
- var $event;
- var $parent;
- var $config;
-
- var $o_queue;
-
- var $selected_date;
- var $selected_file = 0;
-
- var $attributes = array("macAddress");
- var $macAddress = "";
-
- var $sort_by = "time";
- var $sort_dir = 1; // 1 => up, 0 => down
-
- var $ignore_account = TRUE;
- var $standalone = FALSE;
-
- function __construct(&$config,$dn,$parent)
- {
- $this->config = $config;
- $this->parent = $parent;
-
- /* Try to fetch logs for the given event (mac)
- */
- $this->o_queue = new gosaSupportDaemon();
-
- /* Load ldap object if given
- and use this macAddress.
- */
- if(is_object($parent) && $dn != "" && $dn != "new"){
- plugin::plugin($config,$dn,$parent);
- }
-
- /* Get correct macAddress.
- Check if an event is given or a ldap object.
- */
- if(is_array($this->parent) && isset($this->parent['MACADDRESS'])){
- $this->mac = $this->parent['MACADDRESS'];
- $this->standalone = TRUE;
- }elseif(isset($parent->attrs['macAddress'][0])){
- $this->mac = $parent->attrs['macAddress'][0];
- $this->standalone = FALSE;
- }
-
- /* Query for log files
- */
- $res = $this->o_queue->get_log_info_for_mac($this->mac);
- if($this->o_queue->is_configured() && $this->o_queue->is_error()){
- msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
- }
-
- /* Check if there is at least one log file
- */
- if(!isset($res[$this->mac]) || !is_array($res[$this->mac])){
- $this->logs = array();
- }else{
- $this->selected_date = key($res[$this->mac]);
- $this->logs = $res;
- }
-
- }
-
-
- function execute()
- {
- $smarty = get_smarty();
- $smarty->assign("logs",$this->logs);
- $smarty->assign("logs_available", isset($this->logs[$this->mac]));
- $smarty->assign("mac",$this->mac);
- $smarty->assign("selected_file",$this->selected_file);
- $smarty->assign("selected_date",$this->selected_date);
- $smarty->assign("log_file", $this->get_log($this->mac,$this->selected_date,$this->selected_file));
- $smarty->assign("standalone",$this->standalone);
-
- if (isset($this->logs[$this->mac])){
- $date = date("d.m.Y H:i:s",$this->logs[$this->mac][$this->selected_date]['REAL_DATE']);
- }
- $file = $this->selected_file;
- $smarty->assign("selected_log",_("none"));
- if(!empty($file)){
- $smarty->assign("selected_log",$file.", ".$date);
- }
-
- $divlist = new divlist("log_view");
-
- /* Create sort direction images
- */
- if($this->sort_dir){
- $img = "<img src='images/lists/sort-down.png' border='0' alt='\\/'>";
- }else{
- $img = "<img src='images/lists/sort-up.png' border='0' alt='/\\'";
- }
- if($this->sort_by == "file"){
- $img1 = $img;
- $img2 = "";
- }else{
- $img1 = "";
- $img2 = $img;
- }
-
-
- /* Create list header
- */
- $divlist->SetHeader(array(
- array("string"=>"<a href='?plug=".$_GET['plug']."&sort_by=file'>"._("File")." ".$img1."</a>",
- "attach"=>"width='200px;'"),
- array("string"=>"<a href='?plug=".$_GET['plug']."&sort_by=time'>"._("Date")." ".$img2."</a>",
- "attach" => "style='border-right:none;'"),
- ));
-
- /* Create divlist list
- */
- $divlist->SetEntriesPerPage(0);
- $divlist->SetHeight(150);
-
- /* Create sortable array
- */
- $link = "<a href='?plug=".$_GET['plug']."&time=%time%&file=%file%&mac=%mac%'>%str%</a>";
- $to_add = array();
- $sort_by = $this->sort_by;
- foreach($this->logs as $mac => $times){
- foreach($times as $time => $data){
- $rtime = $data['REAL_DATE'];
- foreach($data['FILES'] as $file){
-
- $highlight = "";
- if($file == $this->selected_file && $time == $this->selected_date && $mac == $this->mac){
- $highlight = "background-color:#CCCCCC";
- }
-
- $use_link = preg_replace(array("/%mac%/","/%time%/","/%file%/"),array($mac,$time,$file),$link);
- $to_add[$$sort_by.$file.$time] = array(
- array("string" => preg_replace("/%str%/",$file,$use_link),
- "attach" => "style='width:200px; $highlight'"),
- array("string" => preg_replace("/%str%/",date("d.m.Y H:i:s",$rtime),$use_link),
- "attach" => "style='border-right:none; $highlight'"),
- );
- }
- }
- }
-
- /* Sort entries
- */
- if(!$this->sort_dir){
- uksort($to_add, "strnatcasecmp");
- }else{
- uksort($to_add, "strnatcasecmp");
- $to_add = array_reverse($to_add);
- }
-
- /* Append entries to list
- */
- foreach($to_add as $entry){
- $divlist->AddEntry($entry);
- }
-
- $smarty->assign("ACL",preg_match("/r/",$this->getacl("")));
- $smarty->assign("divlist",$divlist->DrawList());
- return($smarty->fetch(get_template_path('log_view.tpl', TRUE,dirname(__FILE__))));
- }
-
-
- function get_log($mac,$date,$file)
- {
- $res = $this->o_queue->get_log_file($mac,$date,$file);
- if($this->o_queue->is_configured() && $this->o_queue->is_error()){
- msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
- }
- $res = nl2br(htmlentities($res));
- return($res);
- }
-
-
- function save_object()
- {
- foreach(array("time"=>"selected_date","file"=>"selected_file") as $attr => $dest){
- if(isset($_GET[$attr])){
- $this->$dest = $_GET[$attr];
- }
- }
- if(isset($_GET['sort_by']) && in_array($_GET['sort_by'],array("file","time"))){
- if($_GET['sort_by'] == $this->sort_by){
- $this->sort_dir = !$this->sort_dir;
- }
- $this->sort_by = $_GET['sort_by'];
- }
- }
-
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Log view"),
- "plDescription" => _("GOto log view"),
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 30,
- "plSection" => array("administration"),
- "plCategory" => array("workstation","server"),
-
- "plProvidedAcls"=> array()
- ));
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/class_goto_import_file.inc b/gosa-plugins/goto/addons/goto/class_goto_import_file.inc
+++ /dev/null
@@ -1,179 +0,0 @@
-<?php
-
-class goto_import_file extends plugin
-{
-
- var $events = array();
- var $csv_fields = array();
- var $import_successful = FALSE; // Indicates that we have successfully imported everything.
-
- public function __construct($config,&$parent)
- {
- plugin::plugin($config,NULL);
- $this->parent = $parent;
- $this->daemon_events = DaemonEvent::get_event_types( SYSTEM_EVENT | HIDDEN_EVENT);
-
- $this->csv_fields = array(
- "0"=>"TIMESTAMP","1" => "MAC", "2" => "HEADER", "3" => "OGROUP",
- "4" => "BASE", "5" => "FQDN", "6" => "IP", "7" => "DHCP");
- }
-
-
- private function parse_csv($str)
- {
-
- /* Some file checks
- */
- $lines = split("\n",$str);
- if(empty($str) || !count($lines)){
- msg_dialog::display(_("Import"), msgPool::incorrectUpload(_("file is empty")),ERROR_DIALOG);
- return;
- }
-
- /* Reset current events
- */
- $this->events = array();
-
- /* Parse each line of the given file
- */
- foreach($lines as $line){
-
- // Skip empty lines.
- if(empty($line)) continue;
-
- /* Load values from file
- */
- $fields = split(";",$line);
- $event = array();
- foreach($this->csv_fields as $key => $val) {
- $event[$val] = "";
- if(isset($fields[$key])){
- $event[$val] = $fields[$key];
- }
- }
- $this->events[] = $event;
- }
- $this->check_fields();
- }
-
-
- public function execute()
- {
- /* Import file
- */
- if(isset($_POST['import']) && isset($_FILES['file'])) {
- if(isset($_FILES['file']['tmp_name'])){
- $str = file_get_contents($_FILES['file']['tmp_name']);
- $this->parse_csv($str);
- }
- }
-
- /* Import started
- */
- $confirmed = FALSE;
- foreach($_POST as $name => $value){
- if(preg_match("/^MSG_OK/",$name)){
- $confirmed = TRUE;
- }
- }
- if(isset($_POST['start_import']) || $confirmed){
- $error = FALSE;
- if(!$confirmed){
- foreach($this->events as $event){
- if(!empty($event['ERROR'])){
- $error = TRUE;
- break;
- }
- }
- if($error){
- msg_dialog::display(_("Import"),
- _("Selected entries will be skipped because of errors. Do you want to proceed?"),CONFIRM_DIALOG);
- }
- }
- if(!$error){
-
- $success = 0;
- $fail = 0;
-
- foreach($this->events as $key => $event){
- if(!empty($event['ERROR'])){
- $fail ++;
- continue;
- }
-
- /* Create event
- */
- $class= $this->daemon_events['QUEUED'][$event['HEADER']];
- $o_data = $this->daemon_events['BY_CLASS'][$class];
- $object = new $class($this->config);
- $object->add_targets(array($event['MAC']));
- if($o_data['s_Schedule_Action'] == $event['HEADER']){
- $object->set_type(SCHEDULED_EVENT);
- }else{
- $object->set_type(TRIGGERED_EVENT);
- }
-
- /* Update values like fqdn a.s.o
- */
- foreach($this->csv_fields as $name){
- if($name == "TIMESTAMP" && empty($event[$name])) continue;
- $object->set_value($name,$event[$name]);
- }
-
- if(!$this->parent->o_queue->append($object)){
- msg_dialog::display(_("Service infrastructure"),msgPool::siError($this->parent->o_queue->get_error()),ERROR_DIALOG);
- $fail ++;
- }else{
- unset($this->events[$key]);
- $success ++;
- }
- }
- msg_dialog::display(_("Import"),sprintf(_("Import complete: %s events successfully send, %s failed"),$success,$fail),INFO_DIALOG);
- $this->import_successful = count($this->events) == 0;
- }
- }
-
-
- /* Prepare output
- */
- $evts = $this->events;
- foreach($this->events as $id => $evt){
- foreach($evt as $key => $val){
- if(in_array($key,$this->csv_fields)){
- $evts[$id][$key] = "<span style=\"white-space: nowrap;\">".strip_tags($val)."</span>";
- }
- }
- }
-
- $smarty = get_smarty();
- $smarty->assign("info",$evts);
- $smarty->assign("count",count($evts));
- return($smarty->fetch(get_template_path('goto_import_file.tpl', TRUE)));
- }
-
-
- public function check()
- {
- $message = plugin::check();
- $this->check_fields();
- return($message);
- }
-
-
- private function check_fields()
- {
- foreach($this->events as $key => $event){
- $this->events[$key]['ERROR'] = "";
- if(empty($event['MAC']) || !tests::is_mac($event['MAC'])){
- $this->events[$key]['ERROR'] .= msgPool::invalid(_("MAC")).", ";
- }
- if(empty($event['HEADER']) || !isset($this->daemon_events['QUEUED'][$event['HEADER']])){
- $this->events[$key]['ERROR'] .= msgPool::invalid(_("Event")).", ";
- }
- $this->events[$key]['ERROR'] = trim($this->events[$key]['ERROR'],", ");
- }
- }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/class_gotomasses.inc b/gosa-plugins/goto/addons/goto/class_gotomasses.inc
+++ /dev/null
@@ -1,922 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class gotomasses extends plugin
-{
- /* Definitions */
- var $plHeadline = "Deployment status";
- var $plDescription = "System deployment status";
- var $plIcon = "plugins/goto/images/goto.png";
-
- /* attribute list for save action */
- var $attributes= array();
- var $objectclasses= array();
-
- /* Queue tasks */
- var $current = FALSE;
- var $dialog = FALSE;
- var $ids_to_remove = array();
- var $divlist = NULL;
-
- var $events = array();
- var $event_tags = array();
-
- var $sort_by = "Schedule";
- var $sort_dir = "up";
- var $entries = array();
- var $range = 25;
- var $start = 0;
-
- var $recently_removed = array();
-
- function gotomasses(&$config, $dn= NULL)
- {
- /* Include config object */
- $this->config= &$config;
- $this->o_queue = new gosaSupportDaemon(TRUE,5);
- $this->events = DaemonEvent::get_event_types( SYSTEM_EVENT);
-
- /* Get tags that will be used in queue searches */
- $this->event_tags = array("none");
- foreach($this->events['SCHEDULED'] as $evt){
- $this->event_tags[] = $evt['s_Queued_Action'];
- }
-
- /* Load filter settings */
- if(!session::is_set("gotomasses_filter")){
- $gotomasses_filter =
- array(
- "range" => $this->range,
- "sort_by" => $this->sort_by,
- "sort_dir" => $this->sort_dir);
- session::set("gotomasses_filter",$gotomasses_filter);
- }
- $gotomasses_filter = session::get("gotomasses_filter");
- foreach(array("range","sort_by","sort_dir") as $attr) {
- $this->$attr = $gotomasses_filter[$attr];
- }
- }
-
-
- function execute()
- {
- $smarty = get_smarty();
-
- /************
- * Handle posts
- ************/
-
- $s_entry = $s_action = "";
- $arr = array(
-
- "/^pause_/" => "pause",
- "/^resume_/" => "resume",
- "/^execute_process_/" => "execute_process",
- "/^abort_process_/" => "abort_process",
-
- "/^prio_up_/" => "prio_up",
- "/^prio_down_/" => "prio_down",
-
- "/^edit_task_/" => "edit",
- "/^log_view_/" => "logview",
- "/^remove_task_/" => "remove",
- "/^new_task_/" => "new_task");;
-
- foreach($arr as $regex => $action){
- foreach($_POST as $name => $value){
- if(preg_match($regex,$name)){
- $s_action = $action;
- $s_entry = preg_replace($regex,"",$name);
- $s_entry = preg_replace("/_(x|y)$/","",$s_entry);
- }
- }
- }
-
- /* Menu actions */
- if(isset($_POST['menu_action']) && !empty($_POST['menu_action'])){
- $s_action = $_POST['menu_action'];
- }
-
- /* Edit posted from list link */
- if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id']) && isset($this->tasks[$_GET['id']])){
- $s_action = "edit";
- $s_entry = $_GET['id'];
- }
-
-
- /************
- * Import CSV file
- ************/
-
- if($s_action == "import_file" && $this->acl_is_writeable("")){
- $this->dialog = new goto_import_file($this->config,$this);
- }
-
- if(isset($_POST['import_abort'])){
- $this->dialog = FALSE;
- }
-
-
- /************
- * Handle Priority modifications
- ************/
-
- if(preg_match("/^prio_/",$s_action) && $this->acl_is_writeable("")){
- switch($s_action){
- case 'prio_down' : $this->update_priority($s_entry,"down");break;
- case 'prio_up' : $this->update_priority($s_entry,"up");break;
- }
- }
-
- /************
- * Handle pause/resume/execute modifications
- ************/
-
- if(preg_match("/^resume/",$s_action) ||
- preg_match("/^pause/",$s_action) ||
- preg_match("/^abort_process/",$s_action) ||
- preg_match("/^execute_process/",$s_action)){
-
- if($this->acl_is_writeable("")){
- switch($s_action){
- case 'resume' : $this->resume_queue_entries (array($s_entry));break;
- case 'pause' : $this->pause_queue_entries (array($s_entry));break;
- case 'execute_process': $this->execute_queue_entries (array($s_entry));break;
- case 'abort_process' : $this->abort_queue_entries (array($s_entry));break;
- case 'resume_all' : $this->resume_queue_entries ($this->list_get_selected_items());break;
- case 'pause_all' : $this->pause_queue_entries ($this->list_get_selected_items());break;
- case 'execute_process_all': $this->execute_queue_entries ($this->list_get_selected_items());break;
- case 'abort_process_all' : $this->abort_queue_entries ($this->list_get_selected_items());break;
-
- default : trigger_error("Undefined action setting used (".$s_action.").");
- }
- }
- if($this->o_queue->is_error()){
- msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
- }
- }
-
- /************
- * ADD
- ************/
-
- if(preg_match("/^add_event_/",$s_action) && $this->acl_is_writeable("")){
- $type = preg_replace("/^add_event_/","",$s_action);
- if(isset($this->events['BY_CLASS'][$type])){
- $e_data = $this->events['BY_CLASS'][$type];
- $this->dialog = new $e_data['CLASS_NAME']($this->config);
- }
- }
-
- /************
- * EDIT
- ************/
-
- if($s_action == "edit" && $this->acl_is_writeable("")){
- $id = $s_entry;
- $type = FALSE;
- if(isset($this->entries[$id])){
- $event = $this->entries[$s_entry];
- if($event['STATUS'] == "waiting" && isset($this->events['QUEUED'][$event['HEADERTAG']])){
- $evt_name = $this->events['QUEUED'][$event['HEADERTAG']];
- $type = $this->events['BY_CLASS'][$evt_name];
- $this->dialog = new $type['CLASS_NAME']($this->config,$event);
- }
- }
- }
-
-
- /************
- * LOG VIEW
- ************/
-
- if($s_action == "logview" && $this->acl_is_readable("")){
- $id = $s_entry;
- $type = FALSE;
- if(isset($this->entries[$id])){
- $event = $this->entries[$s_entry];
- $this->dialog = new gotoLogView($this->config,"",$event,$this);
- }
- }
-
-
- /************
- * REMOVE
- ************/
-
- /* Remove multiple */
- if($s_action == "remove_multiple" || $s_action == "remove"){
-
- if(!$this->acl_is_removeable()){
- msg_dialog::display(_("Permission"), msgPool::permDelete(), ERROR_DIALOG);
- }else{
-
- if($s_action == "remove"){
- $ids = array($s_entry);
- }else{
- $ids = $this->list_get_selected_items();
- }
-
- $this->ids_to_remove = array();
-
- if(count($ids)){
- $ret = $this->o_queue->ids_exist($ids);
- $ret = $this->o_queue->get_entries_by_id($ret);
- $tmp = "";
-
- $deleteable_jobs = array();
- $not_deleteable_jobs = array();
- foreach($ret as $task){
-
- /* Create a printable job name/description */
- if(isset($this->events['QUEUED'][$task['HEADERTAG']])){
- $evt_name = $this->events['QUEUED'][$task['HEADERTAG']];
- $evt = $this->events['BY_CLASS'][$evt_name];
- $j_name = $task['ID']." - ".$evt['s_Menu_Name']." ".$task['MACADDRESS'];
- }else{
- $j_name = $task['ID']." - ".$task['HEADERTAG']." ".$task['MACADDRESS'];
- }
-
- /* Only remove WAITING or ERROR entries */
- if(in_array($task['STATUS'],array("waiting","error","processed")) ||
- ($task['STATUS'] == "processing" && !preg_match("/install/",$task['HEADERTAG'])) ){
- $this->ids_to_remove[] = $task['ID'];
- $deleteable_jobs[] = $j_name;
- }else{
- $not_deleteable_jobs[] = $j_name;
- }
- }
- if(count($not_deleteable_jobs)){
- msg_dialog::display(_("Remove"),
- sprintf(_("The following jobs couldn't be deleted, they have to be aborted: %s"),
- "<br>".msgPool::buildList($not_deleteable_jobs)),INFO_DIALOG);
- }
-
- if(count($this->ids_to_remove)){
- $smarty->assign("multiple", TRUE);
- $smarty->assign("info",msgPool::deleteInfo($deleteable_jobs));
- $this->current = $s_entry;
- return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
- }
- }
- }
- }
-
- /* Remove specified tasks */
- if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
-
- /* Reboot hosts with not yet startet installations and timestamps in the past
- */
- if($this->acl_is_removeable("")){
- timezone::get_default_timezone();
- foreach($this->ids_to_remove as $id){
- $entry = $this->o_queue->get_entries_by_id(array($id));
- if(isset($entry['ANSWER1'])){
- $entry = $entry['ANSWER1'];
- if( $entry['STATUS'] == "waiting" &&
- $entry['HEADERTAG'] == "trigger_action_reinstall"){
- $evt = new DaemonEvent_reinstall($this->config,$entry);
- if($evt->get_timestamp(FALSE) < time()){
- $r_evt = new DaemonEvent_localboot($this->config);
- $r_evt->add_targets(array($entry['MACADDRESS']));
- $r_evt->set_type(TRIGGERED_EVENT);
- $this->o_queue->append($r_evt);
- }
- }
- }
- }
-
- $this->o_queue->remove_entries($this->ids_to_remove);
- $this->save();
- }
- }
-
- /* Remove aborted */
- if(isset($_POST['delete_cancel'])){
- $this->ids_to_remove = array();;
- }
-
-
- /************
- * EDIT
- ************/
-
- /* Close dialog */
- if(isset($_POST['save_event_dialog'])){
- if(is_object($this->dialog)){
- $this->dialog->save_object();
- if(!$this->o_queue->append($this->dialog)){
- msg_dialog::display(_("Service infrastructure"),msgPool::siError($this->o_queue->get_error()),ERROR_DIALOG);
- }else{
- $this->dialog = FALSE;
- $this->current = -1;
- }
- }
- }
-
-
- /* Close dialog */
- if(isset($_POST['abort_event_dialog'])){
- $this->dialog = FALSE;
- $this->current = -1;
- }
-
- /* Display dialogs if currently opened */
- if(is_object($this->dialog)){
- $this->dialog->save_object();
- $display = $this->dialog->execute();
-
- if($this->dialog instanceOf goto_import_file && $this->dialog->import_successful){
- $this->dialog = FALSE;
- }else{
- return($display);
- }
- }
-
- /************
- * Handle Divlist
- ************/
-
- $divlist = new MultiSelectWindow($this->config,"gotoMasses",array("gotomasses"));
- $divlist->SetInformation(_("This menu allows you to remove and change the properties of GOsa tasks."));
- $divlist->SetSummary(_("List of queued jobs"));
- $divlist->EnableCloseButton(FALSE);
- $divlist->EnableSaveButton(FALSE);
- $divlist->SetHeadpageMode();
- $s = ".|"._("Actions")."|\n";
- $s.= "..|<img src='images/lists/new.png' alt='' border='0' class='center'> "._("Create")."\n";
-
- if($this->acl_is_writeable("")){
- foreach($this->events['SCHEDULED'] as $name => $event){
- $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n";
- }
- }
- if($this->acl_is_removeable()){
- $s.= "..|---|\n";
- $s.= "..|<img src='images/lists/import.png' alt='' border='0' class='center'> "._("Import")."|import_file\n";
- $s.= "..|<img src='images/lists/trash.png' alt='' border='0' class='center'> "._("Remove")."|remove_multiple\n";
- }
- if(preg_match("/w/",$this->getacl(""))){
- $s.= "..|---|\n";
- $s.= "..|<img alt='"._("Resume")."' src='images/status_start.png' border='0' class='center'> "._("Resume")."|resume_all\n";
- $s.= "..|<img alt='"._("Pause")."' src='images/status_pause.png' border='0' class='center'> "._("Pause")."|pause_all\n";
- $s.= "..|<img alt='"._("Abort")."' src='images/small_error.png' border='0' class='center'> "._("Abort")."|abort_process_all\n";
- $s.= "..|<img alt='"._("Execute")."' src='images/rocket.png' border='0' class='center'> "._("Execute")."|execute_process_all\n";
- }
-
- $divlist->SetDropDownHeaderMenu($s);
-
- if($this->sort_dir == "up"){
- $sort_img = "<img src='images/lists/sort-up.png' alt='/\' border=0>";
- }else{
- $sort_img = "<img src='images/lists/sort-down.png' alt='\/' border=0>";
- }
-
- if($this->sort_by == "TargetName"){ $sort_img_1 = $sort_img; } else { $sort_img_1 = "" ;}
- if($this->sort_by == "TaskID"){ $sort_img_2 = $sort_img; } else { $sort_img_2 = "" ;}
- if($this->sort_by == "Schedule"){ $sort_img_3 = $sort_img; } else { $sort_img_3 = "" ;}
- if($this->sort_by == "Action"){ $sort_img_4 = $sort_img; } else { $sort_img_4 = "" ;}
-
- /* Create divlist */
- $divlist->SetListHeader("<input type='image' src='images/lists/reload.png' title='"._("Reload")."'>");
-
- $plug = $_GET['plug'];
- $chk = "<input type='checkbox' id='select_all' name='select_all'
- onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
- /* set Page header */
- $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
- $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TargetName'>"._("Target").$sort_img_1."</a>"));
- $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TaskID'>"._("Task").$sort_img_2."</a>",
- "attach"=>"style='width:120px;'"));
- $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Schedule'>"._("Schedule").$sort_img_3."</a>",
- "attach"=>"style='width:140px;'"));
- $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Action'>"._("Status").$sort_img_4."</a>",
- "attach"=>"style='width:80px;'"));
- $divlist->AddHeader(array("string"=>_("Action"),
- "attach"=>"style='border-right:0px;width:140px;'"));
-
-
- /* Reload the list of entries */
- $this->reload();
-
- foreach($this->entries as $key => $task){
-
- $prio_actions="";
- $action = "";
-
-
- /* If WAITING add priority action
- */
- if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){
- $prio_actions.= "<input class='center' type='image' src='plugins/goto/images/prio_increase.png'
- title='"._("Move up")."' name='prio_up_".$key."'> ";
- $prio_actions.= "<input class='center' type='image' src='plugins/goto/images/prio_decrease.png'
- title='"._("Move down")."' name='prio_down_".$key."'> ";
- }
-
- /* If WAITING add pause action
- */
- if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){
- $prio_actions.= "<input class='center' type='image' src='images/status_pause.png'
- title='"._("Pause job")."' name='pause_".$key."'> ";
- }
-
- /* If PAUSED add resume action
- */
- if(in_array($task['STATUS'],array("paused")) && $this->acl_is_writeable("")){
- $prio_actions.= "<input class='center' type='image' src='images/status_start.png'
- title='"._("Resume job")."' name='resume_".$key."'> ";
- }
-
- /* If PAUSED or WAITING add execution action
- */
- if(in_array($task['STATUS'],array("paused","waiting")) && $this->acl_is_writeable("")){
- $prio_actions.= "<input class='center' type='image' src='images/rocket.png'
- title='"._("Execute now")."' name='execute_process_".$key."'> ";
- }
-
- /* Add logview button, currently ever.
- */
- if($this->acl_is_readable("")){
- $action .= "<input type='image' src='plugins/goto/images/view_logs.png' name='log_view_".$key."'
- class='center' title='"._("View logs")."' alt='"._("View logs")."'> ";
- }
-
- /* If PAUSED or WAITING add edit action
- */
- if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){
- $action.= "<input type='image' src='images/lists/edit.png' name='edit_task_".$key."'
- class='center' title='"._("Edit")."' alt='"._("Edit")."'>";
- }
-
- /* If PROCESSING add abort action
- */
- if(in_array($task['STATUS'],array("processing")) && preg_match("/install/",$task['HEADERTAG']) && $this->acl_is_writeable("")){
- $action.= "<img src='images/empty.png' alt=''>";
- $action.= "<input class='center' type='image' src='images/small_error.png'
- title='"._("Abort job")."' name='abort_process_".$key."'>";
- }
-
- /* If WAITING or ERROR add remove action
- */
- if( $this->acl_is_removeable() && in_array($task['STATUS'],array("waiting","error","processed"))){
- $action.= "<input type='image' src='images/lists/trash.png' name='remove_task_".$key."'
- class='center' title='"._("Remove")."' alt='"._("Remove")."'>";
- }
- if($this->acl_is_writeable("") && in_array($task['STATUS'],array("processing")) && !preg_match("/install/",$task['HEADERTAG'])){
- $action.= "<input type='image' src='images/lists/trash.png' name='remove_task_".$key."'
- class='center' title='"._("Remove")."' alt='"._("Remove")."'>";
- }
-
- /* Create entry display name and tooltip */
- $color = "";
- $display = $task['MACADDRESS'];
- $tooltip = "";
- if(isset($task['PLAINNAME']) && !preg_match("/none/i",$task['PLAINNAME'])){
- $display = $task['PLAINNAME'];
- $tooltip = " title='".$task['MACADDRESS']."' ";
- }
- $display2= $task['HEADERTAG'];
-
- /* Check if this event exists as Daemon class
- * In this case, display a more accurate entry.
- */
- if(isset($this->events['QUEUED'][$task['HEADERTAG']])){
- $evt_name = $this->events['QUEUED'][$task['HEADERTAG']];
- $event_type = $this->events['BY_CLASS'][$evt_name];
- $display2 = $event_type['s_Menu_Name'];
-
- if(strlen($display2) > 20){
- $display2 = substr($display2,0,18)."...";
- }
-
- if(isset($event_type['ListImage']) && !empty($event_type['ListImage'])){
- $display2 = $event_type['ListImage']." ".$display2;
- }
- }
-
- $status = $task['STATUS'];
-
- if($status == "waiting"){
- $status = "<img class='center' src='plugins/goto/images/clock.png' alt=''> "._("Waiting");
- }
- if($status == "error"){
- $status = "<img class='center' src='images/false.png' alt=''> "._("Error");
- }
- if($status == "processed"){
- $status = "<img class='center' src='images/true.png' alt=''> "._("Processed");
- }
-
- /* Special handling for all entries that have
- STATUS == "processing" && PROGRESS == NUMERIC
- */
- if($status == "processing" && isset($task['PROGRESS'])){
- $percent = $task['PROGRESS'];
-
- /* Show activation? */
- if ($percent == "goto-activation"){
- $status = "<img class='center' src='images/lists/off.png' alt=''> "._("Locked");
-
- /* Show hardware detect? */
- } elseif ($percent == "goto-hardware-detection") {
- $status = "<img class='center' src='plugins/goto/images/hardware.png' alt=''> "._("Detection");
-
- /* Real percent */
- } else {
- if (preg_match('/install/', $task['HEADERTAG'])){
- $status = "<img src='progress.php?x=80&y=13&p=".$task['PROGRESS']."' alt=''
- id='progress_".preg_replace("/:/","_",$task['MACADDRESS'])."'>";
- } else {
- $status = preg_replace('/ /', ' ', _("in progress"));
- }
- }
- }
-
- /* Create each field */
- $field0 = array("string" => "<input type='checkbox' id='item_selected_".$task['ID']."' name='item_selected_".$key."'>" ,
- "attach" => "style='width:20px;".$color."'");
- $field1 = array("string" => $display,
- "attach" => $tooltip."style='".$color."'");
- $field1a= array("string" => $display2,
- "attach" => "style='".$color.";width:120px;'");
- if ($task['TIMESTAMP'] == "19700101000000"){
- $field2 = array("string" => _("immediately"),"attach" => "style='".$color.";width:140px;'");
- } else {
- $field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:140px;'");
- }
- $field3 = array("string" => $status,"attach" => "style='".$color.";width:80px;'");
- $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:140px;border-right:0px;'");
- $divlist->AddElement(array($field0,$field1,$field1a,$field2,$field3,$field4));
- }
-
- $smarty = get_smarty();
- $smarty->assign("events",$this->events);
- $smarty->assign("start",$this->start);
- $smarty->assign("start_real", ($this->start + 1));
- $smarty->assign("ranges", array("10" => "10",
- "20" => "20",
- "25" => "25",
- "50" => "50",
- "100"=> "100",
- "200"=> "200",
- "9999" => "*"));
-
- $count = $this->o_queue->number_of_queued_entries($this->event_tags);
- if(!$count) $count = $this->range;
- $divlist->SetListFooter(range_selector($count, $this->start, $this->range,"range"));
- $smarty->assign("range",$this->range);
- $smarty->assign("div",$divlist->Draw());
- return($smarty->fetch (get_template_path('gotomasses.tpl', TRUE, dirname(__FILE__))));
- }
-
-
- /*! \brief Move an entry up or down in the queue, by updating its execution timestamp
- @param $id Integer The ID of the entry which should be updated.
- @param $type String "up" / "down"
- @return boolean TRUE in case of success else FALSE
- */
- public function update_priority($id,$type = "up")
- {
- if($type == "up"){
- $tmp = $this->o_queue->get_queued_entries($this->event_tags,-1,-1,"timestamp DESC");
- }else{
- $tmp = $this->o_queue->get_queued_entries($this->event_tags,-1,-1,"timestamp ASC");
- }
- $last = array();
- foreach($tmp as $entry){
- if($entry['ID'] == $id){
- if(count($last)){
- $time = strtotime($last['TIMESTAMP']);
- if($type == "up"){
- $time ++;
- }else{
- $time --;
- }
- $time_str = date("YmdHis",$time);
- return($this->o_queue->update_entries(array($id),array("timestamp" => $time_str)));
- }else{
- return(FALSE);
- }
- }
- $last = $entry;
- }
- return(FALSE);
- }
-
-
- /*! \brief Resumes to status 'waiting'.
- * @return Boolean TRUE in case of success, else FALSE.
- */
- private function resume_queue_entries($ids)
- {
- if(!count($ids)){
- return;
- }
-
- /* Entries are resumed by setting the status to
- * 'waiting'
- */
- $data = array("status" => "waiting");
-
- /* Check if given ids are valid and check if the status
- * allows resuming.
- */
- $update_ids = array();
- foreach($this->o_queue->get_entries_by_id($ids) as $entry){
- if(isset($entry['STATUS']) && preg_match("/paused/",$entry['STATUS'])){
- $update_ids[] = $entry['ID'];
- }
- }
-
- /* Tell the daemon that we have entries to update.
- */
- if(count($update_ids)){
- if(!$this->o_queue->update_entries($update_ids,$data)){
- msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
- return(FALSE);
- }
- }
- return(TRUE);
- }
-
-
- /*! \brief Force queue job to be done as far as possible.
- * @return Boolean TRUE in case of success, else FALSE.
- */
- private function execute_queue_entries($ids)
- {
- if(!count($ids)){
- return;
- }
-
- /* Execution is forced by updating the status to
- * waiting and setting the timestamp to current time.
- */
- $data = array( "timestamp" => date("YmdHis",time()),
- "status" => "waiting");
-
- /* Only allow execution of paused or waiting entries
- */
- $update_ids = array();
- foreach($this->o_queue->get_entries_by_id($ids) as $entry){
- if(in_array($entry['STATUS'],array("paused","waiting"))){
- $update_ids[] = $entry['ID'];
- }
- }
-
- /* Tell the daemon that we want to update some entries
- */
- if(count($update_ids)){
- if(!$this->o_queue->update_entries($update_ids,$data)){
- msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entries.")) , ERROR_DIALOG);
- return(FALSE);
- }
- }
- return(TRUE);
- }
-
-
- /*! \brief Force queue job to be done as far as possible.
- * @return Boolean TRUE in case of success, else FALSE.
- */
- private function abort_queue_entries($ids)
- {
- if(!count($ids)){
- return;
- }
-
- /* Entries are paused by setting the status to
- * something different from 'waiting'.
- * We simply use 'paused'.
- */
- $data = array("status" => "paused");
-
- /* Detect if the ids we got are valid and
- * check if the status allows pausing.
- */
- $update_ids = array();
- foreach($this->o_queue->get_entries_by_id($ids) as $entry){
- if(isset($entry['STATUS']) && preg_match("/processing/",$entry['STATUS'])){
- if(isset($entry['MACADDRESS'])){
- $update_ids[] = $entry['MACADDRESS'];
- }else{
- trigger_error("No mac address found in event.");
- }
- }
- }
-
- if(class_available("DaemonEvent_faireboot")){
- $tmp = new DaemonEvent_faireboot($this->config);
- $tmp->add_targets($update_ids);
- $tmp->set_type(TRIGGERED_EVENT);
- $this->recently_removed = $update_ids;
-
- if(!$this->o_queue->append($tmp)){
- msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
- return(FALSE);
- }
- }else{
- msg_dialog::display(_("Error"),
- sprintf(_("The job could not be aborted, the required class '%s' was not found."),
- "DaemonEvent_faireboot") , ERROR_DIALOG);
- }
- }
-
-
- /*! \brief Pauses the specified queue entry from execution.
- * @return Boolean TRUE in case of success, else FALSE.
- */
- private function pause_queue_entries($ids)
- {
- if(!count($ids)){
- return;
- }
-
- /* Entries are paused by setting the status to
- * something different from 'waiting'.
- * We simply use 'paused'.
- */
- $data = array("status" => "paused");
-
- /* Detect if the ids we got are valid and
- * check if the status allows pausing.
- */
- $update_ids = array();
- foreach($this->o_queue->get_entries_by_id($ids) as $entry){
- if(isset($entry['STATUS']) && preg_match("/waiting/",$entry['STATUS'])){
- $update_ids[] = $entry['ID'];
- }
- }
-
- /* Tell the daemon that we want to update some entries
- */
- if(count($update_ids)){
- if(!$this->o_queue->update_entries($update_ids,$data)){
- msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
- return(FALSE);
- }
- }
- return(TRUE);
- }
-
-
- /*! \brief Request list of queued jobs.
- * @return Returns an array of all queued jobs.
- */
- function reload()
- {
-
- /* Sort map html-post-name => daemon-col-name
- */
- $map = array(
- "QueuePosition" => "id",
- "Action" => "status",
- "TaskID" => "headertag",
- "TargetName" => "macaddress",
- "Schedule" => "timestamp");
-
- /* Create sort header
- */
- if(!isset($map[$this->sort_by])){
- $sort = "id DESC";
- }else{
- $sort = $map[$this->sort_by];
- if($this->sort_dir == "up"){
- $sort.= " ASC";
- }else{
- $sort.= " DESC";
- }
- }
-
- /* Get entries. */
- $start = $this->start;
- $stop = $this->range;
- $entries = $this->o_queue->get_queued_entries($this->event_tags,$start,$stop,$sort);
- if ($this->o_queue->is_error()){
- msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "<br><br>".$this->o_queue->get_error()), ERROR_DIALOG);
- }
-
- /* Assign entries by id.
- */
- $this->entries = array();
-
- foreach($entries as $entry){
-
- /* Skip entries which will be removed within the next seconds */
- if(isset($entry['MACADDRESS']) && in_array($entry['MACADDRESS'],$this->recently_removed)){
- continue;
- }
- $this->entries[$entry['ID']]= $entry;
- }
- $this->recently_removed = array();
- }
-
-
- /*! \brief Handle post jobs, like sorting.
- */
- function save_object()
- {
- /* Check for sorting changes
- */
- $sort_vals = array("Action","QueuePosition","TargetName","Schedule","TaskID");
- if(isset($_GET['sort']) && in_array($_GET['sort'],$sort_vals)){
- $sort = $_GET['sort'];
- if($this->sort_by == $sort){
- if($this->sort_dir == "up"){
- $this->sort_dir = "down";
- }else{
- $this->sort_dir = "up";
- }
- }
- $this->sort_by = $sort;
- }
-
- /* Range selection used? */
- if(isset($_POST['range']) && is_numeric($_POST['range'])){
- $this->range = $_POST['range'];
- }
-
- /* Save filter settings */
- $gotomasses_filter = session::get("gotomasses_filter");
- foreach(array("range","sort_by","sort_dir") as $attr){
- $gotomasses_filter[$attr] = $this->$attr;
- }
- session::set("gotomasses_filter",$gotomasses_filter);
-
- /* Page changed. */
- if(isset($_GET['start'])){
- $start = $_GET['start'];
- if(is_numeric($start) || $start == 0){
- $this->start = $start;
- }
- }
-
- /* Check start stop and reset if necessary */
- $count = $this->o_queue->number_of_queued_entries($this->event_tags);
- if($this->start >= $count){
- $this->start = $count -1;
- }
- if($this->start < 0){
- $this->start = 0;
- }
- }
-
-
- function save()
- {
- // We do not save anything here.
- }
-
-
- /*! \brief Return a list of all selected items.
- @return Array Returns an array containing all selected item ids.
- */
- function list_get_selected_items()
- {
- $ids = array();
- foreach($_POST as $name => $value){
- if(preg_match("/^item_selected_[0-9]*$/",$name)){
- $id = preg_replace("/^item_selected_/","",$name);
- $ids[$id] = $id;
- }
- }
- return($ids);
- }
-
-
- static function plInfo()
- {
- return (array(
- "plShortName" => _("System mass deployment"),
- "plDescription" => _("Provide a mechanism to automatically activate a set of systems"),
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 0,
- "plSection" => array("addon"),
- "plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))),
- "plProvidedAcls" => array("Comment" => _("Description"))
- ));
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/class_target_list.inc b/gosa-plugins/goto/addons/goto/class_target_list.inc
+++ /dev/null
@@ -1,334 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class target_list extends MultiSelectWindow
-{
- var $config;
- var $list =array();
- var $Targets_used =array();
-
- /* Current base */
- var $selectedBase = "";
- var $departments = array();
-
- /* Regex */
- var $Regex = "*";
- var $IP_start = "0.0.0.0";
- var $IP_end = "255.255.255.255";
-
- /* CheckBoxes, to change default values modify $this->AddCheckBox */
- var $ogroups ;
- var $servers ;
- var $workstations ;
- var $incoming ;
-
-
- /* Subsearch checkbox */
- var $SubSearch ;
- var $IPMatch ;
- var $parent ;
- var $ui ;
-
-
- function target_list(&$config,$Targets_used)
- {
- MultiSelectWindow::MultiSelectWindow($config, "Targetselection", array("ogroup","server","incoming","workstation","gotomasses"));
-
- $this->Targets_used = $Targets_used;
-
- $this->SetInformation( _("Select the target objects for your scheduled action."));
- $this->SetTitle( _("Available targets"));
- $this->SetSummary( _("Available targets"));
- $this->SetHeadpageMode(FALSE);
-
- /* set Page header */
- $chk = "<input type='checkbox' id='select_all' name='select_all'
- onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
- $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
-
- $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
- $this->AddHeader(array("string" => _("Object name"), "attach" => "style=''"));
-
- /* Text ,Value, Name, Is selected */
- $this->AddCheckBox("ogroups", _("Select to see object groups"), _("Show object groups"), true);
- $this->AddCheckBox("servers", _("Select to see servers") , _("Show servers"), true);
- $this->AddCheckBox("workstations", _("Select to see workstations"),_("Show workstations"), true);
- $this->AddCheckBox("incoming", _("Select to see incoming objects") , _("Show new objects"), true);
-
- /* Add SubSearch checkbox */
- $this->AddCheckBox(SEPERATOR);
- $this->AddCheckBox("SubSearch", msgPool::selectToView("","subsearch"), msgPool::selectToView("","subsearch_small"), false);
- $this->AddCheckBox("IPMatch", _("Select to search for a specific IP range only"), _("Match IP range"), false);
-
- /* Name,Text,Default , Connect with alphabet */
- $this->AddRegex ("Regex", _("Regular expression for matching group names"), "*" , true);
- $this->AddRegex ("IP_start", _("IP range start"), "0.0.0.0" , true);
- $this->AddRegex ("IP_end", _("IP range end"), "255.255.255.255" , true);
- $this->EnableAplhabet(TRUE);
- }
-
-
- function GenHeader()
- {
- $options= "";
-
- /* Get all departments within this subtree */
- $ui= get_userinfo();
- $first = "";
- $found = FALSE;
- $base = $this->config->current['BASE'];
-
- /* Add base */
- $tmp = array();
- $tmp[] = array("dn"=>$this->config->current['BASE']);
- $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
- array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
- $deps = array();
- foreach($tmp as $tm){
- $deps[$tm['dn']] = $tm['dn'];
- }
-
- /* Load possible departments */
- $ui= get_userinfo();
- $tdeps= $ui->get_module_departments("ogroups");
- $ids = $this->config->idepartments;
- $first = "";
- $found = FALSE;
- foreach($ids as $dep => $name){
- if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){
-
- /* Keep first base dn in mind, we could need this
- * info if no valid base was found
- */
- if(empty($first)) {
- $first = $dep['dn'];
- }
-
- $value = $ids[$dep];
- if ($this->selectedBase == $dep){
- $found = TRUE;
- $options.= "<option selected='selected' value='".$dep."'>$value</option>";
- } else {
- $options.= "<option value='".$dep."'>$value</option>";
- }
- }
- }
-
- /* The currently used base is not visible with your acl setup.
- * Set base to first useable base.
- */
- if(!$found){
- $this->selectedBase = $first;
- }
-
- /* Get copy & paste icon */
- $acls = $ui->get_permissions($this->selectedBase,"ogroups/ogroup");
- $acl_all= $ui->has_complete_category_acls($this->selectedBase,"ogroups");
-
- /* Add default header */
- $listhead = MultiSelectWindow::get_default_header();
-
- /* Add department selector */
- $listhead .= _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
- " <input class='center' type='image' src='images/lists/submit.png' align='middle'
- title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ";
- $listhead .="</div>";
-
- $this->SetListHeader($listhead);
- }
-
-
- function execute()
- {
- $this->ClearElementsList();
- $this->GenHeader();
- $this->reload();
- $this->SetEntries($this->list);
- return($this->Draw());
- }
-
-
- function SetEntries($list)
- {
- /* Add Copy & Paste buttons if copy&paste is enabled
- */
- // Defining Links
- $editlink = "<a href='?plug=".$_GET['plug']."&id=%s&act=edit_entry'>%s</a>";
-
- $ui = get_userinfo();
-
- // Assigning ogroups
- foreach($list as $key => $val){
-
- if(in_array($val['cn'][0],$this->Targets_used) ||
- isset($val['macAddress'][0]) && in_array($val['macAddress'][0],$this->Targets_used)) continue;
-
- $title = "title='".preg_replace('/ /', ' ', LDAP::fix($val['dn']))."'";
- if(!isset($val['description'][0])){
- $desc = "";
- }else{
- $desc = " - [ ".$val['description'][0]." ]";
- }
- if(!isset($val['ipHostNumber'][0])){
- $desc.= "";
- }else{
- $desc.= " - ".$val['ipHostNumber'][0]."";
- }
-
-
- $img ="Hmm";
- if(in_array("goServer",$val['objectClass'])){
- $img = "<img src='plugins/systems/images/select_server.png' alt='"._("Server")."' ".$title.">";
- }elseif(in_array("gotoWorkstation",$val['objectClass'])){
- $img = "<img src='plugins/systems/images/select_workstation.png' alt='"._("Workstation")."' ".$title.">";
- }elseif(in_array("gosaGroupOfNames",$val['objectClass'])){
- $img = "<img src='plugins/ogroups/images/list_ogroup.png' alt='"._("Object group")."' ".$title.">";
- }
-
- /* Create each field */
- $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
- "attach" => "style='width:20px;'");
- $field1 = array("string" => $img,
- "attach" => "style='text- align:center;width: 20px;'");
- $field2 = array("string" => $val['cn'][0].$desc,
- "attach" => "style='border-right:0px;' ".$title);
-
- $this->AddElement(array($field0,$field1,$field2));
- }
- }
-
-
- function save()
- {
- $ret = array();
- $items = $this->list_get_selected_items();
- foreach($items as $item){
- $ret[] = $this->list[$item];
- }
- return($ret);
- }
-
-
- function save_object()
- {
- MultiSelectWindow::save_object();
- }
-
-
- function reload()
- {
- /* Set base for all searches && initialise some vars */
- $this->list= array();
- $base = $this->selectedBase;
- $filter = "";
- $Regex = $this->Regex;
- $IP_start = $this->IP_start;
- $IP_end = $this->IP_end;
-
- if($this->IPMatch){
- if(!tests::is_ip($IP_start)){
- msg_dialog::display(_("Error"), msgPool::invalid(_("IP range")), ERROR_DIALOG);
- return;
- }
- if(!tests::is_ip($IP_end)){
- msg_dialog::display(_("Error"), msgPool::invalid(_("IP range")), ERROR_DIALOG);
- return;
- }
- }
-
-
- $chk = array(
- "ogroups" => "(&(objectClass=gosaGroupOfNames)(|(gosaGroupObjects=*S*)(gosaGroupObjects=*W*)))" ,
- "servers" => "(objectClass=goServer)" ,
- "incoming" => "(objectClass=GOhard)" ,
- "workstations" => "(objectClass=gotoWorkstation)");
-
- /* Create filter */
- foreach($chk as $chkBox => $FilterPart){
- if($this->$chkBox){
- $filter .= $FilterPart;
- }
- }
- $filter= "(&(cn=".$Regex.")(|".$filter."))";
-
- if($this->SubSearch){
- $res= get_list($filter, array("ogroups","workstations","servers"), $base,
- array("cn","objectClass","gosaGroupObjects","ipHostNumber","description"), GL_SIZELIMIT | GL_SUBSEARCH);
- }else{
- $res= get_list($filter, "ogroups", get_groups_ou().$base,
- array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT );
- $res= array_merge($res,get_list($filter, "workstation", get_ou('workstationRDN').$base,
- array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT ));
- $res= array_merge($res,get_list($filter, "server", get_ou('serverRDN').$base,
- array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT ));
-
- $deps_a = array(
- get_ou("workstationRDN"),
- get_ou("incominou"),
- get_ou("serverRDN"),
- get_ou("ogroupRDN"));
-
- $res = get_sub_list($filter,array("server","incoming","workstation","ogroup"),
- $deps_a,get_ou("systemRDN").$base,array("cn","objectClass","ipHostNumber","description"),GL_SIZELIMIT);
- }
-
- $this->list= $res;
- ksort ($this->list);
- reset ($this->list);
- $tmp=array();
- foreach($this->list as $tkey => $val ){
-
- if($this->IPMatch){
- if(isset($val['ipHostNumber'][0])){
- if(tests::is_ip_range($IP_start,$val['ipHostNumber'][0]) && tests::is_ip_range($val['ipHostNumber'][0],$IP_end)){
- $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
- }
- }
- }else{
- $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
- }
- }
- ksort($tmp);
- $this->list=array();
- foreach($tmp as $val){
- $this->list[]=$val;
- }
- reset ($this->list);
- }
-
- function list_get_selected_items()
- {
- $ids = array();
- foreach($_POST as $name => $value){
- if(preg_match("/^item_selected_[0-9]*$/",$name)){
- $id = preg_replace("/^item_selected_/","",$name);
- $ids[$id] = $id;
- }
- }
- return($ids);
- }
-}
-
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_activate.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_activate.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_faireboot.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_faireboot.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_goto_reload.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_goto_reload.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_halt.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_halt.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_installation_activation.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_installation_activation.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_localboot.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_localboot.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_lock.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_lock.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_memcheck.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_memcheck.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_notify.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_notify.tpl
+++ /dev/null
@@ -1,93 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <b>{t}Message settings{/t}</b>
- <table style="width:100%;">
- <tr>
- <td>{t}Sender{/t}</td>
- <td><input type='text' name="from" value="{$from}" style="width:100%;"></td>
- </tr>
- <tr>
- <td>{t}Subject{/t}</td>
- <td><input type='text' name="subject" value="{$subject}" style="width:100%;"></td>
- </tr>
- <tr>
- <td colspan="2">{t}Message{/t} :</td>
- </tr>
- <tr>
- <td colspan="2" style="width:100%;">
- <textarea style="width:100%;height:250px;" name="message" style="100%;">{$message}</textarea>
- </td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <b>{t}Time schedule{/t}</b>
- <table>
- <tr>
- <td colspan="2" style='vertical-align:top'>{$timestamp}<br><br></td>
- </tr>
- </table>
- <table style='width:100%;'>
- <tr>
- <td style="width:50%;">
- <b>{t}Target users{/t}</b>
- <br>
- <select style="height:180px;width:100%" name="user[]" multiple size=4>
- {html_options options=$user}
- </select>
- </td>
- <td>
- <b>{t}Target groups{/t}</b>
- <br>
- <select style="height:180px;width:100%" name="group[]" multiple size=4>
- {html_options options=$group}
- </select>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <input type="submit" name="open_target_list" value="{$add_str}">
- <input type="submit" name="del_any_target" value="{$del_str}">
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_reboot.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reboot.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_reinstall.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reinstall.tpl
+++ /dev/null
@@ -1,67 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Progress{/t}</td>
- <td>{$progress}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$status}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_reload_ldap_config.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reload_ldap_config.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_rescan.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_rescan.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_sysinfo.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_sysinfo.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_update.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_update.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_wakeup.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_wakeup.tpl
+++ /dev/null
@@ -1,63 +0,0 @@
-
-{if $is_new}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top; border-right:1px solid #AAA'>
- <table>
- <tr>
- <td style='vertical-align:top'><b>{t}Time schedule{/t}</b><br><br>
- {$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table style='width:100%;'>
- <tr>
- <td>
- <b>{t}System list{/t}</b>
- <br>
- {$target_list}
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
-
-{else}
-
-<table style='width:100%;'>
- <tr>
- <td style='width:50%; vertical-align:top;'>
- <table>
- <tr>
- <td>{t}ID{/t}</td>
- <td>{$data.ID}</td>
- </tr>
- <tr>
- <td>{t}Status{/t}</td>
- <td>{$data.STATUS}</td>
- </tr>
- <tr>
- <td>{t}Result{/t}</td>
- <td>{$data.RESULT}</td>
- </tr>
- <tr>
- <td>{t}Target{/t}</td>
- <td>{$data.MACADDRESS}</td>
- </tr>
- <tr>
- <td style='vertical-align:top'>{t}Timestamp{/t}</td>
- <td>{$timestamp}</td>
- </tr>
- </table>
- </td>
- <td style='width:50%; vertical-align:top;'>
- <table >
- </table>
- </td>
- </tr>
-</table>
-
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc
+++ /dev/null
@@ -1,511 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-define("SCHEDULED_EVENT",1);
-define("TRIGGERED_EVENT",2);
-
-define("HIDDEN_EVENT",1);
-define("SYSTEM_EVENT",2);
-define("USER_EVENT" ,4);
-
-
-/*! \brief This is the event base class
- \author Fabian Hickert <hickert@gonicus.de>
- \version 1.00
- \date 26.02.2008
-
- This is the base class for all new daemon events.
- It implements most of the required functionality.
- */
-class DaemonEvent
-{
- /* Menu Strings */
- protected $s_Menu_Name = "s_Menu_Name not set"; // Diplayed in the ActionsMenu->CreateNew
- protected $s_Event_Name = "s_Event_Name not set"; // Will be displayed in the Management list.
- protected $s_Menu_Image = "images/empty.png"; // Image displayed in Actions->New
- protected $s_List_Image = ""; // Image displayed in event listing
-
- public $config; // GOsa configuration object
- protected $data; // The event data, when edited
-
- protected $a_targets = array(); // The list of assigned Targets (When newly created)
- protected $s_Schedule_Action = ""; // The deamon command name when newly created. (e.g. job_trigger_action_halt)
- protected $s_Trigger_Action= ""; // The deamon command name when edited. (e.g. trigger_action_halt)
- protected $s_Queued_Action= ""; // The deamon command name when edited. (e.g. trigger_action_halt)
- protected $timestamp = 0; // Event execution time;
- protected $id = -1; // The Table ID
- protected $status = "unknown";// The current event status
- protected $is_new = TRUE; // Is TRUE if this is a new event
-
- protected $mode = SCHEDULED_EVENT; // Default action is sheduled.
-
- /* Sub dialog hanlding */
- protected $target_divlist = NULL; // The divlist used by the target add dialog
- protected $target_add_list_used = FALSE; // Indicates that the target add list was used.
- protected $time_select_used = FALSE; // Indicates that we have used the timestamp select boxes.
- protected $target_list_used = FALSE; // Target list was diaplayed?
- protected $_target_list = array(); // Object Cache of those objects displayed in the target add dialog
- protected $workstation_list = array(); // Used as cache in the target list.
- protected $server_list = array(); // Used as cache in the target list.
-
- protected $visible_for = HIDDEN_EVENT;
-
- protected $attributes = array("timestamp");
-
- function set_type($type)
- {
- $this->mode = $type;
- }
-
-
- function get_type()
- {
- return($this->mode);
- }
-
- /*! \brief Class contructor.
- @param Array GOsa configuration object.
- @param Array Event data, only given when edited.
- */
- public function __construct($config,$data = array())
- {
- $this->data = $data;
- $this->config = $config;
- timezone::get_default_timezone();
- $this->timestamp = time();
-
- /* Load values from given data */
- if(count($data)){
- $this->is_new = FALSE;
-
- $attrs = array("id" => "ID");
- foreach($attrs as $to => $from){
- $this->$to = $data[$from];
- }
- if(isset($data['TIMESTAMP'])){
- $this->timestamp = $this->_event_to_timestamp($data['TIMESTAMP']);
- }
- }
- }
-
-
- /*! \brief Create the HTML output for the plugin.
- @return String The generated HTML output.
- */
- public function execute()
- {
- $this->time_select_used = FALSE;
- $this->target_list_used = FALSE;
-
- $str = "<h2>"._("This job has no template.")."</h2>";
- $str.= "<p class='seperator'></p>";
- $str.= "<div style='text-align:right;width:100%;padding:3px;'>
- <input type='submit' name='abort_event_dialog' value='".msgPool::cancelButton()."'>
- </div>";
- return($str);
- }
-
- /*! \brief Returns the plugin header, displayed in the template.
- @return String HTML header part.
- */
- public function get_header()
- {
- if($this->target_add_list_used){
- return("");
- }
- $str = "<h2>".sprintf(_("Create '%s' job"),$this->s_Event_Name)."</h2>";
- return($str);
- }
-
-
- /*! \brief Returns the plugin footer (save cancel), displayed in the template.
- @return String HTML footer part.
- */
- public function get_footer()
- {
- if($this->target_add_list_used){
- return("");
- }
- $str = "<p class='seperator'></p>";
- $str.= "<div style='text-align:right;width:99%;padding:5px;'>
- <input type='submit' name='save_event_dialog' value='".msgPool::saveButton()."'>
- <input type='submit' name='abort_event_dialog' value='".msgPool::cancelButton()."'>
- </div>";
- return($str);
- }
-
-
- /*! \brief Returns HTML representation of a timestamp using <select> boxes.
- @return Returns HTML content.
- */
- public function get_time_select()
- {
- $this->time_select_used = TRUE;
-
- $smarty = get_smarty();
-
- $year = date("Y",$this->timestamp);
- $month = date("m",$this->timestamp);
- $day = date("d",$this->timestamp);
-
- $hour = date("H",$this->timestamp);
- $minute = date("i",$this->timestamp);
- $second = date("s",$this->timestamp);
-
- $years = array();
- for($i = date("Y",time()); $i <= 2037 ;$i ++){
- $years[$i] = $i;
- }
- $months = array();
- for($i = 1; $i <= 12; $i ++){
- $e = str_pad($i,2,"0",STR_PAD_LEFT);
- $months[$e] = $e;
- }
- $days = array();
- for($i = 1; $i <= cal_days_in_month(CAL_GREGORIAN,$month,$year); $i ++){
- $e = str_pad($i,2,"0",STR_PAD_LEFT);
- $days[$e] = $e;
- }
- $hours = array();
- for($i = 0; $i < 24; $i ++){
- $e = str_pad($i,2,"0",STR_PAD_LEFT);
- $hours[$e] = $e;
- }
- $minutes = array();
- for($i = 0; $i < 60; $i ++){
- $e = str_pad($i,2,"0",STR_PAD_LEFT);
- $minutes[$e] = $e;
- }
- $seconds = array();
- for($i = 0; $i < 60; $i ++){
- $e = str_pad($i,2,"0",STR_PAD_LEFT);
- $seconds[$e] = $e;
- }
-
- $smarty->assign("years", $years);
- $smarty->assign("months", $months);
- $smarty->assign("days", $days);
- $smarty->assign("hours", $hours);
- $smarty->assign("minutes", $minutes);
- $smarty->assign("seconds", $seconds);
- $smarty->assign("time_year",$year);
- $smarty->assign("time_month",$month);
- $smarty->assign("time_day",$day);
- $smarty->assign("time_hour",$hour);
- $smarty->assign("time_minute",$minute);
- $smarty->assign("time_second",$second);
- return($smarty->fetch(get_template_path('timestamp_select.tpl', TRUE, dirname(__FILE__))));
- }
-
-
- /*! \brief HTML representation of all currently assigned targets using (divSelectBox).
- @return String Returns a listbox with all used targets.
- */
- public function get_target_list()
- {
- $this->target_list_used = TRUE;
- $divlist = new divSelectBox("EventTargets");
- foreach($this->a_targets as $key => $target){
- $divlist->AddEntry(array(
- array("string" => $target),
- array("string" => "<input type='image' src='images/lists/trash.png' title='"._("Remove")."' name='del_target_".$key."'>",
- "attach" => "style='width:20px; border-right:0px;'")
- ));
- }
- $list_footer = "<input type='submit' name='open_target_list' value='"._("Add")."'>";
- return($divlist->DrawList().$list_footer);
- }
-
-
- /*! \brief Returns HTML content, displaying a dialog which allows to add new targets.
- @return String HTML content. (EventTargetAddList)
- */
- public function get_target_add_list()
- {
- $this->target_add_list_used = TRUE;
-
- if($this->target_divlist == NULL){
- $this->target_divlist = new EventTargetAddList($this->config,$this);
- }
- $this->target_divlist->execute();
-
- $smarty = get_smarty();
- $smarty->assign("divlist",$this->target_divlist->Draw());
- return($smarty->fetch(get_template_path('target_list.tpl', TRUE, dirname(__FILE__))));
- }
-
-
- /*! \brief Handles all posted HTML data, including target add,remove...
- */
- public function save_object()
- {
- if(isset($_POST['open_target_list'])){
- $this->target_add_list_used =TRUE;
- }
- if($this->target_divlist != NULL){
- $this->target_divlist->save_object();
- }
- if($this->target_add_list_used){
- if(isset($_POST['abort_target_dialog'])){
- $this->target_add_list_used =FALSE;
- $this->target_divlist = NULL;
- }
- if(isset($_POST['save_target_dialog'])){
- $this->target_add_list_used =FALSE;
- $this->add_targets($this->target_divlist->get_selected_targets());
- $this->target_divlist = NULL;
- }
- }
-
- if($this->time_select_used){
- $time_stamp_values_found = TRUE;
- foreach(array("time_year","time_month","time_day","time_hour","time_minute","time_second") as $attr){
- $time_stamp_values_found &= isset($_POST[$attr]);
- }
- if($time_stamp_values_found){
- $this->timestamp = mktime(
- $_POST['time_hour'],
- $_POST['time_minute'],
- $_POST['time_second'],
- $_POST['time_month'],
- $_POST['time_day'],
- $_POST['time_year']);
- }
- }
-
- if($this->target_list_used){
- foreach($_POST as $name => $value){
- if(preg_match("/^del_target_/",$name)){
- $id = preg_replace("/^del_target_([0-9]*)_.*/","\\1",$name);
- if(isset($this->a_targets[$id])){
- unset($this->a_targets[$id]);
- }
- break;
- }
- }
- }
- }
-
-
- /*! \brief Converts a daemon timestamp into an unix timestamp. \
- e.g. 20080101125959 -> 1199188799
- @param A daemon timestamp YYYYddmmHHiiss
- @return Integer A unix timestamp.
- */
- public function _event_to_timestamp($str)
- {
- return(strtotime($str));
- }
-
-
- /*! \brief Converts a unix timestamp in to a gosa-si timestamp. \
- e.g. 1199188799 -> 20080101125959
- @param A unix timestamp (e.g. 1199188799)
- @return Integer A daemon timestamp (e.g. 20080101125959).
- */
- public function _timestamp_to_event($stamp)
- {
- return(date("YmdHis",$stamp));
- }
-
-
- /*! \brief Returns event information, like menu strings, images ...
- @return Array Event informations.
- */
- public function get_event_info()
- {
- $data =array();
- $data['CLASS_NAME'] = get_class($this);
- $data['s_Menu_Name'] = $this->s_Menu_Name;
- $data['s_Event_Name'] = $this->s_Event_Name;
- foreach(array("s_Queued_Action","s_Schedule_Action","s_Trigger_Action") as $attr){
- if(!empty($this->$attr)){
- $data[$attr] = $this->$attr;
- }
- }
- $data['MenuImage'] = "<img src='".$this->s_Menu_Image."' alt='".$this->s_Menu_Name."' border='0' class='center'>";
- $data['ListImage'] = "<img src='".$this->s_List_Image."' title='".$this->s_Event_Name."'
- alt='".$this->s_Event_Name."' border='0' class='center'>";
- return($data);
- }
-
-
- /*! \brief Check if we have opened the target add dialog.
- @return Boolean TRUE if we have opened the target add dialog else FALSE.
- */
- protected function is_target_list_open()
- {
- return($this->target_add_list_used);
- }
-
-
- /*! \brief Returns a complete list of all available events.
- @return Array Containing $this->get_event_info() for all available events.
- */
- static function get_event_types($type)
- {
- global $class_mapping,$config;
- $list = array();
- $list['BY_CLASS'] = array();
- $list['TRIGGERED'] = array();
- $list['SCHEDULED'] = array();
- $list['QUEUED'] = array();
-
- foreach($class_mapping as $name => $path){
- if(preg_match("/^DaemonEvent_/",$name)){
- $tmp = new $name($config);
- if($tmp->visible_for & $type){
- $evt = $tmp->get_event_info();
- $list['BY_CLASS'][$name] = $evt;
- if(isset($evt['s_Trigger_Action'])){
- $list['TRIGGERED'][$name] = $evt;
- $list['QUEUED'][$evt['s_Trigger_Action']] = $name;
- }
- if(isset($evt['s_Schedule_Action'])){
- $list['SCHEDULED'][$name] = $evt;
- $list['QUEUED'][$evt['s_Schedule_Action']] = $name;
- }
- if(isset($evt['s_Queued_Action'])){
- $list['QUEUED'][$evt['s_Queued_Action']] = $name;
- }
- }
- }
- }
- return($list);
- }
-
-
- /*! \brief Returns TRUE if this event is new. (Not edited)
- @return Boolean TRUE if new, else FALSE.
- */
- public function is_new()
- {
- return($this->is_new);
- }
-
-
- /*! \brief Returns the event tag to schedule a new action
- @param Returns the event e.g. 'job_trigger_action_wake'
- */
- public function get_schedule_action()
- {
- return($this->s_Schedule_Action);
- }
-
-
- /*! \brief Returns the event tag to schedule a new action
- @param Returns the event e.g. 'trigger_action_wake'
- */
- public function get_trigger_action()
- {
- return($this->s_Trigger_Action);
- }
-
-
- /*! brief Returns an array containig all attributes \
- That should be written.
- @return Array e.g. 'status' => 'bla blub'
- */
- public function save()
- {
- $ret = array();
- foreach($this->attributes as $attr){
- $ret[$attr] = $this->$attr;
- }
- $ret['timestamp'] = $this->_timestamp_to_event($this->timestamp);
- return($ret);
- }
-
-
- /*! \brief Returns the event targets
- @return Array All selected targets.
- */
- public function get_targets()
- {
- return($this->a_targets);
- }
-
-
- /*! \brief Returns the event timestamp in GOsa daemon format.
- @return Returns the event timestamp (20081231120000)
- */
- public function get_timestamp($si_type = TRUE)
- {
- if($si_type){
- return($this->_timestamp_to_event($this->timestamp));
- }else{
- return($this->timestamp);
- }
- }
-
-
- /*! \brief Returns the event ID
- @return Returns the event ID
- */
- public function get_id()
- {
- if($this->is_new){
- return(-1);
- }else{
- return($this->data['ID']);
- }
- }
-
-
- /*! \brief Add a target MAC address
- @param Array A List of all target that should be added.
- */
- public function set_timestamp($stamp)
- {
- $this->timestamp = $stamp;
- }
-
-
- /*! \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;
- }
- }
-
- public function check()
- {
- return(array());
- }
-
-
- /*! \brief Update a class variable from outside
- */
- public function set_value($name,$value)
- {
- $name = strtolower($name);
- if(isset($this->$name) && in_array($name,$this->attributes)){
- $this->$name = $value;
- }
- }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_activate.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_activate.inc
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_activate extends DaemonEvent
-{
- var $visible_for = SYSTEM_EVENT;
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Unlock");
- $this->s_Event_Name = _("Unlock");
- $this->s_Schedule_Action = "job_trigger_action_activate";
- $this->s_Trigger_Action= "gosa_trigger_action_activate";
- $this->s_Queued_Action= "trigger_action_activate";
- $this->s_Menu_Image = "images/lists/unlocked.png";
- $this->s_List_Image = "images/lists/unlocked.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_activate.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/goto/events/class_DaemonEvent_activate_new.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_activate_new.inc
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id: class_DaemonEvent_activate_new.inc 10977 2008-05-21 08:25:46Z cajus $$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_activate_new extends DaemonEvent
-{
- var $visible_for = HIDDEN_EVENT;
-
- var $attributes = array("dhcp","ip","fqdn","ogroup","base","mac");
-
- var $dhcp = "";
- var $ip = "";
- var $fqdn = "";
- var $ogroup ="";
- var $base = "";
- var $mac ="";
-
-
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Activate new");
- $this->s_Event_Name = _("Activate new");
- $this->s_Schedule_Action = "job_trigger_activate_new";
- $this->s_Trigger_Action = "gosa_trigger_activate_new";
- $this->s_Queued_Action = "trigger_activate_new";
- $this->s_Menu_Image = "images/lists/unlocked.png";
- $this->s_List_Image = "images/lists/unlocked.png";
- }
-
- public function execute()
- {
- DaemonEvent::execute();
- return("");
-
- $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_activate_new.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/goto/events/class_DaemonEvent_faireboot.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_faireboot.inc
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_faireboot extends DaemonEvent
-{
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Abort installation");
- $this->s_Event_Name = _("Abort installation");
- $this->s_Schedule_Action = "job_trigger_action_faireboot";
- $this->s_Trigger_Action= "gosa_trigger_action_faireboot";
- $this->s_Queued_Action= "trigger_action_faireboot";
- $this->s_Menu_Image = "images/small_error.png";
- $this->s_List_Image = "images/small_error.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_faireboot.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/goto/events/class_DaemonEvent_goto_reload.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_goto_reload.inc
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id: class_DaemonEvent_wakeup.inc 10484 2008-04-16 06:24:25Z cajus $$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_goto_reload extends DaemonEvent
-{
- var $visible_for = HIDDEN_EVENT;
- var $mac = array();
- protected $attributes = array("mac");
-
- public function set_macs($macs)
- {
- $this->mac = $macs;
- }
-
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Goto reload");
- $this->s_Event_Name = _("Reload goto settings");
- $this->s_Schedule_Action= "job_trigger_goto_settings_reload";
- $this->s_Trigger_Action = "gosa_trigger_goto_settings_reload";
- $this->s_Queued_Action = "trigger_action_goto_settings_reload";
- $this->s_Menu_Image = "images/lists/reload.png";
- $this->s_List_Image = "images/lists/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_goto_reload.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/goto/events/class_DaemonEvent_halt.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_halt.inc
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_halt extends DaemonEvent
-{
-
- var $visible_for = SYSTEM_EVENT;
-
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Switch off");
- $this->s_Event_Name = _("Switch off");
- $this->s_Schedule_Action = "job_trigger_action_halt";
- $this->s_Trigger_Action= "gosa_trigger_action_halt";
- $this->s_Queued_Action= "trigger_action_halt";
- $this->s_Menu_Image = "images/lists/off.png";
- $this->s_List_Image = "images/lists/off.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/goto/events/class_DaemonEvent_installation_activation.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_installation_activation.inc
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_installation_activation extends DaemonEvent
-{
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Installation activation");
- $this->s_Event_Name = _("Installation activation");
- $this->s_Schedule_Action = "job_set_activated_for_installation";
- $this->s_Trigger_Action = "gosa_set_activated_for_installation";
- $this->s_Queued_Action = "set_activated_for_installation";
- $this->s_Menu_Image = "images/true.png";
- $this->s_List_Image = "images/true.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_installation_activation.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/goto/events/class_DaemonEvent_localboot.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_localboot.inc
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_localboot extends DaemonEvent
-{
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Force localboot");
- $this->s_Event_Name = _("Force localboot");
- $this->s_Schedule_Action = "job_trigger_action_localboot";
- $this->s_Trigger_Action= "gosa_trigger_action_localboot";
- $this->s_Queued_Action= "trigger_action_localboot";
- $this->s_Menu_Image = "plugins/goto/images/localboot.png";
- $this->s_List_Image = "plugins/goto/images/localboot.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_localboot.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/goto/events/class_DaemonEvent_lock.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_lock.inc
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_lock extends DaemonEvent
-{
- var $visible_for = SYSTEM_EVENT;
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Lock");
- $this->s_Event_Name = _("Lock");
- $this->s_Schedule_Action = "job_trigger_action_lock";
- $this->s_Trigger_Action= "gosa_trigger_action_lock";
- $this->s_Queued_Action= "trigger_action_lock";
- $this->s_Menu_Image = "images/lists/locked.png";
- $this->s_List_Image = "images/lists/locked.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_lock.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/goto/events/class_DaemonEvent_memcheck.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_memcheck.inc
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_memcheck extends DaemonEvent
-{
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Memory test");
- $this->s_Event_Name = _("Memory test");
- $this->s_Schedule_Action= "job_trigger_action_memcheck";
- $this->s_Trigger_Action = "gosa_trigger_action_memcheck";
- $this->s_Queued_Action = "trigger_action_memcheck";
- $this->s_Menu_Image = "plugins/goto/images/memcheck.png";
- $this->s_List_Image = "plugins/goto/images/memcheck.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_memcheck.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/goto/events/class_DaemonEvent_notify.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_notify.inc
+++ /dev/null
@@ -1,211 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_notify extends DaemonEvent
-{
- var $visible_for = USER_EVENT;
-
- var $user = array();
- var $group= array();
-
- var $message = "";
- var $subject = "";
- var $from = "";
-
- var $attributes = array("from","user","group","message","subject");
-
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
-
- $ui = get_userinfo();
- $this->from = $ui->cn;
-
- $this->message = base64_decode($this->message);
- $this->subject = base64_decode($this->subject);
-
- $this->s_Menu_Name = _("Send message");
- $this->s_Event_Name = _("Send message");
-
- $this->s_Schedule_Action = "job_send_user_msg";
- $this->s_Trigger_Action= "gosa_send_user_msg";
- $this->s_Queued_Action= "trigger_action_notify";
- $this->s_Menu_Image = "plugins/goto/images/notify.png";
- $this->s_List_Image = "plugins/goto/images/notify.png";
- $this->a_targets = array("GOSA"); // Required to get the event send. Maybe this is a wrong value.
- }
-
- public function execute()
- {
- DaemonEvent::execute();
-
- /* Check if target add dialog is open */
- if($this->is_target_list_open() && $this->is_new){
- return($this->get_target_add_list());
- }
-
-
- $display = $this->get_header();
- $tmp = $this->data;
- $smarty = get_smarty();
- $smarty->assign("data" , $this->data);
- $smarty->assign("is_new" , $this->is_new);
- $smarty->assign("timestamp" , $this->get_time_select());
-
- $smarty->assign("user" , $this->user);
- $smarty->assign("group" , $this->group);
-
- $smarty->assign("add_str", msgPool::addButton(_("Target")));
- $smarty->assign("del_str", msgPool::delButton(_("Target")));
-
- $smarty->assign("from", xmlentities($this->from));
- $smarty->assign("subject", xmlentities($this->subject));
- $smarty->assign("message", xmlentities($this->message));
-
- $display.= $smarty->fetch(get_template_path('DaemonEvent_notify.tpl', TRUE, dirname(__FILE__)));
- $display.= $this->get_footer();
- return($display);
- }
-
-
- public function check()
- {
- $msgs = DaemonEvent::check();
- if(empty($this->subject)){
- $msgs[] = msgPool::required(_("Subject"));
- }
- if(empty($this->message)){
- $msgs[] = msgPool::required(_("Message"));
- }
- if(empty($this->from)){
- $msgs[] = msgPool::required(_("From"));
- }
- if(!count($this->group) && !count($this->user)){
- $msgs[] = msgPool::required(_("Target"));
- }
- return($msgs);
- }
-
-
- public function save_object()
- {
- DaemonEvent::save_object();
-
- if(isset($_POST['del_any_target']) && isset($_POST['group'])){
- foreach($_POST['group'] as $id){
- if(isset($this->group[$id])){
- unset($this->group[$id]);
- }
- }
- }
- if(isset($_POST['del_any_target']) && isset($_POST['user'])){
- foreach($_POST['user'] as $id){
- if(isset($this->user[$id])){
- unset($this->user[$id]);
- }
- }
- }
-
- if(isset($_POST['subject'])){
- $this->subject = get_post('subject');
- }
- if(isset($_POST['message'])){
- $this->message = get_post('message');
- }
- if(isset($_POST['from'])){
- $this->from = get_post('from');
- }
- }
-
- public function add_users($targets)
- {
- $add = $targets;
- if(!is_array($add)){
- $add = array($add);
- }
- foreach($add as $target){
- if(!in_array($target,$this->user)){
- $this->user[] = $target;
- }
- }
- }
-
-
- public function add_groups($targets)
- {
- $add = $targets;
- if(!is_array($add)){
- $add = array($add);
- }
- foreach($add as $target){
- if(!in_array($target,$this->group)){
- $this->group[] = $target;
- }
- }
- }
-
-
- /*! \brief Returns HTML content, displaying a dialog which allows to add new targets.
- @return String HTML content. (EventTargetAddList)
- */
- public function get_target_add_list()
- {
- $this->target_add_list_used = TRUE;
-
- if($this->target_divlist == NULL){
- $this->target_divlist = new EventTargetAddUserList($this->config,$this);
- }
- $this->target_divlist->execute();
-
- $smarty = get_smarty();
- $smarty->assign("divlist",$this->target_divlist->Draw());
- return($smarty->fetch(get_template_path('target_list.tpl', TRUE, dirname(__FILE__))));
- }
-
-
- /*! \brief Add a target MAC address
- @param Array A List of all target that should be added.
- */
- public function add_targets($targets)
- {
- if(isset($targets['USERS'])){
- $this->add_users($targets['USERS']);
- }
- if(isset($targets['GROUPS'])){
- $this->add_groups($targets['GROUPS']);
- }
- }
-
-
- public function save()
- {
- $ret = DaemonEvent::save();
- $ret['delivery_time'] = $ret['timestamp'];
- $ret['user'] = array_values( $ret['user']);
- $ret['group'] = array_values( $ret['group']);
- $ret['subject'] = base64_encode($ret['subject']);
- $ret['message'] = base64_encode($ret['message']);
- return($ret);
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reboot.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reboot.inc
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_reboot extends DaemonEvent
-{
- var $visible_for = SYSTEM_EVENT;
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Reboot");
- $this->s_Event_Name = _("Reboot");
- $this->s_Schedule_Action = "job_trigger_action_reboot";
- $this->s_Trigger_Action= "gosa_trigger_action_reboot";
- $this->s_Queued_Action= "trigger_action_reboot";
- $this->s_Menu_Image = "images/lists/reload.png";
- $this->s_List_Image = "images/lists/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/goto/events/class_DaemonEvent_recreate_fai_release_db.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_recreate_fai_release_db.inc
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id: class_DaemonEvent_reload_ldap_config.inc 9815 2008-03-14 09:54:45Z cajus $$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_recreate_fai_release_db extends DaemonEvent
-{
- var $visible_for = HIDDEN_EVENT;
-
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Reload fai release db");
- $this->s_Event_Name = _("Reload fai release db");
- $this->s_Schedule_Action= "gosa_recreate_fai_release_db";
- $this->s_Trigger_Action = "gosa_recreate_fai_release_db";
- $this->s_Queued_Action = "recreate_fai_release_db";
- $this->s_Menu_Image = "images/edit.png";
- $this->s_List_Image = "images/edit.png";
- }
-
- public function execute()
- {
- DaemonEvent::execute();
- return("Cannot be displayed");
- }
-
- public function save_object()
- {
- DaemonEvent::save_object();
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_recreate_fai_server_db.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_recreate_fai_server_db.inc
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id: class_DaemonEvent_reload_ldap_config.inc 9815 2008-03-14 09:54:45Z cajus $$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_recreate_fai_server_db extends DaemonEvent
-{
- var $visible_for = HIDDEN_EVENT;
-
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Reload fai server db");
- $this->s_Event_Name = _("Reload fai server db");
- $this->s_Schedule_Action= "gosa_recreate_fai_server_db";
- $this->s_Trigger_Action = "gosa_recreate_fai_server_db";
- $this->s_Queued_Action = "recreate_fai_release_db";
- $this->s_Menu_Image = "images/edit.png";
- $this->s_List_Image = "images/edit.png";
- }
-
- public function execute()
- {
- DaemonEvent::execute();
- return("Cannot be displayed");
- }
-
- public function save_object()
- {
- DaemonEvent::save_object();
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reinstall.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reinstall.inc
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_reinstall extends DaemonEvent
-{
- var $progress = 0;
- var $status = "";
- var $visible_for = SYSTEM_EVENT;
-
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Reinstall");
- $this->s_Event_Name = _("Reinstall");
- $this->s_Schedule_Action = "job_trigger_action_reinstall";
- $this->s_Trigger_Action= "job_trigger_action_reinstall";
- $this->s_Queued_Action= "trigger_action_reinstall";
- $this->s_Menu_Image = "plugins/goto/images/reinstall.png";
- $this->s_List_Image = "plugins/goto/images/reinstall.png";
-
- if(!$this->is_new()){
- if(isset($data['PROGRESS'])){
- $this->progress = $data['PROGRESS'];
- }
- if(isset($data['STATUS'])){
- $this->status = $data['STATUS'];
- }
- }
- }
-
- 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("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);
- $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);
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reload_ldap_config.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reload_ldap_config.inc
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_reload_ldap_config extends DaemonEvent
-{
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Reload ldap config");
- $this->s_Event_Name = _("Reload ldap config");
- $this->s_Schedule_Action= "job_trigger_reload_ldap_config";
- $this->s_Trigger_Action = "gosa_trigger_reload_ldap_config";
- $this->s_Queued_Action = "reload_ldap_config";
- $this->s_Menu_Image = "images/lists/edit.png";
- $this->s_List_Image = "images/lists/edit.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_wakeup.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/goto/events/class_DaemonEvent_rescan.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_rescan.inc
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_rescan extends DaemonEvent
-{
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Rescan hardware");
- $this->s_Event_Name = _("Rescan hardware");
- $this->s_Schedule_Action= "job_detect_hardware";
- $this->s_Trigger_Action = "gosa_detect_hardware";
- $this->s_Queued_Action = "detect_hardware";
- $this->s_Menu_Image = "plugins/goto/images/rescan.png";
- $this->s_List_Image = "plugins/goto/images/rescan.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_rescan.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/goto/events/class_DaemonEvent_sysinfo.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_sysinfo.inc
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_sysinfo extends DaemonEvent
-{
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("System analysis");
- $this->s_Event_Name = _("System analysis");
- $this->s_Schedule_Action= "job_trigger_action_sysinfo";
- $this->s_Trigger_Action = "gosa_trigger_action_sysinfo";
- $this->s_Queued_Action = "trigger_action_sysinfo";
- $this->s_Menu_Image = "plugins/goto/images/sysinfo.png";
- $this->s_List_Image = "plugins/goto/images/sysinfo.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_sysinfo.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/goto/events/class_DaemonEvent_update.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_update.inc
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_update extends DaemonEvent
-{
- var $visible_for = SYSTEM_EVENT;
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Software update");
- $this->s_Event_Name = _("Software update");
- $this->s_Schedule_Action = "job_trigger_action_update";
- $this->s_Trigger_Action= "job_trigger_action_update";
- $this->s_Queued_Action= "trigger_action_update";
- $this->s_Menu_Image = "plugins/goto/images/update.png";
- $this->s_List_Image = "plugins/goto/images/update.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/goto/events/class_DaemonEvent_wakeup.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_wakeup.inc
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class DaemonEvent_wakeup extends DaemonEvent
-{
- var $visible_for = SYSTEM_EVENT;
- public function __construct($config,$data = array())
- {
- DaemonEvent::__construct($config,$data);
- $this->s_Menu_Name = _("Wake up");
- $this->s_Event_Name = _("Start a system");
- $this->s_Schedule_Action= "job_trigger_action_wake";
- $this->s_Trigger_Action = "gosa_trigger_action_wake";
- $this->s_Queued_Action = "trigger_action_wake";
- $this->s_Menu_Image = "images/lists/on.png";
- $this->s_List_Image = "images/lists/on.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_wakeup.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/goto/events/class_EventTargetAddList.inc b/gosa-plugins/goto/addons/goto/events/class_EventTargetAddList.inc
+++ /dev/null
@@ -1,288 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class EventTargetAddList extends MultiSelectWindow
-{
- public $display_server = TRUE;
- public $display_workstation = TRUE;
- public $display_ogroup = TRUE;
- public $filter_iprange = FALSE;
-
- public $regex = "*";
- public $ipfrom = "0.0.0.0";
- public $ipto = "*";
- public $_target_list = array();
-
- public $workstation_list = array();
- public $server_list = array();
-
-
- function __construct(&$config,$parent)
- {
- MultiSelectWindow::MultiSelectWindow($config, "EventTargetAddList",
- array("server",
- "workstation",
- "ogroups"));
-
- $this->parent = $parent;
- $this->ui = get_userinfo();
-
-
- $this->target_divlist = new MultiSelectWindow($this->config,"EventAddTargedtList","gotomasses");
- $this->SetSummary(_("Targets"));
- $this->EnableCloseButton(FALSE);
- $this->EnableSaveButton(FALSE);
-
- $this->SetInformation(_("This dialog shows all available targets for your event, check the targets you want to add and use the 'Use' button to accept."));
-
- /* Toggle all selected / deselected */
- $chk = "<input type='checkbox' id='select_all' name='select_all'
- onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
- $this->EnableAplhabet(TRUE);
-
- /* set Page header */
- $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
- $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
- $this->AddHeader(array("string"=>_("System / Department")));
-
- //$name,$string,$value,$conn,$image="images/lists/search.png")
- $this->AddRegex("regex" ,"regex" ,"*" , TRUE);
- $this->AddRegex("ipfrom","ipfrom" ,"0.0.0.0" , FALSE);
- $this->AddRegex("ipto" ,"ipto" ,"255.255.255.255" , FALSE);
-
- $this->AddCheckBox("display_server","1" ,_("Display server"),TRUE);
- $this->AddCheckBox("display_workstation","1",_("Display workstation"),TRUE);
- $this->AddCheckBox("display_ogroup","1" ,_("Display object groups"),TRUE);
- $this->AddCheckBox("filter_iprange","1" ,_("Filter by IP range"),FALSE);
-
-
-
- /* Create a list of servers
- */
- $tmp = get_sub_list("(&(macAddress=*)(objectClass=goServer))",
- "server",get_ou("serverRDN"),$config->current['BASE'],
- array("cn","objectClass","description","ipHostNumber","macAddress"),GL_SUBSEARCH);
- foreach($tmp as $server){
- $this->server_list[$server['dn']] = $server;
- }
-
- /* Create a list of workstations
- */
- $tmp = get_sub_list("(&(macAddress=*)(objectClass=gotoWorkstation))",
- "server",get_ou("workstationRDN"),$config->current['BASE'],
- array("cn","objectClass","description","ipHostNumber","macAddress"),GL_SUBSEARCH);
- foreach($tmp as $server){
- $this->workstation_list[$server['dn']] = $server;
- }
-
- }
-
-
- function execute()
- {
- $this->ClearElementsList();
- $this->AddDepartments($this->selectedBase,2,1);
- $this->setEntries();
- $this->GenHeader();
- }
-
-
- function GenHeader()
- {
- $modules = array("server","workstation");
-
- /* Add base */
- $tmp = array();
- $base = $this->config->current['BASE'];
- $tmp[] = array("dn"=>$this->config->current['BASE']);
- $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $modules, $base,
- array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
- $deps = array();
- foreach($tmp as $tm){
- $deps[$tm['dn']] = $tm['dn'];
- }
-
- $department = $departments = array();
- $ui= get_userinfo();
- $d = $ui->get_module_departments($modules);
- foreach($d as $department){
- $departments[$department] = $department;
- }
-
- /* Load possible departments */
- $ids = $this->config->idepartments;
- $first = "";
- $found = FALSE;
- $options = array();
- foreach($ids as $dep => $name){
- if(isset($deps[$dep]) && in_array_ics($dep, $departments)){
-
- /* Keep first base dn in mind, we could need this
- * info if no valid base was found
- */
- if(empty($first)) {
- $first = $dep['dn'];
- }
-
- $value = $ids[$dep];
- if ($this->selectedBase == $dep){
- $found = TRUE;
- $options.= "<option selected='selected' value='".$dep."'>$value</option>";
- } else {
- $options.= "<option value='".$dep."'>$value</option>";
- }
- }
- }
-
- $listhead = $this->get_default_header();
-
- /* Add base selection */
- $listhead .= _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
- " <input class='center' type='image' src='images/lists/submit.png' align='middle'
- title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ";
-
- $this->SetListHeader($listhead);
-
- }
-
-
- function get_selected_targets()
- {
- $a_targets = array();
- foreach($this->list_get_selected_items() as $id){
- if(in_array("gosaGroupOfNames",$this->_target_list[$id]['objectClass'])){
- foreach($this->_target_list[$id]['member'] as $mem_dn){
- if(isset($this->workstation_list[$mem_dn])){
- $a_targets[] = $this->workstation_list[$mem_dn]['macAddress'][0];
- }
- if(isset($this->server_list[$mem_dn])){
- $a_targets[] = $this->server_list[$mem_dn]['macAddress'][0];
- }
- }
- }else{
- if(isset($this->_target_list[$id]['macAddress'][0])){
- $a_targets[] = $this->_target_list[$id]['macAddress'][0];
- }
- }
- }
- return($a_targets);
- }
-
-
- function setEntries()
- {
- $_target_list = array();
- if($this->display_server){
- $_target_list = array_merge($_target_list,
- get_list("(&(cn=".$this->regex.")(objectClass=goServer))",
- "server",get_ou("serverRDN").$this->selectedBase,
- array("cn","objectClass","description","ipHostNumber","macAddress"),GL_NONE));
- }
- if($this->display_workstation){
- $_target_list = array_merge($_target_list,
- get_list("(&(cn=".$this->regex.")(objectClass=gotoWorkstation))",
- "workstation",get_ou("workstationRDN").$this->selectedBase,
- array("cn","objectClass","description","ipHostNumber","macAddress"),GL_NONE));
- }
- if($this->display_ogroup){
- $_target_list = array_merge($_target_list,
- get_list("(&(cn=".$this->regex.")(member=*)(objectClass=gosaGroupOfNames))",
- "ogroups",get_ou("ogroupRDN").$this->selectedBase,
- array("cn","objectClass","description","member"),GL_NONE));
- }
- $this->_target_list = $_target_list;
-
- $tmp = array();
- foreach($this->_target_list as $key => $object){
- $tmp[$key] = $object['cn'][0];
- }
- natcasesort($tmp);
-
- foreach($tmp as $key => $obj){
-
- $obj = $this->_target_list[$key];
- $name = $obj['cn'][0];
- if(isset($obj['description'])){
- $name .= " [".$obj['description'][0]."]";
- }
- if(isset($obj['macAddress'])){
- $name .= " - ".$obj['macAddress'][0]."";
- }
- if(isset($obj['ipHostNumber'])){
- $name .= " - ".$obj['ipHostNumber'][0]."";
- }
-
- $img ="";
- if(in_array("goServer",$obj['objectClass'])){
- $img = '<img class="center" src="plugins/systems/images/select_server.png" alt="S" title="'._("Server").'">';
-
- if($this->filter_iprange){
- if(!isset($obj['ipHostNumber']) || !tests::is_in_ip_range($this->ipfrom,$this->ipto, $obj['ipHostNumber'][0])) {
- continue;
- }
- }
- if(!isset($this->server_list[$obj['dn']])){
- continue;
- }
- }elseif(in_array("gotoWorkstation",$obj['objectClass'])){
- $img = '<img class="center" src="plugins/systems/images/select_workstation.png" alt="W" title="'._("Workstation").'">';
- if($this->filter_iprange){
- if(!isset($obj['ipHostNumber']) || !tests::is_in_ip_range($this->ipfrom,$this->ipto,$obj['ipHostNumber'][0])) {
- continue;
- }
- }
- if(!isset($this->workstation_list[$obj['dn']])){
- continue;
- }
- }elseif(in_array("gosaGroupOfNames",$obj['objectClass'])){
- $img = '<img class="center" src="plugins/ogroups/images/select_ogroup.png" alt="O" title="'._("Object group").'">';
- }
-
- $field1 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>",
- "attach" => "style='width:20px;'");
- $field2 = array("string" => $img,
- "attach" => "style='width:20px;'");
- $field3 = array("string" => $name , "attach" => "title='".$obj['dn']."'");
- $this->AddElement(array($field1,$field2,$field3));
- }
- }
-
-
- /*! \brief Returns a set of elements selected in a MultiSelectWindow
- @return Array[integer]=integer
- */
- protected function list_get_selected_items()
- {
- $ids = array();
- foreach($_POST as $name => $value){
- if(preg_match("/^item_selected_[0-9]*$/",$name)){
- $id = preg_replace("/^item_selected_/","",$name);
- $ids[$id] = $id;
- }
- }
- return($ids);
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/events/class_EventTargetAddUsersList.inc b/gosa-plugins/goto/addons/goto/events/class_EventTargetAddUsersList.inc
+++ /dev/null
@@ -1,220 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id: class_EventTargetAddUserList.inc 9597 2008-03-10 14:16:59Z hickert $$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-class EventTargetAddUserList extends MultiSelectWindow
-{
- public $display_server = TRUE;
- public $display_workstation = TRUE;
- public $display_ogroup = TRUE;
- public $filter_iprange = FALSE;
-
- public $regex = "*";
- public $ipfrom = "0.0.0.0";
- public $ipto = "*";
- public $_target_list = array();
-
- function __construct(&$config,$parent)
- {
- MultiSelectWindow::MultiSelectWindow($config, "EventTargetAddUserList",
- array("users","groups"));
-
- $this->parent = $parent;
- $this->ui = get_userinfo();
-
-
- $this->target_divlist = new MultiSelectWindow($this->config,"EventAddTargetUserList","gotomasses");
- $this->SetSummary(_("Targets"));
- $this->EnableCloseButton(FALSE);
- $this->EnableSaveButton(FALSE);
-
- $this->SetInformation(_("This dialog shows all available targets for your event, check the targets you want to add and use the 'Use' button to accept."));
-
- /* Toggle all selected / deselected */
- $chk = "<input type='checkbox' id='select_all' name='select_all'
- onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
-
- $this->EnableAplhabet(TRUE);
-
- /* set Page header */
- $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
- $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
- $this->AddHeader(array("string"=>_("System / Department")));
-
- //$name,$string,$value,$conn,$image="images/lists/search.png")
- $this->AddRegex("regex" ,"regex" ,"*" , TRUE);
-
- $this->AddCheckBox("display_users" ,"1", _("Display users"),TRUE);
- $this->AddCheckBox("display_groups" ,"1", _("Display groups"),TRUE);
- }
-
-
- function execute()
- {
- $this->ClearElementsList();
- $this->AddDepartments($this->selectedBase,2,1);
- $this->setEntries();
- $this->GenHeader();
- }
-
-
- function GenHeader()
- {
- $modules = array("users","groups");
-
- /* Add base */
- $tmp = array();
- $base = $this->config->current['BASE'];
- $tmp[] = array("dn"=>$this->config->current['BASE']);
- $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $modules, $base,
- array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH));
-
- $deps = array();
- foreach($tmp as $tm){
- $deps[$tm['dn']] = $tm['dn'];
- }
-
- $department = $departments = array();
- $ui= get_userinfo();
- $d = $ui->get_module_departments($modules);
- foreach($d as $department){
- $departments[$department] = $department;
- }
-
- /* Load possible departments */
- $ids = $this->config->idepartments;
- $first = "";
- $found = FALSE;
- $options = array();
- foreach($ids as $dep => $name){
- if(isset($deps[$dep]) && in_array_ics($dep, $departments)){
-
- /* Keep first base dn in mind, we could need this
- * info if no valid base was found
- */
- if(empty($first)) {
- $first = $dep['dn'];
- }
-
- $value = $ids[$dep];
- if ($this->selectedBase == $dep){
- $found = TRUE;
- $options.= "<option selected='selected' value='".$dep."'>$value</option>";
- } else {
- $options.= "<option value='".$dep."'>$value</option>";
- }
- }
- }
-
- $listhead = $this->get_default_header();
-
- /* Add base selection */
- $listhead .= _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
- " <input class='center' type='image' src='images/lists/submit.png' align='middle'
- title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ";
-
- $this->SetListHeader($listhead);
-
- }
-
-
- function setEntries()
- {
- $_target_list = array();
-
- if($this->display_users){
- $_target_list = array_merge($_target_list,
- get_sub_list("(&(objectClass=person)(objectClass=gosaAccount))","users",get_people_ou(),get_people_ou().$this->selectedBase,
- array("cn","objectClass","description","uid"),GL_NONE));
- }
- if($this->display_groups){
- $_target_list = array_merge($_target_list,
- get_sub_list("(objectClass=posixGroup)","groups",get_groups_ou(),get_groups_ou().$this->selectedBase,
- array("cn","objectClass","description"),GL_NONE));
- }
- $this->_target_list = $_target_list;
-
- $tmp = array();
- foreach($this->_target_list as $key => $object){
- $tmp[$key] = $object['cn'][0];
- }
- natcasesort($tmp);
-
- foreach($tmp as $key => $obj){
-
- $obj = $this->_target_list[$key];
- $name = $obj['cn'][0];
- if(isset($obj['description'])){
- $name .= " [".$obj['description'][0]."]";
- }
-
- $img ="";
- if(in_array("gosaAccount",$obj['objectClass'])){
- $img = '<img class="center" src="plugins/users/images/select_user.png" alt="U" title="'._("User").'">';
- }elseif(in_array("posixGroup",$obj['objectClass'])){
- $img = '<img class="center" src="plugins/groups/images/groups.png" alt="G" title="'._("Group").'">';
- }
-
- $field1 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>",
- "attach" => "style='width:20px;'");
- $field2 = array("string" => $img,
- "attach" => "style='width:20px;'");
- $field3 = array("string" => $name , "attach" => "title='".$obj['dn']."'");
- $this->AddElement(array($field1,$field2,$field3));
- }
- }
-
-
- function get_selected_targets()
- {
- $a_targets = array("USERS" => array(),"GROUPS" => array());
-
- foreach($this->list_get_selected_items() as $id){
- $obj = $this->_target_list[$id];
- if(in_array("posixGroup",$obj['objectClass'])){
- $a_targets['GROUPS'][] = $obj['cn'][0];
- }
- if(in_array("gosaAccount",$obj['objectClass'])){
- $a_targets['USERS'][] = $obj['uid'][0];
- }
- }
-
- return($a_targets);
- }
-
-
- /*! \brief Returns a set of elements selected in a MultiSelectWindow
- @return Array[integer]=integer
- */
- protected function list_get_selected_items()
- {
- $ids = array();
- foreach($_POST as $name => $value){
- if(preg_match("/^item_selected_[0-9]*$/",$name)){
- $id = preg_replace("/^item_selected_/","",$name);
- $ids[$id] = $id;
- }
- }
- return($ids);
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-plugins/goto/addons/goto/events/target_list.tpl b/gosa-plugins/goto/addons/goto/events/target_list.tpl
+++ /dev/null
@@ -1,7 +0,0 @@
-{$divlist}
-
-<p class='seperator'></p>
-<div style='text-align:right;width:100%;padding-top:5px;padding-right:5px;padding-bottom:5px;'>
- <input type='submit' name='save_target_dialog' value='{t}Apply{/t}'>
- <input type='submit' name='abort_target_dialog' value='{t}Cancel{/t}'>
-</div>
diff --git a/gosa-plugins/goto/addons/goto/events/timestamp_select.tpl b/gosa-plugins/goto/addons/goto/events/timestamp_select.tpl
+++ /dev/null
@@ -1,45 +0,0 @@
-<table cellspacing="0" cellpadding="0">
- <tr>
- <td>{t}Year{/t}</td>
- <td>{t}Month{/t}</td>
- <td>{t}Day{/t}</td>
- <td> </td>
- <td>{t}Hour{/t}</td>
- <td>{t}Minute{/t}</td>
- <td>{t}Second{/t}</td>
- </tr>
- <tr>
- <td>
- <select name="time_year" onChange="document.mainform.submit();">
- {html_options values=$years options=$years selected=$time_year}
- </select>
- </td>
- <td>
- <select name="time_month" onChange="document.mainform.submit();">
- {html_options values=$months options=$months selected=$time_month}
- </select>
- </td>
- <td>
- <select name="time_day">
- {html_options values=$days options=$days selected=$time_day}
- </select>
- </td>
- <td> </td>
- <td>
- <select name="time_hour">
- {html_options values=$hours options=$hours selected=$time_hour}
- </select>
- </td>
- <td>
- <select name="time_minute">
- {html_options values=$minutes options=$minutes selected=$time_minute}
- </select>
- </td>
- <td>
- <select name="time_second">
- {html_options values=$seconds options=$seconds selected=$time_second}
- </select>
- </td>
- </tr>
-</table>
-
diff --git a/gosa-plugins/goto/addons/goto/goto_import_file.tpl b/gosa-plugins/goto/addons/goto/goto_import_file.tpl
+++ /dev/null
@@ -1,87 +0,0 @@
-<h2>{t}Import jobs{/t}</h2>
-<p>
-{t}You can import a list of jobs into the GOsa job queue. This should be a semicolon seperated list of items in the following format:{/t}
-</p>
-<i>{t}timestamp{/t} ; {t}MAC-address{/t} ; {t}job type{/t} ; {t}object group{/t} [ ; {t}import base{/t} ; {t}full hostname{/t} ; {t}IP-address{/t} ; {t}DHCP group{/t} ]</i>
-<br>
-<br>
-{if !$count}
-{t}Example{/t}:
-<br>
-20080626162556 <b>;</b> 00:0C:29:99:1E:37 <b>;</b> job_trigger_activate_new <b>;</b> goto-client <b>;</b> dc=test,dc=gonicus,dc=de
-<br>
-<br>
-{/if}
-
-<p class="seperator"></p>
-
-<table>
- <tr>
- <td>
- {t}Select list to import{/t}
- </td>
- <td>
- <input type='file' name='file' value="{t}Browse{/t}">
- <input type='submit' name='import' value='{t}Upload{/t}'>
- </td>
- </tr>
-</table>
-
- {if $count}
- <p class="seperator"> </p>
- <br>
- <br>
- <div style='width:100%; height:300px; overflow: scroll;'>
- <table cellpadding="3" cellspacing="0" style='width:100%; background-color: #CCCCCC; border: solid 1px #CCCCCC;'>
- <tr>
- <td><b>{t}Timestamp{/t}</b></td>
- <td><b>{t}MAC{/t}</b></td>
- <td><b>{t}Event{/t}</b></td>
- <td><b>{t}Object group{/t}</b></td>
- <td><b>{t}Base{/t}</b></td>
- <td><b>{t}FQDN{/t}</b></td>
- <td><b>{t}IP{/t}</b></td>
- <td><b>{t}DHCP{/t}</b></td>
- </tr>
- {foreach from=$info item=item key=key}
- {if $item.ERROR}
- <tr style='background-color: #F0BBBB;'>
- <td>{$item.TIMESTAMP}</td>
- <td>{$item.MAC}</td>
- <td>{$item.HEADER}</td>
- <td>{$item.OGROUP}</td>
- <td>{$item.BASE}</td>
- <td>{$item.FQDN}</td>
- <td>{$item.IP}</td>
- <td>{$item.DHCP}</td>
- </tr>
- <tr style='background-color: #F0BBBB;'>
- <td colspan="7"><b>{$item.ERROR}</b></td>
- </tr>
- {else}
- {if ($key % 2)}
- <tr class="rowxp0">
- {else}
- <tr class="rowxp1">
- {/if}
- <td>{$item.TIMESTAMP}</td>
- <td style='border-left: solid 1px #BBBBBB;'>{$item.MAC}</td>
- <td style='border-left: solid 1px #BBBBBB;'>{$item.HEADER}</td>
- <td style='border-left: solid 1px #BBBBBB;'>{$item.OGROUP}</td>
- <td style='border-left: solid 1px #BBBBBB;'>{$item.BASE}</td>
- <td style='border-left: solid 1px #BBBBBB;'>{$item.FQDN}</td>
- <td style='border-left: solid 1px #BBBBBB;'>{$item.IP}</td>
- <td style='border-left: solid 1px #BBBBBB;'>{$item.DHCP}</td>
- </tr>
- {/if}
- {/foreach}
- </table>
- </div>
- {/if}
-<br>
-<p class='seperator'></p>
-<div style='text-align:right;width:99%; padding-right:5px; padding-top:5px;'>
- <input type='submit' name='start_import' value='{t}Import{/t}' >
- <input type='submit' name='import_abort' value='{msgPool type=backButton}'>
-</div>
-<br>
diff --git a/gosa-plugins/goto/addons/goto/gotomasses.tpl b/gosa-plugins/goto/addons/goto/gotomasses.tpl
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-{$div}
-
-<!--
-JS to reload the progress bars.
-
--->
-{literal}
-<script type="text/javascript">
-
-/* Get request object handler for this type of browser
- */
-if (typeof XMLHttpRequest != 'undefined')
-{
- xmlHttpObject = new XMLHttpRequest();
-}
-if (!xmlHttpObject)
-{
- try
- {
- xmlHttpObject = new ActiveXObject("Msxml2.XMLHTTP");
- }
- catch(e)
- {
- try
- {
- xmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
- }
- catch(e)
- {
- xmlHttpObject = null;
- }
- }
-}
-
-var fai_status = new Array();
-
-function loadContent()
-{
- var c = 0;
-
- /* Create array of available progress images once
- */
- if(!fai_status.length){
- for (var i = 0; i < document.images.length; i++) {
- var img = document.images[i];
- var id = img.id;
- if(id.match(/^progress_/)){
- var mac = id.replace(/^progress_/,'');
- mac = mac.replace(/_/g,':');
- fai_status[c] = new Object();
- fai_status[c]['MAC'] = mac;
- fai_status[c]['PROGRESS'] = -1;
- c ++;
- }
- }
- }
-
- /* Create string of macs used as parameter for getFAIstatus.php
- to retrieve all progress values.
- */
- var macs = "";
- for (var i = 0; i < fai_status.length; i++) {
- macs += fai_status[i]['MAC'] + ","
- }
-
- /* Send request
- */
- xmlHttpObject.open('get','getFAIstatus.php?mac=' + macs);
- xmlHttpObject.onreadystatechange = handleContent;
- xmlHttpObject.send(null);
- return false;
-}
-
-
-function handleContent()
-{
- if (xmlHttpObject.readyState == 4)
- {
- /* Get text and split by newline
- */
- var text = xmlHttpObject.responseText;
- var data = text.split("\n");
-
- /* Walk through progress images and check if the
- progress status has changed
- */
- for (var e = 0; e < fai_status.length; e++) {
-
- /* Walk through returned values and parse out
- mac and progress value */
- var found = false;
-
- /* Create object id out of mac address
- 12:34:56:12:34:56 => progress_12_34_56_12_34_56
- */
- var id = fai_status[e]["MAC"].replace(/:/g,"_");
- id = "progress_" + id;
- var img = document.getElementById(id);
-
- /* Continue if there is no image object iwth this id
- */
- if(!img){
- continue;
- }
-
- for (var i = 0; i < data.length; i++) {
- var mac = data[i].replace(/\|.*$/,"");
- var progress= data[i].replace(/^.*\|/,"");
-
- /* Match mac returned by the support daemon and
- the one out of our list */
- if(fai_status[e]["MAC"] == mac){
- found = true;
-
- /* Check if progress has changed
- */
- if(fai_status[e]["PROGRESS"] != progress){
- img.src = "progress.php?x=80&y=13&p=" + progress;
- fai_status[e]["PROGRESS"] = progress;
- }
- break;
- }
- }
- //document.getElementById("text1").value += "\n ";
-
- /* There was no status send for the current mac.
- This means it was removed from the queue.
- */
- if(!found){
- document.mainform.submit();
- }
- }
- timer=setTimeout('loadContent()',3000);
- }
-}
-
-timer=setTimeout('loadContent()',3000);
-</script>
-{/literal}
diff --git a/gosa-plugins/goto/addons/goto/log_view.tpl b/gosa-plugins/goto/addons/goto/log_view.tpl
+++ /dev/null
@@ -1,29 +0,0 @@
-{if !$ACL}
-
- <h2>{msgPool type=permView}</h2>
-
-{else}
- {if $logs_available}
- <h2>{t}Available logs{/t}</h2>
-
- <div style="width:99%;border: solid 1px #CCCCCC;">{$divlist}</div>
- <br>
- <p class="seperator"></p>
- <h2>{t}Selected log{/t}: {$selected_log}</h2>
- <div style="width:99%;height:350px;padding:3px;background-color:white; overflow-y: scroll;border: solid 1px;">
- {$log_file}
- </div>
- {else}
- <h2>{t}No logs for this host available!{/t}</h2>
- {/if}
-{/if}
-
-{if $standalone}
-<br>
-<input type="hidden" name="ignore" value="1">
-<p class='seperator'></p>
-<div style='text-align:right;width:99%; padding-right:5px; padding-top:5px;'>
- <input type='submit' name='abort_event_dialog' value='{msgPool type=backButton}'>
-</div>
-<br>
-{/if}
diff --git a/gosa-plugins/goto/addons/goto/main.inc b/gosa-plugins/goto/addons/goto/main.inc
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/*
- * This code is part of GOsa (http://www.gosa-project.org)
- * Copyright (C) 2003-2008 GONICUS GmbH
- *
- * ID: $$Id$$
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-if (!$remove_lock){
-
- /* Create gotomasses object on demand */
- if (!session::is_set('gotomasses') || (isset($_GET['reset']) && $_GET['reset'] == 1) || isset($_POST['reload_gotomass_data'])){
- $gotomasses= new gotomasses ($config);
- $gotomasses->set_acl_category("gotomasses");
-
- /* Check root dn and user dn for acl informations */
- $gotomasses->set_acl_base($config->current['BASE']);
- if($gotomasses->getacl("") == ""){
- $gotomasses->set_acl_base($ui->dn);
- }
-
- /* Check if we have acl on our own base */
- if($gotomasses->getacl("") == ""){
- $gotomasses->set_acl_base(dn2base($ui->dn));
- }
- session::set("gotomasses",$gotomasses);
- }
- $gotomasses = session::get('gotomasses');
-
- /* Execute formular */
- $display= $gotomasses->save_object();
- if(isset($_POST['save_gotomass_changes'])){
- $gotomasses->save();
- }
- $display= $gotomasses->execute ();
-
- /* Page header*/
- $display= print_header(get_template_path('plugins/goto/images/goto.png'), _("System deployment status")).$display;
-
- /* Store changes in session */
- session::set('gotomasses',$gotomasses);
-}
diff --git a/gosa-plugins/goto/addons/goto/remove.tpl b/gosa-plugins/goto/addons/goto/remove.tpl
+++ /dev/null
@@ -1,20 +0,0 @@
-<div style="font-size:18px;">
- <img alt="" src="images/warning.png" align=top> {t}Warning{/t}
-</div>
-<p>
- {$info}
-</p>
-
-<p>
- {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t}
-</p>
-
-<p class="plugbottom">
-{if $multiple}
- <input type=submit name="delete_multiple_confirm" value="{msgPool type=delButton}">
-{else}
- <input type=submit name="delete_confirm" value="{msgPool type=delButton}">
-{/if}
- <input type=submit name="delete_cancel" value="{msgPool type=cancelButton}">
-</p>
-