Code

Fixed create missing trees
[gosa.git] / include / class_plugin.inc
index ccb7e5406d772e97cd0eb290aec7ba1a32215e1e..b71e576ca9b205b107d7e07509c0d45aefa6d54d 100644 (file)
@@ -122,6 +122,10 @@ class plugin
   /* This variable indicates that this class can handle multiple dns at once. */
   var $multiple_support = FALSE; 
 
+  /* This aviable indicates, that we are currently in multiple edit handle */
+  var $multiple_support_active = FALSE; 
+  var $selected_edit_values = array();
+
   /*! \brief plugin constructor
 
     If 'dn' is set, the node loads the given 'dn' from LDAP
@@ -276,6 +280,16 @@ class plugin
   /* Save data to object */
   function save_object()
   {
+    if($this->multiple_support_active){
+      foreach($this->attributes as $attr){
+        if(isset($_POST["use_".$attr])){
+          $this->selected_edit_values[$attr] = TRUE;
+        }else{
+          $this->selected_edit_values[$attr] = FALSE;
+        }
+      }
+    }
+
     /* Save values to object */
     foreach ($this->attributes as $val){
       if ($this->acl_is_writeable($val) && isset ($_POST["$val"])){
@@ -1201,11 +1215,15 @@ class plugin
     $cfg= &$this->config->current;
 
     /* check if there are special server configurations for snapshots */
-    if(isset($cfg['SNAPSHOT_SERVER'])){
+
+    if(isset($cfg['SERVER']) && isset($cfg['SNAPSHOT_SERVER']) && $cfg['SERVER'] == $cfg['SNAPSHOT_SERVER']){
+      $ldap_to    = $ldap;
+    }elseif(isset($cfg['SNAPSHOT_SERVER'])){
       $server       = $cfg['SNAPSHOT_SERVER'];
       $user         = $cfg['SNAPSHOT_USER'];
       $password     = $cfg['SNAPSHOT_PASSWORD'];
       $snapldapbase = $cfg['SNAPSHOT_BASE'];
+
       $ldap_to      = new LDAP($user,$password, $server);
       $ldap_to -> cd ($snapldapbase);
       show_ldap_error($ldap->get_error(), sprintf(_("Method get available snapshots with dn '%s' failed."),$this->dn));
@@ -1369,7 +1387,8 @@ class plugin
       }
 
       /* Restore one of the already deleted objects */
-      if(preg_match("/^RestoreDeletedSnapShot_/",$name) && $once){
+      if(((isset($_POST['menu_action']) && $_POST['menu_action'] == "RestoreDeletedSnapShot") 
+          || preg_match("/^RestoreDeletedSnapShot_/",$name)) && $once){
         $once = false;
         $this->snapDialog = new SnapShotDialog($this->config,"",$this);
         $this->snapDialog->set_snapshot_bases($baseSuffixe);
@@ -1391,7 +1410,7 @@ class plugin
 
     /* Create a new snapshot requested, check
        the given attributes and create the snapshot*/
-    if(isset($_POST['CreateSnapshot'])){
+    if(isset($_POST['CreateSnapshot']) && is_object($this->snapDialog)){
       $this->snapDialog->save_object();
       $msgs = $this->snapDialog->check();
       if(count($msgs)){
@@ -1420,7 +1439,7 @@ class plugin
   }
 
 
-  function plInfo()
+  static function plInfo()
   {
     return array();
   }
@@ -1625,6 +1644,25 @@ class plugin
       }
     }
   }
+
+  
+  function get_multi_edit_values()
+  {
+    $ret = array();
+    foreach($this->selected_edit_values as $attr => $active){
+      if($active){
+        $ret[$attr] = $this->$attr;
+      }
+    }
+    return($ret);
+  }
+
+  function set_multi_edit_value()
+  {
+
+  }
+
 }
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>