1-click moderation
authorx2000habouzit <x2000habouzit>
Sun, 24 Oct 2004 13:49:02 +0000 (13:49 +0000)
committerx2000habouzit <x2000habouzit>
Sun, 24 Oct 2004 13:49:02 +0000 (13:49 +0000)
ChangeLog
htdocs/listes/admin.php
htdocs/listes/moderate.php
templates/listes/admin.tpl
templates/listes/moderate.tpl

index 8db0923..8bc667a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,9 @@ Changes :
 
        * Lists :
                - auto-moderate/discard mails detected as SPAM by bogofilter.           -MC
-               - alpha-sort on listes/admin.php page (members gestion).                        -MC
+               - improve header/subject decoding.                                                                      -MC
+               - alpha-sort on listes/admin.php + msgs for each operations.            -MC
+               - 1-click moderation for accept and reject cases.                                       -MC
        
        * Usability :
                - all <a><img ... /></a> now have title (closes: FS#99).                        -MC
index 7adf3b6..2bd6221 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: admin.php,v 1.6 2004-10-23 21:31:46 x2000habouzit Exp $
+        $Id: admin.php,v 1.7 2004-10-24 13:49:02 x2000habouzit Exp $
  ***************************************************************************/
 
 if(empty($_REQUEST['liste'])) header('Location: index.php');
@@ -31,11 +31,16 @@ include('xml-rpc-client.inc.php');
 $res = $globals->db->query("SELECT password FROM auth_user_md5 WHERE user_id={$_SESSION['uid']}");
 list($pass) = mysql_fetch_row($res);
 mysql_free_result($res);
+    
+$err = Array();
 
 $client = new xmlrpc_client("http://{$_SESSION['uid']}:$pass@localhost:4949");
 
 if(isset($_REQUEST['add_member'])) {
-    $client->mass_subscribe('polytechnique.org', $liste, Array($_REQUEST['add_member']));
+    $arr = $client->mass_subscribe('polytechnique.org', $liste, Array($_REQUEST['add_member']));
+    if(is_array($arr)) {
+       foreach($arr as $addr) $err[] = "{$addr[0]} inscrit.";
+    }
 }
 
 if(isset($_REQUEST['del_member'])) {
@@ -44,7 +49,8 @@ if(isset($_REQUEST['del_member'])) {
 }
 
 if(isset($_REQUEST['add_owner'])) {
-    $client->add_owner('polytechnique.org', $liste, $_REQUEST['add_owner']);
+    if($client->add_owner('polytechnique.org', $liste, $_REQUEST['add_owner']))
+       $err = $_REQUEST['add_owner']." ajouté aux modérateurs.";
 }
 
 if(isset($_REQUEST['del_owner'])) {
@@ -89,5 +95,6 @@ if(list($det,$mem,$own) = $client->get_members('polytechnique.org', $liste)) {
 } else
     $page->assign('no_list',true);
 
+$page->assign('err', $err);
 $page->run();
 ?>
index 78c799c..86933f9 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: moderate.php,v 1.9 2004-10-24 12:54:44 x2000habouzit Exp $
+        $Id: moderate.php,v 1.10 2004-10-24 13:49:02 x2000habouzit Exp $
  ***************************************************************************/
 
 if(empty($_REQUEST['liste'])) header('Location: index.php');
@@ -48,14 +48,15 @@ if(isset($_POST['sdel'])) {
     /** 2 is the magic for REJECT see Defaults.py **/
 }
 
-if(isset($_POST['mid'])) {
-    include_once('diogenes.mailer.inc.php');
-    $mid = $_POST['mid'];
-    if(isset($_POST['mok'])) {
+if(isset($_REQUEST['mid'])) {
+    $mid = $_REQUEST['mid'];
+    if(isset($_REQUEST['mok'])) {
+       unset($_GET['mid']);
        $client->handle_request('polytechnique.org', $liste,$mid,1,''); /** 1 = APPROVE **/
     } elseif(isset($_POST['mno'])) {
        $reason = stripslashes($_POST['reason']);
        if($client->handle_request('polytechnique.org', $liste,$mid,2,$reason)) { /** 2 = REJECT **/
+           include_once('diogenes.mailer.inc.php');
            $mailer = new DiogenesMailer("$liste-bounces@polytechnique.org",
                "$liste-owner@polytechnique.org", "Message refusé");
            $texte = "le message a été refusé par {$_SESSION['prenom']} {$_SESSION['nom']} avec la raison :\n"
@@ -63,8 +64,10 @@ if(isset($_POST['mid'])) {
            $mailer->setBody(wordwrap($texte,72));
            $mailer->send();
        }
-    } elseif(isset($_POST['mdel'])) {
+    } elseif(isset($_REQUEST['mdel'])) {
+       unset($_GET['mid']);
        if($client->handle_request('polytechnique.org', $liste,$mid,3,'')) { /** 3 = DISCARD **/
+           include_once('diogenes.mailer.inc.php');
            $mailer = new DiogenesMailer("$liste-bounces@polytechnique.org",
                "$liste-owner@polytechnique.org", "Message supprimé");
            $texte = "le message a été supprimé par {$_SESSION['prenom']} {$_SESSION['nom']}.\n\n"
@@ -76,6 +79,7 @@ if(isset($_POST['mid'])) {
 }
 
 if(isset($_REQUEST['sid'])) {
+
     $sid = $_REQUEST['sid'];
     if(list($subs,$mails) = $client->get_pending_ops('polytechnique.org', $liste)) {
        foreach($subs as $user) {
index 432d569..1ba3b9f 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: admin.tpl,v 1.11 2004-10-23 21:33:40 x2000habouzit Exp $
+        $Id: admin.tpl,v 1.12 2004-10-24 13:49:03 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
@@ -55,6 +55,10 @@ Pour entrer un utilisateur, il faut remplir les champs pr
 c'est-à-dire "prenom.nom" ou "prenom.nom.promo"
 </p>
 
+{foreach from=$err item=e}
+<p class='error'>{$e}</p>
+{/foreach}
+
 <div class='rubrique'>
   modérateurs de la liste
 </div>
index 0542fec..2bb19a6 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: moderate.tpl,v 1.13 2004-10-24 12:54:44 x2000habouzit Exp $
+        $Id: moderate.tpl,v 1.14 2004-10-24 13:49:03 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
 </div>
 
 {if $mails|@count}
+<ul>
+  <li>
+  <strong>accepter:</strong> le mail est immédiatement libéré, et envoyé à la
+  liste.
+  </li>
+  <li>
+  <strong>refuser:</strong> pour refuser un mail, suivre le lien [voir] et
+  remplir le formulaire en bas de page.
+  </li>
+  <li>
+  <strong>rejeter:</strong> le mail est effacé sans autre forme de procès.
+  N'utiliser <strong>QUE</strong> pour les virus et les courriers indésirables.
+  </li>
+</ul>
+
 <table class='bicol' cellpadding='0' cellspacing='0'>
   <tr>
     <th>émetteur</th>
   {foreach from=$mails item=m}
   <tr class='{cycle values="pair,impair"}'>
     <td>{$m.sender}</td>
-    <td>{$m.subj}</td>
+    <td>{$m.subj|default:"[pas de sujet]"}</td>
     <td class='right'>{$m.size}o</td>
     <td class='right'>{$m.stamp|date_format:"%H:%M:%S<br />%d %b %Y"}</td>
     <td class='action'>
       <a href='?liste={$smarty.request.liste}&amp;mid={$m.id}'>voir</a>
-    </td>
+      <a href='?liste={$smarty.request.liste}&amp;mid={$m.id}&amp;mok=1'>accepter</a><br />
+      <a href='?liste={$smarty.request.liste}&amp;mid={$m.id}&amp;mok=1'>rejeter</a></td>
   </tr>
   {/foreach}
 </table>