From: hickert Date: Thu, 4 Dec 2008 06:27:14 +0000 (+0000) Subject: Reverted move action addons/goto is now again part goto X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e90c9b033d4f6955df26eed3d2ab66b6f7d2452b;p=gosa.git Reverted move action addons/goto is now again part goto git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13157 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/addons/goto/class_gotoLogView.inc b/gosa-plugins/fai/addons/goto/class_gotoLogView.inc deleted file mode 100644 index a5e166ff2..000000000 --- a/gosa-plugins/fai/addons/goto/class_gotoLogView.inc +++ /dev/null @@ -1,215 +0,0 @@ - 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 = "\\/"; - }else{ - $img = "/\\sort_by == "file"){ - $img1 = $img; - $img2 = ""; - }else{ - $img1 = ""; - $img2 = $img; - } - - - /* Create list header - */ - $divlist->SetHeader(array( - array("string"=>""._("File")." ".$img1."", - "attach"=>"width='200px;'"), - array("string"=>""._("Date")." ".$img2."", - "attach" => "style='border-right:none;'"), - )); - - /* Create divlist list - */ - $divlist->SetEntriesPerPage(0); - $divlist->SetHeight(150); - - /* Create sortable array - */ - $link = "%str%"; - $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 deleted file mode 100644 index 0b3338505..000000000 --- a/gosa-plugins/fai/addons/goto/class_goto_import_file.inc +++ /dev/null @@ -1,179 +0,0 @@ -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] = "".strip_tags($val).""; - } - } - } - - $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 deleted file mode 100644 index ad278eaba..000000000 --- a/gosa-plugins/fai/addons/goto/class_gotomasses.inc +++ /dev/null @@ -1,922 +0,0 @@ -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"), - "
".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.= "..| "._("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.= "..| "._("Import")."|import_file\n"; - $s.= "..| "._("Remove")."|remove_multiple\n"; - } - if(preg_match("/w/",$this->getacl(""))){ - $s.= "..|---|\n"; - $s.= "..|"._("Resume")." "._("Resume")."|resume_all\n"; - $s.= "..|"._("Pause")." "._("Pause")."|pause_all\n"; - $s.= "..|"._("Abort")." "._("Abort")."|abort_process_all\n"; - $s.= "..|"._("Execute")." "._("Execute")."|execute_process_all\n"; - } - - $divlist->SetDropDownHeaderMenu($s); - - if($this->sort_dir == "up"){ - $sort_img = "/\"; - }else{ - $sort_img = "\/"; - } - - 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(""); - - $plug = $_GET['plug']; - $chk = ""; - - /* set Page header */ - $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); - $divlist->AddHeader(array("string"=>""._("Target").$sort_img_1."")); - $divlist->AddHeader(array("string"=>""._("Task").$sort_img_2."", - "attach"=>"style='width:120px;'")); - $divlist->AddHeader(array("string"=>""._("Schedule").$sort_img_3."", - "attach"=>"style='width:140px;'")); - $divlist->AddHeader(array("string"=>""._("Status").$sort_img_4."", - "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.= " "; - $prio_actions.= " "; - } - - /* If WAITING add pause action - */ - if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){ - $prio_actions.= " "; - } - - /* If PAUSED add resume action - */ - if(in_array($task['STATUS'],array("paused")) && $this->acl_is_writeable("")){ - $prio_actions.= " "; - } - - /* If PAUSED or WAITING add execution action - */ - if(in_array($task['STATUS'],array("paused","waiting")) && $this->acl_is_writeable("")){ - $prio_actions.= " "; - } - - /* Add logview button, currently ever. - */ - if($this->acl_is_readable("")){ - $action .= " "; - } - - /* If PAUSED or WAITING add edit action - */ - if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){ - $action.= ""; - } - - /* If PROCESSING add abort action - */ - if(in_array($task['STATUS'],array("processing")) && preg_match("/install/",$task['HEADERTAG']) && $this->acl_is_writeable("")){ - $action.= ""; - $action.= ""; - } - - /* If WAITING or ERROR add remove action - */ - if( $this->acl_is_removeable() && in_array($task['STATUS'],array("waiting","error","processed"))){ - $action.= ""; - } - if($this->acl_is_writeable("") && in_array($task['STATUS'],array("processing")) && !preg_match("/install/",$task['HEADERTAG'])){ - $action.= ""; - } - - /* 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 = " "._("Waiting"); - } - if($status == "error"){ - $status = " "._("Error"); - } - if($status == "processed"){ - $status = " "._("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 = " "._("Locked"); - - /* Show hardware detect? */ - } elseif ($percent == "goto-hardware-detection") { - $status = " "._("Detection"); - - /* Real percent */ - } else { - if (preg_match('/install/', $task['HEADERTAG'])){ - $status = ""; - } else { - $status = preg_replace('/ /', ' ', _("in progress")); - } - } - } - - /* Create each field */ - $field0 = array("string" => "" , - "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(_("Required class '%s' cannot be found: job not aborted!"), - "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"), "

".$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 deployment"), - "plDescription" => _("Provide a mechanism to automatically activate systems"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 0, - "plSection" => array("addon"), - "plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System 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 deleted file mode 100644 index 5ae70c23b..000000000 --- a/gosa-plugins/fai/addons/goto/class_target_list.inc +++ /dev/null @@ -1,334 +0,0 @@ -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 = ""; - $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.= ""; - } else { - $options.= ""; - } - } - } - - /* 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")." ". - "  "; - $listhead .=""; - - $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 = "%s"; - - $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 = ""._("Server").""; - }elseif(in_array("gotoWorkstation",$val['objectClass'])){ - $img = ""._("Workstation").""; - }elseif(in_array("gosaGroupOfNames",$val['objectClass'])){ - $img = ""._("Object group").""; - } - - /* Create each field */ - $field0 = array("string" => "" , - "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 deleted file mode 100644 index d8db5666c..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_activate.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Time schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_faireboot.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_faireboot.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_faireboot.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_goto_reload.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_goto_reload.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_goto_reload.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_halt.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_halt.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_halt.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_installation_activation.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_installation_activation.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_installation_activation.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_localboot.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_localboot.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_localboot.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_lock.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_lock.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_lock.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_memcheck.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_memcheck.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_memcheck.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_notify.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_notify.tpl deleted file mode 100644 index 98ca474b4..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_notify.tpl +++ /dev/null @@ -1,93 +0,0 @@ - -{if $is_new} - - - - - - -
- {t}Message settings{/t} - - - - - - - - - - - - - - - -
{t}Sender{/t}
{t}Subject{/t}
{t}Message{/t} :
- -
-
- {t}Schedule{/t} - - - - -
{$timestamp}

- - - - - - - - -
- {t}Target users{/t} -
- -
- {t}Target groups{/t} -
- -
- - -
-
- -{else} - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_reboot.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_reboot.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_reboot.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_reinstall.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_reinstall.tpl deleted file mode 100644 index b61f37edf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_reinstall.tpl +++ /dev/null @@ -1,67 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Progress{/t}{$progress}
{t}Status{/t}{$status}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/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 deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_reload_ldap_config.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_rescan.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_rescan.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_rescan.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_sysinfo.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_sysinfo.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_sysinfo.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_update.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_update.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_update.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/DaemonEvent_wakeup.tpl b/gosa-plugins/fai/addons/goto/events/DaemonEvent_wakeup.tpl deleted file mode 100644 index 02f6dacaf..000000000 --- a/gosa-plugins/fai/addons/goto/events/DaemonEvent_wakeup.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - -
{t}Schedule{/t}

- {$timestamp}
-
- - - - -
- {t}System list{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent.inc b/gosa-plugins/fai/addons/goto/events/class_DaemonEvent.inc deleted file mode 100644 index f6ae2b7f0..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent.inc +++ /dev/null @@ -1,511 +0,0 @@ - - \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 = "

"._("This job has no template!")."

"; - $str.= "

"; - $str.= "
- -
"; - 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 = "

".sprintf(_("Create '%s' job"),$this->s_Event_Name)."

"; - 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 = "

"; - $str.= "
-   - -
"; - return($str); - } - - - /*! \brief Returns HTML representation of a timestamp using ", - "attach" => "style='width:20px; border-right:0px;'") - )); - } - $list_footer = ""; - 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'] = "".$this->s_Menu_Name.""; - $data['ListImage'] = "".$this->s_Event_Name.""; - 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 deleted file mode 100644 index 5e7224d04..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_activate.inc +++ /dev/null @@ -1,67 +0,0 @@ -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 deleted file mode 100644 index ddf10555e..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_activate_new.inc +++ /dev/null @@ -1,79 +0,0 @@ -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 deleted file mode 100644 index e529c910d..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_faireboot.inc +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100644 index 110b023f7..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_goto_reload.inc +++ /dev/null @@ -1,75 +0,0 @@ -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 deleted file mode 100644 index d7b572d69..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_halt.inc +++ /dev/null @@ -1,69 +0,0 @@ -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 deleted file mode 100644 index 20b14e4a4..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_installation_activation.inc +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100644 index 3906c2df5..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_localboot.inc +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100644 index 8074378c6..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_lock.inc +++ /dev/null @@ -1,67 +0,0 @@ -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 deleted file mode 100644 index ad160addf..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_memcheck.inc +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100644 index 13bf90dd8..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_notify.inc +++ /dev/null @@ -1,211 +0,0 @@ -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 deleted file mode 100644 index b11bd3b4e..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_reboot.inc +++ /dev/null @@ -1,67 +0,0 @@ -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 deleted file mode 100644 index f882842f6..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_recreate_fai_release_db.inc +++ /dev/null @@ -1,51 +0,0 @@ -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 deleted file mode 100644 index 647d9af0a..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_recreate_fai_server_db.inc +++ /dev/null @@ -1,51 +0,0 @@ -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 deleted file mode 100644 index f87bb8e10..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_reinstall.inc +++ /dev/null @@ -1,76 +0,0 @@ -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 deleted file mode 100644 index 1a555b213..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_reload_ldap_config.inc +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100644 index 6d4686e35..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_rescan.inc +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100644 index 05ff34c18..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_sysinfo.inc +++ /dev/null @@ -1,66 +0,0 @@ -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 deleted file mode 100644 index 3571fc328..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_update.inc +++ /dev/null @@ -1,67 +0,0 @@ -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 deleted file mode 100644 index 075482a92..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_DaemonEvent_wakeup.inc +++ /dev/null @@ -1,67 +0,0 @@ -s_Menu_Name = _("Wake up"); - $this->s_Event_Name = _("Wake 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 deleted file mode 100644 index fbc32992a..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_EventTargetAddList.inc +++ /dev/null @@ -1,288 +0,0 @@ -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 the event. Check the targets you want to add and use the 'Apply' button.")); - - /* Toggle all selected / deselected */ - $chk = ""; - - $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.= ""; - } else { - $options.= ""; - } - } - } - - $listhead = $this->get_default_header(); - - /* Add base selection */ - $listhead .= _("Base")."  ". - "  "; - - $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 = 'S'; - - 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 = 'W'; - 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 = 'O'; - } - - $field1 = array("string" => "", - "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 deleted file mode 100644 index 714b6edde..000000000 --- a/gosa-plugins/fai/addons/goto/events/class_EventTargetAddUsersList.inc +++ /dev/null @@ -1,220 +0,0 @@ -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 = ""; - - $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.= ""; - } else { - $options.= ""; - } - } - } - - $listhead = $this->get_default_header(); - - /* Add base selection */ - $listhead .= _("Base")."  ". - "  "; - - $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 = 'U'; - }elseif(in_array("posixGroup",$obj['objectClass'])){ - $img = 'G'; - } - - $field1 = array("string" => "", - "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 deleted file mode 100644 index 0ec59f25f..000000000 --- a/gosa-plugins/fai/addons/goto/events/target_list.tpl +++ /dev/null @@ -1,7 +0,0 @@ -{$divlist} - -

