Code

Save scroll position
[gosa.git] / gosa-core / include / class_management.inc
index c92488c37ef562d8ff9a0eff2968c8ca13ec7f92..98f02cee2fa00e1f020fc4958dc88d4833b15697 100644 (file)
@@ -3,7 +3,7 @@
  * This code is part of GOsa (http://www.gosa-project.org)
  * Copyright (C) 2003-2008 GONICUS GmbH
  *
- * ID: $$Id: class_plugin.inc 14584 2009-10-12 14:04:22Z hickert $$
+ * ID: $$Id$$
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -26,42 +26,66 @@ class management
   public $config = null;
   public $ui     = null;
 
-  public $plIcon        = "";
-  public $plDescription = "";
-  public $plHeadline    = "";
+  // The plugin description
+  public $plugname      = "unconfigured";
+  public $plIcon        = "unconfigured";
+  public $plDescription = "unconfigured";
+  public $plHeadline    = "unconfigured";
 
-  // Protected 
+  // The currently used object(s) (e.g. in edit, removal)
   protected $dn = "";
   protected $dns = array();
 
-  protected $storagePoints = array();
-
+  // The last used object(s).
   protected $last_dn = "";
   protected $last_dns = array();
 
-  protected $tabClass = "";
-  protected $tabType = "";
-  protected $aclCategory = "";
-  protected $objectName = "";
+  // The common places the displayed objects are stored in. (e.g. array("ou=groups,",".."))
+  protected $storagePoints = array();
+
+  // The tab definitions to use for the current object.
+  protected $tabClass = "";         // e.g. usertabs
+  protected $tabType = "";          // e.g. USERTABS
+  protected $aclCategory = "";      // e.g. users
+  protected $objectName = "";       // e.g. users
+
+  // The opened object.
   protected $tabObject = null;
   protected $dialogObject = null;
 
+  // The last opened object.
   protected $last_tabObject = null;
   protected $last_dialogObject = null;
 
-  protected $displayApplyBtn = "";
+  // Whether to display the apply button or not
+  protected $displayApplyBtn = FALSE;
+
+  // Whether to display a header or not.
+  protected $skipHeader = false;
+
+  // Whether to display a footer or not.
+  protected $skipFooter = false;
+
+  // Copy&Paste handler
   protected $cpHandler = null;
+
+  // Indicates that we want to paste objects right now.
   protected $cpPastingStarted = FALSE;
+
+  // The Snapshot handler class.
   protected $snapHandler = null;
 
-  // Private
-  protected $plugname = "";
-  protected $headpage = null;
-  protected $filter = null;
+  // The listing handlers
+  private $headpage = null;
+  private $filter = null;
+
+  // A list of configured actions/events
   protected $actions = array();
-  
-  function  __construct($config,$ui,$plugname, $headpage)
+
+  // Attributes managed by this plugin, can be used in post events;
+  protected $attributes = array(); 
+
+  function  __construct(&$config,$ui,$plugname, $headpage)
   {
     $this->plugname = $plugname;
     $this->headpage = $headpage;
@@ -81,6 +105,7 @@ class management
     $this->registerAction("apply",  "applyChanges");
     $this->registerAction("save",   "saveChanges");
     $this->registerAction("cancel", "cancelEdit");
+    $this->registerAction("cancelDelete", "cancelEdit");
     $this->registerAction("remove", "removeEntryRequested");
     $this->registerAction("removeConfirmed", "removeEntryConfirmed");
 
@@ -93,9 +118,11 @@ class management
     $this->registerAction("saveSnapshot","saveSnapshot");
     $this->registerAction("restoreSnapshot","restoreSnapshot");
     $this->registerAction("cancelSnapshot","closeDialogs");
-
   }
 
+  /*! \brief  Execute this plugin
+   *          Handle actions/events, locking, snapshots, dialogs, tabs,...
+   */
   function execute()
   {
     // Ensure that html posts and gets are kept even if we see a 'Entry islocked' dialog.
@@ -146,20 +173,45 @@ class management
       foreach($this->storagePoints as $sp){
         $bases[] = $sp.$this->headpage->getBase();
       }
+
+      // No bases specified? Try base  
+      if(!count($bases)) $bases[] = $this->headpage->getBase();
+
       $this->snapHandler->setSnapshotBases($bases);
     }
     
+    // Display list
+    return($this->renderList());
+  }
+  
+  function renderList()
+  {
     $this->headpage->update();
     $display = $this->headpage->render();
     return($this->getHeader().$display);
   }
 
