Code

Updated mass deployment, supports ip range selection now
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Oct 2007 06:54:55 +0000 (06:54 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 23 Oct 2007 06:54:55 +0000 (06:54 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7622 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/gotomasses/class_goto_task.inc
plugins/addons/gotomasses/class_gotomasses.inc
plugins/addons/gotomasses/class_target_list.inc
plugins/addons/gotomasses/goto_task.tpl

index 6091af34b33db16ce382ff0c577f8674e505322e..e081d836043015d376c355388bf98cc63c38a292 100644 (file)
@@ -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);
 
index 981c4227671c34a0b230b0d4b1e412cca766aab0..72e6bab044b2dcf8d841652a3075fe61b2af67a4 100644 (file)
@@ -205,7 +205,8 @@ class gotomasses extends plugin
  
     /* Create divlist */
     $divlist->SetListHeader($header);
- /* Toggle all selected / deselected */
+
+    /* Toggle all selected / deselected */
     $chk = "<input type='checkbox' id='select_all' name='select_all'
                onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
 
index 703454e4c6772c1df978963fade49e238bc1556e..cdae5cb182456acf0b7950cce45d92e42ba92e00 100644 (file)
@@ -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();
index 0f231aa5897870204017a4bd51b79827f1939edc..0c93fcf560b6e707b47a22631f95768d186d3bfb 100644 (file)
@@ -88,7 +88,7 @@
        <tr>
                <td colspan="2">
             <table  summary="" style="border:1px solid #B0B0B0;width:100%; " cellspacing=0 cellpadding=0>
-                <tr>
+                <tr>   
                     <td>
                                                {render acl=$TargetACL}
                                                {$Target_list}