From: hickert Date: Fri, 17 Aug 2007 13:38:27 +0000 (+0000) Subject: Updated gotomasses X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=113f42db57322dd9d1a5caaaf4b9fd46fb522db4;p=gosa.git Updated gotomasses Not finished yet git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7068 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/addons/gotomasses/class_goto_task.inc b/plugins/addons/gotomasses/class_goto_task.inc index e5d464f4d..87af0b6e2 100644 --- a/plugins/addons/gotomasses/class_goto_task.inc +++ b/plugins/addons/gotomasses/class_goto_task.inc @@ -19,8 +19,9 @@ class goto_task extends plugin var $Taret = array(); var $Actions = array(); - - var $attributes = array("Minute","Hour","Day","Month","Weekday","Action","Comment","Target"); + var $OGroup = ""; + var $OGroups = array(); + var $attributes = array("OGroup","Minute","Hour","Day","Month","Weekday","Action","Comment","Target"); function goto_task($config,$parent,$data = array()) @@ -47,6 +48,11 @@ class goto_task extends plugin } } + /* Create ogroup select list */ + $this->OGroups = array("keep_current" => "["._("Keep current")."]", + "unset_membership" => "["._("Quit group membership")."]"); + $this->OGroups = array_merge($this->OGroups,$this->parent->get_object_groups()); + /* Prepare list of available actions */ $this->Actions = $this->parent->get_actions(); } @@ -150,6 +156,7 @@ class goto_task extends plugin $smarty->assign("Months" , $tmp['Month']); $smarty->assign("Weekdays", $tmp['Weekday']); + $smarty->assign("OGroups" , $this->OGroups); $smarty->assign("Expert" , $this->Expert); $smarty->assign("Actions" , $this->Actions); @@ -194,6 +201,15 @@ class goto_task extends plugin } } + function save() + { + $tmp = array(); + foreach($this->attributes as $attr){ + $tmp[$attr] = $this->$attr; + } + return($tmp); + } + /* Return values for listboxes. */ diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc index c81ec3bd0..216e99665 100644 --- a/plugins/addons/gotomasses/class_gotomasses.inc +++ b/plugins/addons/gotomasses/class_gotomasses.inc @@ -15,7 +15,7 @@ class gotomasses extends plugin /* Queue tasks */ var $tasks = array(); - + var $current =false; var $dialog = NULL; function gotomasses($config, $dn= NULL) @@ -25,13 +25,18 @@ class gotomasses extends plugin /* Include config object */ $this->config= $config; + + $this->load_csv_data(); } function execute() { - /* Check posts */ + /************ + * Handle posts + ************/ + $s_entry = $s_action = ""; $arr = array("/^edit_/"=>"edit","/^remove_/"=>"remove"); foreach($arr as $regex => $action){ @@ -44,6 +49,10 @@ class gotomasses extends plugin } } + /************ + * List posts + ************/ + /* Remove entry from list */ if($s_action == "remove" && isset($this->tasks[$s_entry])){ unset($this->tasks[$s_entry]); @@ -53,6 +62,7 @@ class gotomasses extends plugin if($s_action == "edit" && isset($this->tasks[$s_entry])){ $entry = $this->tasks[$s_entry]; $this->dialog = new goto_task($this->config,$this,$entry); + $this->current = $s_entry; } /* Close dialog */ @@ -63,7 +73,15 @@ class gotomasses extends plugin /* Close dialog */ if(isset($_POST['save_goto_task'])){ $this->dialog->save_object(); - $this->dialog = NULL; + $msgs = $this->dialog->check(); + if(count($msgs)){ + foreach($msgs as $msg){ + print_red($msg); + } + }else{ + $this->tasks[$this->current] = $this->dialog->save(); + $this->dialog = NULL; + } } /* Display dialogs if currently opened */ @@ -73,7 +91,10 @@ class gotomasses extends plugin } - $this->load_csv_data(); + /************ + * Handle Divlist + ************/ + $smarty = get_smarty(); $plug = $_GET['plug']; $divlist = new divlist("gotomasses"); @@ -183,7 +204,7 @@ class gotomasses extends plugin $row = preg_replace('/ */umi'," ",$row); $parts = split(" ",$row); - if(count($parts) != 7){ + if(count($parts) != 8){ print_red(_("Entry broken, skipped.")); }else{ @@ -194,7 +215,8 @@ class gotomasses extends plugin $entry['Month'] = $parts[3]; $entry['Weekday'] = $parts[4]; $entry['Action'] = $parts[5]; - $entry['Target'] = split(",",$parts[6]); + $entry['OGroup'] = $parts[6]; + $entry['Target'] = split(",",$parts[7]); $entry['Comment'] = $comment; $this->tasks [] = $entry; } diff --git a/plugins/addons/gotomasses/class_target_list.inc b/plugins/addons/gotomasses/class_target_list.inc index bb91452dd..4c1e79e72 100644 --- a/plugins/addons/gotomasses/class_target_list.inc +++ b/plugins/addons/gotomasses/class_target_list.inc @@ -23,12 +23,13 @@ class target_list extends MultiSelectWindow var $SubSearch ; var $parent ; var $ui ; - - - + + function target_list($config,$Targets_used) { MultiSelectWindow::MultiSelectWindow($config, "Targetselection", array("ogroup","gotomasses")); + + $this->Targets_used = $Targets_used; $this->SetInformation( _("Select the target objects for your scheduled action.")); $this->SetTitle( _("Available targets")); @@ -155,6 +156,9 @@ class target_list extends MultiSelectWindow // 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 = ""; @@ -210,7 +214,7 @@ class target_list extends MultiSelectWindow $Regex = $this->Regex; $chk = array( - "ogroups" => "(objectClass=gosaGroupOfNames)" , + "ogroups" => "(&(objectClass=gosaGroupOfNames)(|(gosaGroupObjects=*S*)(gosaGroupObjects=*W*)))" , "servers" => "(objectClass=goServer)" , "workstations" => "(objectClass=gotoWorkstation)"); diff --git a/plugins/addons/gotomasses/goto_task.tpl b/plugins/addons/gotomasses/goto_task.tpl index 6988b0ab3..c673e2210 100644 --- a/plugins/addons/gotomasses/goto_task.tpl +++ b/plugins/addons/gotomasses/goto_task.tpl @@ -37,6 +37,25 @@ + + + + + + + +
+ {t}Object group membership{/t} + + {render acl=$OGroupACL} + + {/render} +
+ + +

{t}Target systems{/t}