+  function getHeadpage()
+  {
+    return($this->headpage);
+  }
+
+  function getFilter()
+  {
+    return($this->filter);
+  }
+
+  /*! \brief  Generates the plugin header which is displayed whenever a tab object is 
+   *           opened.
+   */
   protected function getHeader()
   {
+    if($this->skipHeader) return("");
+
     if (get_object_info() != ""){
       $display= print_header(get_template_path($this->plIcon),_($this->plDescription),
-      "<img alt=\"\" class=\"center\" src=\"".get_template_path('images/lists/locked.png')."\">".
-        LDAP::fix(get_object_info()));
+          "<img alt=\"\" class=\"center\" src=\"".get_template_path('images/lists/locked.png')."\">".
+          LDAP::fix(get_object_info()));
     } else {
       $display= print_header(get_template_path($this->plIcon),_($this->plDescription));
     }
@@ -167,19 +219,28 @@ class management
   }
 
 
+  /*! \brief  Generates the footer which is used whenever a tab object is 
+   *           displayed.
+   */
   protected function _getTabFooter()
-  { 
+  {
+    // Do not display tab footer for non tab objects 
     if(!($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug)){
       return("");
     }
-  
+
+    // Check if there is a dialog opened - We don't need any buttons in this case. 
     if($this->tabObject->by_object[$this->tabObject->current]){
       $current = $this->tabObject->by_object[$this->tabObject->current];  
-      if(is_object($current->dialog)){
+      if(isset($current->dialog) && (is_object($current->dialog) || $current->dialog)){
         return("");
       }
     }
 
+    // Skip footer if requested;
+    if($this->skipFooter) return("");
+
+    // In case an of locked entry, we may have opened a read-only tab.
     $str = "";
     if(isset($this->tabObject->read_only) && $this->tabObject->read_only == TRUE){
       $str.= "<p style=\"text-align:right\">
@@ -187,6 +248,8 @@ class management
         </p>";
       return($str);
     }else{
+
+      // Display ok, (apply) and cancel buttons
       $str.= "<p style=\"text-align:right\">\n";
       $str.= "<input type=submit name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
       $str.= "&nbsp;\n";
@@ -201,11 +264,22 @@ class management
   }
 
 
-  protected function removeEntryRequested($action,$entry,$all)
+  /*! \brief  Initiates the removal for the given entries
+   *           and displays a confirmation dialog.
+   *      
+   *  @param  String  'action'  The name of the action which was the used as trigger.
+   *  @param  Array   'target'  A list of object dns, which should be affected by this method.
+   *  @param  Array   'all'     A combination of both 'action' and 'target'.
+   */
+  protected function removeEntryRequested($action="",$target=array(),$all=array())
   {
     $disallowed = array();
     $this->dns = array();
-    foreach($entry as $dn){
+
+    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Entry removel requested!");
+
+    // Check permissons for each target 
+    foreach($target as $dn){
       $acl = $this->ui->get_permissions($dn, $this->aclCategory."/".$this->aclPlugin);
       if(preg_match("/d/",$acl)){
         $this->dns[] = $dn;
@@ -213,25 +287,26 @@ class management
         $disallowed[] = $dn;
       }
     }
-
     if(count($disallowed)){
       msg_dialog::display(_("Permission"),msgPool::permDelete($disallowed),INFO_DIALOG);
     }
 
+    // We've at least one entry to delete.
     if(count($this->dns)){
 
-      /* Check locks */
+      // check locks
       if ($user= get_multiple_locks($this->dns)){
         return(gen_locked_message($user,$this->dns));
       }
 
+      // Add locks
       $dns_names = array();
       foreach($this->dns as $dn){
         $dns_names[] =LDAP::fix($dn);
       }
       add_lock ($this->dns, $this->ui->dn);
 
-      /* Lock the current entry, so nobody will edit it during deletion */
+      // Display confirmation dialog.
       $smarty = get_smarty();
       $smarty->assign("info", msgPool::deleteInfo($dns_names,_($this->objectName)));
       $smarty->assign("multiple", true);
@@ -240,44 +315,66 @@ class management
   }  
 
 
-  protected function removeEntryConfirmed()
+  /*! \brief  Object removal was confirmed, now remove the requested entries. 
+   *      
+   *  @param  String  'action'  The name of the action which was the used as trigger.
+   *  @param  Array   'target'  A list of object dns, which should be affected by this method.
+   *  @param  Array   'all'     A combination of both 'action' and 'target'.
+   */
+  function removeEntryConfirmed($action="",$target=array(),$all=array(),
+      $altTabClass="",$altTabType="",$altAclCategory="")
   {
+    $tabType = $this->tabType;
+    $tabClass = $this->tabClass;
+    $aclCategory = $this->aclCategory;
+    if(!empty($altTabClass)) $tabClass = $altTabClass;
+    if(!empty($altTabType)) $tabType = $altTabType;
+    if(!empty($altAclCategory)) $aclCategory = $altAclCategory;
+
+    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Entry removel confirmed!");
+
     foreach($this->dns as $key => $dn){
 
-      /* Load permissions for selected 'dn' and check if
-         we're allowed to remove this 'dn' */
+      // Check permissions, are we allowed to remove this object? 
       $acl = $this->ui->get_permissions($dn, $this->aclCategory."/".$this->aclPlugin);
       if(preg_match("/d/",$acl)){
 
-        /* Delete request is permitted, perform LDAP action */
+        // Delete the object
         $this->dn = $dn;
-        $tab = $this->tabClass;
-        $this->tabObject= new $tab($this->config,$this->config->data['TABS'][$this->tabType], $this->dn, $this->aclCategory);
+        $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory, true, true);
         $this->tabObject->set_acl_base($this->dn);
+        $this->tabObject->parent = &$this;
         $this->tabObject->delete ();
+
+        // Remove the lock for the current object.
         del_lock($this->dn);        
       } else {
-
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
         msg_dialog::display(_("Permission error"), msgPool::permDelete(), ERROR_DIALOG);
         new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
       }
     }
 
+    // Cleanup
     $this->remove_lock();
     $this->closeDialogs();
   }
 
 
+  /*! \brief  Detects actions/events send by the ui
+   *           and the corresponding targets.
+   */
   function detectPostActions()
   {
+    if(!is_object($this->headpage)){
+      trigger_error("No valid headpage given....!");
+      return(array());
+    }
     $action= $this->headpage->getAction();
-
     if(isset($_POST['edit_apply']))  $action['action'] = "apply";    
     if(isset($_POST['edit_finish'])) $action['action'] = "save";    
     if(isset($_POST['edit_cancel'])) $action['action'] = "cancel";    
     if(isset($_POST['delete_confirmed'])) $action['action'] = "removeConfirmed";   
+    if(isset($_POST['delete_cancel'])) $action['action'] = "cancelDelete";   
 
     // Detect Snapshot actions
     if(isset($_POST['CreateSnapshot'])) $action['action'] = "saveSnapshot";   
@@ -295,6 +392,9 @@ class management
     return($action);
   }
 
+
+  /*! \brief  Calls the registered method for a given action/event.
+   */
   function handleActions($action)
   {
     // Start action  
@@ -305,13 +405,23 @@ class management
     }
   } 
 
+
+  /*! \brief  Opens the snapshot creation dialog for the given target.
+   *      
+   *  @param  String  'action'  The name of the action which was the used as trigger.
+   *  @param  Array   'target'  A list of object dns, which should be affected by this method.
+   *  @param  Array   'all'     A combination of both 'action' and 'target'.
+   */
   function createSnapshotDialog($action="",$target=array(),$all=array())
   {
+    @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Snaptshot creation initiated!");
+
     foreach($target as $entry){
       if(!empty($entry) && $this->ui->allow_snapshot_create($entry,$this->aclCategory)){
         $this->dialogObject = new SnapShotDialog($this->config,$entry,$this);
         $this->dialogObject->aclCategories = array($this->aclCategory);
-        
+        $this->dialogObject->parent = &$this;
+
       }else{
         msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to create a snapshot for %s."),$entry),
             ERROR_DIALOG);
@@ -327,7 +437,7 @@ class management
    *  @param  Array   'target'  A list of object dns, which should be affected by this method.
    *  @param  Array   'all'     A combination of both 'action' and 'target'.
    */
-  function saveSnapsho($action="",$target=array(),$all=array())
+  function saveSnapshot($action="",$target=array(),$all=array())
   {
     $this->dialogObject->save_object();
     $msgs = $this->dialogObject->check();
@@ -338,6 +448,7 @@ class management
     }else{
       $this->dn =  $this->dialogObject->dn;
       $this->snapHandler->create_snapshot( $this->dn,$this->dialogObject->CurrentDescription);
+      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Snaptshot created!");
       $this->closeDialogs();
     }
   }
@@ -355,6 +466,7 @@ class management
     $entry = array_pop($target);
     if(!empty($entry) && $this->ui->allow_snapshot_restore($entry,$this->aclCategory)){
       $this->snapHandler->restore_snapshot($entry);
+      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Snaptshot restored!");
       $this->closeDialogs();
     }else{
       msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),
@@ -380,14 +492,19 @@ class management
       }
     }
 
+    // No bases specified? Try base  
+    if(!count($bases)) $bases[] = $this->headpage->getBase();
+
     // No target, open the restore removed object dialog.
     if(!count($target)){ 
       $entry = $this->headpage->getBase();
       if(!empty($entry) && $this->ui->allow_snapshot_restore($entry,$this->aclCategory)){
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$entry,"Snaptshot restoring initiated!");
         $this->dialogObject = new SnapShotDialog($this->config,$entry,$this);
         $this->dialogObject->set_snapshot_bases($bases);
         $this->dialogObject->display_all_removed_objects = true;
         $this->dialogObject->display_restore_dialog = true;
+        $this->dialogObject->parent = &$this;
       }else{
         msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),
             ERROR_DIALOG);
@@ -397,9 +514,11 @@ class management
       // Display the restore points for a given object.
       $entry = array_pop($target);
       if(!empty($entry) && $this->ui->allow_snapshot_restore($entry,$this->aclCategory)){
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$entry,"Snaptshot restoring initiated!");
         $this->dialogObject = new SnapShotDialog($this->config,$entry,$this);
         $this->dialogObject->set_snapshot_bases($bases);
         $this->dialogObject->display_restore_dialog = true;
+        $this->dialogObject->parent = &$this;
       }else{
         msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),
             ERROR_DIALOG);
