From 9529dbf3712de15a97a32383b517f8e58d92b6d4 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 26 Apr 2006 09:39:58 +0000 Subject: [PATCH] Added optional attributes for handle_post_events git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3114 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_plugin.inc | 32 +++++++++++++++---- include/functions_setup.inc | 28 ++++++++-------- plugins/admin/fai/class_faiTemplateEntry.inc | 6 ++-- .../systems/class_workstationGeneric.inc | 2 +- 4 files changed, 43 insertions(+), 25 deletions(-) diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 76bf6e7d4..66a191fc8 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -504,7 +504,7 @@ class plugin return($display); } - function postcreate() + function postcreate($add_attrs= array()) { /* Find postcreate entries for this class */ $command= search_config($this->config->data['MENU'], get_class($this), "POSTCREATE"); @@ -520,6 +520,12 @@ class plugin } } $command= preg_replace("/%dn/", $this->dn, $command); + + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute"); @@ -532,7 +538,7 @@ class plugin } } - function postmodify() + function postmodify($add_attrs= array()) { /* Find postcreate entries for this class */ $command= search_config($this->config->data['MENU'], get_class($this), "POSTMODIFY"); @@ -548,6 +554,12 @@ class plugin } } $command= preg_replace("/%dn/", $this->dn, $command); + + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute"); @@ -560,7 +572,7 @@ class plugin } } - function postremove() + function postremove($add_attrs= array()) { /* Find postremove entries for this class */ $command= search_config($this->config->data['MENU'], get_class($this), "POSTREMOVE"); @@ -576,6 +588,12 @@ class plugin } } $command= preg_replace("/%dn/", $this->dn, $command); + + /* Additional attributes */ + foreach ($add_attrs as $name => $value){ + $command= preg_replace("/%$name/", $value, $command); + } + if (check_command($command)){ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute"); @@ -790,19 +808,19 @@ class plugin } - function handle_post_events($mode) + function handle_post_events($mode, $add_attrs= array()) { switch ($mode){ case "add": - $this->postcreate(); + $this->postcreate($add_attrs); break; case "modify": - $this->postmodify(); + $this->postmodify($add_attrs); break; case "remove": - $this->postremove(); + $this->postremove($add_attrs); break; } } diff --git a/include/functions_setup.inc b/include/functions_setup.inc index d800479f5..570c3ec2c 100644 --- a/include/functions_setup.inc +++ b/include/functions_setup.inc @@ -250,20 +250,20 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false /* Fix for PHP Fehler "Undefined index: ldapconf" * Ablaufverfolgung[1]: Funktion schema_check Datei: /home/hickert/gosa/include/functions_setup.inc (Zeile 230) */ - if((isset($_SESSION['ldapconf']['mail_methods']))&&(isset($_SESSION['ldapconf']))){ - if(($_SESSION['ldapconf']['mail_methods'][$_SESSION['ldapconf']['mail']] == "kolab")&&(!$CalledByIndexPhP)){ - if(!isset($objectclasses['kolabInetOrgPerson'])) { - $messages['kolab']['msg']= _("Support for Kolab disabled, no schema seems to be installed, setting mail-method to cyrus"); - $affich['kolab']['msg']=$messages['kolab']['msg']."kolab2.schema"; - $tmp= array_flip($_SESSION['ldapconf']['mail_methods']); - $_SESSION['ldapconf']['mail']=$tmp['cyrus']; - $messages['kolab']['status']= FALSE; - $affich['kolab']['status']= FALSE; - }else{ - $affich['kolab']['msg']=_("Support for Kolab enabled")."gofon.schema"; - $affich['kolab']['status']= TRUE; - } - } + if(isset($_SESSION['ldapconf']['mail_methods'])){ + if(($_SESSION['ldapconf']['mail_methods'][$_SESSION['ldapconf']['mail']] == "kolab")&&(!$CalledByIndexPhP)){ + if(!isset($objectclasses['kolabInetOrgPerson'])) { + $messages['kolab']['msg']= _("Support for Kolab disabled, no schema seems to be installed, setting mail-method to cyrus"); + $affich['kolab']['msg']=$messages['kolab']['msg']."kolab2.schema"; + $tmp= array_flip($_SESSION['ldapconf']['mail_methods']); + $_SESSION['ldapconf']['mail']=$tmp['cyrus']; + $messages['kolab']['status']= FALSE; + $affich['kolab']['status']= FALSE; + }else{ + $affich['kolab']['msg']=_("Support for Kolab enabled")."gofon.schema"; + $affich['kolab']['status']= TRUE; + } + } } if($aff==0){ return ($messages); diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc index a82b75ec0..57eee4124 100644 --- a/plugins/admin/fai/class_faiTemplateEntry.inc +++ b/plugins/admin/fai/class_faiTemplateEntry.inc @@ -46,7 +46,7 @@ class faiTemplateEntry extends plugin }else{ $this->status = "new"; - $this->orig_cn = false; + $this->orig_cn= false; } $this->user = explode( '.', $this->FAIowner ); @@ -62,8 +62,8 @@ class faiTemplateEntry extends plugin function execute() { - /* Call parent execute */ - plugin::execute(); + /* Call parent execute */ + plugin::execute(); /* Fill templating stuff */ $smarty = get_smarty(); diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 68b41f956..0748e9138 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -182,7 +182,7 @@ class workgeneric extends plugin show_ldap_error($ldap->get_error()); /* Optionally execute a command after we're done */ - $this->handle_post_events("remove"); + $this->handle_post_events("remove", array("macAddress", $this->netConfigDNS->macAddress)); /* Delete references to object groups */ $ldap->cd ($this->config->current['BASE']); -- 2.30.2