Code

Fix for #4146
[gosa.git] / trunk / gosa-plugins / goto / admin / systems / goto / class_workstationService.inc
index f0fcff4e40bab939967d2b0eb1d0649369f9edfd..4e122d898bf859c892051095fa47f56c8ae8bc56 100644 (file)
@@ -80,10 +80,17 @@ class workservice extends plugin
     }
 
     /* Get list of available xdrivers */
-    $this->XDrivers = $this->getListOfXDrivers();
+    foreach($this->getListOfXDrivers() as $xdriver) {
+      $this->XDrivers[$xdriver] = $xdriver;
+    }
 
-    array_unshift($this->XDrivers, "["._("unknown")."]");
+    if (isset($this->attrs['gosaGroupObjects'])) {
+      array_unshift($this->XDrivers, "["._("manual/auto")."]");
+    }
+    else {
+      array_unshift($this->XDrivers, "["._("unknown")."]");
+    }
+     
     $this->XColordepths= array( 
         "8"        => "8 " ._("bit"), 
         "15"       => "15 "._("bit"),      
@@ -98,12 +105,18 @@ class workservice extends plugin
       $this->XKbModels[$type] = $type;
     }
 
-    $this->MouseTypes= array("ImPS/2" => "ImPS/2", "PS/2" => "PS/2", "Microsoft" => "Microsoft", 
-                              "Logitech" => "Logitech","explorerps/2"=>"explorerps/2",);
+    $this->MouseTypes= array("auto" => "auto",
+                             "explorerps/2" => "explorerps/2",
+                             "ImPS/2" => "ImPS/2",
+                             "PS/2" => "PS/2",
+                             "Microsoft" => "Microsoft",
+                             "Logitech" => "Logitech",);
 
-    $this->MousePorts= array("/dev/ttyS0"  =>"/dev/ttyS0", 
-                             "/dev/ttyS1"       => "/dev/ttyS1",          "/dev/psaux"  =>"/dev/psaux", 
-                             "/dev/input/mice"  => "/dev/input/mice");
+    $this->MousePorts= array("/dev/input/mice" => "/dev/input/mice",
+                             "/dev/mouse" => "/dev/mouse",
+                             "/dev/psaux" => "/dev/psaux",
+                             "/dev/ttyS0" => "/dev/ttyS0",
+                             "/dev/ttyS1" => "/dev/ttyS1",);
 
     /* Additional values will be extracted from CONFIG_DIR./keyboardLayouts */
     $this->XKbLayouts = array("de"=> "de","en" =>"en", "es" => "es", "us" =>"us", "fr" => "fr");
@@ -178,7 +191,7 @@ class workservice extends plugin
     $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))");
     if ($ldap->count() == 1){
       $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
-                  "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport");
+                  "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport", "gotoXDriver");
       $attrs= $ldap->fetch();
 
       foreach ($map as $name){
@@ -187,6 +200,12 @@ class workservice extends plugin
         }
         
         switch ($name){
+          case 'gotoXDriver':
+            $ogroup_driver = $attrs['gotoXDriver'][0];
+            if (in_array($ogroup_driver, $this->XDrivers) && (empty($this->attrs['gotoXDriver']))) {
+                $this->XDrivers = array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XDrivers;
+            }
+            break;
           case 'gotoXResolution':
             $this->XResolutions= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XResolutions;
             break;
@@ -203,10 +222,10 @@ class workservice extends plugin
             $this->XKbVariants= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->XKbVariants;
             break;
           case 'gotoXMouseType':
-            $this->MouseTypes= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
+            $this->MouseTypes= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MouseTypes;
             break;
           case 'gotoXMouseport':
-            $this->MousePorts= array('AUTO' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
+            $this->MousePorts= array('default' => _("inherited").' ['.$attrs[$name][0].']' ) + $this->MousePorts;
             break;
         }
 
@@ -217,13 +236,14 @@ class workservice extends plugin
     /* Workaround to fill in inherited values if we've specified an objectclass */
     $SelectedSystemType = session::get("SelectedSystemType");
     if (isset($SelectedSystemType['ogroup']) && $SelectedSystemType['ogroup'] != 'none'){
+      $this->XDrivers=array('default' => _("inherited"));
       $this->XResolutions= array('default' => _("inherited"));
       $this->XColordepths= array('default' => _("inherited"));
       $this->XKbModels= array('default' => _("inherited"));
       $this->XKbLayouts= array('default' => _("inherited"));
       $this->XKbVariants= array('default' => _("inherited"));
-      $this->MouseTypes= array('AUTO' => _("inherited"));
-      $this->MousePorts= array('AUTO' => _("inherited"));
+      $this->MouseTypes= array('default' => _("inherited"));
+      $this->MousePorts= array('default' => _("inherited"));
     }
   }
 
@@ -422,7 +442,7 @@ class workservice extends plugin
     /* Strip out 'default' values */
     foreach(array(
           "gotoXDriver", "gotoXResolution", "gotoXColordepth",
-          "gotoXKbModel", "gotoXKbLayout",
+          "gotoXKbModel", "gotoXKbLayout", "gotoXDriver",
           "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport") as $val){
 
       if ($this->attrs[$val] == "default"){
@@ -471,7 +491,7 @@ class workservice extends plugin
       $drivers = array("ati", "atimisc", "chips", "cirrus", "cyrix", "fbdev", "fglrx",
           "i128", "i740", "i810", "intel", "imstt", "mga", "neomagic", "newport", "nsc",  "nv", "nvidia",
           "r128", "radeon", "rendition", "s3", "s3virge", "savage", "siliconmotion",
-          "sis", "tdfx", "tga", "trident", "tseng", "vesa", "vga", "vmware");
+          "sis", "tdfx", "tga", "trident", "tseng", "vboxvideo", "vesa", "vga", "vmware");
     }
     return($drivers);
   }