last page and last touch for ML interface... Now have to manage list creation/deletion
authorx2000habouzit <x2000habouzit>
Sat, 25 Sep 2004 09:48:06 +0000 (09:48 +0000)
committerx2000habouzit <x2000habouzit>
Sat, 25 Sep 2004 09:48:06 +0000 (09:48 +0000)
htdocs/listes/check.php [new file with mode: 0644]
scripts/mailman/mailman-rpc.py
templates/listes/admin.tpl
templates/listes/check.tpl [new file with mode: 0644]
templates/listes/moderate.tpl
templates/listes/options.tpl
templates/listes/soptions.tpl

diff --git a/htdocs/listes/check.php b/htdocs/listes/check.php
new file mode 100644 (file)
index 0000000..2e1fd2b
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************
+        $Id: check.php,v 1.1 2004-09-25 09:48:06 x2000habouzit Exp $
+ ***************************************************************************/
+
+if(empty($_REQUEST['liste'])) header('Location: index.php');
+$liste = strtolower($_REQUEST['liste']);
+
+require("auto.prepend.inc.php");
+new_admin_page('listes/check.tpl', true);
+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);
+
+$client = new xmlrpc_client("http://{$_SESSION['uid']}:$pass@localhost:4949");
+
+if(isset($_POST['correct'])) { $client->check_options('polytechnique.org', $liste, true); }
+
+if(list($details,$options) = $client->check_options('polytechnique.org', $liste)) {
+    $page->assign_by_ref('details', $details);
+    $page->assign_by_ref('options', $options);
+} else
+    $page->assign('no_list', true);
+
+$page->run();
+?>
index 231c8cc..27069cc 100755 (executable)
@@ -18,7 +18,7 @@
 #*  Foundation, Inc.,                                                      *
 #*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
 #***************************************************************************
-#   $Id: mailman-rpc.py,v 1.36 2004-09-24 16:43:52 x2000habouzit Exp $
+#   $Id: mailman-rpc.py,v 1.37 2004-09-25 09:48:07 x2000habouzit Exp $
 #***************************************************************************
 
 import base64, MySQLdb, os, getopt, sys, MySQLdb.converters
@@ -511,7 +511,7 @@ def del_from_wl((userdesc,perms),vhost,listname,addr):
         return 0
 
 #-------------------------------------------------------------------------------
