Code

Added FAIstate update
[gosa.git] / plugins / admin / departments / tabs_department.inc
index b966f7e9d30e083597c259f8f6ab827024d236ff..9e3f6675bd435d75c7d2b63d27be774d3adf3635 100644 (file)
@@ -2,12 +2,15 @@
 
 class deptabs extends tabs
 {
-  var $base             = "";
+  var $base= "";
 
-  function deptabs($config, $data, $dn)
+  function deptabs($config, $data, $dn,$category)
   {
-    tabs::tabs($config, $data, $dn);
+    tabs::tabs($config, $data, $dn,$category);
     $this->base= $this->by_object['department']->base;
+
+    /* Add references/acls/snapshots */
+    $this->addSpecialTabs();
   }
 
   function check()
@@ -16,40 +19,34 @@ class deptabs extends tabs
   }
 
 
-  /* Save all changes (generic tab will do our tagging)
-      if source dn != destination dn then MustBeMoved will be set */
-  function save()
+  function save($justsave = false)
   {
-    $baseobject = $this->by_object['department'];
-
-    $ou         = preg_replace('/,/', '\,', $baseobject->ou);
-    $new_dn     = @LDAP::convert('ou='.$ou.','.$baseobject->base);
-
-    /* If dn has changed move dep & sub entries */
-    if ($this->dn != $new_dn && $this->dn != "new"){
-      /* if( new_dn is subtree of this->dn ) */
-      $cnt1 = count(split(",",$this->dn));
-      $cnt2 = count(split(",",$new_dn));
-      if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
-        print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
-      }else{
-        $this->by_object['department']->MustBeMoved      = true;
-        $this->by_object['department']->MoveDestination  = $new_dn;
-        $this->by_object['department']->MoveSource       = $this->dn;
-        $this->by_object['department']->ou  = $baseobject->attrs['ou'][0];
-        $ret              = tabs::save(TRUE);
-        $this->by_object['department']->save(true);
-        return($ret);
+    $baseobject= $this->by_object['department'];
+    $ou= preg_replace('/,/', '\,', $baseobject->ou);
+    $new_dn= @LDAP::convert('ou='.$ou.','.$baseobject->base);
+    
+    if($justsave){
+      if ($this->dn != $new_dn && $this->dn != "new"){
+        /* if( new_dn is subtree of this->dn ) */
+        $cnt1 = count(split(",",$this->dn));
+        $cnt2 = count(split(",",$new_dn));
+        if((strstr($new_dn,$this->dn))&&($cnt1<$cnt2)){
+          print_red(_("Try to move tree failed. Destination tree is subtree of source tree."));
+        }else{
+          /* Prepare to be moved */
+          $baseobject->recursive_move($this->dn, $new_dn);                     
+          $this->by_object['department'] = $baseobject;
+          return;
+        }
       }
-    }else{
-      $this->dn         = $new_dn;
-      $baseobject->dn   = $this->dn;
-      $ret              = tabs::save(TRUE);
-      $baseobject->save(true);
-      $this->by_object['department']= $baseobject;
-      return($ret);
     }
+    $this->dn= $new_dn;
+    $baseobject->dn= $this->dn;
+    $this->by_object['department']= $baseobject;
+    return(tabs::save(TRUE));
   }
+
+
 }
-  // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-  ?>
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>