Code

Added system filter
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Jan 2010 12:41:58 +0000 (12:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Jan 2010 12:41:58 +0000 (12:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15125 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc [new file with mode: 0644]
gosa-plugins/systems/admin/systems/system-filter.xml
gosa-plugins/systems/admin/systems/system-list.xml

diff --git a/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc b/gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc
new file mode 100644 (file)
index 0000000..725d549
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+
+class filterSYSTEMS {
+
+  static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
+  {
+    $entries = filterLDAP::query($base, $scope, $filter, $attributes, $category, $objectStorage);
+
+    foreach($entries as $key => $entry){
+      if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'),'/')."/i", $entry['dn'])){
+
+        // Detect incoming types
+        if(in_array('gotoWorkstation', $entry['objectClass'])){
+          $entries[$key]['objectClass'][] = 'FAKE_OC_NewWorkstation';
+          $entries[$key]['cn'][0].= " <i>("._("New workstation").")</i>";
+        }elseif(in_array('gotoTerminal', $entry['objectClass'])){
+          $entries[$key]['objectClass'][] = 'FAKE_OC_NewTerminal';
+          $entries[$key]['cn'][0].= " <i>("._("New terminal").")</i>";
+        }elseif(in_array('GOhard', $entry['objectClass']) && !isset($entry['gotoMode'][0])){ 
+          $entries[$key]['objectClass'][] = 'FAKE_OC_NewUnknownDevice';
+          $entries[$key]['cn'][0].= " <i>("._("New unknown device").")</i>";
+        }elseif(in_array('GOhard', $entry['objectClass'])){
+          $entries[$key]['objectClass'][] = 'FAKE_OC_NewDevice';
+          $entries[$key]['cn'][0].= " <i>("._("New device").")</i>";
+        }
+
+      // Detect SAMBA machines
+      }elseif(in_array('sambaSamAccount', $entry['objectClass']) && preg_match("/\$$/", $entry['cn'][0])){
+        $entries[$key]['objectClass'][] = 'FAKE_OC_winstation';
+
+      // Detect Workstation templates
+      }elseif(in_array('gotoWorkstation', $entry['objectClass'])){
+        if(!isset($entry['macAddress'][0]) || $entry['macAddress'][0] == "-"){
+          $entries[$key]['objectClass'][] = 'FAKE_OC_WorkstationTemplate';
+        }
+
+      // Detect Terminal templates
+      }elseif(in_array('gotoTerminal', $entry['objectClass'])){
+        if(!isset($entry['macAddress'][0]) || $entry['macAddress'][0] == "-"){
+          $entries[$key]['objectClass'][] = 'FAKE_OC_TerminalTemplate';
+        }
+
+      // Detect Server templates
+      }elseif(in_array('goServer', $entry['objectClass'])){
+        if(!isset($entry['macAddress'][0]) || $entry['macAddress'][0] == "-"){
+          $entries[$key]['objectClass'][] = 'FAKE_OC_ServerTemplate';
+        }
+      }
+
+      // Detect object states
+      foreach(array('gotoWorkstation','gotoTerminal','goServer') as $type){
+        if(in_array($type, $entry['objectClass'])){
+
+          if(isset($entry['gotoMode'][0]) && preg_match("/locked/i", $entry['gotoMode'][0])){
+            $entries[$key]['objectClass'][] = $type."__IS_LOCKED";
+          }elseif(isset($entry['FAIstate'][0])){
+            switch (preg_replace('/:.*$/', '', $entry['FAIstate'][0])) {
+              case 'error':
+                $state= '__IS_ERROR';
+                break;
+              case 'installing':
+              case 'install':
+              case 'sysinfo':
+              case 'softupdate':
+              case 'scheduledupdate':
+                $state= '__IS_BUSY';
+                break;
+              default: $state ="";
+            }
+            if(!empty($state)) $entries[$key]['objectClass'][] = $type.$state;
+          }
+        }
+      }
+    }
+
+    return($entries);
+  }
+
+}
+
+?>
index bb9f5942c48f5552b9a41ff1122fad44ea9858c2..583e9a2c3b9172d03ca04250722b6447faa556f1 100644 (file)
@@ -16,6 +16,7 @@
       <attribute>cn</attribute>
       <attribute>description</attribute>
       <attribute>gotoMode</attribute>
+      <attribute>FAIstate</attribute>
       <attribute>macAddress</attribute>
     </query>
     <scope>auto</scope>
index 9d004b6be9a328be4f6fa05e302bf962e73d0759..ad2068a0c7b83630ffa01c14b7176e5df9d35264 100644 (file)
       <image>plugins/systems/images/select_new_workstation.png</image>
     </objectType>
 
+    <objectType>
+      <label>Locked server</label>
+      <objectClass>goServer__IS_LOCKED</objectClass>
+      <category>server</category>
+      <class>servgeneric</class>
+      <image>plugins/systems/images/server_locked.png</image>
+    </objectType>
+
+    <objectType>
+      <label>Locked workstation</label>
+      <objectClass>gotoWorkstation</objectClass>
+      <category>workstation</category>
+      <class>workgeneric</class>
+      <image>plugins/systems/images/workstation_locked.png</image>
+    </objectType>
+
+    <objectType>
+      <label>Locked terminal</label>
+      <objectClass>gotoTerminal</objectClass>
+      <category>terminal</category>
+      <class>termgeneric</class>
+      <image>plugins/systems/images/terminal_locked.png</image>
+    </objectType>
+
+
     <objectType>
       <label>New terminal</label>
       <objectClass>FAKE_OC_NewTerminal</objectClass>