-# admin procedures [ ?????.php ]
+# admin procedures [ soptions.php ]
 #
 
 admin_opts = [ 'advertised', 'archive', 'default_member_moderation', \
@@ -528,6 +528,76 @@ def set_admin_options((userdesc,perms),vhost,listname,values):
     return set_options((userdesc,perms),vhost,listname,admin_opts,values)
 
 #-------------------------------------------------------------------------------
+# admin procedures [ check.php ]
+#
+
+check_opts = {
+    'acceptable_aliases'            : '',
+    'admin_immed_notify'            : True,
+    'administrivia'                 : True,
+    'anonymous_list'                : False,
+    'autorespond_admin'             : False,
+    'autorespond_postings'          : False,
+    'autorespond_requests'          : False,
+    'available_languages'           : ['fr'],
+    'ban_list'                      : [],
+    'bounce_matching_headers'       : '',
+    'bounce_processing'             : False,
+    'convert_html_to_plaintext'     : False,
+    'digestable'                    : False,
+    'digest_is_default'             : False,
+    'discard_these_nonmembers'      : [],
+    'emergency'                     : False,
+    'encode_ascii_prefixes'         : 2,
+    'filter_content'                : False,
+    'first_strip_reply_to'          : False,
+    'forward_auto_discards'         : True,
+    'header_filter_rules'           : [],
+    'hold_these_nonmembers'         : [],
+    'host_name'                     : 'lists.polytechnique.org',
+    'include_list_post_header'      : False,
+    'include_rfc2369_headers'       : False,
+    'new_member_options'            : 256,
+    'nondigestable'                 : True,
+    'obscure_addresses'             : True,
+    'preferred_language'            : 'fr',
+    'reject_these_nonmembers'       : [],
+    'reply_goes_to_list'            : 0,
+    'reply_to_address'              : '',
+    'require_explicit_destination'  : False,
+    'send_reminders'                : 0,
+    'send_welcome_msg'              : True,
+    'topics_enabled'                : False,
+    'umbrella_list'                 : False,
+    'unsubscribe_policy'            : 0,
+}
+
+def check_options((userdesc,perms),vhost,listname,correct=False):
+    try:
+        mlist = MailList.MailList(vhost+'-'+listname)
+    except:
+        return 0
+    try:
+        if perms != 'admin': return 0
+        options = { }
+        for (k,v) in check_opts.iteritems():
+            if mlist.__dict__[k] != v:
+                options[k] = v,mlist.__dict__[k]
+                if correct: mlist.__dict__[k] = v
+        real_name = str('-').join(mlist.internal_name().split('-')[1:])
+        if real_name != mlist.real_name:
+            options['real_name'] = real_name, mlist.real_name
+            if correct: mlist.real_name = real_name
+        if correct: mlist.Save()
+        details = get_list_info((userdesc,perms),mlist)[0]
+        mlist.Unlock()
+        return (details,options)
+    except:
+        mlist.Unlock()
+        raise
+        return 0
+
+#-------------------------------------------------------------------------------
 # server
 #
 class FastXMLRPCServer(SimpleXMLRPCServer):
@@ -586,9 +656,11 @@ server.register_function(get_owner_options)
 server.register_function(set_owner_options)
 server.register_function(add_to_wl)
 server.register_function(del_from_wl)
-#
+# soptions.php
 server.register_function(get_admin_options)
 server.register_function(set_admin_options)
+# check.php
+server.register_function(check_options)
 
 server.serve_forever()
 
index 6f32287..bb78897 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: admin.tpl,v 1.6 2004-09-24 16:28:06 x2000habouzit Exp $
+        $Id: admin.tpl,v 1.7 2004-09-25 09:48:07 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
@@ -38,12 +38,13 @@ Tu n'es pas administrateur de la liste, mais du site.
 {/if}
 
 <p>
-[<a href='index.php'>listes</a>] &gt;
+[<a href='index.php'>listes</a>] »
 [<a href='moderate.php?liste={$smarty.get.liste}'>modération</a>]
 [abonnés]
 [<a href='options.php?liste={$smarty.get.liste}'>options</a>]
-{perms level=admin}
+{perms level=admin} »
 [<a href='soptions.php?liste={$smarty.get.liste}'>Soptions</a>]
+[<a href='check.php?liste={$smarty.get.liste}'>check</a>]
 {/perms}
 </p>
 
diff --git a/templates/listes/check.tpl b/templates/listes/check.tpl
new file mode 100644 (file)
index 0000000..e35fac4
--- /dev/null
@@ -0,0 +1,72 @@
+{***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http ://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************
+        $Id : admin.tpl,v 1.4 2004/09/23 18:47:00 x2000habouzit Exp $
+ ***************************************************************************}
+
+{dynamic}
+
+{if $no_list || $smarty.session.perms neq admin }
+
+<p class='erreur'>La liste n'existe pas ou tu n'as pas le droit de l'administrer</p>
+
+{else}
+
+<div class='rubrique'>
+  Changer les options de la liste {$details.addr}
+</div>
+
+<p>
+[<a href='index.php'>listes</a>] »
+[<a href='moderate.php?liste={$smarty.get.liste}'>modération</a>]
+[<a href='admin.php?liste={$smarty.get.liste}'>abonnés</a>]
+[<a href='options.php?liste={$smarty.get.liste}'>options</a>]
+{perms level=admin} »
+[<a href='soptions.php?liste={$smarty.get.liste}'>Soptions</a>]
+[check]
+{/perms}
+</p>
+
+{if $options|@count}
+<table class='bicol' cellpadding='2' cellspacing='0'>
+  <tr><th colspan='3'>Options incorrectres pour {$details.addr}</th></tr>
+  <tr><th>champs</th><th>devrait être:</th><th>est ...</th></tr>
+  {foreach from=$options key=k item=o}
+  <tr>
+    <td class='titre'>{$k}</td>
+    <td>{if $o[0] === false}False{elseif $o[0] === true}True{elseif $o[0] === ''}" "{else}{$o[0]}{/if}</td>
+    <td>{if $o[1] === false}False{elseif $o[1] === true}True{elseif $o[1] === ''}" "{else}{$o[1]}{/if}</td>
+  </tr>
+  {/foreach}
+</table>
+<form action='{$smarty.server.REQUEST_URI}' method='post'>
+  <div class='center'>
+    <br />
+    <input type='submit' name='correct' value='Corriger les valeurs !' />
+  </div>
+</form>
+{else}
+<p>Liste correcte !</p>
+{/if}
+
+{/if}
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index b57c7ba..798b3c0 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: moderate.tpl,v 1.8 2004-09-24 16:43:53 x2000habouzit Exp $
+        $Id: moderate.tpl,v 1.9 2004-09-25 09:48:07 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
 </div>
 
 <p>
-[<a href='index.php'>listes</a>] &gt;
+[<a href='index.php'>listes</a>] »
 [modération]
 [<a href='admin.php?liste={$smarty.get.liste}'>abonnés</a>]
 [<a href='options.php?liste={$smarty.get.liste}'>options</a>]
-{perms level=admin}
+{perms level=admin} »
 [<a href='soptions.php?liste={$smarty.get.liste}'>Soptions</a>]
+[<a href='check.php?liste={$smarty.get.liste}'>check</a>]
 {/perms}
 </p>
 
index bd65daa..4296574 100644 (file)
@@ -38,12 +38,13 @@ Tu n'es pas administrateur de la liste, mais du site.
 {/if}
 
 <p>
-[<a href='index.php'>listes</a>] &gt;
+[<a href='index.php'>listes</a>] »
 [<a href='moderate.php?liste={$smarty.get.liste}'>modération</a>]
 [<a href='admin.php?liste={$smarty.get.liste}'>abonnés</a>]
 [options]
-{perms level=admin}
+{perms level=admin} »
 [<a href='soptions.php?liste={$smarty.get.liste}'>Soptions</a>]
+[<a href='check.php?liste={$smarty.get.liste}'>check</a>]
 {/perms}
 </p>
 
index 533b4ca..f4a2672 100644 (file)
 <div class='rubrique'>
   Changer les options de la liste {$details.addr}
 </div>
-{if !$details.own}
-<p class='erreur'>
-Tu n'es pas administrateur de la liste, mais du site.
-</p>
-{/if}
 
 <p>
-[<a href='index.php'>listes</a>] &gt;
+[<a href='index.php'>listes</a>] »
 [<a href='moderate.php?liste={$smarty.get.liste}'>modération</a>]
 [<a href='admin.php?liste={$smarty.get.liste}'>abonnés</a>]
 [<a href='options.php?liste={$smarty.get.liste}'>options</a>]
-{perms level=admin}
+{perms level=admin} »
 [Soptions]
+[<a href='check.php?liste={$smarty.get.liste}'>check</a>]
 {/perms}
 </p>