Code

Added empty lines
[gosa.git] / plugins / personal / mail / class_mailAccount.inc
index 19517a7be294753c746569dc93f5b7a5d0363958..4587546aeb8efd6e1d58c963a4a1c3c0ff421b71 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 /* Load sieve support */
-@require_once ("class_sieve.inc");
+require_once ("class_sieve.inc");
 
 /* Load mail methods */
 global $BASE_DIR;
@@ -174,19 +174,34 @@ class mailAccount extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Load templating engine */
     $smarty= get_smarty();
     $display= "";
 
+    $mailserver= array();
+    foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
+      $mailserver[]= $key;
+    }
+
     /* Do we need to flip is_account state? */
     if (isset($_POST['modify_state'])){
       $this->is_account= !$this->is_account;
     }
 
+    /* Show main page */
+    $mailserver= array();
+    foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
+      $mailserver[]= $key;
+    }
+
     /* Do we represent a valid account? */
     if (!$this->is_account && $this->parent == NULL){
-      $display= "<img src=\"images/stop.png\" align=center>&nbsp;<b>".
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
         _("This account has no mail extensions.")."</b>";
+
       $display.= back_to_main();
       return ($display);
     }
@@ -197,8 +212,7 @@ class mailAccount extends plugin
         $display= $this->show_header(_("Remove mail account"),
             _("This account has mail features enabled. You can disable them by clicking below."));
       } else {
-        $display= $this->show_header(_("Create mail account"),
-            _("This account has mail features disabled. You can enable them by clicking below."));
+        $display= $this->show_header(_("Create mail account"), _("This account has mail features disabled. You can enable them by clicking below."));
         return ($display);
       }
     }
@@ -419,21 +433,18 @@ class mailAccount extends plugin
       return ($display);
     }
 
-    /* Show main page */
-    $mailserver= array();
-    foreach ($this->config->data['SERVERS']['IMAP'] as $key => $val){
-      $mailserver[]= $key;
-    }
     $smarty->assign("mailServers", $mailserver);
     foreach(array("gosaMailServer", "gosaMailQuota", "perms", "mail",
           "gosaMailAlternateAddress", "gosaMailForwardingAddress",
           "gosaVacationMessage", "gosaMailDeliveryMode",
           "gosaMailMaxSize", "gosaSpamSortLevel", "gosaSpamMailbox") as $val){
+
       $smarty->assign("$val", $this->$val);
       $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
     }
+
     if (is_numeric($this->gosaMailQuota) && $this->gosaMailQuota != 0){
-      $smarty->assign("quotausage", $this->quotaUsage * 100 / $this->gosaMailQuota);
+      $smarty->assign("quotausage", progressbar(round(($this->quotaUsage * 100)/ $this->gosaMailQuota,100,15,true)));
       $smarty->assign("quotadefined", "true");
     } else {
       $smarty->assign("quotadefined", "false");
@@ -527,7 +538,12 @@ class mailAccount extends plugin
     $method->fixAttributesOnRemove($this);
 
     /* Mailmethod wants us to remove the entry from LDAP. Keep uid! */
+    #fixme: || kolab || is differs here, you can't delete all attrs specified in this plugin .... 
+    #fixme: there are some attributes we have to keep, i think.
     unset ($this->attrs['uid']);
+
+
+
     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
         $this->attributes, "Save");
     $ldap->cd($this->dn);
@@ -619,6 +635,15 @@ class mailAccount extends plugin
     $id= $method->uattrib;
     $method->fixAttributesOnStore($this);
 
+    /* Remove Mailquota if = "" */
+    if($this->attrs['gosaMailQuota']=="") {
+      $this->attrs['gosaMailQuota']=array();
+    }
+
+    if(empty($this->attrs['gosaSpamMailbox'])){
+      unset($this->attrs['gosaSpamMailbox']);
+    }
+
     /* Save data to LDAP */
     $ldap->cd($this->dn);
     $ldap->modify($this->attrs);
@@ -648,7 +673,7 @@ class mailAccount extends plugin
     /* 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");
       }
     } else {
       $this->handle_post_events("add");
@@ -663,6 +688,10 @@ class mailAccount extends plugin
 
     $message= array();
 
+    if(empty($this->gosaMailServer)){
+      $message[]= _("There is no valid mailserver specified, please add one in the system setup.");
+    }
+
     /* must: mail */
     if ($this->mail == ""){
       $message[]= _("The required field 'Primary address' is not set.");
@@ -677,7 +706,7 @@ class mailAccount extends plugin
       }
     }
     $ldap->cd($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaMailAccount)(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
+    $ldap->search ("(&(!(objectClass=gosaUserTemplate))(|(mail=".$this->mail.")(gosaMailAlternateAddress=".
         $this->mail."))(!(uid=".$this->uid."))(!(cn=".$this->uid.")))", array("uid"));
     if ($ldap->count() != 0){
       $message[]= _("The primary address you've entered is already in use.");
@@ -708,6 +737,10 @@ class mailAccount extends plugin
       $message[]= _("You need to set the maximum mail size in order to reject anything.");
     }
 
+    if((preg_match("/S/", $this->gosaMailDeliveryMode))&&(empty($this->gosaSpamMailbox))) {
+      $message[]= _("You specified Spam settings, but there is no Folder specified.");
+    }
+
     return ($message);
   }