-
-   - -
diff --git a/gosa-plugins/fai/addons/goto/events/timestamp_select.tpl b/gosa-plugins/fai/addons/goto/events/timestamp_select.tpl deleted file mode 100644 index 9253774c9..000000000 --- a/gosa-plugins/fai/addons/goto/events/timestamp_select.tpl +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
{t}Year{/t}{t}Month{/t}{t}Day{/t}  {t}Hour{/t}{t}Minute{/t}{t}Second{/t}
-   - -   - -   -   -   - -   - - -
- diff --git a/gosa-plugins/fai/addons/goto/goto_import_file.tpl b/gosa-plugins/fai/addons/goto/goto_import_file.tpl deleted file mode 100644 index 30bddeaac..000000000 --- a/gosa-plugins/fai/addons/goto/goto_import_file.tpl +++ /dev/null @@ -1,87 +0,0 @@ -

{t}Import jobs{/t}

-

-{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} -

-{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} ] -
-
-{if !$count} -{t}Example{/t}: -
-20080626162556 ; 00:0C:29:99:1E:37 ; job_trigger_activate_new ; goto-client ; dc=test,dc=gonicus,dc=de -
-
-{/if} - -

-  - - - - - -
- {t}Select list to import{/t} - - - -
- - {if $count} -

 

-
-
-
- - - - - - - - - - - - {foreach from=$info item=item key=key} - {if $item.ERROR} - - - - - - - - - - - - - - {else} - {if ($key % 2)} - - {else} - - {/if} - - - - - - - - - - {/if} - {/foreach} -
{t}Timestamp{/t}{t}MAC{/t}{t}Event{/t}{t}Object group{/t}{t}Base{/t}{t}FQDN{/t}{t}IP{/t}{t}DHCP{/t}
{$item.TIMESTAMP}{$item.MAC}{$item.HEADER}{$item.OGROUP}{$item.BASE}{$item.FQDN}{$item.IP}{$item.DHCP}
{$item.ERROR}
{$item.TIMESTAMP}{$item.MAC}{$item.HEADER}{$item.OGROUP}{$item.BASE}{$item.FQDN}{$item.IP}{$item.DHCP}
-
- {/if} -
-

-
-   - -
-
diff --git a/gosa-plugins/fai/addons/goto/gotomasses.tpl b/gosa-plugins/fai/addons/goto/gotomasses.tpl deleted file mode 100644 index 97b3eff01..000000000 --- a/gosa-plugins/fai/addons/goto/gotomasses.tpl +++ /dev/null @@ -1,141 +0,0 @@ - - -{$div} - - -{literal} - -{/literal} diff --git a/gosa-plugins/fai/addons/goto/log_view.tpl b/gosa-plugins/fai/addons/goto/log_view.tpl deleted file mode 100644 index 433214f22..000000000 --- a/gosa-plugins/fai/addons/goto/log_view.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{if !$ACL} - -

