Code

Added a first set of reference changes - nearly untested
[gosa.git] / plugins / personal / connectivity / class_phpgwAccount.inc
index 0080bbbc9690460483f9787159584a34f0e4409b..9a9457071abae427520dadbfc85a8464e5bd3777 100644 (file)
@@ -15,16 +15,30 @@ class phpgwAccount extends plugin
   var $objectclasses= array("phpgwAccount");
   var $ReadOnly = false;
 
-  function phpgwAccount ($config, $dn= NULL)
+  var $uid  = "";
+  var $view_logged = FALSE;
+
+  function phpgwAccount (&$config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
+
+    /* Setting uid to default */
+    if(isset($this->attrs['uid'][0])){
+      $this->uid = $this->attrs['uid'][0];
+    }
   }
 
   function execute()
   {
        /* Call parent execute */
 //     plugin::execute();
-  
+    /* Log view */
+    if($this->is_account && !$this->view_logged){
+      $this->view_logged = TRUE;
+      new log("view","users/".get_class($this),$this->dn);
+    }
     /* Show tab dialog headers */
     $display= "";
 
@@ -34,7 +48,6 @@ class phpgwAccount extends plugin
     /* Load attributes */
     foreach($this->attributes as $val){
       $smarty->assign("$val", $this->$val);
-      $smarty->assign($val."ACL", chkacl($this->acl, "$val"));
     }
     if ($this->is_account){
       $smarty->assign("phpgwState", "checked");
@@ -71,8 +84,10 @@ class phpgwAccount extends plugin
 
       show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/PHPgw account with dn '%s' failed."),$this->dn));
 
+      new log("remove","users/".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');
+      $this->handle_post_events('remove',array("uid" => $this->uid));
     }
   }
 
@@ -115,16 +130,23 @@ class phpgwAccount extends plugin
     $this->cleanup();
     $ldap->modify ($this->attrs); 
 
+    if($this->initially_was_account){
+      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+    }else{
+      new 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/PHPgw account with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
     if ($this->initially_was_account == $this->is_account){
       if ($this->is_modified){
-        $this->handle_post_events("mofify");
+        $this->handle_post_events("modify",array("uid" => $this->uid));
       }
     } else {
-      $this->handle_post_events("add");
+      $this->handle_post_events("add",array("uid" => $this->uid));
     }
+
   }
 
 
@@ -133,12 +155,12 @@ class phpgwAccount extends plugin
   {
     return (array(
           "plShortName"     => _("PHP GW"),
-          "plDescription"   => _("PHP GW account settings"),
+          "plDescription"   => _("PHP GW account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
           "plSelfModify"    => TRUE,
           "plDepends"       => array("user"),
-          "plPriority"      => 5,                                 // Position in tabs
-          "plSection"       => "personal",                        // This belongs to personal
-          "plCategory"      => array("users"),
+          "plPriority"      => 24,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
           "plOptions"       => array(),
 
           "plProvidedAcls"  => array()