From eab71bd792b2d90ac490559a254cb7fa46ba0f5a Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 6 Jan 2010 08:59:01 +0000 Subject: [PATCH] Updated management class -We may want to send post events from the mangement plugins too git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15071 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_management.inc | 55 +++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/gosa-core/include/class_management.inc b/gosa-core/include/class_management.inc index 81a798b58..516f0b476 100644 --- a/gosa-core/include/class_management.inc +++ b/gosa-core/include/class_management.inc @@ -335,8 +335,8 @@ class management $this->dn = $dn; $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->delete (); $this->tabObject->parent = &$this; + $this->tabObject->delete (); // Remove the lock for the current object. del_lock($this->dn); @@ -850,6 +850,59 @@ class management $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: -- 2.30.2