From 7862517e6fd83fa687eb08624ce83b4ee287b5f8 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Fri, 24 Sep 2004 16:28:05 +0000 Subject: [PATCH] superuser admin pages ... now : full list, and creation scripts ... --- htdocs/listes/soptions.php | 67 +++++++++++++++++++++ scripts/mailman/mailman-rpc.py | 7 ++- templates/listes/admin.tpl | 5 +- templates/listes/moderate.tpl | 5 +- templates/listes/options.tpl | 3 + templates/listes/soptions.tpl | 130 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 212 insertions(+), 5 deletions(-) create mode 100644 htdocs/listes/soptions.php create mode 100644 templates/listes/soptions.tpl diff --git a/htdocs/listes/soptions.php b/htdocs/listes/soptions.php new file mode 100644 index 0000000..9e69814 --- /dev/null +++ b/htdocs/listes/soptions.php @@ -0,0 +1,67 @@ +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(); +?> diff --git a/scripts/mailman/mailman-rpc.py b/scripts/mailman/mailman-rpc.py index 5ceb580..208b6b6 100755 --- a/scripts/mailman/mailman-rpc.py +++ b/scripts/mailman/mailman-rpc.py @@ -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() diff --git a/templates/listes/admin.tpl b/templates/listes/admin.tpl index 09193cd..6f32287 100644 --- a/templates/listes/admin.tpl +++ b/templates/listes/admin.tpl @@ -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. [modération] [abonnés] [options] +{perms level=admin} +[Soptions] +{/perms}

diff --git a/templates/listes/moderate.tpl b/templates/listes/moderate.tpl index 3bdf159..1d62cb5 100644 --- a/templates/listes/moderate.tpl +++ b/templates/listes/moderate.tpl @@ -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] [abonnés] [options] +{perms level=admin} +[Soptions] +{/perms}

diff --git a/templates/listes/options.tpl b/templates/listes/options.tpl index c4c0897..bd65daa 100644 --- a/templates/listes/options.tpl +++ b/templates/listes/options.tpl @@ -42,6 +42,9 @@ Tu n'es pas administrateur de la liste, mais du site. [modération] [abonnés] [options] +{perms level=admin} +[Soptions] +{/perms}

diff --git a/templates/listes/soptions.tpl b/templates/listes/soptions.tpl new file mode 100644 index 0000000..533b4ca --- /dev/null +++ b/templates/listes/soptions.tpl @@ -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 } + +

La liste n'existe pas ou tu n'as pas le droit de l'administrer

+ +{else} + +
+ Changer les options de la liste {$details.addr} +
+{if !$details.own} +

+Tu n'es pas administrateur de la liste, mais du site. +

+{/if} + +

+[listes] > +[modération] +[abonnés] +[options] +{perms level=admin} +[Soptions] +{/perms} +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Options de la liste {$details.addr}
+ msg_header :
+ ajouté au début de tous les messages. +
+ +
+ msg_footer :
+ ajouté à la fin de tous les messages. +
+ +
Options avancées de la liste {$details.addr}
+ visibilité :
+ si coché, la liste sera listée dans listes/index.php. + (les listes d'admin doivent être déochées) +
+ + publique +
+ diffusion : + + libre
+ modérée aux extérieurs
+ modérée +
+ archive :
+ Liste archivée ? +
+ + liste archivée +
+ max_message_size :
+ Taille maximale des posts en Ko: +
+ Ko +
+ +
+
+ +
+
+ +{/if} + +{/dynamic} + +{* vim:set et sw=2 sts=2 sws=2: *} -- 2.1.4