{msgPool type=permView}

- -{else} - {if $logs_available} -

{t}Available logs{/t}

- -
{$divlist}
-
-

-

{t}Selected log{/t}: {$selected_log}

-
- {$log_file} -
- {else} -

{t}No logs for this host available!{/t}

- {/if} -{/if} - -{if $standalone} -
- -

-
- -
-
-{/if} diff --git a/gosa-plugins/fai/addons/goto/main.inc b/gosa-plugins/fai/addons/goto/main.inc deleted file mode 100644 index ade2ef7a4..000000000 --- a/gosa-plugins/fai/addons/goto/main.inc +++ /dev/null @@ -1,56 +0,0 @@ -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 deleted file mode 100644 index 975c107c0..000000000 --- a/gosa-plugins/fai/addons/goto/remove.tpl +++ /dev/null @@ -1,20 +0,0 @@ -
-  {t}Warning{/t} -
-

- {$info} -

- -

- {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t} -

- -

-{if $multiple} - -{else} - -{/if} - -

- diff --git a/gosa-plugins/goto/addons/goto/class_gotoLogView.inc b/gosa-plugins/goto/addons/goto/class_gotoLogView.inc new file mode 100644 index 000000000..a5e166ff2 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/class_gotoLogView.inc @@ -0,0 +1,215 @@ + 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 = "\\/"; + }else{ + $img = "/\\sort_by == "file"){ + $img1 = $img; + $img2 = ""; + }else{ + $img1 = ""; + $img2 = $img; + } + + + /* Create list header + */ + $divlist->SetHeader(array( + array("string"=>""._("File")." ".$img1."", + "attach"=>"width='200px;'"), + array("string"=>""._("Date")." ".$img2."", + "attach" => "style='border-right:none;'"), + )); + + /* Create divlist list + */ + $divlist->SetEntriesPerPage(0); + $divlist->SetHeight(150); + + /* Create sortable array + */ + $link = "%str%"; + $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 new file mode 100644 index 000000000..0b3338505 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/class_goto_import_file.inc @@ -0,0 +1,179 @@ +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] = "".strip_tags($val).""; + } + } + } + + $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 new file mode 100644 index 000000000..ad278eaba --- /dev/null +++ b/gosa-plugins/goto/addons/goto/class_gotomasses.inc @@ -0,0 +1,922 @@ +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"), + "
".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.= "..| "._("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.= "..| "._("Import")."|import_file\n"; + $s.= "..| "._("Remove")."|remove_multiple\n"; + } + if(preg_match("/w/",$this->getacl(""))){ + $s.= "..|---|\n"; + $s.= "..|"._("Resume")." "._("Resume")."|resume_all\n"; + $s.= "..|"._("Pause")." "._("Pause")."|pause_all\n"; + $s.= "..|"._("Abort")." "._("Abort")."|abort_process_all\n"; + $s.= "..|"._("Execute")." "._("Execute")."|execute_process_all\n"; + } + + $divlist->SetDropDownHeaderMenu($s); + + if($this->sort_dir == "up"){ + $sort_img = "/\"; + }else{ + $sort_img = "\/"; + } + + 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(""); + + $plug = $_GET['plug']; + $chk = ""; + + /* set Page header */ + $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); + $divlist->AddHeader(array("string"=>""._("Target").$sort_img_1."")); + $divlist->AddHeader(array("string"=>""._("Task").$sort_img_2."", + "attach"=>"style='width:120px;'")); + $divlist->AddHeader(array("string"=>""._("Schedule").$sort_img_3."", + "attach"=>"style='width:140px;'")); + $divlist->AddHeader(array("string"=>""._("Status").$sort_img_4."", + "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.= " "; + $prio_actions.= " "; + } + + /* If WAITING add pause action + */ + if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){ + $prio_actions.= " "; + } + + /* If PAUSED add resume action + */ + if(in_array($task['STATUS'],array("paused")) && $this->acl_is_writeable("")){ + $prio_actions.= " "; + } + + /* If PAUSED or WAITING add execution action + */ + if(in_array($task['STATUS'],array("paused","waiting")) && $this->acl_is_writeable("")){ + $prio_actions.= " "; + } + + /* Add logview button, currently ever. + */ + if($this->acl_is_readable("")){ + $action .= " "; + } + + /* If PAUSED or WAITING add edit action + */ + if(in_array($task['STATUS'],array("waiting")) && $this->acl_is_writeable("")){ + $action.= ""; + } + + /* If PROCESSING add abort action + */ + if(in_array($task['STATUS'],array("processing")) && preg_match("/install/",$task['HEADERTAG']) && $this->acl_is_writeable("")){ + $action.= ""; + $action.= ""; + } + + /* If WAITING or ERROR add remove action + */ + if( $this->acl_is_removeable() && in_array($task['STATUS'],array("waiting","error","processed"))){ + $action.= ""; + } + if($this->acl_is_writeable("") && in_array($task['STATUS'],array("processing")) && !preg_match("/install/",$task['HEADERTAG'])){ + $action.= ""; + } + + /* 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 = " "._("Waiting"); + } + if($status == "error"){ + $status = " "._("Error"); + } + if($status == "processed"){ + $status = " "._("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 = " "._("Locked"); + + /* Show hardware detect? */ + } elseif ($percent == "goto-hardware-detection") { + $status = " "._("Detection"); + + /* Real percent */ + } else { + if (preg_match('/install/', $task['HEADERTAG'])){ + $status = ""; + } else { + $status = preg_replace('/ /', ' ', _("in progress")); + } + } + } + + /* Create each field */ + $field0 = array("string" => "" , + "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(_("Required class '%s' cannot be found: job not aborted!"), + "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"), "

".$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 deployment"), + "plDescription" => _("Provide a mechanism to automatically activate systems"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 0, + "plSection" => array("addon"), + "plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System 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 new file mode 100644 index 000000000..5ae70c23b --- /dev/null +++ b/gosa-plugins/goto/addons/goto/class_target_list.inc @@ -0,0 +1,334 @@ +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 = ""; + $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.= ""; + } else { + $options.= ""; + } + } + } + + /* 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")." ". + "  "; + $listhead .=""; + + $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 = "%s"; + + $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 = ""._("Server").""; + }elseif(in_array("gotoWorkstation",$val['objectClass'])){ + $img = ""._("Workstation").""; + }elseif(in_array("gosaGroupOfNames",$val['objectClass'])){ + $img = ""._("Object group").""; + } + + /* Create each field */ + $field0 = array("string" => "" , + "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 new file mode 100644 index 000000000..d8db5666c --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_activate.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Time schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_faireboot.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_faireboot.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_faireboot.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_goto_reload.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_goto_reload.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_goto_reload.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_halt.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_halt.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_halt.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_installation_activation.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_installation_activation.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_installation_activation.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_localboot.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_localboot.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_localboot.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_lock.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_lock.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_lock.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_memcheck.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_memcheck.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_memcheck.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_notify.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_notify.tpl new file mode 100644 index 000000000..98ca474b4 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_notify.tpl @@ -0,0 +1,93 @@ + +{if $is_new} + + + + + + +
+ {t}Message settings{/t} + + + + + + + + + + + + + + + +
{t}Sender{/t}
{t}Subject{/t}
{t}Message{/t} :
+ +
+
+ {t}Schedule{/t} + + + + +
{$timestamp}

+ + + + + + + + +
+ {t}Target users{/t} +
+ +
+ {t}Target groups{/t} +
+ +
+ + +
+
+ +{else} + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_reboot.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reboot.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reboot.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_reinstall.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reinstall.tpl new file mode 100644 index 000000000..b61f37edf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reinstall.tpl @@ -0,0 +1,67 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Progress{/t}{$progress}
{t}Status{/t}{$status}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/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 new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reload_ldap_config.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_rescan.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_rescan.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_rescan.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_sysinfo.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_sysinfo.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_sysinfo.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_update.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_update.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_update.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_wakeup.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_wakeup.tpl new file mode 100644 index 000000000..02f6dacaf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_wakeup.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + +
{t}Schedule{/t}

+ {$timestamp}
+
+ + + + +
+ {t}System list{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc new file mode 100644 index 000000000..f6ae2b7f0 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc @@ -0,0 +1,511 @@ + + \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 = "

"._("This job has no template!")."

"; + $str.= "

"; + $str.= "
+ +
"; + 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 = "

".sprintf(_("Create '%s' job"),$this->s_Event_Name)."

"; + 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 = "

"; + $str.= "
+   + +
"; + return($str); + } + + + /*! \brief Returns HTML representation of a timestamp using ", + "attach" => "style='width:20px; border-right:0px;'") + )); + } + $list_footer = ""; + 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'] = "".$this->s_Menu_Name.""; + $data['ListImage'] = "".$this->s_Event_Name.""; + 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 new file mode 100644 index 000000000..5e7224d04 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_activate.inc @@ -0,0 +1,67 @@ +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 new file mode 100644 index 000000000..ddf10555e --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_activate_new.inc @@ -0,0 +1,79 @@ +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 new file mode 100644 index 000000000..e529c910d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_faireboot.inc @@ -0,0 +1,66 @@ +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 new file mode 100644 index 000000000..110b023f7 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_goto_reload.inc @@ -0,0 +1,75 @@ +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 new file mode 100644 index 000000000..d7b572d69 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_halt.inc @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..20b14e4a4 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_installation_activation.inc @@ -0,0 +1,66 @@ +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 new file mode 100644 index 000000000..3906c2df5 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_localboot.inc @@ -0,0 +1,66 @@ +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 new file mode 100644 index 000000000..8074378c6 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_lock.inc @@ -0,0 +1,67 @@ +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 new file mode 100644 index 000000000..ad160addf --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_memcheck.inc @@ -0,0 +1,66 @@ +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 new file mode 100644 index 000000000..13bf90dd8 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_notify.inc @@ -0,0 +1,211 @@ +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 new file mode 100644 index 000000000..b11bd3b4e --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reboot.inc @@ -0,0 +1,67 @@ +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 new file mode 100644 index 000000000..f882842f6 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_recreate_fai_release_db.inc @@ -0,0 +1,51 @@ +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 new file mode 100644 index 000000000..647d9af0a --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_recreate_fai_server_db.inc @@ -0,0 +1,51 @@ +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 new file mode 100644 index 000000000..f87bb8e10 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reinstall.inc @@ -0,0 +1,76 @@ +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 new file mode 100644 index 000000000..1a555b213 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reload_ldap_config.inc @@ -0,0 +1,66 @@ +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 new file mode 100644 index 000000000..6d4686e35 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_rescan.inc @@ -0,0 +1,66 @@ +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 new file mode 100644 index 000000000..05ff34c18 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_sysinfo.inc @@ -0,0 +1,66 @@ +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 new file mode 100644 index 000000000..3571fc328 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_update.inc @@ -0,0 +1,67 @@ +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 new file mode 100644 index 000000000..075482a92 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_wakeup.inc @@ -0,0 +1,67 @@ +s_Menu_Name = _("Wake up"); + $this->s_Event_Name = _("Wake 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 new file mode 100644 index 000000000..fbc32992a --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_EventTargetAddList.inc @@ -0,0 +1,288 @@ +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 the event. Check the targets you want to add and use the 'Apply' button.")); + + /* Toggle all selected / deselected */ + $chk = ""; + + $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.= ""; + } else { + $options.= ""; + } + } + } + + $listhead = $this->get_default_header(); + + /* Add base selection */ + $listhead .= _("Base")."  ". + "  "; + + $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 = 'S'; + + 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 = 'W'; + 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 = 'O'; + } + + $field1 = array("string" => "", + "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 new file mode 100644 index 000000000..714b6edde --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_EventTargetAddUsersList.inc @@ -0,0 +1,220 @@ +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 = ""; + + $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.= ""; + } else { + $options.= ""; + } + } + } + + $listhead = $this->get_default_header(); + + /* Add base selection */ + $listhead .= _("Base")."  ". + "  "; + + $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 = 'U'; + }elseif(in_array("posixGroup",$obj['objectClass'])){ + $img = 'G'; + } + + $field1 = array("string" => "", + "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 new file mode 100644 index 000000000..0ec59f25f --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/target_list.tpl @@ -0,0 +1,7 @@ +{$divlist} + +

