Code

Apply patch from mba for #4146
[gosa.git] / trunk / gosa-plugins / goto / admin / systems / goto / class_workstationService.inc
index b5c8e3488a8c06a191593def1f3958031191f15a..bf30f119f689b264ef3adbffe77ef2da44c879b9 100644 (file)
@@ -49,7 +49,7 @@ class workservice extends plugin
   var $XKbLayouts       =array();
   var $XKbVariants      =array();
 
-  var $InheritXYSync = FALSE;
+  var $InheritXYSync = TRUE;
 
   function workservice (&$config, $dn= NULL, $parent= NULL)
   {
@@ -182,8 +182,20 @@ class workservice extends plugin
       }
     }
 
-    if(isset($this->attrs['gotoXHsync']) && isset($this->attrs['gotoXYsync'])) {
-      $this->InheritXYSync = FALSE;
+    if(preg_match("/\+/",$this->gotoXHsync)){
+      $this->AutoSync = true;
+      $this->gotoXHsync = preg_replace("/\+/","-",$this->gotoXHsync);
+      $this->gotoXVsync = preg_replace("/\+/","-",$this->gotoXVsync);
+    }
+
+    if (isset($this->attrs['gotoXHsync']) && isset($this->attrs['gotoXVsync'])) {
+        if(!empty($this->attrs['gotoXHsync'][0]) && !empty($this->attrs['gotoXVsync'][0])) {
+        $this->InheritXYSync = FALSE;
+       }
+    } else {
+        if($this->dn == "new") {
+          $this->InheritXYSync = FALSE;
+        }
     }
 
     /* Workaround to fill in inherited values if we've specified an objectclass */
@@ -317,7 +329,7 @@ class workservice extends plugin
       $smarty->assign("AutoSyncCHK"," ");
       $smarty->assign("hiddenState","");
     }
-    if($this->InheritXYSync) {
+    if($this->InheritXYSync && !isset($this->parent->by_object['ogroup'])) {
       $smarty->assign("InheritXYSync", " checked ");
       $smarty->assign("hiddenState", " disabled ");
       $smarty->assign("AutoSynchiddenState", " disabled ");
@@ -470,9 +482,7 @@ class workservice extends plugin
     if($this->InheritXYSync) {
       $this->attrs['gotoXHsync'] = array();
       $this->attrs['gotoXVsync'] = array();
-    }
-
-    if($this->AutoSync){
+    } elseif ($this->AutoSync) {
       $this->attrs['gotoXHsync'] = "30+55";
       $this->attrs['gotoXVsync'] = "50+70";
     }