From: hickert Date: Tue, 23 Oct 2007 06:54:55 +0000 (+0000) Subject: Updated mass deployment, supports ip range selection now X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=df50b0dab91558f569170b9bae0663200de076d7;p=gosa.git Updated mass deployment, supports ip range selection now git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7622 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/addons/gotomasses/class_goto_task.inc b/plugins/addons/gotomasses/class_goto_task.inc index 6091af34b..e081d8360 100644 --- a/plugins/addons/gotomasses/class_goto_task.inc +++ b/plugins/addons/gotomasses/class_goto_task.inc @@ -28,10 +28,12 @@ class goto_task extends plugin var $Initial_Target = array(); var $Actions = array(); var $new = FALSE; - var $attributes = array("Zone","Section","OGroup","Minute","Hour","Day","Month","Weekday","Action","Comment","Target","Initial_Target"); + var $attributes = array("Zone","Section","OGroup","Minute","Hour","Day", + "Month","Weekday","Action","Comment","Target","Initial_Target"); var $configure_dhcp = FALSE; - var $configure_dns = FALSE; + var $configure_dns = FALSE; + function goto_task(&$config, &$parent, $data = array()) { @@ -167,7 +169,7 @@ class goto_task extends plugin } /* Save selected objects as target */ - if(isset($_POST['SaveMultiSelectWindow'])){ + if(isset($_POST['SaveMultiSelectWindow']) && is_object($this->dialog)){ $this->dialog->save_object(); $ret = $this->dialog->save(); foreach($ret as $entry){ @@ -192,7 +194,8 @@ class goto_task extends plugin ********/ $divlist = new divlist("goto_task"); - $divlist->SetPluginMode(); +# $divlist->SetPluginMode(); + $divlist->setHeight(200); $divlist->SetWidth("100%"); $divlist->SetEntriesPerPage(0); diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc index 981c42276..72e6bab04 100644 --- a/plugins/addons/gotomasses/class_gotomasses.inc +++ b/plugins/addons/gotomasses/class_gotomasses.inc @@ -205,7 +205,8 @@ class gotomasses extends plugin /* Create divlist */ $divlist->SetListHeader($header); - /* Toggle all selected / deselected */ + + /* Toggle all selected / deselected */ $chk = ""; diff --git a/plugins/addons/gotomasses/class_target_list.inc b/plugins/addons/gotomasses/class_target_list.inc index 703454e4c..cdae5cb18 100644 --- a/plugins/addons/gotomasses/class_target_list.inc +++ b/plugins/addons/gotomasses/class_target_list.inc @@ -12,6 +12,8 @@ class target_list extends MultiSelectWindow /* Regex */ var $Regex = "*"; + var $IP_start = "0.0.0.0"; + var $IP_end = "255.255.255.255"; /* CheckBoxes, to change default values modify $this->AddCheckBox */ var $ogroups ; @@ -55,6 +57,8 @@ class target_list extends MultiSelectWindow /* Name,Text,Default , Connect with alphabet */ $this->AddRegex ("Regex", _("Regular expression for matching group names"), "*" , true); + $this->AddRegex ("IP_start", _("IP range start"), "*" , true); + $this->AddRegex ("IP_end", _("IP range end"), "*" , true); $this->EnableAplhabet(TRUE); } @@ -136,9 +140,6 @@ class target_list extends MultiSelectWindow $this->GenHeader(); $this->reload(); $this->SetEntries($this->list); - foreach($this->list as $key => $data){ - - } return($this->Draw()); } @@ -165,6 +166,12 @@ class target_list extends MultiSelectWindow }else{ $desc = " - [ ".$val['description'][0]." ]"; } + if(!isset($val['ipHostNumber'][0])){ + $desc.= ""; + }else{ + $desc.= " - ".$val['ipHostNumber'][0].""; + } + $img ="Hmm"; if(in_array("goServer",$val['objectClass'])){ @@ -212,6 +219,18 @@ class target_list extends MultiSelectWindow $base = $this->selectedBase; $filter = ""; $Regex = $this->Regex; + $IP_start = $this->IP_start; + $IP_end = $this->IP_end; + + if(!is_ip($IP_start)){ + print_red(_("Please specify a valid IP range.")); + return; + } + if(!is_ip($IP_end)){ + print_red(_("Please specify a valid IP range.")); + return; + } + $chk = array( "ogroups" => "(&(objectClass=gosaGroupOfNames)(|(gosaGroupObjects=*S*)(gosaGroupObjects=*W*)))" , @@ -228,15 +247,14 @@ class target_list extends MultiSelectWindow if($this->SubSearch){ $res= get_list($filter, array("ogroups","workstations","servers"), $base, - array("cn","objectClass","gosaGroupObjects"), GL_SIZELIMIT | GL_SUBSEARCH); + array("cn","objectClass","gosaGroupObjects","ipHostNumber","description"), GL_SIZELIMIT | GL_SUBSEARCH); }else{ $res= get_list($filter, "ogroups", get_groups_ou().$base, - array("cn","objectClass"), GL_SIZELIMIT ); + array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT ); $res= array_merge($res,get_list($filter, "workstation", "ou=workstations,ou=systems,".$base, - array("cn","objectClass"), GL_SIZELIMIT )); + array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT )); $res= array_merge($res,get_list($filter, "server", "ou=servers,ou=systems,".$base, - array("cn","objectClass"), GL_SIZELIMIT )); - + array("cn","objectClass","ipHostNumber","description"), GL_SIZELIMIT )); } $this->list= $res; @@ -244,7 +262,14 @@ class target_list extends MultiSelectWindow reset ($this->list); $tmp=array(); foreach($this->list as $tkey => $val ){ - $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val; + + if(isset($val['ipHostNumber'][0])){ + if(is_ip_range($IP_start,$val['ipHostNumber'][0]) && 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(); diff --git a/plugins/addons/gotomasses/goto_task.tpl b/plugins/addons/gotomasses/goto_task.tpl index 0f231aa58..0c93fcf56 100644 --- a/plugins/addons/gotomasses/goto_task.tpl +++ b/plugins/addons/gotomasses/goto_task.tpl @@ -88,7 +88,7 @@ - +
{render acl=$TargetACL} {$Target_list}