Code

Added RDN support for users
[gosa.git] / plugins / admin / systems / class_terminalService.inc
index 4beecf9e0d14c0ebbc70c4dff2336a3bb3235264..76c58af78831a3f7983c40b96d84787ae5e17e2f 100644 (file)
@@ -2,11 +2,6 @@
 
 class termservice 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");
-
   /* Generic terminal attributes */
   var $gotoLpdEnable= FALSE;
   var $gotoXMonitor= "";
@@ -29,6 +24,7 @@ class termservice extends plugin
   var $gotoScannerClients= "";
   var $gotoScannerBackend= "";
   var $goFonHardware= "automatic";
+  var $AutoSync = false;
 
   /* Needed values and lists */
   var $ignore_account= TRUE;
@@ -112,7 +108,7 @@ class termservice extends plugin
       $this->XKbModels[$type] = $type;
     }
 
-    /* Additional values will be extracted from /etc/gosa/keyboardLayouts */
+    /* Additional values will be extracted from CONFIG_DIR./keyboardLayouts */
     $this->XKbLayouts= array ("default"=>"["._("inherited")."]","de"=> "de","intl" =>"intl","us" =>"us");
     $this->XKbVariants= array ("default"=>"["._("inherited")."]", "nodeadkeys"=>"nodeadkeys", "basic"=>"basic");
 
@@ -195,7 +191,7 @@ class termservice extends plugin
     ksort($this->hardware_list);
 
     /* Convert gotoLpdEnable */
-    $this->gotoLpdEnable= ($this->gotoLpdEnable == "Yes");
+    $this->gotoLpdEnable= preg_match("/yes/i",$this->gotoLpdEnable);
 
       /* Load hardware list */
     $ldap= $this->config->get_ldap_link();
@@ -236,6 +232,11 @@ class termservice extends plugin
         }
       }
     }
+    if(preg_match("/\+/",$this->gotoXHsync)){
+      $this->AutoSync = true;
+      $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
+      $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
+    }
   }
 
   function execute()
@@ -321,6 +322,17 @@ class termservice extends plugin
     $smarty->assign ("hardware_list", $hl);
     $smarty->assign ("gotoXMonitor", $this->gotoXMonitor);
 
+    $smarty->assign("AutoSyncACL",chkacl($this->acl,"AutoSync"));
+  
+    if($this->AutoSync){
+      $smarty->assign("AutoSyncCHK"," checked ");
+      $smarty->assign("hiddenState"," disabled ");
+    }else{
+      $smarty->assign("AutoSyncCHK"," ");
+      $smarty->assign("hiddenState","");
+    }
+
+  
     /* Show main page */
     return($smarty->fetch (get_template_path('terminalService.tpl', TRUE)));
   }
@@ -346,7 +358,15 @@ class termservice extends plugin
           $this->$val= TRUE;
         }
       }
+    } 
+    if(isset($_POST['gotoXDriver'])){
+      if(isset($_POST['AutoSync'])){
+        $this->AutoSync = true;
+      }else{
+        $this->AutoSync = false;
+      }
     }
+
   }
 
 
@@ -357,38 +377,43 @@ class termservice extends plugin
     $message= plugin::check();
 
     /* Default entries can use blank hsync/vsync entries */
-    if ($this->dn != "" && $this->cn != "default" && $this->cn != "wdefault"){
-
-      /* Check vsync for correct usage */
-      $val= preg_replace ("/\s/", "", $this->gotoXVsync);
-      if (!preg_match ("/^\d+(\.\d+)?(\-\d+(\.\d+)?)?$/", $val)
-          && chkacl ($this->acl, "gotoXVsync") == ""){
-
-        $message[]= _("Please specify a valid VSync range.");
-      } elseif (chkacl ($this->acl, "gotoXVsync") == ""){
-        list($v1,$v2)= split ("-", $val);
-        if ($v2 != ""){
-          if ($v1 > $v2){
-            $message[]= _("Please specify a valid VSync range.");
+    if ($this->dn != "" && $this->cn != "default" && $this->cn != "default"){
+
+      /* But only if no auto sync is enabled... */
+      if (!$this->AutoSync){
+
+        /* Check vsync for correct usage */
+        $val= preg_replace ("/\s/", "", $this->gotoXVsync);
+        if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)
+            && chkacl ($this->acl, "gotoXVsync") == ""){
+
+          $message[]= _("Please specify a valid VSync range.");
+        } elseif (chkacl ($this->acl, "gotoXVsync") == ""){
+          list($v1,$v2)= preg_split ("/[-+]/", $val);
+          if ($v2 != ""){
+            if ($v1 > $v2){
+              $message[]= _("Please specify a valid VSync range.");
+            }
           }
         }
-      }
 
-      /* Check hsync for correct usage */
-      $val= preg_replace ("/\s/", "", $this->gotoXHsync);
-      if (!preg_match ("/^\d+(\.\d+)?(\-\d+(\.\d+)?)?$/", $val)
-          && chkacl ($this->acl, "gotoXHsync") == ""){
-
-        $message[]= _("Please specify a valid HSync range.");
-      } elseif (chkacl ($this->acl, "gotoXHsync") == ""){
-        list($v1,$v2)= split ("-", $val);
-        if ($v2 != ""){
-          if ($v1 > $v2){
-            $message[]= _("Please specify a valid HSync range.");
+        /* Check hsync for correct usage */
+        $val= preg_replace ("/\s/", "", $this->gotoXHsync);
+        if (!preg_match ("/^\d+(\.\d+)?([-]\d+(\.\d+)?)?$/", $val)
+            && chkacl ($this->acl, "gotoXHsync") == ""){
+
+          $message[]= _("Please specify a valid HSync range.");
+        } elseif (chkacl ($this->acl, "gotoXHsync") == ""){
+          list($v1,$v2)= preg_split ("/[-+]/", $val);
+          if ($v2 != ""){
+            if ($v1 > $v2){
+              $message[]= _("Please specify a valid HSync range.");
+            }
           }
         }
       }
     }
+
     return ($message);
   }
 
@@ -412,6 +437,11 @@ class termservice extends plugin
       }
     }
 
+    if($this->AutoSync){
+      $this->attrs['gotoXHsync'] = "30+55";
+      $this->attrs['gotoXVsync'] = "50+70";
+    }
+
     /* Write back to ldap */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);