superuser admin pages ...
authorx2000habouzit <x2000habouzit>
Fri, 24 Sep 2004 16:28:05 +0000 (16:28 +0000)
committerx2000habouzit <x2000habouzit>
Fri, 24 Sep 2004 16:28:05 +0000 (16:28 +0000)
now : full list, and creation scripts ...

htdocs/listes/soptions.php [new file with mode: 0644]
scripts/mailman/mailman-rpc.py
templates/listes/admin.tpl
templates/listes/moderate.tpl
templates/listes/options.tpl
templates/listes/soptions.tpl [new file with mode: 0644]

diff --git a/htdocs/listes/soptions.php b/htdocs/listes/soptions.php
new file mode 100644 (file)
index 0000000..9e69814
--- /dev/null
@@ -0,0 +1,67 @@
+<?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: soptions.php,v 1.1 2004-09-24 16:28:05 x2000habouzit Exp $
+ ***************************************************************************/
+
+if(empty($_REQUEST['liste'])) header('Location: index.php');
+$liste = strtolower($_REQUEST['liste']);
+
+require("auto.prepend.inc.php");
+new_admin_page('listes/soptions.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['submit'])) {
+    $values = $_POST;
+    unset($values['submit']);
+    switch($values['moderate']) {
+       case '0':
+           $values['generic_nonmember_action'] = 0;
+           $values['default_member_moderation'] = 0;
+           break;
+       case '1':
+           $values['generic_nonmember_action'] = 1;
+           $values['default_member_moderation'] = 0;
+           break;
+       case '2':
+           $values['generic_nonmember_action'] = 1;
+           $values['default_member_moderation'] = 1;
+           break;
+    }
+    unset($values['moderate']);
+    $values['advertised'] = empty($values['advertised']) ? false : true;
+    $values['archive'] = empty($values['archive']) ? false : true;
+    $client->set_admin_options('polytechnique.org', $liste, $values);
+}
+
+if(list($details,$options) = $client->get_admin_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 5ceb580..208b6b6 100755 (executable)
@@ -18,7 +18,7 @@
 #*  Foundation, Inc.,                                                      *
 #*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
 #***************************************************************************
-#       $Id: mailman-rpc.py,v 1.34 2004-09-24 15:34:42 x2000habouzit Exp $
+#   $Id: mailman-rpc.py,v 1.35 2004-09-24 16:28:06 x2000habouzit Exp $
 #***************************************************************************
 
 import base64, MySQLdb, os, getopt, sys, MySQLdb.converters
@@ -186,6 +186,7 @@ def set_options((userdesc,perms),vhost,listname,opts,vals):
         return 1
     except:
         mlist.Unlock()
+        raise
         return 0
 
 #-------------------------------------------------------------------------------
@@ -514,8 +515,7 @@ def del_from_wl((userdesc,perms),vhost,listname,addr):
 #
 
 admin_opts = [ 'advertised', 'archive', 'default_member_moderation', \
-        'generic_nonmember_action', 'max_message_size', 'max_num_recipients', \
-        'member_moderation_action', 'msg_footer', 'msg_header', 'new_member_options' ]
+        'generic_nonmember_action', 'max_message_size', 'msg_footer', 'msg_header']
 
 def get_admin_options((userdesc,perms),vhost,listname):
     if perms != 'admin':
@@ -588,6 +588,7 @@ server.register_function(add_to_wl)
 server.register_function(del_from_wl)
 #
 server.register_function(get_admin_options)
+server.register_function(set_admin_options)
 
 server.serve_forever()
 
index 09193cd..6f32287 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: admin.tpl,v 1.5 2004-09-24 14:35:13 x2000habouzit Exp $
+        $Id: admin.tpl,v 1.6 2004-09-24 16:28:06 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
@@ -42,6 +42,9 @@ Tu n'es pas administrateur de la liste, mais du site.
 [<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}
+[<a href='soptions.php?liste={$smarty.get.liste}'>Soptions</a>]
+{/perms}
 </p>
 
 <p>
