Code

Added a first set of reference changes - nearly untested
[gosa.git] / plugins / personal / connectivity / class_oxchangeAccount.inc
index caf7c4a8c51326d5a606f28dd7c734f59682db44..6fe7b9a4533c7fd84ed91af61b516170e1cee89c 100644 (file)
@@ -30,6 +30,7 @@ class oxchangeAccount extends plugin
   var $OXTimeZone="GMT";
   var $mailEnabled="OK";
   var $dnModeValue = "";
+  var $view_logged = FALSE;
 
   /* attribute list for save action */
   var $attributes= array("OXAppointmentDays", "OXTaskDays", "OXTimeZone","mailEnabled");
@@ -579,7 +580,7 @@ class oxchangeAccount extends plugin
   var $dnmode= "";
   var $uid ="";
 
-  function oxchangeAccount ($config, $dn= NULL)
+  function oxchangeAccount (&$config, $dn= NULL)
   {
     plugin::plugin ($config, $dn);
     for ($i=0;$i<count($this->config->data['TABS']['CONNECTIVITY']);$i++){
@@ -602,11 +603,16 @@ class oxchangeAccount extends plugin
 
   function execute()
   {
-       /* Call parent execute */
-       //plugin::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);
+    }
 
-       $display="";
+    $display="";
 
     /* Show main page */
     $smarty= get_smarty();
@@ -714,15 +720,15 @@ class oxchangeAccount extends plugin
          isset($this->oxconf["PGPASSWD"])){
         $pgcon = @pg_connect("host=".$this->oxconf["PGHOST"]." user=".$this->oxconf["PGUSER"]." password=".$this->oxconf["PGPASSWD"]." dbname=".$this->oxconf["PGDBNAME"]);
         if (! $pgcon){
-          print_red(_("Couldn't connect to postgresql database!"));
+          print_red(_("Connectivity")."&nbsp;"._("Openexchange")."&nbsp;:"._("Couldn't connect to postgresql database!"));
           return;
         }
       }else{
-        print_red(_("Needed parameters for openexchange connectivity plugin are missing!"));
+        print_red(_("Connectivity")."&nbsp;"._("Openexchange")."&nbsp;:"._("Needed parameters for openexchange connectivity plugin are missing!"));
         return;
       }
     }else{
-      print_red(_("PHP4 module for postgresql database is missing!"));
+      print_red(_("Connectivity")."&nbsp;"._("Openexchange")."&nbsp;:"._("PHP4 module for postgresql database is missing!"));
       return;
     }
 
@@ -739,6 +745,9 @@ class oxchangeAccount extends plugin
         $this->attributes, "Save");
     $this->cleanup();
     $ldap->modify ($this->attrs); 
+
+    new 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/oxchange addressbook account with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
@@ -809,8 +818,7 @@ class oxchangeAccount extends plugin
     preg_match("/^(\w+(?=\=))=((\w|\s|\.)+(?=\,)),.*/",$this->dn,$uidarray);
     $uid=$uidarray[2];
     if (trim($uid) == "") {
-      print_red(_("The Open-Xchange accountname is empty and thus invalid! Check to make sure that ".
-                  "you are not using any strange characters in the loginname."));
+      print_red(_("The Open-Xchange accountname is empty and thus invalid! Check to make sure that you are not using any strange characters in the loginname."));
       return;
     }
        
@@ -843,6 +851,12 @@ class oxchangeAccount 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/oxchange account with dn '%s' failed."),$this->dn));
 
     /* Optionally execute a command after we're done */
@@ -948,12 +962,12 @@ class oxchangeAccount extends plugin
   {
     return (array(
           "plShortName"     => _("Open xchange"),
-          "plDescription"   => _("Open xchange account settings"),
+          "plDescription"   => _("Open xchange account settings")."&nbsp;:&nbsp;<u>"._("Connectivity addon")."</u>",
           "plSelfModify"    => TRUE,
           "plDepends"       => array("user"),
-          "plPriority"      => 4,                                 // Position in tabs
-          "plSection"       => "personal",                        // This belongs to personal
-          "plCategory"      => array("users"),
+          "plPriority"      => 27,                                 // Position in tabs
+          "plSection"     => array("personal" => _("My account")),
+          "plCategory"    => array("users"),
           "plOptions"       => array(),
 
           "plProvidedAcls"  => array(