@@ -414,7 +533,7 @@ class management
    *  @param  Array   'target'  A list of object dns, which should be affected by this method.
    *  @param  Array   'all'     A combination of both 'action' and 'target'.
    */
-  function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory)
+  function newEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
   {
     /* To handle mutliple object types overload this method.
      * ...
@@ -440,7 +559,7 @@ class management
     if(!empty($altTabClass)) $tabClass = $altTabClass;
     if(!empty($altTabType)) $tabType = $altTabType;
     if(!empty($altAclCategory)) $aclCategory = $altAclCategory;
-  {
+
     // Check locking & lock entry if required 
     $this->displayApplyBtn = FALSE;
     $this->dn = "new";
@@ -456,6 +575,8 @@ class management
     }else{
       $this->tabObject= new $tabClass($this->config,$this->config->data['TABS'][$tabType], $this->dn, $aclCategory);
       $this->tabObject->set_acl_base($this->headpage->getBase());
+      $this->tabObject->parent = &$this;
+      @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Create new entry initiated!");
     }
   }
 
@@ -467,7 +588,7 @@ class management
    *  @param  Array   'target'  A list of object dns, which should be affected by this method.
    *  @param  Array   'all'     A combination of both 'action' and 'target'.
    */
-  function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory)
+  function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
   {
     /* To handle mutliple object types overload this method.
      * ...
@@ -486,7 +607,14 @@ class management
      *     }
      *   }
      * }
-     **/ 
+     **/
+
+    // Do not create a new tabObject while there is already one opened,
+    //  the user may have just pressed F5 to reload the page.
+    if(is_object($this->tabObject)){
+      return;
+    }
     $tabType = $this->tabType;
     $tabClass = $this->tabClass;
     $aclCategory = $this->aclCategory;
@@ -516,7 +644,9 @@ class management
       }else{
         $tab = $tabClass;
         $this->tabObject= new $tab($this->config,$this->config->data['TABS'][$tabType], $this->dn,$aclCategory);
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dn,"Edit entry initiated!");
         $this->tabObject->set_acl_base($this->dn);
