Code

Updated remaining attributes
[gosa.git] / gosa-plugins / sudo / admin / sudo / class_target_list_systems.inc
index 0bfd3defe6a2821c7126bd12f6ac536a6243a0ec..64a676a481340f95b471d17393cfe95e642ed535 100644 (file)
 
 class target_list_systems extends MultiSelectWindow
 {
-  var $config;
-  var $list         =array();
-  var $Targets_used =array();
-
-  /* Current base */
-  var $selectedBase       = "";
-  var $departments        = array();
+  public $config;
+  protected $list         =array();
+  private $Targets_used =array();
 
   /* Regex */
-  var $Regex              = "*";
+  protected $Regex           = "*";
 
   /* CheckBoxes, to change default values modify $this->AddCheckBox */
-  var $ogroups        ;
-  var $servers        ;
-  var $workstations   ;
-  var $incoming       ;
+  protected $servers        ;
+  protected $workstations   ;
+  protected $terminals      ;
 
 
   /* Subsearch checkbox */
-  var $SubSearch          ;
-  var $IPMatch            ;
-  var $parent             ;
-  var $ui                 ;
+  protected $SubSearch       ;
+  protected $parent          ;
+  public $ui                 ;
  
  
   function target_list_systems(&$config,$Targets_used)
@@ -54,8 +48,8 @@ class target_list_systems extends MultiSelectWindow
     $this->Targets_used = $Targets_used;
     
     $this->SetInformation(  _("Select the target objects for your scheduled action."));
-    $this->SetTitle(        _("Available targets"));
-    $this->SetSummary(      _("Available targets"));
+    $this->SetTitle(        _("Available systems"));
+    $this->SetSummary(      _("Available systems"));
     $this->SetHeadpageMode(FALSE);
     
     /* set Page header */
@@ -103,8 +97,12 @@ class target_list_systems extends MultiSelectWindow
     }
 
     /* Load possible departments */
-    $ui= get_userinfo();
-    $tdeps= $ui->get_module_departments("ogroups");
+    $tdeps= array();
+    $tdeps= array_merge($tdeps,$ui->get_module_departments("server"));
+    $tdeps= array_merge($tdeps,$ui->get_module_departments("terminal"));
+    $tdeps= array_merge($tdeps,$ui->get_module_departments("workstation"));
+    $tdeps = array_unique($tdeps); 
     $ids = $this->config->idepartments;
     $first = "";
     $found = FALSE;
@@ -135,17 +133,13 @@ class target_list_systems extends MultiSelectWindow
       $this->selectedBase = $first;
     }
 
-    /* Get copy & paste icon */
-    $acls  = $ui->get_permissions($this->selectedBase,"ogroups/ogroup");
-    $acl_all= $ui->has_complete_category_acls($this->selectedBase,"ogroups");
-
     /* Add default header */
     $listhead = MultiSelectWindow::get_default_header();
 
     /* Add department selector */
     $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
-      " <input class='center' type='image' src='images/list_submit.png' align='middle'
-      title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
+      " <input class='center' type='image' src='images/lists/submit.png' align='middle'
+      title='"._("Submit")."' name='submit_department' alt='"._("Submit")."'>&nbsp;";
     $listhead .="</div>";
 
     $this->SetListHeader($listhead);
@@ -167,12 +161,11 @@ class target_list_systems extends MultiSelectWindow
       /* Add Copy & Paste buttons if copy&paste is enabled
      */
     // Defining Links
-    $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
     $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
 
     $ui = get_userinfo();
 
