Code

Systems Workstation Startup
[gosa.git] / plugins / admin / systems / class_workstationService.inc
index e7ec6c77d6cf67132200aae667c26462d69a1397..a12ac099244755167392beb14dd4f5e2062d83a7 100644 (file)
@@ -2,11 +2,6 @@
 
 class workservice extends plugin
 {
-  /* CLI vars */
-  var $cli_summary= "Manage terminal service aspects";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
   var $gotoScannerEnable;
   /* Generic terminal attributes */
   var $gotoXMonitor= "";
@@ -58,9 +53,18 @@ class workservice extends plugin
   var $XKbLayouts       =array();
   var $XKbVariants      =array();
 
-  function workservice ($config, $dn= NULL)
+  var $member_of_ogroup = FALSE;
+
+  function workservice ($config, $dn= NULL, $parent= NULL)
   {
-    plugin::plugin ($config, $dn);
+    plugin::plugin ($config, $dn, $parent);
+
+    if(!isset($this->parent->by_object['ogroup'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn"));
+      $this->member_of_ogroup = $ldap->count() >= 1;
+    }
 
     $this->XResolutions= array( 
         "640x480"   =>  "640x480",
@@ -112,9 +116,9 @@ class workservice extends plugin
                              "/dev/ttyS1"       => "/dev/ttyS1",          "/dev/psaux"  =>"/dev/psaux", 
                              "/dev/input/mice"  => "/dev/input/mice");
 
-    /* Additional values will be extracted from /etc/gosa/keyboardLayouts */
+    /* Additional values will be extracted from CONFIG_DIR/gosa/keyboardLayouts */
     $this->XKbLayouts= array ("de"=> "de","intl" =>"intl","us" =>"us");
-    $this->XKbVariants= array ("nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
+    $this->XKbVariants= array ("basic"=>"basic", "nodeadkeys"=>"nodeadkeys");
 
     /* try to read additional keyboard layouts 
      */
@@ -223,6 +227,17 @@ class workservice extends plugin
       }
 
     }
+
+    /* Workaround to fill in inherited values if we've specified an objectclass */
+    if (isset($_SESSION['SelectedSystemType']['ogroup']) && $_SESSION['SelectedSystemType']['ogroup'] != 'none'){
+      $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"));
+    }
   }
 
   function execute()
@@ -316,6 +331,8 @@ class workservice extends plugin
       $smarty->assign("hiddenState","");
     }
 
+    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
+
     /* Show main page */
     return($smarty->fetch (get_template_path('workstationService.tpl',TRUE,dirname(__FILE__))));
   }
@@ -330,7 +347,11 @@ class workservice extends plugin
   {
     plugin::save_object();
 
-    if(isset($_POST['gotoXDriver'])){
+    if(isset($_POST["inheritAll"])){
+      $this->set_everything_to_inherited();
+    }
+
+    if(isset($_POST['gotoXDriver']) && chkacl($this->acl,"AutoSync") == ""){
       if(isset($_POST['AutoSync'])){
         $this->AutoSync = true;
       }else{
@@ -423,6 +444,19 @@ class workservice extends plugin
     $this->handle_post_events("modify");
   }
 
+  
+  function set_everything_to_inherited()
+  {
+      $this->gotoXKbLayout = "default";
+      $this->gotoXKbModel = "default";
+      $this->gotoXKbVariant = "default";      
+
+      $this->gotoXDriver ="default";
+      $this->gotoXResolution ="default";
+      $this->gotoXColordepth ="default";
+      $this->gotoXMouseType ="default";
+      $this->gotoXMouseport ="default";
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: