From: hickert Date: Wed, 20 Feb 2008 14:02:46 +0000 (+0000) Subject: Updated gotomasses X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cf4be6d176c3fba2165fde9801ae890af9f7571e;p=gosa.git Updated gotomasses -Removed old classes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8991 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/addons/gotomasses/class_goto_task.inc b/gosa-plugins/goto/addons/gotomasses/class_goto_task.inc deleted file mode 100644 index e6f0eb2be..000000000 --- a/gosa-plugins/goto/addons/gotomasses/class_goto_task.inc +++ /dev/null @@ -1,130 +0,0 @@ -parent = &$parent; - $this->data = $data; - - /* Intialize plugin */ - $this->config = &$config; - } - - - function execute() - { - $smarty = get_smarty(); - $smarty->assign("Actions",$this->parent->get_actions()); - foreach($this->attributes as $attr){ - if(isset($this->data[$attr])){ - $smarty->assign($attr,$this->data[$attr]); - }else{ - $smarty->assign($attr,""); - } - } - - $year = substr($this->data['TIMESTAMP'],0,4); - $month = substr($this->data['TIMESTAMP'],4,2); - $day = substr($this->data['TIMESTAMP'],6,2); - - $hour = substr($this->data['TIMESTAMP'],8,2); - $minute = substr($this->data['TIMESTAMP'],10,2); - $second = substr($this->data['TIMESTAMP'],12,2); - - $years = array(); - for($i = date("Y",time()); $i <= 2037 ;$i ++){ - $years[$i] = $i; - } - $months = array(); - for($i = 1; $i <= 12; $i ++){ - $e = str_pad($i,2,"0",STR_PAD_LEFT); - $months[$e] = $e; - } - $days = array(); - for($i = 1; $i <= cal_days_in_month(CAL_GREGORIAN,$month,$year); $i ++){ - $e = str_pad($i,2,"0",STR_PAD_LEFT); - $days[$e] = $e; - } - $hours = array(); - for($i = 0; $i < 24; $i ++){ - $e = str_pad($i,2,"0",STR_PAD_LEFT); - $hours[$e] = $e; - } - $minutes = array(); - for($i = 0; $i < 60; $i ++){ - $e = str_pad($i,2,"0",STR_PAD_LEFT); - $minutes[$e] = $e; - } - $seconds = array(); - for($i = 0; $i < 60; $i ++){ - $e = str_pad($i,2,"0",STR_PAD_LEFT); - $seconds[$e] = $e; - } - - $smarty->assign("years", $years); - $smarty->assign("months", $months); - $smarty->assign("days", $days); - $smarty->assign("hours", $hours); - $smarty->assign("minutes", $minutes); - $smarty->assign("seconds", $seconds); - - $smarty->assign("time_year",$year); - $smarty->assign("time_month",$month); - $smarty->assign("time_day",$day); - $smarty->assign("time_hour",$hour); - $smarty->assign("time_minute",$minute); - $smarty->assign("time_second",$second); - - return ($smarty->fetch (get_template_path('goto_task.tpl', TRUE))); - } - - - function save_object() - { - if(isset($_POST['HeaderTag'])){ - $possible_tags = $this->parent->get_actions(); - $tag = $_POST['HeaderTag']; - if(isset($possible_tags[$tag])){ - $this->data['HEADERTAG'] = $tag; - } - } - foreach(array("status","macaddress") as $attr){ - if(isset($_POST[$attr])){ - $this->data[strtoupper($attr)] = $_POST[$attr]; - } - } - $date = ""; - foreach(array("time_year","time_month","time_day","time_hour","time_minute","time_second") as $attr){ - if(isset($_POST[$attr])){ - $date .= $_POST[$attr]; - } - } - if(strlen($date) == 14){ - $this->data['TIMESTAMP'] = $date; - } - } - - function save() - { - $tmp = array(); - foreach(array("STATUS","MACADDRESS","HEADERTAG","TIMESTAMP") as $attr){ - if(isset($this->data[$attr])){ - $tmp[$attr] = $this->data[$attr]; - } - } - return($tmp); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc index a03420249..28172e3a0 100644 --- a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc +++ b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc @@ -120,18 +120,11 @@ class gotomasses extends plugin $this->dialog = new $e_data['NAME']($this->config); } } - - /************ - * ADD/EDIT Dialog Handling - ************/ - /************ * REMOVE ************/ - echo $s_action; - /* Remove multiple */ if($s_action == "remove_multiple" || $s_action == "remove"){ @@ -173,25 +166,9 @@ class gotomasses extends plugin } -# /************ -# * EDIT -# ************/ -# -# /* Edit selected entry */ -# if($s_action == "edit"){ -# $entry = $this->o_queue->get_entry_by_id($s_entry); -# if($entry){ -# $this->dialog = new goto_task($this->config,$this,$entry); -# $this->current = $s_entry; -# } -# } -# -# /* New entry */ -# if($s_action== "new_task" && $this->acl_is_createable()){ -# $this->dialog = new goto_task($this->config,$this); -# $this->current = -1; -# } -# + /************ + * EDIT + ************/ /* Close dialog */ if(isset($_POST['save_event_dialog'])){ @@ -219,39 +196,7 @@ class gotomasses extends plugin $this->dialog = FALSE; $this->current = -1; } -# -# /* Close dialog */ -# if((isset($_POST['save_goto_task']) || isset($_POST['apply_goto_task'])) && is_object($this->dialog) ){ -# $this->dialog->save_object(); -# $msgs = $this->dialog->check(); -# if(count($msgs)){ -# foreach($msgs as $msg){ -# msg_dialog::display(_("Error"), $msg, ERROR_DIALOG); -# } -# }else{ -# -# if($this->o_queue->id_exists($this->current)){ -# $this->o_queue->update_entries(array($this->current),$this->dialog->save()); -# }else{ -# $tmp = $this->dialog->save(); -# $tmp2= array(); -# $targets =$tmp['Target']; -# foreach($targets as $target){ -# $tmp['Target'] = array($target); -# $tmp2[] = $tmp; -# } -# if(!$this->o_queue->add_multiple($tmp2)){ -# msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG); -# } -# } -# if(!isset($_POST['apply_goto_task'])){ -# $this->dialog = FALSE; -# $this->current = -1; -# } -# $this->save(); -# } -# } -# + /* Display dialogs if currently opened */ if(is_object($this->dialog)){ $this->dialog->save_object(); diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc index 90a6aecec..9039e88e9 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc @@ -57,24 +57,6 @@ class DaemonEvent if(count($data)){ $this->is_new = 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; - } } public function execute() @@ -93,6 +75,9 @@ class DaemonEvent public function get_header() { + if($this->target_add_list_used){ + return(""); + } $str = "