+        $this->tabObject->parent = &$this;
       }
     }else{
 
@@ -537,10 +667,12 @@ class management
         if ($tmp->entries_locked()){
           return($tmp->display_lock_message());
         }
-        
+
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dns,"Edit entry initiated!");
+
         // Now lock entries.
-        $tmp->lock_entries($this->ui->dn);
         if($tmp->multiple_available()){
+          $tmp->lock_entries($this->ui->dn);
           $this->tabObject = $tmp;
           set_object_info($this->tabObject->get_object_info());
         }
@@ -565,6 +697,19 @@ class management
         return("");
       }else{
         $this->tabObject->save();
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dns,"Entry saved!");
+        $this->remove_lock();
+        $this->closeDialogs();
+      }
+    }elseif($this->dialogObject instanceOf plugin){
+      $this->dialogObject->save_object();
+      $msgs = $this->dialogObject->check();
+      if(count($msgs)){
+        msg_dialog::displayChecks($msgs); 
+        return("");
+      }else{
+        $this->dialogObject->save();
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dns,"Entry saved!");
         $this->remove_lock();
         $this->closeDialogs();
       }
@@ -578,20 +723,21 @@ class management
    */
   protected function applyChanges()
   {
-  if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){
-    $this->tabObject->save_object();
+    if($this->tabObject instanceOf tabs || $this->tabObject instanceOf multi_plug){
+      $this->tabObject->save_object();
       $msgs = $this->tabObject->check();
       if(count($msgs)){
         msg_dialog::displayChecks($msgs); 
         return("");
       }else{
         $this->tabObject->save();
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$this->dns,"Modifications applied!");
         $this->tabObject->re_init();
       }
     }
   }
 