-    // Assigning ogroups
+    // Assigning systems 
     foreach($list as $key => $val){
 
       if(in_array($val['cn'][0],$this->Targets_used) || 
@@ -184,22 +177,14 @@ class target_list_systems extends MultiSelectWindow
       }else{
         $desc = " - [ ".$val['description'][0]." ]";
       }
-      if(!isset($val['ipHostNumber'][0])){
-        $desc.= "";
-      }else{
-        $desc.= " - ".$val['ipHostNumber'][0]."";
-      }
-
 
-      $img ="Hmm";
+      $img ="?";
       if(in_array("goServer",$val['objectClass'])){
-        $img = "<img src='images/select_server.png' alt='"._("Server")."' ".$title.">";
+        $img = "<img src='plugins/systems/images/select_server.png' alt='"._("Server")."' ".$title.">";
       }elseif(in_array("gotoWorkstation",$val['objectClass'])){
-        $img = "<img src='images/select_workstation.png' alt='"._("Workstation")."' ".$title.">";
+        $img = "<img src='plugins/systems/images/select_workstation.png' alt='"._("Workstation")."' ".$title.">";
       }elseif(in_array("gotoTerminal",$val['objectClass'])){
-        $img = "<img src='images/select_terminal.png' alt='"._("Terminal")."' ".$title.">";
-      }else{
-          print_a($val);
+        $img = "<img src='plugins/systems/images/select_terminal.png' alt='"._("Terminal")."' ".$title.">";
       }
 
       /* Create each field */
@@ -240,37 +225,48 @@ class target_list_systems extends MultiSelectWindow
     $filter   = "";
     $Regex    = $this->Regex;
 
-    $chk = array(
-        "terminal"     => "(objectClass=gotoTerminal)",
-        "server"       => "(objectClass=goServer)" ,
-        "workstation"  => "(objectClass=gotoWorkstation)");
-
-    /* Create filter */
-    foreach($chk as $chkBox => $FilterPart){
-      if($this->$chkBox){
-        $filter .=  $FilterPart;
-      }
-    }
     $filter= "(&(cn=".$Regex.")(|".$filter."))";
 
     if($this->SubSearch){
-      $res= get_list($filter, array("terminal","workstation","server"), $base, 
-            array("cn","objectClass","gosaGroupObjects","ipHostNumber","description"), GL_SIZELIMIT | GL_SUBSEARCH);
+      $res= array();
+      if($this->terminal){
+        $filter = "(objectClass=gotoTerminal)";
+        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_sub_list($filter,"terminal",get_ou('terminalou'),$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
+      }
+      if($this->workstation){
+        $filter = "(objectClass=gotoWorkstation)";  
+        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_sub_list($filter, "workstation",  get_ou('workstationou'),$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
+      }
+      if($this->server){
+        $filter = "(objectClass=goServer)";
+        $filter = "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_sub_list($filter, "server", get_ou('serverou'),$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT | GL_SUBSEARCH));
+      }
     }else{
-      $res= get_list($filter, "terminal", get_ou('terminalou').$base, 
-            array("cn","objectClass","description"), GL_SIZELIMIT );
-      $res= array_merge($res,get_list($filter, "workstation",  get_ou('workstationou').$base, 
-            array("cn","objectClass","description"), GL_SIZELIMIT ));
-      $res= array_merge($res,get_list($filter, "server", get_ou('serverou').$base, 
-            array("cn","objectClass","description"), GL_SIZELIMIT ));
-
-      $deps_a = array(
-          get_ou("workstationou"),
-          get_ou("terminalou"),
-          get_ou("serverou"));
-
-      $res = get_sub_list($filter,array("server","terminal","workstation"), 
-                  $deps_a,get_ou("systemsou").$base,array("cn","objectClass","description"),GL_SIZELIMIT);
+      $res= array();
+      if($this->terminal){
+        $filter = "(objectClass=gotoTerminal)";
+        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_list($filter,"terminal", get_ou('terminalou').$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT ));
+      }
+      if($this->workstation){
+        $filter = "(objectClass=gotoWorkstation)";  
+        $filter= "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_list($filter, "workstation",  get_ou('workstationou').$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT ));
+      }
+      if($this->server){
+        $filter = "(objectClass=goServer)";
+        $filter = "(&(cn=".$Regex.")(|".$filter."))";
+        $res= array_merge($res,get_list($filter, "server", get_ou('serverou').$base, 
+              array("cn","objectClass","description"), GL_SIZELIMIT ));
+      }
     }
 
     $this->list= $res;