Code

Added system filter
[gosa.git] / gosa-plugins / systems / admin / systems / class_divListSystem.inc
index 1066c0bd292e3c32ad25838f3d8fbcc75e4e3751..fa2466df448f29682468f5f8427020b7896290b3 100644 (file)
@@ -39,6 +39,7 @@ class divListSystem extends MultiSelectWindow
   var $ShowPrinters;
   var $ShowDevices;
   var $ShowPhones;
+  var $ShowOpsiHosts;
 
   /* Subsearch checkbox */
   var $SubSearch;
@@ -48,12 +49,12 @@ class divListSystem extends MultiSelectWindow
 
   function divListSystem (&$config,$parent)
   {
-    MultiSelectWindow::MultiSelectWindow($config, "System", array("server",
-                                                                  "workstation",
-                                                                  "terminal",
-                                                                  "phone",
-                                                                  "incoming",
-                                                                  "printer"));
+    $classes = array("server","workstation","terminal","phone","incoming","winworkstation","printer","component");
+    if(class_available("opsiGeneric")){
+      $classes[] = "opsi";
+    }
+
+    MultiSelectWindow::MultiSelectWindow($config, "System", $classes);
 
     $this->parent       = $parent;
     $this->ui           = get_userinfo();
@@ -115,6 +116,12 @@ class divListSystem extends MultiSelectWindow
           msgPool::selectToView(  _("MicroSoft Windows based workstations")), 
           sprintf(_("Show %s"),   _("windows based workstations")),true);
     }
+    /* Add opsi checkboxes if opsi is enabled */
+    if($this->parent->opsi instanceof opsi && $this->parent->opsi->enabled()){
+      $this->AddCheckBox("ShowOpsiHosts" , sprintf(_("Display objects of type '%s'."),
+            _("OPSI installed client")),_("Show OPSI based clients")   ,true);
+    }
+
     if(class_available("printtabs")){
       $this->AddCheckBox("ShowPrinters",
           msgPool::selectToView(  _("network printers")),   
@@ -199,9 +206,12 @@ class divListSystem extends MultiSelectWindow
       $s.= "...|<img src='plugins/systems/images/select_component.png' alt='' border='0' class='center'>".
         "&nbsp;"._("Component")."|"."newsystem_component|\n";
     }
-    if(class_available("opsiGeneric") && preg_match("/c/",$ui->get_permissions($this->selectedBase,"opsi/opsiGeneric"))){
+
+    if($this->parent->opsi instanceof opsi && 
+        $this->parent->opsi->enabled() &&  
+        preg_match("/c/",$ui->get_permissions($this->selectedBase,"opsi/opsiGeneric"))){
       $s.= "...|<img src='plugins/systems/images/select_winstation.png' alt='' border='0' class='center'>".
-        "&nbsp;"._("Opsi")."|"."newsystem_opsi_client|\n";
+        "&nbsp;"._("Opsi client")."|"."newsystem_opsi_client|\n";
     }
 
     if($this->parent->si_active){
@@ -333,7 +343,7 @@ class divListSystem extends MultiSelectWindow
         $display= $val["cn"][0].$dsc;
       }
 
-      /* Check if this is a terminal/workstation && if we are allowed to change the gotoRootPasswd */
+      /* Check if this is a terminal/workstation && if we are allowed to change the userPassword */
       $display_key_for = array("terminal","workstation","server","component");
       $pwd_acl = $ui->get_permissions($val['dn'],$tabs[$type]['ACL'],"userPassword");
       if(preg_match("/w/",$pwd_acl) && in_array($type,$display_key_for)){
@@ -380,13 +390,13 @@ class divListSystem extends MultiSelectWindow
       $field1 = array("string" => sprintf($img['img'],$val['dn']),
           "attach" => "style='text-align:center;width:20px;'");
       $field2 = array("string" => sprintf($editlink,$key,$display),
-          "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', @LDAP::fix($val['dn']))."'");
+          "attach" => "style='' title='".preg_replace('/ /', '&nbsp;', LDAP::fix($val['dn']))."'");
       $field3 = array("string" => preg_replace("/%KEY%/", "$key", $action2.$action),
           "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
 
       if($this->parent->fai_activated){
 
-        $release ="&nbsp;";
+        $release ="";
         $release_attach = ""; 
         if(isset($val['FAIclass'][0]) && preg_match("/:/",$val['FAIclass'][0])){
           $release        = preg_replace("/^.*:/","",$val['FAIclass'][0]);
@@ -397,7 +407,7 @@ class divListSystem extends MultiSelectWindow
             title='".sprintf(_("Inherited from %s"),trim($ogs_release[$val['dn']]['CN'],", "))."'>";
           $release_attach = "title='".sprintf(_("Inherited from %s"),trim($ogs_release[$val['dn']]['CN'],", "))."'"; 
         }
-        $field2a = array("string" => $release,"attach"=>$release_attach." style='width:100px;'");
+        $field2a = array("string" => $release."&nbsp;","attach"=>$release_attach." style='width:100px;'");
         $this->AddElement( array($field0,$field1,$field2,$field2a,$field3));
       }else{
         $this->AddElement( array($field0,$field1,$field2,$field3));
@@ -435,7 +445,7 @@ class divListSystem extends MultiSelectWindow
     $str.= "<img class='center' src='plugins/systems/images/select_newsystem.png'
       title='".$num_new_str."' alt='".$num_new_str."'>&nbsp;".$cnts['NewDevice']."&nbsp;&nbsp;&nbsp;&nbsp;";
     $str.= "<img class='center' src='plugins/systems/images/select_winstation.png'
-      title='".$num_wws_str."' alt='".$num_wws_str."'>&nbsp;".$cnts['winstation']."&nbsp;&nbsp;&nbsp;&nbsp;";
+      title='".$num_wws_str."' alt='".$num_wws_str."'>&nbsp;".($cnts['winstation'] + $cnts['opsi_client'])."&nbsp;&nbsp;&nbsp;&nbsp;";
     $str.= "<img class='center' src='images/lists/folder.png'
       title='".$num_dep_str."' alt='".$num_dep_str."'>&nbsp;".$num_deps."&nbsp;&nbsp;&nbsp;&nbsp;";