"._("Daemon event")." - ".$this->s_Event_Name."

"; return($str); } @@ -187,48 +172,16 @@ class DaemonEvent return($divlist->DrawList().$list_footer); } + public function get_target_add_list() { $this->target_add_list_used = TRUE; - if(1 | $this->target_divlist == NULL){ + if($this->target_divlist == NULL){ $this->target_divlist = new EventTargetAddList($this->config,$this); } $this->target_divlist->execute(); - $_target_list = array(); - if($this->target_divlist->display_server){ - $_target_list = array_merge($_target_list, - get_list("(&(cn=".$this->target_divlist->regex.")(objectClass=goServer))", - "server",get_ou("serverou").$this->target_divlist->selectedBase, - array("cn","objectClass","description","ipHostNumber","macAddress"),GL_NONE)); - } - if($this->target_divlist->display_workstation){ - $_target_list = array_merge($_target_list, - get_list("(&(cn=".$this->target_divlist->regex.")(objectClass=gotoWorkstation))", - "workstation",get_ou("workstationou").$this->target_divlist->selectedBase, - array("cn","objectClass","description","ipHostNumber","macAddress"),GL_NONE)); - } - if($this->target_divlist->display_ogroup){ - $_target_list = array_merge($_target_list, - get_list("(&(cn=".$this->target_divlist->regex.")(member=*)(objectClass=gosaGroupOfNames))", - "ogroups",get_ou("ogroupou").$this->target_divlist->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); - $tmp2 = array(); - foreach($tmp as $key => $sort){ - $tmp2[] = $this->_target_list[$key]; - } - - $this->target_divlist->setEntries($tmp2); - $smarty = get_smarty(); $smarty->assign("divlist",$this->target_divlist->Draw()); return($smarty->fetch(get_template_path('target_list.tpl', TRUE, dirname(__FILE__)))); @@ -251,18 +204,18 @@ class DaemonEvent 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_list[$id]['objectClass'])){ - foreach($this->_target_list[$id]['member'] as $mem_dn){ - if(isset($this->workstation_list[$mem_dn])){ - $this->a_targets[] = $this->workstation_list[$mem_dn]['macAddress'][0]; + 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->server_list[$mem_dn])){ - $this->a_targets[] = $this->server_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_list[$id]['macAddress'][0])){ - $this->a_targets[] = $this->_target_list[$id]['macAddress'][0]; + if(isset($this->target_divlist->_target_list[$id]['macAddress'][0])){ + $this->a_targets[] = $this->target_divlist->_target_list[$id]['macAddress'][0]; } } } diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_EventTargetAddList.inc b/gosa-plugins/goto/addons/gotomasses/events/class_EventTargetAddList.inc index 4d68d6233..7fd571002 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_EventTargetAddList.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_EventTargetAddList.inc @@ -82,6 +82,7 @@ class EventTargetAddList extends MultiSelectWindow { $this->ClearElementsList(); $this->AddDepartments($this->selectedBase,2,1); + $this->setEntries(); $this->GenHeader(); } @@ -146,10 +147,8 @@ class EventTargetAddList extends MultiSelectWindow } - function setEntries($list) + function setEntries() { - - $_target_list = array(); if($this->display_server){ $_target_list = array_merge($_target_list,