index 3bdf159..1d62cb5 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: moderate.tpl,v 1.6 2004-09-24 14:35:13 x2000habouzit Exp $
+        $Id: moderate.tpl,v 1.7 2004-09-24 16:28:06 x2000habouzit Exp $
  ***************************************************************************}
 
 {dynamic}
@@ -42,6 +42,9 @@ Tu n'es pas administrateur de la liste, mais du site.
 [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}
+[<a href='soptions.php?liste={$smarty.get.liste}'>Soptions</a>]
+{/perms}
 </p>
 
 <div class='rubrique'>
index c4c0897..bd65daa 100644 (file)
@@ -42,6 +42,9 @@ Tu n'es pas administrateur de la liste, mais du site.
 [<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}
+[<a href='soptions.php?liste={$smarty.get.liste}'>Soptions</a>]
+{/perms}
 </p>
 
 <form method='post' action='{$smarty.server.REQUEST_URI}'>
diff --git a/templates/listes/soptions.tpl b/templates/listes/soptions.tpl
new file mode 100644 (file)
index 0000000..533b4ca
--- /dev/null
@@ -0,0 +1,130 @@
+{***************************************************************************
+ *  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>
+{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='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}
+[Soptions]
+{/perms}
+</p>
+
+<form method='post' action='{$smarty.server.REQUEST_URI}'>
+  <table class='bicol' cellpadding='2' cellspacing='0'>
+    <tr><th colspan='2'>Options de la liste {$details.addr}</th></tr>
+    <tr class='impair'>
+      <td>
+        <strong>msg_header :</strong><br />
+        <span class='smaller'>ajouté au début de tous les messages.</span>
+      </td>
+      <td>
+        <textarea cols='40' rows='8' name='msg_header'>{$options.msg_header}</textarea>
+      </td>
+    </tr>
+    <tr class='impair'>
+      <td>
+        <strong>msg_footer :</strong><br />
+        <span class='smaller'>ajouté à la fin de tous les messages.</span>
+      </td>
+      <td>
+        <textarea cols='40' rows='8' name='msg_footer'>{$options.msg_footer}</textarea>
+      </td>
+    </tr>
+    <tr><th colspan='2'>Options avancées de la liste {$details.addr}</th></tr>
+    <tr class='impair'>
+      <td>
+        <strong>visibilité :</strong><br />
+        <span class='smaller'>si coché, la liste sera listée dans listes/index.php.
+          (les listes d'admin doivent être déochées)</span>
+      </td>
+      <td>
+        <input type='checkbox' name='advertised' {if $options.advertised}checked='checked'{/if} />
+        publique
+      </td>
+    </tr>
+    <tr class='impair'>
+      <td>
+        <strong>diffusion :</strong>
+      </td>
+      <td>
+        <input type='radio' name='moderate' value='0'
+        {if !$options.generic_nonmember_action && !$options.default_member_moderation}
+        checked='checked'{/if} />libre<br />
+        <input type='radio' name='moderate' value='1'
+        {if $options.generic_nonmember_action && !$options.default_member_moderation}
+        checked='checked'{/if} />modérée aux extérieurs<br />
+        <input type='radio' name='moderate' value='2'
+        {if $options.generic_nonmember_action && $options.default_member_moderation}
+        checked='checked'{/if} />modérée
+      </td>
+    </tr>
+    <tr class='pair'>
+      <td>
+        <strong>archive :</strong><br />
+        <span class='smaller'>Liste archivée ?</span>
+      </td>
+      <td>
+        <input type='checkbox' name='archive' {if $options.archive}checked='checked'{/if} />
+        liste archivée
+      </td>
+    </tr>
+    <tr class='pair'>
+      <td>
+        <strong>max_message_size :</strong><br />
+        <span class='smaller'>Taille maximale des posts en Ko:</span>
+      </td>
+      <td>
+        <input type='text' name='max_message_size' value='{$options.max_message_size}' /> Ko
+      </td>
+    </tr>
+  </table>
+
+  <div class='center'>
+    <br />
+    <input type='submit' name='submit' value='Valider les modifications' />
+  </div>
+</form>
+
+{/if}
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}