-  
+
   /*! \brief  This method closes dialogs
    *           and cleans up the cached object info and the ui.
    */
@@ -605,6 +751,7 @@ class management
     $this->dns = array();
     $this->tabObject = null;
     $this->dialogObject = null;
+    $this->skipFooter = FALSE;
     set_object_info();
   }
 
@@ -618,7 +765,7 @@ class management
     $this->closeDialogs();
   }
 
+
   /*! \brief  Every click in the list user interface sends an event
    *           here can we connect those events to a method. 
    *          eg.  ::registerEvent('new','createUser')
@@ -630,7 +777,7 @@ class management
     $this->actions[$action] = $target;
   }
 
-  
+
   /*! \brief  Removes ldap object locks created by this class.
    *          Whenever an object is edited, we create locks to avoid 
    *           concurrent modifications.
@@ -653,29 +800,41 @@ class management
    *  @param  Array   'target'  A list of object dns, which should be affected by this method.
    *  @param  Array   'all'     A combination of both 'action' and 'target'.
    */
-  function copyPasteHandler($action="",$target=array(),$all=array())
+  function copyPasteHandler($action="",$target=array(),$all=array(), 
+      $altTabClass ="", $altTabType = "", $altAclCategory="",$altAclPlugin="")
   {
     // Return without any actions while copy&paste handler is disabled.
     if(!is_object($this->cpHandler))  return("");
 
+    $tabType = $this->tabType;
+    $tabClass = $this->tabClass;
+    $aclCategory = $this->aclCategory;
+    $aclPlugin = $this->aclPlugin;
+    if(!empty($altTabClass)) $tabClass = $altTabClass;
+    if(!empty($altTabType)) $tabType = $altTabType;
+    if(!empty($altAclCategory)) $aclCategory = $altAclCategory;
+    if(!empty($altAclPlugin)) $aclPlugin = $altAclPlugin;
+
     // Save user input
     $this->cpHandler->save_object();
 
     // Add entries to queue 
-    if($s_action == "copy" || $s_action == "cut"){
+    if($action == "copy" || $action == "cut"){
       $this->cpHandler->cleanup_queue();
-      foreach($s_entry as $dn){
-        if($s_action == "copy" && $this->ui->is_copyable($dn,$this->aclCategory,$this->aclPlugin)){
-          $this->cpHandler->add_to_queue($dn,"copy",$this->tabClass,$this->tabType,$this->aclCategory);
+      foreach($target as $dn){
+        if($action == "copy" && $this->ui->is_copyable($dn,$aclCategory,$aclPlugin)){
+          $this->cpHandler->add_to_queue($dn,"copy",$tabClass,$tabType,$aclCategory,$this);
+          @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$dn,"Entry copied!");
         }
-        if($s_action == "cut" && $this->ui->is_cutable($dn,$this->aclCategory,$this->aclPlugin)){
-          $this->cpHandler->add_to_queue($dn,"cut",$this->tabClass,$this->tabType,$this->aclCategory);
+        if($action == "cut" && $this->ui->is_cutable($dn,$aclCategory,$aclPlugin)){
+          $this->cpHandler->add_to_queue($dn,"cut",$tabClass,$tabType,$aclCategory,$this);
+          @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$dn,"Entry cutted!");
         }
       }
     }
 
     // Initiate pasting
-    if($s_action == "paste"){
+    if($action == "paste"){
       $this->cpPastingStarted = TRUE;
     }
 
@@ -696,6 +855,63 @@ class management
   }
 
 
+  function setFilter($str) {
+    $this->filter = $str;
+  }
+
+
+  function postcreate() {
+    $this->_handlePostEvent('POSTCREATE');
+  }
+  function postmodify(){
+    $this->_handlePostEvent('POSTMODIFY');
+  }
+  function postremove(){
+    $this->_handlePostEvent('POSTREMOVE');
+  }
+
+  function _handlePostEvent($type)
+  {
+
+    /* Find postcreate entries for this class */
+    $command= $this->config->search(get_class($this), $type,array('menu', 'tabs'));
+    if ($command != ""){
+
+      /* Walk through attribute list */
+      foreach ($this->attributes as $attr){
+        if (!is_array($this->$attr)){
+          $add_attrs[$attr] = $this->$attr;
+        }
+      }
+      $add_attrs['dn']=$this->dn;
+
+      $tmp = array();
+      foreach($add_attrs as $name => $value){
+        $tmp[$name] =  strlen($name);
+      }
+      arsort($tmp);
+
+      /* Additional attributes */
+      foreach ($tmp as $name => $len){
+        $value = $add_attrs[$name];
+        $command= str_replace("%$name", "$value", $command);
+      }
+
+      if (check_command($command)){
+        @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
+            $command, "Execute");
+        exec($command,$arr);
+        foreach($arr as $str){
+          @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
+              $command, "Result: ".$str);
+        }
+      } else {
+        $message= msgPool::cmdnotfound($type, get_class($this));
+        msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
+      }
+    }
+
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: