Code

Updated workstation - Startup
[gosa.git] / plugins / admin / systems / class_goService.inc
index 515be0eb8a3e7a3c7acca89b29a9910d6ef827e0..edfd3d7d5be09a72320c841fa09f905965c67c4c 100644 (file)
@@ -16,23 +16,25 @@ class goService extends plugin{
   var $dn                   = NULL;
   var $cn                   = "";
   var $DisplayName          = "";
+  var $view_logged  =FALSE;
 
    
   /* Construcktion */ 
-  function goService($config,$dn)
+  function goService(&$config,$dn)
   {
     plugin::plugin($config,$dn);
     $this->DisplayName = _("Empty service");
-
-    if($this->is_account){
-      @log::log("view","server/".get_class($this),$this->dn);
-    }
   }
 
   
   /* Create content */
   function execute()
   {
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","server/".get_class($this),$this->dn);
+    }
+
     $str ="<div style='width:100%; text-align:right;'>".
           "  <input type='submit' name='SaveService' value='"._("Save")."'>&nbsp;".
           "  <input type='submit' name='CancelService' value='"._("Cancel")."'>".
@@ -95,7 +97,7 @@ class goService extends plugin{
       
     }
 
-    @log::log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
 
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
     $this->handle_post_events("remove");
@@ -112,16 +114,16 @@ class goService extends plugin{
     if($ldap->count()){
       $ldap->cd($this->dn);
       $ldap->modify($this->attrs);
-      @log::log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }else{
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
-      @log::log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }
     if($this->initially_was_account){
+      new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
       $this->handle_post_events("modify");
     }else{
       $this->handle_post_events("add");
+      new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
     }
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of server services/".get_class($this)." - (".$this->DisplayName.") with dn '%s' failed."),$this->dn));
   }
@@ -176,11 +178,7 @@ class goService extends plugin{
   function action_hook($add_attrs= array())
   {
     /* Find postcreate entries for this class */
-    $command= search_config($this->config->data['MENU'], get_class($this), "ACTION_HOOK");
-    if ($command == "" && isset($this->config->data['TABS'])){
-      $command= search_config($this->config->data['TABS'], get_class($this), "ACTION_HOOK");
-    }
-
+    $command= $this->config->search(get_class($this), "ACTION_HOOK",array('menu','tabs'));
     if ($command != ""){
 
       /* Walk through attribute list */