Code

Updated filter...
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Jan 2010 15:48:09 +0000 (15:48 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 8 Jan 2010 15:48:09 +0000 (15:48 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15127 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/systems/admin/systems/class_filterSYSTEMS.inc
gosa-plugins/systems/admin/systems/class_systemManagement.inc
gosa-plugins/systems/admin/systems/system-filter.tpl
gosa-plugins/systems/admin/systems/system-list.xml

index 5b1d87ae7e8b4f37811ab05c5aa2cd8011357613..9a4df16eeb27569d603c3be6cd70cc0f159d48fe 100644 (file)
@@ -74,38 +74,37 @@ class filterSYSTEMS {
     }
 
     // Append opsi stuff ...
-    if(preg_match("/FAIstate=__NETBOOT__/", $filter)){
-      global $config;
-      $ui = get_userinfo();
-      if(class_available('opsi') && $base == $config->current['BASE']){
-        $opsi = new opsi($config);
-        $objects = array();
-        if($opsi instanceof opsi && $opsi->enabled()){
-          $opsi_acl = $ui->get_permissions($base,"opsi/opsiProperties");
-          if(preg_match("/r/",$opsi_acl)){
-            $opsi_clients = $opsi->get_hosts_for_system_management();
-            if($opsi->is_error()){
-              msg_dialog::display(_("Error"),msgPool::siError($opsi->get_error()),ERROR_DIALOG);
-            }else{
-              foreach($opsi_clients as $entry){
-                $entry['objectClass'] = array("FAKE_OC_OpsiHost");
-                $item = array('count' => count($entry));
-                foreach($entry as  $name => $value){
-                  $item[] = $name;
-                  $item[$name] = $value;
-                }
-                $entries[] = $item;
-              }
+    global $config;
+    $ui = get_userinfo();
+    if(preg_match("/FAIstate=__NETBOOT__/", $filter) && 
+        class_available('opsi') &&
+        $base == $config->current['BASE']){
+
+      // Check ACLs and opsi handle
+      $opsi_acl = $ui->get_permissions($base,"opsi/opsiProperties");
+      $opsi = new opsi($config);
+      $objects = array();
+      if($opsi instanceof opsi && $opsi->enabled() && preg_match("/r/",$opsi_acl)){
+
+        // Get list of opsi hosts 
+        $opsi_clients = $opsi->get_hosts_for_system_management();
+        if($opsi->is_error()){
+          msg_dialog::display(_("Error"),msgPool::siError($opsi->get_error()),ERROR_DIALOG);
+        }else{
+          foreach($opsi_clients as $entry){
+            $entry['objectClass'] = array("FAKE_OC_OpsiHost");
+            $item = array('count' => count($entry));
+            foreach($entry as  $name => $value){
+              $item[] = $name;
+              $item[$name] = $value;
             }
-          } 
+            $entries[] = $item;
+          }
         }
       }
     }
-  
-
     return($entries);
   }
-
 }
 
 ?>
index c3efc23d9dbaf871aebc7398960f99351e0db200..3845cef7b06118c69a13bf3846ea06d7711fdab2 100644 (file)
@@ -46,8 +46,8 @@ class systemManagement extends management
     $tD = $this->getObjectDefinitions(); 
     $sP = array();
     foreach($tD as $entry){
-      if(!empty($entry['RDN']))
-      $sP[] = $entry['RDN'];
+      if(!empty($entry['ou']))
+        $sP[] = $entry['ou'];
     }
     $this->storagePoints = array_unique($sP);
 
@@ -55,25 +55,25 @@ class systemManagement extends management
 #    if (session::global_is_set(get_class($this)."_filter")){
 #      $filter= session::global_get(get_class($this)."_filter");
 #    } else {
-      $filter = new filter(get_template_path("system-filter.xml", true));
-      $filter->setObjectStorage($this->storagePoints);
+  $filter = new filter(get_template_path("system-filter.xml", true));
+  $filter->setObjectStorage($this->storagePoints);
 #    }
-    $this->setFilter($filter);
+  $this->setFilter($filter);
 
-    // Build headpage
-    $headpage = new listing(get_template_path("system-list.xml", true));
-    $headpage->setFilter($filter);
+  // Build headpage
+  $headpage = new listing(get_template_path("system-list.xml", true));
+  $headpage->setFilter($filter);
 
-    $filter->setConverter('INCOMING', 'systemManagement::incomingFilterConverter');
+  $filter->setConverter('INCOMING', 'systemManagement::incomingFilterConverter');
 
-    // Add copy&paste and snapshot handler.
-    if ($this->config->boolValueIsTrue("main", "copyPaste")){
-      $this->cpHandler = new CopyPasteHandler($this->config);
-    }
-    if($this->config->get_cfg_value("enableSnapshots") == "true"){
-      $this->snapHandler = new SnapshotHandler($this->config);
-    }
-    parent::__construct($config, $ui, "systems", $headpage);
+  // Add copy&paste and snapshot handler.
+  if ($this->config->boolValueIsTrue("main", "copyPaste")){
+    $this->cpHandler = new CopyPasteHandler($this->config);
+  }
+  if($this->config->get_cfg_value("enableSnapshots") == "true"){
+    $this->snapHandler = new SnapshotHandler($this->config);
+  }
+  parent::__construct($config, $ui, "systems", $headpage);
   }
 
   static function incomingFilterConverter($filter)
@@ -83,121 +83,140 @@ class systemManagement extends management
     return(preg_replace("/%systemIncomingRDN/", $rdn,$filter));
   }
 
-  
- /*! \brief   Overridden render method of class mangement.
-  *            this allows us to add a release selection box.
-  */
-function renderList()
-{
-  $headpage = $this->getHeadpage();
-  $headpage->update();
-
-  $tD = $this->getObjectDefinitions();
-  $smarty = get_smarty();
-  foreach($tD as $name => $obj){
-    $smarty->assign("USE_".$name, (empty($obj['TABNAME']) || class_available($obj['TABNAME'])));
+  function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+  {
+    $headpage = $this->getHeadpage();
+    foreach($target as $id){
+      $type = $headpage->getType($id);
+      echo $type."<br>";
+    }
   }
 
-  $display = $headpage->render();
-  return($this->getHeader().$display);
-}
+
+
+  /*! \brief   Overridden render method of class mangement.
+   *            this allows us to add a release selection box.
+   */
+  function renderList()
+  {
+    $headpage = $this->getHeadpage();
+    $headpage->update();
+
+    $tD = $this->getObjectDefinitions();
+    $smarty = get_smarty();
+    foreach($tD as $name => $obj){
+      $smarty->assign("USE_".$name, (empty($obj['TABNAME']) || class_available($obj['TABNAME'])));
+    }
+
+    $display = $headpage->render();
+    return($this->getHeader().$display);
+  }
 
 
   public function getObjectDefinitions()
   {
+
+#       "workstation" =>  array(
+#           "RDN"       => get_ou('workstationRDN'),
+#           "CLASS"   => "WORKTABS",
+#           "TABNAME" => "workgeneric",
+#           "TABCLASS"=> "worktabs",
+#           "ACLC"    => "workstation",
+#           "ACL"     => "workstation/workgeneric" ),
+
+
     $tabs = array(
-        "incoming"    => array(
-          "RDN"       => get_ou('systemIncomingRDN'),
-          "CLASS"     => "",
-          "TABNAME"   => "",
-          "TABCLASS"  => "",
-          "ACLC"      => "incoming",
-          "ACL"       => "incoming/systems"),
-
-        "ArpNewDevice"=> array(
-          "RDN"       => get_ou('systemIncomingRDN'),
-          "CLASS"     => "TERMTABS",
-          "TABNAME"   => "termgeneric" ,
-          "TABCLASS"  => "termtabs",
-          "ACLC"      => "incoming",
-          "ACL"       => "incoming/systems"),
-
-        "NewDevice"   => array(
-          "RDN"       => get_ou('systemIncomingRDN'),
-          "CLASS"     => "TERMTABS",
-          "TABNAME"   => "termgeneric",
-          "TABCLASS"  => "termtabs",
-          "ACLC"      => "incoming",
-          "ACL"       => "incoming/systems"),
-
-        "terminal"    => array(
-            "RDN"       => get_ou('terminalRDN'),
-            "CLASS"     => "TERMTABS",
-            "TABNAME"   => "termgeneric",
-            "TABCLASS"  => "termtabs",
-            "ACLC"      => "terminal",
-            "ACL"       => "terminal/termgeneric"),
-
-        "workstation" =>  array(
-            "RDN"       => get_ou('workstationRDN'),
-            "CLASS"   => "WORKTABS",
-            "TABNAME" => "workgeneric",
-            "TABCLASS"=> "worktabs",
-            "ACLC"    => "workstation",
-            "ACL"     => "workstation/workgeneric" ),
-
-        "server"      => array(
-            "RDN"       => get_ou('serverRDN'),
-            "CLASS"   => "SERVTABS",
-            "TABNAME" => "servgeneric",
-            "TABCLASS"=> "servtabs",
-            "ACLC"    => "server",
-            "ACL"     => "server/servgeneric"),
-
-        "printer"     => array(
-            "RDN"       => get_ou('printerRDN'),
-            "CLASS"   => "PRINTTABS",
-            "TABNAME" => "printgeneric",
-            "TABCLASS"=> "printtabs",
-            "ACLC"    => "printer",
-            "ACL"     => "printer/printgeneric"),
-
-        "phone"       => array(
-            "RDN"       => get_ou('phoneRDN'),
-            "CLASS"   => "PHONETABS",
-            "TABNAME" => "phoneGeneric",
-            "TABCLASS"=> "phonetabs",
-            "ACLC"    => "phone",
-            "ACL"     => "phone/phoneGeneric"),
-
-        "winstation"  => array(
-            "RDN"       => get_winstations_ou(),
-            "CLASS"   => "WINTABS",
-            "TABNAME" => "wingeneric",
-            "TABCLASS"=> "wintabs",
-            "ACLC"    => "winworkstation",
-            "ACL"     => "winworkstation/wingeneric"),
-
-        "component"   => array(
-            "RDN"       => get_ou('componentRDN'),
-            "CLASS"   => "COMPONENTTABS",
-            "TABNAME" => "componentGeneric",
-            "TABCLASS"=> "componenttabs",
-            "ACLC"    => "component",
-            "ACL"     => "component/componentGeneric"),
-
-        "opsi_client" => array(
-            "RDN"     => "",
-            "CLASS"   => "OPSITABS",
-            "TABNAME" => "opsiGeneric" ,
-            "TABCLASS"=> "opsi_tabs",
-            "ACLC"    => "opsi" ,
-            "ACL"     => "opsi/opsiGeneric"));
+        "FAKE_OC_OpsiHost" => array(
+          "ou"          => "",
+          "plugClass"   => "opsiGeneric",
+          "tabClass"    => "opsi_tabs",
+          "tabDesc"     => "OPSITABS",
+          "aclClass"    => "opsiGeneric",
+          "aclCategory" => "opsi"),
+
+        "goServer" => array(
+          "ou"          => get_ou('serverRDN'),
+          "plugClass"   => "servgeneric",
+          "tabClass"    => "servtabs",
+          "tabDesc"     => "SERVTABS",
+          "aclClass"    => "servgeneric",
+          "aclCategory" => "server"),
+
+        "gotoWorkstation" => array(
+          "ou"          => get_ou('workstationRDN'),
+          "plugClass"   => "workgeneric",
+          "tabClass"    => "worktabs",
+          "tabDesc"     => "WORKTABS",
+          "aclClass"    => "workstation",
+          "aclCategory" => "workgeneric"),
+
+        "gotoTerminal" => array(
+            "ou"          => get_ou('terminalRDN'),
+            "plugClass"   => "termgeneric",
+            "tabClass"    => "termtabs",
+            "tabDesc"     => "TERMTABS",
+            "aclClass"    => "terminal",
+            "aclCategory" => "termgeneric"),
+
+        "gotoPrinter" => array(
+            "ou"          => get_ou('printerRDN'),
+            "plugClass"   => "printgeneric",
+            "tabClass"    => "printtabs",
+            "tabDesc"     => "PRINTABS",
+            "aclClass"    => "printer",
+            "aclCategory" => "printgeneric"),
+
+        "FAKE_OC_NewDevice" => array(
+            "ou"          => get_ou('systemIncomingRDN'),
+            "plugClass"   => "termgeneric",
+            "tabClass"    => "termtabs",
+            "tabDesc"     => "TERMTABS",
+            "aclClass"    => "terminal",
+            "aclCategory" => "termgeneric"),
+
+        "goFonHardware" => array(
+            "ou"          => get_ou('phoneRDN'),
+            "plugClass"   => "phoneGeneric",
+            "tabClass"    => "phonetabs",
+            "tabDesc"     => "PHONETABS",
+            "aclClass"    => "phone",
+            "aclCategory" => "phoneGeneric"),
+
+        "FAKE_OC_winstation" => array(
+            "ou"          => get_winstations_ou(),
+            "plugClass"   => "wingeneric",
+            "tabClass"    => "wintabs",
+            "tabDesc"     => "WINTABS",
+            "aclClass"    => "wingeneric",
+            "aclCategory" => "winworkstation"),
+
+        "ieee802Device" => array(
+            "ou"          => get_ou('componentRDN'),
+            "plugClass"   => "componentGeneric",
+            "tabClass"    => "componenttabs",
+            "tabDesc"     => "COMPONENTTABS",
+            "aclClass"    => "componentGeneric",
+            "aclCategory" => "component"),
+        );
+
+    // Now map some special types
+    $tabs['FAKE_OC_NewWorkstation'] = &$tabs['gotoWorkstation'];
+    $tabs['FAKE_OC_NewTerminal'] = &$tabs['gotoTerminal'];
+    $tabs['FAKE_OC_NewServer'] = &$tabs['gotoWorkstation'];
+    $tabs['gotoWorkstation__IS_BUSY'] = &$tabs['gotoWorkstation'];
+    $tabs['gotoWorkstation__IS_ERROR'] = &$tabs['gotoWorkstation'];
+    $tabs['gotoWorkstation__IS_LOCKED'] = &$tabs['gotoWorkstation'];
+    $tabs['gotoTerminal__IS_BUSY'] = &$tabs['gotoTerminal'];
+    $tabs['gotoTerminal__IS_ERROR'] = &$tabs['gotoTerminal'];
+    $tabs['gotoTerminal__IS_LOCKED'] = &$tabs['gotoTerminal'];
+    $tabs['goServer__IS_BUSY'] = &$tabs['goServer'];
+    $tabs['goServer__IS_ERROR'] = &$tabs['goServer'];
+    $tabs['goServer__ISLOCKED'] = &$tabs['goServer'];
+
+    $tabs['FAKE_OC_NewUnknownDevice'] = &$tabs['FAKE_OC_NewDevice'];
 
     return($tabs);
   }
-
-
 } 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index a0f1e50f64982a8aeed03368a780303516117bf5..d274520493c8ed4edb2a99d32dc7d755d01eac6d 100644 (file)
@@ -7,31 +7,31 @@
 <div class="contentboxb">
   <div style="border-top:1px solid #AAAAAA"></div>
 
-  {if $USE_server}
+  {if $USE_goServer}
   {$SERVER}&nbsp;{t}Show servers{/t}<br>
   {/if}
-  {if $USE_workstation}
+  {if $USE_gotoWorkstation}
   {$WORKSTATION}&nbsp;{t}Show workstations{/t}<br>
   {/if}
-  {if $USE_terminal}
+  {if $USE_gotoTerminal}
   {$TERMINAL}&nbsp;{t}Show terminals{/t}<br>
   {/if}
-  {if $USE_printer}
+  {if $USE_gotoPrinter}
   {$PRINTER}&nbsp;{t}Show network printer{/t}<br>
   {/if}
-  {if $USE_phone}
+  {if $USE_goFonHardware}
   {$PHONE}&nbsp;{t}Show phones{/t}<br>
   {/if}
-  {if $USE_winstation}
+  {if $USE_FAKE_OC_winstation}
   {$WINSTATION}&nbsp;{t}Show windows based workstations{/t}<br>
   {/if}
-  {if $USE_component}
+  {if $USE_ieee802Device}
   {$COMPONENT}&nbsp;{t}Show network devices{/t}<br>
   {/if}
-  {if $USE_incoming}
+  {if $USE_FAKE_OC_NewWorkstation || $USE_FAKE_OC_NewTerminal || $USE_FAKE_OC_NewServer || $USE_FAKE_OC_NewDevice || $USE_FAKE_OC_NewUnknownDevice}
   {$INCOMING}&nbsp;{t}Show incoming devices{/t}<br>
   {/if}
-  {if $USE_opsi_client}
+  {if $USE_FAKE_OC_OpsiHost}
   {$OPSI}&nbsp;{t}Show OPSI based clients{/t}<br>
   {/if}
 
index ad2068a0c7b83630ffa01c14b7176e5df9d35264..de478353bbf8503df2de6a30e6e1ffab085b9c0b 100644 (file)
     <label>List of systems</label>
     <defaultSortColumn>1</defaultSortColumn>
 
+    <objectType>
+      <label>Opsi host</label>
+      <objectClass>FAKE_OC_OpsiHost</objectClass>
+      <category>opsi</category>
+      <class>opsiGeneric</class>
+      <image>plugins/systems/images/select_winstation.png</image>
+    </objectType>
+
     <objectType>
       <label>New workstation</label>
       <objectClass>FAKE_OC_NewWorkstation</objectClass>