From: cajus Date: Tue, 4 Mar 2008 10:22:58 +0000 (+0000) Subject: Updated X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f513211908f96acf7d1be71a2a27be83513d17cb;p=gosa.git Updated git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9303 594d385d-05f5-0310-b6e9-bd551577e9d8 --- 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..e1556f54b --- /dev/null +++ b/gosa-plugins/goto/addons/goto/class_gotomasses.inc @@ -0,0 +1,766 @@ +config= &$config; + $this->o_queue = new gosaSupportDaemon(TRUE,10); + $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['BY_CLASS'] as $evt){ + if(isset($evt['s_Queued_Action'])){ + $this->event_tags[] = $evt['s_Queued_Action']; + } + } + } + + + 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", + "/^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']; + } + + + /************ + * Handle Priority modifications + ************/ + + if(preg_match("/^prio_/",$s_action)){ + 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)){ + + 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)){ + $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"){ + $id = $s_entry; + $type = FALSE; + if(isset($this->entries[$id])){ + $event = $this->entries[$s_entry]; + + + if($event['STATUS'] == "waiting" && isset($this->events['BY_QUEUED_ACTION'][$event['HEADERTAG']])){ + $type = $this->events['BY_QUEUED_ACTION'][$event['HEADERTAG']]; + $this->dialog = new $type['CLASS_NAME']($this->config,$event); + } + } + } + + /************ + * REMOVE + ************/ + + /* Remove multiple */ + if($s_action == "remove_multiple" || $s_action == "remove"){ + + if(!$this->acl_is_removeable()){ + msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG); + }else{ + + if($s_action == "remove"){ + $ids = array($s_entry); + }else{ + $ids = $this->list_get_selected_items(); + } + + if(count($ids)){ + $ret = $this->o_queue->ids_exist($ids); + $ret = $this->o_queue->get_entries_by_id($ret); + + $tmp = ""; + foreach($ret as $task){ + + /* Only remove WAITING or ERROR entries */ + if(in_array($task['STATUS'],array("waiting","error"))){ + $this->ids_to_remove[] = $task['ID']; + if(isset($this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']])){ + $evt = $this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']]; + $tmp.= "\n".$task['ID']." - ".$evt['s_Menu_Name']." ".$task['MACADDRESS']; + }else{ + $tmp.= "\n".$task['ID']." - ".$task['HEADERTAG']." ".$task['MACADDRESS']; + } + } + } + $smarty->assign("multiple", TRUE); + $smarty->assign("info",sprintf(_("You are about to remove the following actions from the GOsa support Daemon: %s"),"
".$tmp."
")); + $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'])){ + $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(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."), + $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(); + return($this->dialog->execute()); + } + + /************ + * 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"; + foreach($this->events['BY_CLASS'] as $name => $event){ + $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n"; + } + if($this->acl_is_removeable()){ + $s.= "..|---|\n"; + $s.= "..| "._("Remove")."|remove_multiple\n"; + } + if(preg_match("/w/",$this->getacl(""))){ + $s.= "..|---|\n"; + $s.= "..| "._("Resume all")."|resume_all\n"; + $s.= "..| "._("Pause all")."|pause_all\n"; + $s.= "..| "._("Abort all")."|abort_process_all\n"; + $s.= "..| "._("Execute all")."|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:100px;'")); + $divlist->AddHeader(array("string"=>""._("Status").$sort_img_4."", + "attach"=>"style='width:80px;'")); + $divlist->AddHeader(array("string"=>_("Action"), + "attach"=>"style='border-right:0px;width:120px;'")); + + + /* 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"))){ + $prio_actions.= " "; + $prio_actions.= " "; + } + + /* If WAITING add pause action + */ + if(in_array($task['STATUS'],array("waiting"))){ + $prio_actions.= " "; + } + + /* If PAUSED add resume action + */ + if(in_array($task['STATUS'],array("paused"))){ + $prio_actions.= " "; + } + + /* If PROCESSING add abort action + */ + if(in_array($task['STATUS'],array("processing"))){ + $prio_actions.= ""; + } + + /* If PAUSED or WAITING add execution action + */ + if(in_array($task['STATUS'],array("paused","waiting"))){ + $prio_actions.= " "; + } + + /* If PAUSED or WAITING add edit action + */ + if(in_array($task['STATUS'],array("waiting"))){ + $action.= ""; + } + + /* If WAITING or ERROR add remove action + */ + if( $this->acl_is_removeable() && in_array($task['STATUS'],array("waiting","error"))){ + $action.= ""; + } + + $color = ""; + $display = $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['BY_QUEUED_ACTION'][$task['HEADERTAG']]['s_Menu_Name'])){ + $event_type = $this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']]; + $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"); + } + + /* Special handling for all entries that have + STATUS == "processing" && PROGRESS == NUMERIC + */ + if($status == "processing" && isset($task['PROGRESS'])){ + $percent = $task['PROGRESS']; + $status = "".$percent." %"; + } + + + /* Create each field */ + $field0 = array("string" => "" , + "attach" => "style='width:20px;".$color."'"); + $field1 = array("string" => $display, + "attach" => "style='".$color."'"); + $field1a= array("string" => $display2, + "attach" => "style='".$color.";width:120px;'"); + $field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:100px;'"); + $field3 = array("string" => $status,"attach" => "style='".$color.";width:80px;'"); + $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;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(); + $smarty->assign("range_selector", 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(_("Could not 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(_("Could not 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); + if(!$this->o_queue->append($tmp)){ + msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG); + return(FALSE); + } + }else{ + msg_dialog::display(_("Error"), + sprintf(_("The Job could not be aborted, the '%s' event class was not found."), + "DaemonEvent_faireboot") , ERROR_DIALOG); + } + } + + + /*! \brief Pauses the specified queue entry from execution. + * @return Boolean TRUE in case of success, else FALSE. + */ + private function pause_queue_entries($ids) + { + if(!count($ids)){ + return; + } + + /* Entries are paused by setting the status to + * something different from 'waiting'. + * We simply use 'paused'. + */ + $data = array("status" => "paused"); + + /* Detect if the ids we got are valid and + * check if the status allows pausing. + */ + $update_ids = array(); + foreach($this->o_queue->get_entries_by_id($ids) as $entry){ + if(isset($entry['STATUS']) && preg_match("/waiting/",$entry['STATUS'])){ + $update_ids[] = $entry['ID']; + } + } + + /* Tell the daemon that we want to update some entries + */ + if(count($update_ids)){ + if(!$this->o_queue->update_entries($update_ids,$data)){ + msg_dialog::display(_("Error"), sprintf(_("Could not 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){ + $this->entries[$entry['ID']]= $entry; + } + } + + + /*! \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']; + } + + /* 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(); + if($this->start >= $count){ + $this->start = $count -1; + } + if($this->start < 0){ + $this->start = 0; + } + } + + + function save() + { + // We do not save anything here. + } + + + /*! \brief Return a list of all selected items. + @return Array Returns an array containing all selected item ids. + */ + function list_get_selected_items() + { + $ids = array(); + foreach($_POST as $name => $value){ + if(preg_match("/^item_selected_[0-9]*$/",$name)){ + $id = preg_replace("/^item_selected_/","",$name); + $ids[$id] = $id; + } + } + return($ids); + } + + + static function plInfo() + { + return (array( + "plShortName" => _("System mass deployment"), + "plDescription" => _("Provide a mechanism to automatically activate a set of systems"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 0, + "plSection" => array("addon"), + "plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))), + "plProvidedAcls" => array("Comment" => _("Description")) + )); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/addons/goto/class_target_list.inc b/gosa-plugins/goto/addons/goto/class_target_list.inc new file mode 100644 index 000000000..d2c49aeb2 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/class_target_list.inc @@ -0,0 +1,335 @@ +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", _("Select to search within subtrees"), _("Search in subtrees"), 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 + $linkopen = "%s"; + $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"), _("IP range is invalid!"), ERROR_DIALOG); + return; + } + if(!tests::is_ip($IP_end)){ + msg_dialog::display(_("Error"), _("IP range is invalid!"), 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('workstationou').$base, + array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT )); + $res= array_merge($res,get_list($filter, "server", get_ou('serverou').$base, + array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT )); + + $deps_a = array( + get_ou("workstationou"), + get_ou("incominou"), + get_ou("serverou"), + get_ou("ogroupou")); + + $res = get_sub_list($filter,array("server","incoming","workstation","ogroup"), + $deps_a,get_ou("systemsou").$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_faireboot.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_faireboot.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_faireboot.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_halt.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_halt.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_halt.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_install.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_install.tpl new file mode 100644 index 000000000..40a62eb70 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_install.tpl @@ -0,0 +1,67 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/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_installation_activation.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_installation_activation.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_installation_activation.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_localboot.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_localboot.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_localboot.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_memcheck.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_memcheck.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_memcheck.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_notify.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_notify.tpl new file mode 100644 index 000000000..25a8618ef --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_notify.tpl @@ -0,0 +1,60 @@ + +{if $is_new} + + + + + + + + + + + + + + + + +
{t}Send on:{/t}{$timestamp}
+ {t}Subject{/t} + + +
+ {t}Text{/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..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reboot.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_reinstall.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reinstall.tpl new file mode 100644 index 000000000..40a62eb70 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reinstall.tpl @@ -0,0 +1,67 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/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..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_reload_ldap_config.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_rescan.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_rescan.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_rescan.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_sysinfo.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_sysinfo.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_sysinfo.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_update.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_update.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_update.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/DaemonEvent_wakeup.tpl b/gosa-plugins/goto/addons/goto/events/DaemonEvent_wakeup.tpl new file mode 100644 index 000000000..4e3fc127d --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/DaemonEvent_wakeup.tpl @@ -0,0 +1,63 @@ + +{if $is_new} + + + + + + +
+ + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
+
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc new file mode 100644 index 000000000..ae4f7e310 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc @@ -0,0 +1,504 @@ + + \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; + + 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 event 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 = "

"._("Daemon event")." - ".$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; + foreach($this->list_get_selected_items() as $id){ + if(in_array("gosaGroupOfNames",$this->target_divlist->_target_list[$id]['objectClass'])){ + foreach($this->target_divlist->_target_list[$id]['member'] as $mem_dn){ + if(isset($this->target_divlist->workstation_list[$mem_dn])){ + $this->a_targets[] = $this->target_divlist->workstation_list[$mem_dn]['macAddress'][0]; + } + if(isset($this->target_divlist->server_list[$mem_dn])){ + $this->a_targets[] = $this->target_divlist->server_list[$mem_dn]['macAddress'][0]; + } + } + }else{ + if(isset($this->target_divlist->_target_list[$id]['macAddress'][0])){ + $this->a_targets[] = $this->target_divlist->_target_list[$id]['macAddress'][0]; + } + } + } + $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); + foreach(array("s_Menu_Name","s_Event_Name","s_Queued_Action","s_Schedule_Action","s_Trigger_Action") as $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['BY_TRIGGERED_ACTION'] = array(); + $list['BY_SCHEDULED_ACTION'] = array(); + $list['BY_QUEUED_ACTION'] = 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; + $list['BY_TRIGGERED_ACTION'][$evt['s_Trigger_Action']] = $evt; + $list['BY_SCHEDULED_ACTION'][$evt['s_Schedule_Action']] = $evt; + $list['BY_QUEUED_ACTION'] [$evt['s_Queued_Action']] = $evt; + } + } + } + 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() + { + return(array("timestamp" => $this->_timestamp_to_event($this->timestamp))); + } + + + /*! \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() + { + return($this->_timestamp_to_event($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 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); + } + + + /*! \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; + } + } +} + +// 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_halt.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_halt.inc new file mode 100644 index 000000000..f743f009b --- /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/status_stopped.png"; + $this->s_List_Image = "images/status_stopped.png"; + } + + public function execute() + { + DaemonEvent::execute(); + + $display = $this->get_header(); + + $tmp = $this->data; + + /* Check if target add dialog is open */ + if($this->is_target_list_open() && $this->is_new){ + return($this->get_target_add_list()); + } + + $smarty = get_smarty(); + $smarty->assign("data" , $this->data); + $smarty->assign("target_list" , $this->get_target_list()); + $smarty->assign("is_new" , $this->is_new); + $smarty->assign("timestamp" , $this->get_time_select()); + $display.= $smarty->fetch(get_template_path('DaemonEvent_halt.tpl', TRUE, dirname(__FILE__))); + $display.= $this->get_footer(); + return($display); + } + + public function save_object() + { + DaemonEvent::save_object(); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_install.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_install.inc new file mode 100644 index 000000000..32d5aed11 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_install.inc @@ -0,0 +1,82 @@ +s_Menu_Name = _("Install"); + $this->s_Event_Name = _("Install"); + $this->s_Schedule_Action = "job_trigger_action_install"; + $this->s_Trigger_Action= "gosa_trigger_action_install"; + $this->s_Queued_Action= "trigger_action_install"; + $this->s_Menu_Image = "images/fai_small.png"; + $this->s_List_Image = "images/fai_small.png"; + + if(!$this->is_new()){ + if(isset($data['PROGRESS'])){ + $this->progress = $data['PROGRESS']; + } + if(isset($data['STATUS'])){ + $this->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_install.tpl', TRUE, dirname(__FILE__))); + $display.= $this->get_footer(); + return($display); + } + + public function save() + { + $ret = DaemonEvent::save(); + return($ret); + } +} +// 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..f3ff263d6 --- /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 = "images/select_workstation.png"; + $this->s_List_Image = "images/select_workstation.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_memcheck.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_memcheck.inc new file mode 100644 index 000000000..e2d238c51 --- /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 = "images/memory.png"; + $this->s_List_Image = "images/memory.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..7486e7ea8 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_notify.inc @@ -0,0 +1,71 @@ +s_Menu_Name = _("Send message"); + $this->s_Event_Name = _("Send message"); + $this->s_Schedule_Action = "job_trigger_action_notify"; + $this->s_Trigger_Action= "gosa_trigger_action_notify"; + $this->s_Queued_Action= "trigger_action_notify"; + $this->s_Menu_Image = "images/mailto.png"; + $this->s_List_Image = "images/mailto.png"; + + $this->a_targets = array("GOsa"); + } + + public function execute() + { + DaemonEvent::execute(); + $display = $this->get_header(); + $tmp = $this->data; + $smarty = get_smarty(); + $smarty->assign("subject" ,"subject"); + $smarty->assign("message" ,"message"); + $smarty->assign("data" , $this->data); + $smarty->assign("data" , $this->data); + $smarty->assign("is_new" , $this->is_new); + $smarty->assign("timestamp" , $this->get_time_select()); + $display.= $smarty->fetch(get_template_path('DaemonEvent_notify.tpl', TRUE, dirname(__FILE__))); + $display.= $this->get_footer(); + return($display); + } + + public function save_object() + { + DaemonEvent::save_object(); + } + + public function save() + { + $ret = DaemonEvent::save(); + $ret['user'] = array("test","asdf"); + print_a($ret); + 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..e0b55999d --- /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/list_reload.png"; + $this->s_List_Image = "images/list_reload.png"; + } + + public function execute() + { + DaemonEvent::execute(); + + $display = $this->get_header(); + + $tmp = $this->data; + + /* Check if target add dialog is open */ + if($this->is_target_list_open() && $this->is_new){ + return($this->get_target_add_list()); + } + + $smarty = get_smarty(); + $smarty->assign("data" , $this->data); + $smarty->assign("target_list" , $this->get_target_list()); + $smarty->assign("is_new" , $this->is_new); + $smarty->assign("timestamp" , $this->get_time_select()); + $display.= $smarty->fetch(get_template_path('DaemonEvent_reboot.tpl', TRUE, dirname(__FILE__))); + $display.= $this->get_footer(); + return($display); + } + + public function save_object() + { + DaemonEvent::save_object(); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reinstall.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reinstall.inc new file mode 100644 index 000000000..77c71c9ce --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_reinstall.inc @@ -0,0 +1,82 @@ +s_Menu_Name = _("Reinstall"); + $this->s_Event_Name = _("Reinstall"); + $this->s_Schedule_Action = "job_trigger_action_reinstall"; + $this->s_Trigger_Action= "gosa_trigger_action_reinstall"; + $this->s_Queued_Action= "trigger_action_reinstall"; + $this->s_Menu_Image = "images/fai_small.png"; + $this->s_List_Image = "images/fai_small.png"; + + if(!$this->is_new()){ + if(isset($data['PROGRESS'])){ + $this->progress = $data['PROGRESS']; + } + if(isset($data['STATUS'])){ + $this->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); + } + + public function save() + { + $ret = DaemonEvent::save(); + return($ret); + } +} +// 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..2dcb00f5b --- /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_reload_ldap_config"; + $this->s_Trigger_Action = "gosa_reload_ldap_config"; + $this->s_Queued_Action = "reload_ldap_config"; + $this->s_Menu_Image = "images/edit.png"; + $this->s_List_Image = "images/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..f44647604 --- /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_trigger_action_rescan"; + $this->s_Trigger_Action = "gosa_trigger_action_rescan"; + $this->s_Queued_Action = "trigger_action_rescan"; + $this->s_Menu_Image = "images/snd_hardware.png"; + $this->s_List_Image = "images/snd_hardware.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..0e9cf111d --- /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 = "images/hardware.png"; + $this->s_List_Image = "images/hardware.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..bace753f6 --- /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= "gosa_trigger_action_update"; + $this->s_Queued_Action= "trigger_action_update"; + $this->s_Menu_Image = "images/time.png"; + $this->s_List_Image = "images/time.png"; + } + + public function execute() + { + DaemonEvent::execute(); + + $display = $this->get_header(); + + $tmp = $this->data; + + /* Check if target add dialog is open */ + if($this->is_target_list_open() && $this->is_new){ + return($this->get_target_add_list()); + } + + $smarty = get_smarty(); + $smarty->assign("data" , $this->data); + $smarty->assign("target_list" , $this->get_target_list()); + $smarty->assign("is_new" , $this->is_new); + $smarty->assign("timestamp" , $this->get_time_select()); + $display.= $smarty->fetch(get_template_path('DaemonEvent_update.tpl', TRUE, dirname(__FILE__))); + $display.= $this->get_footer(); + return($display); + } + + public function save_object() + { + DaemonEvent::save_object(); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_wakeup.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent_wakeup.inc new file mode 100644 index 000000000..729d945fa --- /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 = _("Start a system"); + $this->s_Schedule_Action= "job_trigger_action_wake"; + $this->s_Trigger_Action = "gosa_trigger_action_wake"; + $this->s_Queued_Action = "trigger_action_wake"; + $this->s_Menu_Image = "images/status_running.png"; + $this->s_List_Image = "images/status_running.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..e3b524381 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/class_EventTargetAddList.inc @@ -0,0 +1,249 @@ +parent = $parent; + $this->ui = get_userinfo(); + + + $this->target_divlist = new MultiSelectWindow($this->config,"EventAddTargedtList","gotomasses"); + $this->SetSummary(_("Targets")); + $this->EnableCloseButton(FALSE); + $this->EnableSaveButton(FALSE); + + $this->SetInformation(_("This dialog shows all available targets for your event, check the targets you want to add and use the 'Use' button to accept.")); + + /* Toggle all selected / deselected */ + $chk = ""; + + $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/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("serverou"),$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("workstationou"),$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 setEntries() + { + $_target_list = array(); + if($this->display_server){ + $_target_list = array_merge($_target_list, + get_list("(&(cn=".$this->regex.")(objectClass=goServer))", + "server",get_ou("serverou").$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("workstationou").$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("ogroupou").$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)); + } + } +} +// 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..589ff244c --- /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..c9a206bd0 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/events/timestamp_select.tpl @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + +
{t}Jahr{/t}{t}Monat{/t}{t}Tag{/t}{t}Stunde{/t}{t}Minute{/t}{t}Sekunde{/t}
+   + +   + +   + +   + +   + + +
+ diff --git a/gosa-plugins/goto/addons/goto/goto_task.tpl b/gosa-plugins/goto/addons/goto/goto_task.tpl new file mode 100644 index 000000000..61220bd45 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/goto_task.tpl @@ -0,0 +1,99 @@ + + + + + + + + +
+

{t}Job details{/t}

+
+ + + + + + + + + + + + + +
{t}Job ID{/t}{$ID}
+ {t}Header Tag{/t} + + + +
  +
+ {t}Schedule Execution{/t} + + + + + + + + + + + + + + + + + + +
{t}Jahr{/t}{t}Monat{/t}{t}Tag{/t}{t}Stunde{/t}{t}Minute{/t}{t}Sekunde{/t}
+   + +   + +   + +   + +   + + +
+
+
+ +{if $HEADERTAG == "ping"} + + +{elseif $HEADERTAG == "sayHello"} + + +{else} + +{/if} +
{t}Status{/t}
{t}Mac{/t}
{t}Status{/t}
{t}Mac{/t}
{t}Job type not implented{/t}
+
+ +

 

+ +

+ + +

diff --git a/gosa-plugins/goto/addons/goto/gotomasses.tpl b/gosa-plugins/goto/addons/goto/gotomasses.tpl new file mode 100644 index 000000000..844cdebf6 --- /dev/null +++ b/gosa-plugins/goto/addons/goto/gotomasses.tpl @@ -0,0 +1,4 @@ +{$div} +
+{$range_selector} +
diff --git a/gosa-plugins/goto/addons/goto/main.inc b/gosa-plugins/goto/addons/goto/main.inc new file mode 100644 index 000000000..8c6bd8088 --- /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('images/system.png'), _("System deployment")).$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..6113ae3be --- /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} + +

+ diff --git a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc deleted file mode 100644 index e1556f54b..000000000 --- a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc +++ /dev/null @@ -1,766 +0,0 @@ -config= &$config; - $this->o_queue = new gosaSupportDaemon(TRUE,10); - $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['BY_CLASS'] as $evt){ - if(isset($evt['s_Queued_Action'])){ - $this->event_tags[] = $evt['s_Queued_Action']; - } - } - } - - - 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", - "/^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']; - } - - - /************ - * Handle Priority modifications - ************/ - - if(preg_match("/^prio_/",$s_action)){ - 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)){ - - 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)){ - $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"){ - $id = $s_entry; - $type = FALSE; - if(isset($this->entries[$id])){ - $event = $this->entries[$s_entry]; - - - if($event['STATUS'] == "waiting" && isset($this->events['BY_QUEUED_ACTION'][$event['HEADERTAG']])){ - $type = $this->events['BY_QUEUED_ACTION'][$event['HEADERTAG']]; - $this->dialog = new $type['CLASS_NAME']($this->config,$event); - } - } - } - - /************ - * REMOVE - ************/ - - /* Remove multiple */ - if($s_action == "remove_multiple" || $s_action == "remove"){ - - if(!$this->acl_is_removeable()){ - msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG); - }else{ - - if($s_action == "remove"){ - $ids = array($s_entry); - }else{ - $ids = $this->list_get_selected_items(); - } - - if(count($ids)){ - $ret = $this->o_queue->ids_exist($ids); - $ret = $this->o_queue->get_entries_by_id($ret); - - $tmp = ""; - foreach($ret as $task){ - - /* Only remove WAITING or ERROR entries */ - if(in_array($task['STATUS'],array("waiting","error"))){ - $this->ids_to_remove[] = $task['ID']; - if(isset($this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']])){ - $evt = $this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']]; - $tmp.= "\n".$task['ID']." - ".$evt['s_Menu_Name']." ".$task['MACADDRESS']; - }else{ - $tmp.= "\n".$task['ID']." - ".$task['HEADERTAG']." ".$task['MACADDRESS']; - } - } - } - $smarty->assign("multiple", TRUE); - $smarty->assign("info",sprintf(_("You are about to remove the following actions from the GOsa support Daemon: %s"),"
".$tmp."
")); - $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'])){ - $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(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."), - $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(); - return($this->dialog->execute()); - } - - /************ - * 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"; - foreach($this->events['BY_CLASS'] as $name => $event){ - $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n"; - } - if($this->acl_is_removeable()){ - $s.= "..|---|\n"; - $s.= "..| "._("Remove")."|remove_multiple\n"; - } - if(preg_match("/w/",$this->getacl(""))){ - $s.= "..|---|\n"; - $s.= "..| "._("Resume all")."|resume_all\n"; - $s.= "..| "._("Pause all")."|pause_all\n"; - $s.= "..| "._("Abort all")."|abort_process_all\n"; - $s.= "..| "._("Execute all")."|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:100px;'")); - $divlist->AddHeader(array("string"=>""._("Status").$sort_img_4."", - "attach"=>"style='width:80px;'")); - $divlist->AddHeader(array("string"=>_("Action"), - "attach"=>"style='border-right:0px;width:120px;'")); - - - /* 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"))){ - $prio_actions.= " "; - $prio_actions.= " "; - } - - /* If WAITING add pause action - */ - if(in_array($task['STATUS'],array("waiting"))){ - $prio_actions.= " "; - } - - /* If PAUSED add resume action - */ - if(in_array($task['STATUS'],array("paused"))){ - $prio_actions.= " "; - } - - /* If PROCESSING add abort action - */ - if(in_array($task['STATUS'],array("processing"))){ - $prio_actions.= ""; - } - - /* If PAUSED or WAITING add execution action - */ - if(in_array($task['STATUS'],array("paused","waiting"))){ - $prio_actions.= " "; - } - - /* If PAUSED or WAITING add edit action - */ - if(in_array($task['STATUS'],array("waiting"))){ - $action.= ""; - } - - /* If WAITING or ERROR add remove action - */ - if( $this->acl_is_removeable() && in_array($task['STATUS'],array("waiting","error"))){ - $action.= ""; - } - - $color = ""; - $display = $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['BY_QUEUED_ACTION'][$task['HEADERTAG']]['s_Menu_Name'])){ - $event_type = $this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']]; - $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"); - } - - /* Special handling for all entries that have - STATUS == "processing" && PROGRESS == NUMERIC - */ - if($status == "processing" && isset($task['PROGRESS'])){ - $percent = $task['PROGRESS']; - $status = "".$percent." %"; - } - - - /* Create each field */ - $field0 = array("string" => "" , - "attach" => "style='width:20px;".$color."'"); - $field1 = array("string" => $display, - "attach" => "style='".$color."'"); - $field1a= array("string" => $display2, - "attach" => "style='".$color.";width:120px;'"); - $field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:100px;'"); - $field3 = array("string" => $status,"attach" => "style='".$color.";width:80px;'"); - $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;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(); - $smarty->assign("range_selector", 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(_("Could not 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(_("Could not 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); - if(!$this->o_queue->append($tmp)){ - msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG); - return(FALSE); - } - }else{ - msg_dialog::display(_("Error"), - sprintf(_("The Job could not be aborted, the '%s' event class was not found."), - "DaemonEvent_faireboot") , ERROR_DIALOG); - } - } - - - /*! \brief Pauses the specified queue entry from execution. - * @return Boolean TRUE in case of success, else FALSE. - */ - private function pause_queue_entries($ids) - { - if(!count($ids)){ - return; - } - - /* Entries are paused by setting the status to - * something different from 'waiting'. - * We simply use 'paused'. - */ - $data = array("status" => "paused"); - - /* Detect if the ids we got are valid and - * check if the status allows pausing. - */ - $update_ids = array(); - foreach($this->o_queue->get_entries_by_id($ids) as $entry){ - if(isset($entry['STATUS']) && preg_match("/waiting/",$entry['STATUS'])){ - $update_ids[] = $entry['ID']; - } - } - - /* Tell the daemon that we want to update some entries - */ - if(count($update_ids)){ - if(!$this->o_queue->update_entries($update_ids,$data)){ - msg_dialog::display(_("Error"), sprintf(_("Could not 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){ - $this->entries[$entry['ID']]= $entry; - } - } - - - /*! \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']; - } - - /* 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(); - if($this->start >= $count){ - $this->start = $count -1; - } - if($this->start < 0){ - $this->start = 0; - } - } - - - function save() - { - // We do not save anything here. - } - - - /*! \brief Return a list of all selected items. - @return Array Returns an array containing all selected item ids. - */ - function list_get_selected_items() - { - $ids = array(); - foreach($_POST as $name => $value){ - if(preg_match("/^item_selected_[0-9]*$/",$name)){ - $id = preg_replace("/^item_selected_/","",$name); - $ids[$id] = $id; - } - } - return($ids); - } - - - static function plInfo() - { - return (array( - "plShortName" => _("System mass deployment"), - "plDescription" => _("Provide a mechanism to automatically activate a set of systems"), - "plSelfModify" => FALSE, - "plDepends" => array(), - "plPriority" => 0, - "plSection" => array("addon"), - "plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))), - "plProvidedAcls" => array("Comment" => _("Description")) - )); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/class_target_list.inc b/gosa-plugins/goto/addons/gotomasses/class_target_list.inc deleted file mode 100644 index d2c49aeb2..000000000 --- a/gosa-plugins/goto/addons/gotomasses/class_target_list.inc +++ /dev/null @@ -1,335 +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", _("Select to search within subtrees"), _("Search in subtrees"), 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 - $linkopen = "%s"; - $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"), _("IP range is invalid!"), ERROR_DIALOG); - return; - } - if(!tests::is_ip($IP_end)){ - msg_dialog::display(_("Error"), _("IP range is invalid!"), 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('workstationou').$base, - array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT )); - $res= array_merge($res,get_list($filter, "server", get_ou('serverou').$base, - array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT )); - - $deps_a = array( - get_ou("workstationou"), - get_ou("incominou"), - get_ou("serverou"), - get_ou("ogroupou")); - - $res = get_sub_list($filter,array("server","incoming","workstation","ogroup"), - $deps_a,get_ou("systemsou").$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/gotomasses/events/DaemonEvent_faireboot.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_faireboot.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_faireboot.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_install.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_install.tpl deleted file mode 100644 index 40a62eb70..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_install.tpl +++ /dev/null @@ -1,67 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/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/gotomasses/events/DaemonEvent_installation_activation.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_installation_activation.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_installation_activation.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_localboot.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_localboot.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_localboot.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_memcheck.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_memcheck.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_memcheck.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_notify.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_notify.tpl deleted file mode 100644 index 25a8618ef..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_notify.tpl +++ /dev/null @@ -1,60 +0,0 @@ - -{if $is_new} - - - - - - - - - - - - - - - - -
{t}Send on:{/t}{$timestamp}
- {t}Subject{/t} - - -
- {t}Text{/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/gotomasses/events/DaemonEvent_reboot.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reboot.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reboot.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tpl deleted file mode 100644 index 40a62eb70..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tpl +++ /dev/null @@ -1,67 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/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/gotomasses/events/DaemonEvent_reload_ldap_config.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reload_ldap_config.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reload_ldap_config.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_rescan.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_rescan.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_rescan.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_sysinfo.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_sysinfo.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_sysinfo.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl deleted file mode 100644 index 4e3fc127d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl +++ /dev/null @@ -1,63 +0,0 @@ - -{if $is_new} - - - - - - -
- - - - - -
{t}Timestamp{/t}{$timestamp}
-
- - - - -
- {t}Target objects{/t} -
- {$target_list} -
-
- -{else} - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
-
- -
-
- -{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc deleted file mode 100644 index ae4f7e310..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc +++ /dev/null @@ -1,504 +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; - - 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 event 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 = "

"._("Daemon event")." - ".$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; - foreach($this->list_get_selected_items() as $id){ - if(in_array("gosaGroupOfNames",$this->target_divlist->_target_list[$id]['objectClass'])){ - foreach($this->target_divlist->_target_list[$id]['member'] as $mem_dn){ - if(isset($this->target_divlist->workstation_list[$mem_dn])){ - $this->a_targets[] = $this->target_divlist->workstation_list[$mem_dn]['macAddress'][0]; - } - if(isset($this->target_divlist->server_list[$mem_dn])){ - $this->a_targets[] = $this->target_divlist->server_list[$mem_dn]['macAddress'][0]; - } - } - }else{ - if(isset($this->target_divlist->_target_list[$id]['macAddress'][0])){ - $this->a_targets[] = $this->target_divlist->_target_list[$id]['macAddress'][0]; - } - } - } - $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); - foreach(array("s_Menu_Name","s_Event_Name","s_Queued_Action","s_Schedule_Action","s_Trigger_Action") as $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['BY_TRIGGERED_ACTION'] = array(); - $list['BY_SCHEDULED_ACTION'] = array(); - $list['BY_QUEUED_ACTION'] = 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; - $list['BY_TRIGGERED_ACTION'][$evt['s_Trigger_Action']] = $evt; - $list['BY_SCHEDULED_ACTION'][$evt['s_Schedule_Action']] = $evt; - $list['BY_QUEUED_ACTION'] [$evt['s_Queued_Action']] = $evt; - } - } - } - 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() - { - return(array("timestamp" => $this->_timestamp_to_event($this->timestamp))); - } - - - /*! \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() - { - return($this->_timestamp_to_event($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 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); - } - - - /*! \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; - } - } -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_faireboot.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_faireboot.inc deleted file mode 100644 index e529c910d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc deleted file mode 100644 index f743f009b..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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/status_stopped.png"; - $this->s_List_Image = "images/status_stopped.png"; - } - - public function execute() - { - DaemonEvent::execute(); - - $display = $this->get_header(); - - $tmp = $this->data; - - /* Check if target add dialog is open */ - if($this->is_target_list_open() && $this->is_new){ - return($this->get_target_add_list()); - } - - $smarty = get_smarty(); - $smarty->assign("data" , $this->data); - $smarty->assign("target_list" , $this->get_target_list()); - $smarty->assign("is_new" , $this->is_new); - $smarty->assign("timestamp" , $this->get_time_select()); - $display.= $smarty->fetch(get_template_path('DaemonEvent_halt.tpl', TRUE, dirname(__FILE__))); - $display.= $this->get_footer(); - return($display); - } - - public function save_object() - { - DaemonEvent::save_object(); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_install.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_install.inc deleted file mode 100644 index 32d5aed11..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_install.inc +++ /dev/null @@ -1,82 +0,0 @@ -s_Menu_Name = _("Install"); - $this->s_Event_Name = _("Install"); - $this->s_Schedule_Action = "job_trigger_action_install"; - $this->s_Trigger_Action= "gosa_trigger_action_install"; - $this->s_Queued_Action= "trigger_action_install"; - $this->s_Menu_Image = "images/fai_small.png"; - $this->s_List_Image = "images/fai_small.png"; - - if(!$this->is_new()){ - if(isset($data['PROGRESS'])){ - $this->progress = $data['PROGRESS']; - } - if(isset($data['STATUS'])){ - $this->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_install.tpl', TRUE, dirname(__FILE__))); - $display.= $this->get_footer(); - return($display); - } - - public function save() - { - $ret = DaemonEvent::save(); - return($ret); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_installation_activation.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_installation_activation.inc deleted file mode 100644 index 20b14e4a4..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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/goto/addons/gotomasses/events/class_DaemonEvent_localboot.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_localboot.inc deleted file mode 100644 index f3ff263d6..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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 = "images/select_workstation.png"; - $this->s_List_Image = "images/select_workstation.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/gotomasses/events/class_DaemonEvent_memcheck.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_memcheck.inc deleted file mode 100644 index e2d238c51..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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 = "images/memory.png"; - $this->s_List_Image = "images/memory.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/gotomasses/events/class_DaemonEvent_notify.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_notify.inc deleted file mode 100644 index 7486e7ea8..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_notify.inc +++ /dev/null @@ -1,71 +0,0 @@ -s_Menu_Name = _("Send message"); - $this->s_Event_Name = _("Send message"); - $this->s_Schedule_Action = "job_trigger_action_notify"; - $this->s_Trigger_Action= "gosa_trigger_action_notify"; - $this->s_Queued_Action= "trigger_action_notify"; - $this->s_Menu_Image = "images/mailto.png"; - $this->s_List_Image = "images/mailto.png"; - - $this->a_targets = array("GOsa"); - } - - public function execute() - { - DaemonEvent::execute(); - $display = $this->get_header(); - $tmp = $this->data; - $smarty = get_smarty(); - $smarty->assign("subject" ,"subject"); - $smarty->assign("message" ,"message"); - $smarty->assign("data" , $this->data); - $smarty->assign("data" , $this->data); - $smarty->assign("is_new" , $this->is_new); - $smarty->assign("timestamp" , $this->get_time_select()); - $display.= $smarty->fetch(get_template_path('DaemonEvent_notify.tpl', TRUE, dirname(__FILE__))); - $display.= $this->get_footer(); - return($display); - } - - public function save_object() - { - DaemonEvent::save_object(); - } - - public function save() - { - $ret = DaemonEvent::save(); - $ret['user'] = array("test","asdf"); - print_a($ret); - return($ret); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc deleted file mode 100644 index e0b55999d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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/list_reload.png"; - $this->s_List_Image = "images/list_reload.png"; - } - - public function execute() - { - DaemonEvent::execute(); - - $display = $this->get_header(); - - $tmp = $this->data; - - /* Check if target add dialog is open */ - if($this->is_target_list_open() && $this->is_new){ - return($this->get_target_add_list()); - } - - $smarty = get_smarty(); - $smarty->assign("data" , $this->data); - $smarty->assign("target_list" , $this->get_target_list()); - $smarty->assign("is_new" , $this->is_new); - $smarty->assign("timestamp" , $this->get_time_select()); - $display.= $smarty->fetch(get_template_path('DaemonEvent_reboot.tpl', TRUE, dirname(__FILE__))); - $display.= $this->get_footer(); - return($display); - } - - public function save_object() - { - DaemonEvent::save_object(); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc deleted file mode 100644 index 77c71c9ce..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc +++ /dev/null @@ -1,82 +0,0 @@ -s_Menu_Name = _("Reinstall"); - $this->s_Event_Name = _("Reinstall"); - $this->s_Schedule_Action = "job_trigger_action_reinstall"; - $this->s_Trigger_Action= "gosa_trigger_action_reinstall"; - $this->s_Queued_Action= "trigger_action_reinstall"; - $this->s_Menu_Image = "images/fai_small.png"; - $this->s_List_Image = "images/fai_small.png"; - - if(!$this->is_new()){ - if(isset($data['PROGRESS'])){ - $this->progress = $data['PROGRESS']; - } - if(isset($data['STATUS'])){ - $this->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); - } - - public function save() - { - $ret = DaemonEvent::save(); - return($ret); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reload_ldap_config.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reload_ldap_config.inc deleted file mode 100644 index 2dcb00f5b..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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_reload_ldap_config"; - $this->s_Trigger_Action = "gosa_reload_ldap_config"; - $this->s_Queued_Action = "reload_ldap_config"; - $this->s_Menu_Image = "images/edit.png"; - $this->s_List_Image = "images/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/gotomasses/events/class_DaemonEvent_rescan.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_rescan.inc deleted file mode 100644 index f44647604..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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_trigger_action_rescan"; - $this->s_Trigger_Action = "gosa_trigger_action_rescan"; - $this->s_Queued_Action = "trigger_action_rescan"; - $this->s_Menu_Image = "images/snd_hardware.png"; - $this->s_List_Image = "images/snd_hardware.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/gotomasses/events/class_DaemonEvent_sysinfo.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_sysinfo.inc deleted file mode 100644 index 0e9cf111d..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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 = "images/hardware.png"; - $this->s_List_Image = "images/hardware.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/gotomasses/events/class_DaemonEvent_update.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc deleted file mode 100644 index bace753f6..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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= "gosa_trigger_action_update"; - $this->s_Queued_Action= "trigger_action_update"; - $this->s_Menu_Image = "images/time.png"; - $this->s_List_Image = "images/time.png"; - } - - public function execute() - { - DaemonEvent::execute(); - - $display = $this->get_header(); - - $tmp = $this->data; - - /* Check if target add dialog is open */ - if($this->is_target_list_open() && $this->is_new){ - return($this->get_target_add_list()); - } - - $smarty = get_smarty(); - $smarty->assign("data" , $this->data); - $smarty->assign("target_list" , $this->get_target_list()); - $smarty->assign("is_new" , $this->is_new); - $smarty->assign("timestamp" , $this->get_time_select()); - $display.= $smarty->fetch(get_template_path('DaemonEvent_update.tpl', TRUE, dirname(__FILE__))); - $display.= $this->get_footer(); - return($display); - } - - public function save_object() - { - DaemonEvent::save_object(); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc deleted file mode 100644 index 729d945fa..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc +++ /dev/null @@ -1,67 +0,0 @@ -s_Menu_Name = _("Wake up"); - $this->s_Event_Name = _("Start a system"); - $this->s_Schedule_Action= "job_trigger_action_wake"; - $this->s_Trigger_Action = "gosa_trigger_action_wake"; - $this->s_Queued_Action = "trigger_action_wake"; - $this->s_Menu_Image = "images/status_running.png"; - $this->s_List_Image = "images/status_running.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/gotomasses/events/class_EventTargetAddList.inc b/gosa-plugins/goto/addons/gotomasses/events/class_EventTargetAddList.inc deleted file mode 100644 index e3b524381..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/class_EventTargetAddList.inc +++ /dev/null @@ -1,249 +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 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/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("serverou"),$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("workstationou"),$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 setEntries() - { - $_target_list = array(); - if($this->display_server){ - $_target_list = array_merge($_target_list, - get_list("(&(cn=".$this->regex.")(objectClass=goServer))", - "server",get_ou("serverou").$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("workstationou").$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("ogroupou").$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)); - } - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/events/target_list.tpl b/gosa-plugins/goto/addons/gotomasses/events/target_list.tpl deleted file mode 100644 index 589ff244c..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/target_list.tpl +++ /dev/null @@ -1,7 +0,0 @@ -{$divlist} - -

-
-   - -
diff --git a/gosa-plugins/goto/addons/gotomasses/events/timestamp_select.tpl b/gosa-plugins/goto/addons/gotomasses/events/timestamp_select.tpl deleted file mode 100644 index c9a206bd0..000000000 --- a/gosa-plugins/goto/addons/gotomasses/events/timestamp_select.tpl +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - -
{t}Jahr{/t}{t}Monat{/t}{t}Tag{/t}{t}Stunde{/t}{t}Minute{/t}{t}Sekunde{/t}
-   - -   - -   - -   - -   - - -
- diff --git a/gosa-plugins/goto/addons/gotomasses/goto_task.tpl b/gosa-plugins/goto/addons/gotomasses/goto_task.tpl deleted file mode 100644 index 61220bd45..000000000 --- a/gosa-plugins/goto/addons/gotomasses/goto_task.tpl +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - -
-

{t}Job details{/t}

-
- - - - - - - - - - - - - -
{t}Job ID{/t}{$ID}
- {t}Header Tag{/t} - - - -
  -
- {t}Schedule Execution{/t} - - - - - - - - - - - - - - - - - - -
{t}Jahr{/t}{t}Monat{/t}{t}Tag{/t}{t}Stunde{/t}{t}Minute{/t}{t}Sekunde{/t}
-   - -   - -   - -   - -   - - -
-
-
- -{if $HEADERTAG == "ping"} - - -{elseif $HEADERTAG == "sayHello"} - - -{else} - -{/if} -
{t}Status{/t}
{t}Mac{/t}
{t}Status{/t}
{t}Mac{/t}
{t}Job type not implented{/t}
-
- -

 

- -

- - -

diff --git a/gosa-plugins/goto/addons/gotomasses/gotomasses.tpl b/gosa-plugins/goto/addons/gotomasses/gotomasses.tpl deleted file mode 100644 index 844cdebf6..000000000 --- a/gosa-plugins/goto/addons/gotomasses/gotomasses.tpl +++ /dev/null @@ -1,4 +0,0 @@ -{$div} -
-{$range_selector} -
diff --git a/gosa-plugins/goto/addons/gotomasses/main.inc b/gosa-plugins/goto/addons/gotomasses/main.inc deleted file mode 100644 index 8c6bd8088..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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('images/system.png'), _("System deployment")).$display; - - /* Store changes in session */ - session::set('gotomasses',$gotomasses); -} diff --git a/gosa-plugins/goto/addons/gotomasses/remove.tpl b/gosa-plugins/goto/addons/gotomasses/remove.tpl deleted file mode 100644 index 6113ae3be..000000000 --- a/gosa-plugins/goto/addons/gotomasses/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} - -

-