first page of the mailing lists interface ....
authorx2000habouzit <x2000habouzit>
Fri, 10 Sep 2004 11:52:36 +0000 (11:52 +0000)
committerx2000habouzit <x2000habouzit>
Fri, 10 Sep 2004 11:52:36 +0000 (11:52 +0000)
it's good to see my work work :)

for mailman-rpc.py: use dictionnaries instead of tuples, it's a looooooooot better for later use in php

configs/menu.conf.php
htdocs/css/default.css
htdocs/listes/index.php [new file with mode: 0644]
scripts/mailman/mailman-rpc.py
templates/listes/index.tpl [new file with mode: 0644]

index 022e77e..282f21c 100644 (file)
@@ -13,7 +13,7 @@ if(logged()) {
         'Services' => Array (
             'Envoyer un mail' => 'sendmail.php' ,
             'Forums & PA' => 'banana/' ,
-            'Listes de diffusion' => '###url###' ,
+            'Listes de diffusion' => 'listes/' ,
             'Micropaiements' => 'paiement/' ,
             'Patte cassée' => 'pattecassee.php' ,
         ),
index 9a2d5a8..fb53e8c 100644 (file)
@@ -150,6 +150,7 @@ table.tinybicol td, table.bicol td {
     background: inherit;
 }
 
+table.tinybicol td, table.bicol td { padding-left: 4px; padding-right: 4px; }
 
 td.half { width: 50%; padding: 4px; }
 td.titre {
@@ -581,4 +582,4 @@ div.spacer { clear: both; }
 }
 
 /* vim: set et ts=4 sts=4 sw=4: */
-/* $Id: default.css,v 1.41 2004-09-06 06:25:07 x2000coic Exp $ */
+/* $Id: default.css,v 1.42 2004-09-10 11:52:36 x2000habouzit Exp $ */
diff --git a/htdocs/listes/index.php b/htdocs/listes/index.php
new file mode 100644 (file)
index 0000000..b8bb818
--- /dev/null
@@ -0,0 +1,36 @@
+<?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: index.php,v 1.1 2004-09-10 11:52:36 x2000habouzit Exp $
+ ***************************************************************************/
+
+require("auto.prepend.inc.php");
+new_skinned_page('listes/index.tpl', AUTH_COOKIE);
+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");
+
+$listes = $client->get_lists();
+$page->assign_by_ref('listes',$listes);
+$page->run();
+?>
index 934f36e..5803521 100755 (executable)
@@ -18,7 +18,7 @@
 #*  Foundation, Inc.,                                                      *
 #*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
 #***************************************************************************
-#       $Id: mailman-rpc.py,v 1.13 2004-09-10 07:02:02 x2000habouzit Exp $
+#       $Id: mailman-rpc.py,v 1.14 2004-09-10 11:52:37 x2000habouzit Exp $
 #***************************************************************************
 
 import base64, MySQLdb
@@ -126,7 +126,14 @@ def get_lists((userdesc,perms)):
         is_owner  = userdesc.address in mlist.owner
         is_admin  = mm_cfg.ADMIN_ML_OWNER in mlist.owner
         if ( mlist.advertised ) or ( perms == 'admin' and is_admin ) or is_member or is_owner:
-            result.append( (name,1-mlist.advertised+is_admin,is_member,is_owner) )
+            result.append( {
+                    'list' : name,
+                    'desc' : mlist.description,
+                    'diff' : mlist.generic_nonmember_action,
+                    'ins'  : mlist.subscribe_policy > 0,
+                    'priv' : (1-mlist.advertised)+2*is_admin,
+                    'you'  : is_member + 2*is_owner
+                    } )
     return result
 
 def get_members((userdesc,perms),listname):
diff --git a/templates/listes/index.tpl b/templates/listes/index.tpl
new file mode 100644 (file)
index 0000000..b2ab516
--- /dev/null
@@ -0,0 +1,96 @@
+{***************************************************************************
+ *  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: index.tpl,v 1.1 2004-09-10 11:52:37 x2000habouzit Exp $
+ ***************************************************************************}
+
+ {dynamic}
+
+<div class="rubrique">
+  Listes de diffusion publiques
+</div>
+
+<table class='bicol' cellpadding='0' cellspacing='0'>
+  <tr>
+    <th>Liste</th>
+    <th>Description</th>
+    <th>Diffusion</th>
+    <th>Inscription</th>
+  </tr>
+  {foreach from=$listes item=liste}
+  {if $liste.priv eq 0}
+  <tr class='{cycle values="impair,pair"}'>
+    <td>{$liste.list}{if $liste.you>1}*{/if}</td>
+    <td>{$liste.desc}</td>
+    <td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
+    <td class='right'>{if $liste.you is odd}désinscription{elseif $liste.ins}ins modérée{else}inscription{/if}</td>
+  </tr>
+  {/if}
+  {/foreach}
+</table>
+
+<div class="rubrique">
+  Listes de diffusion privées
+</div>
+
+<table class='bicol' cellpadding='0' cellspacing='0'>
+  <tr>
+    <th>Liste</th>
+    <th>Description</th>
+    <th>Diffusion</th>
+    <th>Inscription</th>
+  </tr>
+  {foreach from=$listes item=liste}
+  {if $liste.priv eq 1}
+  <tr class='{cycle values="impair,pair"}'>
+    <td>{$liste.list}{if $liste.you>1}*{/if}</td>
+    <td>{$liste.desc}</td>
+    <td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
+    <td class='right'>{if $liste.you is odd}désinscription{elseif $liste.ins}ins modérée{else}inscription{/if}</td>
+  </tr>
+  {/if}
+  {/foreach}
+</table>
+
+<div class="rubrique">
+  Listes d'administration
+</div>
+
+<table class='bicol' cellpadding='0' cellspacing='0'>
+  <tr>
+    <th>Liste</th>
+    <th>Description</th>
+    <th>Diffusion</th>
+    <th>Inscription</th>
+  </tr>
+  {foreach from=$listes item=liste}
+  {if $liste.priv > 1}
+  <tr class='{cycle values="impair,pair"}'>
+    <td>{$liste.list}{if $liste.you>1}*{/if}</td>
+    <td>{$liste.desc}</td>
+    <td class='center'>{if $liste.diff}modérée{else}libre{/if}</td>
+    <td class='right'>{if $liste.you is odd}désinscription{elseif $liste.ins}ins modérée{else}inscription{/if}</td>
+  </tr>
+  {/if}
+  {/foreach}
+</table>
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}