+
+   + +
diff --git a/gosa-plugins/goto/addons/goto/events/timestamp_select.tpl b/gosa-plugins/goto/addons/goto/events/timestamp_select.tpl new file mode 100644 index 000000000..9253774c9 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/timestamp_select.tpl @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + +
{t}Year{/t}{t}Month{/t}{t}Day{/t}  {t}Hour{/t}{t}Minute{/t}{t}Second{/t}
+   + +   + +   +   +   + +   + + +
+ diff --git a/gosa-plugins/goto/addons/goto/goto_import_file.tpl b/gosa-plugins/goto/addons/goto/goto_import_file.tpl new file mode 100644 index 000000000..30bddeaac --- /dev/null +++ b/gosa-plugins/goto/addons/goto/goto_import_file.tpl @@ -0,0 +1,87 @@ +

{t}Import jobs{/t}

+

+{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} +

+{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} ] +
+
+{if !$count} +{t}Example{/t}: +
+20080626162556 ; 00:0C:29:99:1E:37 ; job_trigger_activate_new ; goto-client ; dc=test,dc=gonicus,dc=de +
+
+{/if} + +

+  + + + + + +
+ {t}Select list to import{/t} + + + +
+ + {if $count} +

 

+
+
+
+ + + + + + + + + + + + {foreach from=$info item=item key=key} + {if $item.ERROR} + + + + + + + + + + + + + + {else} + {if ($key % 2)} + + {else} + + {/if} + + + + + + + + + + {/if} + {/foreach} +
{t}Timestamp{/t}{t}MAC{/t}{t}Event{/t}{t}Object group{/t}{t}Base{/t}{t}FQDN{/t}{t}IP{/t}{t}DHCP{/t}
{$item.TIMESTAMP}{$item.MAC}{$item.HEADER}{$item.OGROUP}{$item.BASE}{$item.FQDN}{$item.IP}{$item.DHCP}
{$item.ERROR}
{$item.TIMESTAMP}{$item.MAC}{$item.HEADER}{$item.OGROUP}{$item.BASE}{$item.FQDN}{$item.IP}{$item.DHCP}
+
+ {/if} +
+

