Code

Allows to select ogroups
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Jan 2010 16:27:32 +0000 (16:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Jan 2010 16:27:32 +0000 (16:27 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15240 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/addons/goto/events/class_EventTargetAddList.inc
gosa-plugins/goto/addons/goto/events/eventTargetSystems-filter.xml
gosa-plugins/goto/addons/goto/events/eventTargetSystems-list.xml

index 01a1cabe0b58e8f48d2438526967063761d44fb1..06ab8c7ae13b71195464d4f22ae9ea34fee61642 100644 (file)
@@ -33,15 +33,16 @@ class EventTargetAddList extends management
     $this->storagePoints = array(
         get_ou("serverRDN"), 
         get_ou("workstationRDN"), 
+        get_ou("ogroupRDN"), 
         get_ou('terminalRDN'));
 
     // Build filter
-    if (session::global_is_set(get_class($this)."_filter")){
-      $filter= session::global_get(get_class($this)."_filter");
-    } else {
+#    if (session::global_is_set(get_class($this)."_filter")){
#     $filter= session::global_get(get_class($this)."_filter");
+  #  } else {
       $filter = new filter(get_template_path("../../addons/goto/events/eventTargetSystems-filter.xml", TRUE));
       $filter->setObjectStorage($this->storagePoints);
-    }
+   # }
     $this->setFilter($filter);
 
     // Build headpage
@@ -66,14 +67,36 @@ class EventTargetAddList extends management
 
   function get_selected_targets()
   {
+    // Collect mac addresses 
     $entries = $this->save();
     $macs = array();
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
+    $member_dns = array();
     foreach($entries as $entry){
       if(isset($entry['macAddress'][0])){
         $macs[] = $entry['macAddress'][0];
       }
+      if(in_array("gosaGroupOfNames", $entry['objectClass'])){
+        $ldap->cat($entry['dn']);
+        if($ldap->count()){
+          $attrs = $ldap->fetch();
+          if(isset($attrs['member'])){
+            for($i =0 ; $i< $attrs['member']['count']; $i++){
+              $member_dns[] = $attrs['member'][$i];
+            }
+          }
+        }
+      }
+    }
+    foreach($member_dns as $dn){
+      $ldap->cat($dn, array('macAddress')); 
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        if(isset($attrs['macAddress'])){
+          $macs[] = $attrs['macAddress'][0];
+        }
+      }
     }
     return($macs);
   }
index 7aa75de8d11eb9c2bdeac2a130b7c8deb7151df6..9ccd976da1f57fb44cacd53bafe8ac88e1dc5a4e 100644 (file)
@@ -10,7 +10,7 @@
   <search>
     <query>
       <backend>SystemByIp</backend>
-      <filter>(&amp;(|$SERVER $WORKSTATION $TERMINAL ) $NAME) $IPSTART $IPSTOP $BYIP</filter>
+      <filter>(&amp;(|$SERVER $WORKSTATION $TERMINAL $OGROUP) $NAME) $IPSTART $IPSTOP $BYIP</filter>
       <attribute>dn</attribute>
       <attribute>objectClass</attribute>
       <attribute>cn</attribute>
     </autocomplete>
   </element>
 
+  <element>
+    <type>checkbox</type>
+    <tag>OGROUP</tag>
+    <default>true</default>
+    <set>(objectClass=gosaGroupOfNames)</set>
+    <unset></unset>
+  </element>
+
   <element>
     <type>checkbox</type>
     <tag>SERVER</tag>
index b863f795e06a27e0c33495df98e2349fdf28f8e1..4ef82076b216bc23543c05c1fdebe81e7c38bbbe 100644 (file)
       <image>plugins/systems/images/select_terminal.png</image>
     </objectType>
 
+    <objectType>
+      <label>Object Group</label>
+      <objectClass>gosaGroupOfNames</objectClass>
+      <category>ogroups</category>
+      <class>ogroup</class>
+      <image>plugins/ogroups/images/ogroup.png</image>
+    </objectType>
+
   </definition>
 
   <table>
-    <layout>|20px;c|220px||</layout>
+    <layout>|20px;c|220px||||</layout>
 
     <department>
       <value>%{filter:objectType(dn,objectClass)}</value>
@@ -46,7 +54,7 @@
 
     <department>
       <value>%{filter:departmentLink(row,dn,description)}</value>
-      <span>1</span>
+      <span>3</span>
     </department>
 
     <column>
       <export>true</export>
     </column>
 
+    <column>
+      <label>IP</label>
+      <sortAttribute>ipHostNumber</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{ipHostNumber}</value>
+      <export>true</export>
+    </column>
+
+    <column>
+      <label>Mac</label>
+      <sortAttribute>macAddress</sortAttribute>
+      <sortType>string</sortType>
+      <value>%{macAddress}</value>
+      <export>true</export>
+    </column>
+
   </table>
 
   <actionmenu>