Code

Added modified menu templates, removed unused templates
[gosa.git] / include / class_plugin.inc
index 6be4321c646abd83be903ef8b2d94175985ac602..58cec70eea89b1dc07b20aae2db6382120a67c79 100644 (file)
@@ -118,6 +118,14 @@ class plugin
   /* This can be set to render the tabulators in another stylesheet */
   var $pl_notify= FALSE;
 
+
+  /* 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
@@ -141,7 +149,7 @@ class plugin
 
     /* Get LDAP descriptor */
     $ldap= $this->config->get_ldap_link();
-    if ($dn != NULL){
+    if ($dn !== NULL){
 
       /* Load data to 'attrs' and save 'dn' */
       if ($parent !== NULL){
@@ -272,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"])){
@@ -400,15 +418,12 @@ class plugin
     $message= array();
 
     /* Skip if we've no config object */
-    if (!isset($this->config)){
+    if (!isset($this->config) || !is_object($this->config)){
       return $message;
     }
 
     /* Find hooks entries for this class */
-    $command= search_config($this->config->data['MENU'], get_class($this), "CHECK");
-    if ($command == "" && isset($this->config->data['TABS'])){
-      $command= search_config($this->config->data['TABS'], get_class($this), "CHECK");
-    }
+    $command= $this->config->search(get_class($this), "CHECK", array('menu', 'tabs'));
 
     if ($command != ""){
 
@@ -569,10 +584,7 @@ class plugin
   function postcreate($add_attrs= array())
   {
     /* Find postcreate entries for this class */
-    $command= search_config($this->config->data['MENU'], get_class($this), "POSTCREATE");
-    if ($command == "" && isset($this->config->data['TABS'])){
-      $command= search_config($this->config->data['TABS'], get_class($this), "POSTCREATE");
-    }
+    $command= $this->config->search(get_class($this), "POSTCREATE",array('menu', 'tabs'));
 
     if ($command != ""){
 
@@ -604,10 +616,7 @@ class plugin
   function postmodify($add_attrs= array())
   {
     /* Find postcreate entries for this class */
-    $command= search_config($this->config->data['MENU'], get_class($this), "POSTMODIFY");
-    if ($command == "" && isset($this->config->data['TABS'])){
-      $command= search_config($this->config->data['TABS'], get_class($this), "POSTMODIFY");
-    }
+    $command= $this->config->search(get_class($this), "POSTMODIFY",array('menu','tabs'));
 
     if ($command != ""){
 
@@ -639,11 +648,7 @@ class plugin
   function postremove($add_attrs= array())
   {
     /* Find postremove entries for this class */
-    $command= search_config($this->config->data['MENU'], get_class($this), "POSTREMOVE");
-    if ($command == "" && isset($this->config->data['TABS'])){
-      $command= search_config($this->config->data['TABS'], get_class($this), "POSTREMOVE");
-    }
-
+    $command= $this->config->search(get_class($this), "POSTREMOVE",array('menu','tabs'));
     if ($command != ""){
 
       /* Additional attributes */
@@ -1273,7 +1278,7 @@ class plugin
       $snapldapbase = $cfg['SNAPSHOT_BASE'];
       $ldap_to      = new LDAP($user,$password, $server);
       $ldap_to->cd ($snapldapbase);
-      show_ldap_error($ldap->get_error(), sprintf(_("Method get deleted snapshots with dn '%s' failed."),$this->dn));
+      show_ldap_error($ldap_to->get_error(), sprintf(_("Method get deleted snapshots with dn '%s' failed."),$this->dn));
     }else{
       $ldap_to    = $ldap;
     }
@@ -1634,6 +1639,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:
 ?>