Code

Added logging to fax extensions
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 May 2007 10:15:34 +0000 (10:15 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 May 2007 10:15:34 +0000 (10:15 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6417 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/gofax/blocklists/class_blocklistManagement.inc
plugins/gofax/faxaccount/class_gofaxAccount.inc
plugins/gofax/faxreports/class_faxreport.inc

index a002dfcb8dac9cd1a3ca537dadaabc375ba451b1..7fd5512c7afca4442b2da10485c053d9abc9423d 100644 (file)
@@ -21,6 +21,7 @@ class blocklist extends plugin
   var $attributes       = array("cn", "description");
   var $objectclasses    = array();
   var $DivListBlocklist = NULL;
+  var $view_logged = FALSE;
 
   function blocklist ($config, $ui)
   {
@@ -279,7 +280,7 @@ class blocklist extends plugin
      ***************/
 
     /* Handle interactions: delete */
-    if (isset($_POST['delete_number']) && count($_POST['numbers']) > 0){
+    if (isset($_POST['delete_number']) && isset($_POST['numbers']) && count($_POST['numbers']) > 0){
       $this->delNumber ($_POST['numbers']);
     }
 
@@ -323,7 +324,13 @@ class blocklist extends plugin
     if($this->dn){
 
       $dn = $this->dn;
-  
+
+      /* Log view */
+      if(!$this->view_logged){
+        $this->view_logged = TRUE;
+        @log::log("view","users/".get_class($this),$this->dn);
+      }
       /* set Account states, this is nescessary for get_allowed_bases */
       $this->initially_was_account= true;
       $this->is_account = true;
@@ -460,6 +467,7 @@ class blocklist extends plugin
     $this->description= "";
     $this->cn= "";
     $this->base= $_SESSION['CurrentMainBase'];
+    $this->view_logged = FALSE;
     $this->goFaxBlocklist= array();
   }
 
@@ -518,6 +526,9 @@ class blocklist extends plugin
   {
     $ldap= $this->config->get_ldap_link();
     $ldap->rmDir($this->dn);
+
+    @log::log("remove","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+  
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of blocklist with dn '%s' failed."),$this->dn));
     $this->clear_fields();
     $this->handle_post_events("remove");
@@ -622,12 +633,14 @@ class blocklist extends plugin
       $ldap->cd($this->dn);
       $this->cleanup();
       $ldap->modify($this->attrs);
+      @log::log("modify","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
       $this->handle_post_events("modify");
     } else {
       $ldap->cd($this->config->current['BASE']);
       $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
+      @log::log("create","gofaxlist/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
       $this->handle_post_events("add");
     }
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of blocklist with dn '%s' failed."),$this->dn));
index 1b1b26b4432c027009fbcd1eb1ba2a79a8738dba..50a3c9b373830361821531fd5f227feb9d40cc6b 100644 (file)
@@ -37,6 +37,7 @@ class gofaxAccount extends plugin
   var $in_blocklist_dialog= FALSE;
   var $out_blocklist_dialog= FALSE;
   var $current_blocklist= array();
+  var $view_logged = FALSE;
 
   /* Copy & paste variables */
   var $CopyPasteVars=array("facsimileTelephoneNumber");//,"goFaxRBlocklist","goFaxRBlockgroups","goFaxSBlocklist","goFaxSBlockgroups");
@@ -111,6 +112,13 @@ class gofaxAccount extends plugin
   {
     /* Call parent execute */
     plugin::execute();
+
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      @log::log("view","users/".get_class($this),$this->dn);
+    }
+
     /* Hickert : 11.11.05
      * Added to be able to handle department selection in divSelelect
      */
@@ -621,6 +629,8 @@ class gofaxAccount extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs); 
 
+    @log::log("remove","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+
     show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/fax account with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
@@ -741,6 +751,13 @@ class gofaxAccount extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs); 
 
+    /* Log last action */
+    if($this->initially_was_account){
+      @log::log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      @log::log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }
+
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of user/fax account with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
index c7ac755b0b6ac04de8751467054709c9e3da192a..2bc248c5d45b371f4fdebc5b26f95c14009291c7 100644 (file)
@@ -17,6 +17,7 @@ class faxreport extends plugin
   var $report_list    = array();
   var $ui             = NULL;
   var $range          = 20;
+  var $view_logged = FALSE;
 
   /* Constant stuff */
   var $status= array( "SENT", "MAILED", "SERROR", "RERROR", "SBLOCK", "RBLOCK",
@@ -64,6 +65,12 @@ class faxreport extends plugin
     /* Call parent execute */
     plugin::execute();
 
+    /* Log view */
+    if(!$this->view_logged){
+      $this->view_logged = TRUE;
+      @log::log("view","users/".get_class($this),$this->dn);
+    }
+
     /************ 
       Variable initialisation 
      ************/