Code

Updated kolab to write groups in a kolab manner
[gosa.git] / plugins / admin / groups / class_groupMail.inc
index 544e0cb04b39aa1fc36bb0806abd5da8c2c3ed76..f7744376383a24247d20379ec9bb82c810835ec2 100644 (file)
@@ -119,13 +119,20 @@ class mailgroup extends plugin
           }
           
           /* Update quota values */
-          $this->quotaUsage= $quota['quotaUsage'];
-          $this->gosaMailQuota= $quota['gosaMailQuota'];
+          if ($quota['gosaMailQuota'] == 2147483647){
+            $this->quotaUsage= "";
+            $this->gosaMailQuota= "";
+          } else {
+            $this->quotaUsage= $quota['quotaUsage'];
+            $this->gosaMailQuota= $quota['gosaMailQuota'];
+          }
           $method->disconnect();
         }
 
       }
 
+      /* Adapt attributes if needed */
+      $method->fixAttributesOnLoad($this);
     }
 
     /* Get global filter config */
@@ -160,6 +167,9 @@ class mailgroup extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Load templating engine */
     $smarty= get_smarty();
     if ($_SESSION['js']==FALSE){
@@ -356,6 +366,7 @@ class mailgroup extends plugin
 
       /* Show dialog */
       $smarty->assign("search_image", get_template_path('images/search.png'));
+      $smarty->assign("usearch_image", get_template_path('images/search_user.png'));
       $smarty->assign("tree_image", get_template_path('images/tree.png'));
       $smarty->assign("infoimage", get_template_path('images/info.png'));
       $smarty->assign("launchimage", get_template_path('images/small_filter.png'));
@@ -426,7 +437,7 @@ class mailgroup extends plugin
       $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
     }
     if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
-      $smarty->assign("quotausage", progressbar(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true));
+      $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true)));
       $smarty->assign("quotadefined", "true");
     } else {
       $smarty->assign("quotadefined", "false");
@@ -465,6 +476,7 @@ class mailgroup extends plugin
         $method->deleteMailbox($this->uid);
         $method->disconnect();
       }
+      $method->fixAttributesOnRemove($this);
     }
 
     /* Optionally execute a command after we're done */
@@ -570,6 +582,7 @@ class mailgroup extends plugin
     /* Only do IMAP actions if we are not a template */
     if (!$this->is_template){
       $method= new $this->method($this->config);
+      $method->fixAttributesOnStore($this);
       if ($method->connect($this->gosaMailServer)){
         $method->updateMailbox($this->uid);
         $method->setQuota($this->uid, $this->gosaMailQuota);
@@ -613,7 +626,7 @@ class mailgroup extends plugin
       $message[]= _("Please enter a valid email addres in 'Primary address' field.");
     }
     $ldap->cd($this->config->current['BASE']);
-    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
+    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(objectClass=gosaMailAccount)(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
         $this->mail."))(!(uid=".$this->cn."))(!(cn=".$this->cn.")))");
     if ($ldap->count() != 0){
       $message[]= _("The primary address you've entered is already in use.");
@@ -647,7 +660,7 @@ class mailgroup extends plugin
     }
 
     if(empty($this->gosaMailServer)){
-      $message[] = _("Please Select a valid Mailserver.");
+      $message[] = _("Please select a valid mail server.");
     }
 
     return ($message);