From e0552ced78ef48dd50e3df1edabeb441ceffd4e6 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 21 May 2007 09:51:59 +0000 Subject: [PATCH] Added gofon logging git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6416 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_phoneConferenceGeneric.inc | 18 +++++++++++++++++- plugins/gofon/fonreports/class_fonreport.inc | 7 ++++++- plugins/gofon/macro/class_gofonMacro.inc | 18 ++++++++++++++++-- .../gofon/phoneaccount/class_phoneAccount.inc | 18 ++++++++++++++++-- 4 files changed, 55 insertions(+), 6 deletions(-) diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 057401432..50795e6a0 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -52,7 +52,7 @@ class conference extends plugin /* Headpage attributes */ var $last_dep_sorting= "invalid"; var $departments= array(); - + var $view_logged = FALSE; var $dialog ; /* attribute list for save action */ @@ -148,6 +148,12 @@ class conference extends plugin /* Call parent execute */ plugin::execute(); + /* Log last action */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + @log::log("view","gofonconference/".get_class($this),$this->dn); + } + $smarty= get_smarty(); $smarty->assign("bases" ,$this->config->idepartments); @@ -250,6 +256,8 @@ class conference extends plugin $ldap->cd ($this->dn); $ldap->recursive_remove(); + @log::log("remove","gofonconference/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + /* Optionally execute a command after we're done */ $this->handle_post_events('remove'); } @@ -660,6 +668,14 @@ class conference extends plugin $ldap->add($this->attrs); $this->handle_post_events('add'); } + + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","gofonconference/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","gofonconference/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } + show_ldap_error($ldap->get_error(), sprintf(_("Saving of goFonConference/generic with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ diff --git a/plugins/gofon/fonreports/class_fonreport.inc b/plugins/gofon/fonreports/class_fonreport.inc index 69abf97f4..7c58872b4 100644 --- a/plugins/gofon/fonreports/class_fonreport.inc +++ b/plugins/gofon/fonreports/class_fonreport.inc @@ -24,7 +24,7 @@ class fonreport extends plugin /* attribute list for save action */ var $attributes_SO = array("start","search_for","search_base","range","month","sort_direction","sort","year"); var $objectclasses = array(); - + var $view_logged = FALSE; /* Construct class */ function fonreport ($config, $ui) @@ -104,6 +104,11 @@ class fonreport extends plugin /* GVet template engine */ $smarty= get_smarty(); + /* Log view */ + if(!$this->view_logged){ + $this->view_logged = TRUE; + @log::log("view","gofon/".get_class($this),$this->dn); + } /***************** Variable Init diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index cbcc99951..213cf6256 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -42,7 +42,7 @@ class macro extends plugin /*! attribute list for save action */ var $attributes = array("cn","base", "description","displayName","goFonMacroContent","goFonMacroVisible"); - + var $view_logged = FALSE; var $orig_cn = ""; /*! Objectclasses that this calls handles */ var $objectclasses = array("top", "goFonMacro"); @@ -97,6 +97,12 @@ class macro extends plugin /* Call parent execute */ plugin::execute(); + /* Log view */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + @log::log("view","gofonmacro/".get_class($this),$this->dn); + } + /* Variables */ $vars = ""; $tmp = array(); @@ -482,7 +488,8 @@ class macro extends plugin } /* Remove phone macro */ - $ldap->rmDir($this->dn); + $ldap->rmDir($this->dn); + @log::log("remove","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn)); /* Delete references to object groups */ @@ -527,6 +534,13 @@ class macro extends plugin $this->handle_post_events("add"); } show_ldap_error($ldap->get_error(), sprintf(_("Saving of goFonMacro/generic account with dn '%s' failed."),$this->dn)); + + /* Log last action */ + if($this->initially_was_account){ + @log::log("modify","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + }else{ + @log::log("create","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); + } } } diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index a92672422..25e1f2382 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -46,6 +46,8 @@ class phoneAccount extends plugin var $uid; + var $view_logged = FALSE; + function phoneAccount ($config, $dn= NULL, $parent= NULL) { plugin::plugin ($config, $dn, $parent); @@ -788,10 +790,14 @@ class phoneAccount extends plugin /* Call parent execute */ plugin::execute(); - $display = ""; + /* Log view */ + if($this->is_account && !$this->view_logged){ + $this->view_logged = TRUE; + @log::log("view","users/".get_class($this),$this->dn); + } + $display = ""; $SkipWrite = (!isset($this->parent) || !$this->parent) && !isset($_SESSION['edit']); - if(empty($this->macro)&&(!empty($this->goFonMacro))){ /* Go through already saved values, for a parameter */ @@ -1230,6 +1236,13 @@ class phoneAccount extends plugin $this->attrs['telephoneNumber'] =$tmp_numbers; $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/phone account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ @@ -1367,6 +1380,7 @@ class phoneAccount 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/phone account with dn '%s' failed."),$this->dn)); /* Optionally execute a command after we're done */ -- 2.30.2