+
+   + +
+
diff --git a/gosa-plugins/goto/addons/goto/gotomasses.tpl b/gosa-plugins/goto/addons/goto/gotomasses.tpl new file mode 100644 index 000000000..97b3eff01 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/gotomasses.tpl @@ -0,0 +1,141 @@ + + +{$div} + + +{literal} + +{/literal} diff --git a/gosa-plugins/goto/addons/goto/log_view.tpl b/gosa-plugins/goto/addons/goto/log_view.tpl new file mode 100644 index 000000000..433214f22 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/log_view.tpl @@ -0,0 +1,29 @@ +{if !$ACL} + +

{msgPool type=permView}

+ +{else} + {if $logs_available} +

{t}Available logs{/t}

+ +
{$divlist}
+
+

+

{t}Selected log{/t}: {$selected_log}

+
+ {$log_file} +
+ {else} +

{t}No logs for this host available!{/t}

+ {/if} +{/if} + +{if $standalone} +
+ +

+
+ +
+
+{/if} diff --git a/gosa-plugins/goto/addons/goto/main.inc b/gosa-plugins/goto/addons/goto/main.inc new file mode 100644 index 000000000..ade2ef7a4 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/main.inc @@ -0,0 +1,56 @@ +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 new file mode 100644 index 000000000..975c107c0 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/remove.tpl @@ -0,0 +1,20 @@ +
+  {t}Warning{/t} +
+

+ {$info} +

+ +

+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t} +

+ +

+{if $multiple} + +{else} + +{/if} + +

+