From: Florent Bruneau Date: Thu, 24 Apr 2008 21:30:29 +0000 (+0200) Subject: Separate mails with a X-Org-Mail header from the others in moderation form. X-Git-Tag: core/1.0.0~233 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=717b9fa7c34c381a1f341149f5c1e613cb9922ea;p=platal.git Separate mails with a X-Org-Mail header from the others in moderation form. Signed-off-by: Florent Bruneau --- diff --git a/bin/lists.rpc.py b/bin/lists.rpc.py index aac5a23..67abde0 100755 --- a/bin/lists.rpc.py +++ b/bin/lists.rpc.py @@ -528,17 +528,24 @@ def get_pending_ops(userdesc, perms, vhost, listname): helds = [] for id in mlist.GetHeldMessageIds(): ptime, sender, subject, reason, filename, msgdata = mlist.GetRecord(id) + fpath = os.path.join(mm_cfg.DATA_DIR, filename) try: - size = os.path.getsize(os.path.join(mm_cfg.DATA_DIR, filename)) + size = os.path.getsize(fpath) except OSError, e: if e.errno <> errno.ENOENT: raise continue + try: + msg = readMessage(fpath) + fromX = msg.has_key("X-Org-Mail") + except: + pass helds.append({ 'id' : id, 'sender': quote(sender, True), 'size' : size, 'subj' : quote(subject, True), - 'stamp' : ptime + 'stamp' : ptime, + 'fromx' : fromX }) if dosave: mlist.Save() mlist.Unlock() diff --git a/modules/lists.php b/modules/lists.php index 3ef6ebf..040e818 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -480,6 +480,11 @@ class ListsModule extends PLModule if (list($subs,$mails) = $this->get_pending_ops($domain, $liste)) { foreach ($mails as $key=>$mail) { $mails[$key]['stamp'] = strftime("%Y%m%d%H%M%S", $mail['stamp']); + if ($mail['fromx']) { + $page->assign('with_fromx', true); + } else { + $page->assign('with_nonfromx', true); + } } $page->assign_by_ref('subs', $subs); $page->assign_by_ref('mails', $mails); diff --git a/templates/lists/moderate.tpl b/templates/lists/moderate.tpl index 30be737..a8ecdd2 100644 --- a/templates/lists/moderate.tpl +++ b/templates/lists/moderate.tpl @@ -74,7 +74,7 @@

S'il y a trop d'indésirables, il est probablement plus rapide pour la suite de les jeter directement et non de les modérer en modifant le réglage de - l'antispam. + l'antispam.

{javascript name="jquery"} @@ -94,6 +94,51 @@ function toggleAll() { //]]>
+{if $with_fromx} + + + + + + + + + + + {foreach from=$mails item=m name=mail} + {if $m.fromx} + + + + + + + + + {/if} + {/foreach} +
MailInfos
+ Les mails suivants proviennent d'adresses identifiées comme étant celles de camarades. +
+ + + De :
+ Sujet : +
+ {$m.sender}
+ {$m.subj|hdc|smarty:nodefaults} +
+ le {$m.stamp|date_format:"%x"} à {$m.stamp|date_format:"%X"}
+ {$m.size} octets
+
+ {icon name=add title="Accepter le message"} + + {icon name=magnifier title="Voir le message"}
+ {icon name=delete title="Spam !"} +
+{/if} + +{if $with_nonfromx} {foreach from=$mails item=m name=mail} + {if !$m.fromx} + {/if} {/foreach}
@@ -105,6 +150,7 @@ function toggleAll() {
@@ -129,12 +175,15 @@ function toggleAll() { {icon name=delete title="Spam !"}
+{/if} +

Utilise ces boutons pour appliquer une action à tous les mails sélectionnés.
- +