X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_management.inc;h=98f02cee2fa00e1f020fc4958dc88d4833b15697;hb=53553834328f43ffd06c805c940b18738349ab94;hp=53303acd12cde0131de3fb19d6f6e274f7efc682;hpb=336797273c2169145f797eb673809894dc279c3c;p=gosa.git diff --git a/gosa-core/include/class_management.inc b/gosa-core/include/class_management.inc index 53303acd1..98f02cee2 100644 --- a/gosa-core/include/class_management.inc +++ b/gosa-core/include/class_management.inc @@ -58,7 +58,10 @@ class management protected $last_dialogObject = null; // Whether to display the apply button or not - protected $displayApplyBtn = ""; + protected $displayApplyBtn = FALSE; + + // Whether to display a header or not. + protected $skipHeader = false; // Whether to display a footer or not. protected $skipFooter = false; @@ -79,7 +82,10 @@ class management // 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; @@ -200,6 +206,8 @@ class management */ protected function getHeader() { + if($this->skipHeader) return(""); + if (get_object_info() != ""){ $display= print_header(get_template_path($this->plIcon),_($this->plDescription), "\"\"". @@ -335,8 +343,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); @@ -663,8 +671,8 @@ class management @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()); } @@ -743,6 +751,7 @@ class management $this->dns = array(); $this->tabObject = null; $this->dialogObject = null; + $this->skipFooter = FALSE; set_object_info(); } @@ -850,6 +859,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: