Code

Added optional attributes for handle_post_events
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 Apr 2006 09:39:58 +0000 (09:39 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 26 Apr 2006 09:39:58 +0000 (09:39 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3114 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_plugin.inc
include/functions_setup.inc
plugins/admin/fai/class_faiTemplateEntry.inc
plugins/admin/systems/class_workstationGeneric.inc

index 76bf6e7d4bd577c8bf82dd821a714d337f8bc8e2..66a191fc89f11acfa5cd864ede95bae3de8e3d75 100644 (file)
@@ -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;
     }
   }
index d800479f5250d77703252f142527028a348b68ed..570c3ec2c4476cdad0d2159a3a52e430335bf11a 100644 (file)
@@ -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']."<td class=\"check\">kolab2.schema</td>";
-           $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")."<td class=\"check\">gofon.schema</td>";
-           $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']."<td class=\"check\">kolab2.schema</td>";
+        $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")."<td class=\"check\">gofon.schema</td>";
+        $affich['kolab']['status']= TRUE;
+      }
+    }
   }
   if($aff==0){
     return ($messages);
index a82b75ec0996fd298dbb71b01f0a4dd504994c7f..57eee41245f8440b826e34ff19138ea7672279f2 100644 (file)
@@ -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();
index 68b41f95672fa073a1c610c09d31f110acaffa39..0748e91381d97067f6bd15153166eba19dc9703e 100644 (file)
@@ -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']);