Displays antispam level in users email admin pages (Closes #1315).
authorStéphane Jacob <sj@m4x.org>
Thu, 3 Mar 2011 22:23:01 +0000 (23:23 +0100)
committerStéphane Jacob <sj@m4x.org>
Thu, 3 Mar 2011 22:23:01 +0000 (23:23 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
ChangeLog
include/emails.inc.php
templates/admin/user.tpl

index e697fe5..20b5c77 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@ VERSION 1.1.0                                                         XX XX XXXX
 Bug/Wish:
 
     * Admin:
+        - #1315: Displays antispam level in users email admin pages        -JAC
         - #1399: Displays all similar entreprises only on demand           -JAC
         - #1403: Displays grade if any in medal validation process         -JAC
 
index c09a7b4..5f98fff 100644 (file)
@@ -296,7 +296,7 @@ function ids_from_mails(array $emails)
 // The Bogo class represents a spam filtering level in plat/al architecture.
 class Bogo
 {
-    private static $states = array(
+    public static $states = array(
         0 => 'default',
         1 => 'let_spams',
         2 => 'tag_spams',
@@ -393,6 +393,7 @@ class Email
     public $display_email;
     public $domain;
     public $action;
+    public $filter_level;
 
     // Redirection status properties.
     public $active;
@@ -426,6 +427,7 @@ class Email
             $this->$status = ($status == $row['flags']);
         }
         $this->sufficient = ($this->type == 'smtp' || $this->type == 'googleapps');
+        $this->filter_level = ($this->type == 'imap') ? null : array_search($this->action, Bogo::$states);
         $this->user = &$user;
     }
 
index dc8794d..c5ab851 100644 (file)
@@ -381,7 +381,7 @@ $(function() {
   {xsrf_token_field}
   <table class="bicol" cellpadding="2" cellspacing="0">
     <tr>
-      <th colspan="4">
+      <th colspan="5">
         Redirections
       </th>
     </tr>
@@ -414,6 +414,9 @@ $(function() {
         {if $mail->email == 'googleapps'}</a>{/if}
         {if $mail->broken}<em> (en panne)</em></span>{/if}
       </td>
+      <td>
+        {if $mail->type != 'imap'}<span class="smaller">(niveau {$mail->filter_level} : {$mail->action})</span>{/if}
+      </td>
       <td class="action">
         {if $mail->is_removable()}
         <a href="javascript:del_fwd('{$mail->email}')">{icon name=cross}</a>
@@ -422,7 +425,7 @@ $(function() {
     </tr>
     {if $mail->panne && $mail->panne neq "0000-00-00"}
     <tr class="{$class}">
-      <td colspan="3" class="smaller" style="color: #f00">
+      <td colspan="4" class="smaller" style="color: #f00">
         {icon name=error title="Panne"}
         Panne de {$mail->display_email} le {$mail->panne|date_format}
         {if $mail->panne neq $mail->last}confirmée le {$mail->last|date_format}{/if}
@@ -438,7 +441,7 @@ $(function() {
       <td class="titre" colspan="2">
         Ajouter une adresse
       </td>
-      <td>
+      <td colspan="2">
         <input type="text" name="email" size="29" maxlength="255" value="" />
       </td>
       <td class="action">
@@ -451,7 +454,7 @@ $(function() {
       </td>
     </tr>
     <tr class="{$class}">
-      <td colspan="4" class="center">
+      <td colspan="5" class="center">
         {if $actives}
         <input type="submit" name="disable_fwd" value="Désactiver la redirection des emails" />
         {/if}