X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_management.inc;h=98f02cee2fa00e1f020fc4958dc88d4833b15697;hb=53553834328f43ffd06c805c940b18738349ab94;hp=6f8babb4222eac399cefc5fb5f850025d6dac5e3;hpb=d83dc92745f08462bc31b2dacd3e33a0c46abc6b;p=gosa.git diff --git a/gosa-core/include/class_management.inc b/gosa-core/include/class_management.inc index 6f8babb42..98f02cee2 100644 --- a/gosa-core/include/class_management.inc +++ b/gosa-core/include/class_management.inc @@ -58,7 +58,13 @@ 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; // Copy&Paste handler protected $cpHandler = null; @@ -76,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; @@ -197,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), "\"\"". @@ -226,6 +237,9 @@ class management } } + // 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){ @@ -329,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); @@ -657,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()); } @@ -737,6 +751,7 @@ class management $this->dns = array(); $this->tabObject = null; $this->dialogObject = null; + $this->skipFooter = FALSE; set_object_info(); } @@ -844,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: