From: x2000habouzit Date: Sat, 25 Sep 2004 09:48:06 +0000 (+0000) Subject: last page and last touch for ML interface... Now have to manage list creation/deletion X-Git-Tag: xorg/old~1494 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=ad7061f9a957ef1c011e62bdb71c741e22d005e4;p=platal.git last page and last touch for ML interface... Now have to manage list creation/deletion --- diff --git a/htdocs/listes/check.php b/htdocs/listes/check.php new file mode 100644 index 0000000..2e1fd2b --- /dev/null +++ b/htdocs/listes/check.php @@ -0,0 +1,46 @@ +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(); +?> diff --git a/scripts/mailman/mailman-rpc.py b/scripts/mailman/mailman-rpc.py index 231c8cc..27069cc 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.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() diff --git a/templates/listes/admin.tpl b/templates/listes/admin.tpl index 6f32287..bb78897 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.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}

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

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

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

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

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

+ +{if $options|@count} + + + + {foreach from=$options key=k item=o} + + + + + + {/foreach} +
Options incorrectres pour {$details.addr}
champsdevrait être:est ...
{$k}{if $o[0] === false}False{elseif $o[0] === true}True{elseif $o[0] === ''}" "{else}{$o[0]}{/if}{if $o[1] === false}False{elseif $o[1] === true}True{elseif $o[1] === ''}" "{else}{$o[1]}{/if}
+
+
+
+ +
+
+{else} +

Liste correcte !

+{/if} + +{/if} + +{/dynamic} + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/listes/moderate.tpl b/templates/listes/moderate.tpl index b57c7ba..798b3c0 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.8 2004-09-24 16:43:53 x2000habouzit Exp $ + $Id: moderate.tpl,v 1.9 2004-09-25 09:48:07 x2000habouzit Exp $ ***************************************************************************} {dynamic} @@ -33,12 +33,13 @@

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

diff --git a/templates/listes/options.tpl b/templates/listes/options.tpl index bd65daa..4296574 100644 --- a/templates/listes/options.tpl +++ b/templates/listes/options.tpl @@ -38,12 +38,13 @@ Tu n'es pas administrateur de la liste, mais du site. {/if}

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

diff --git a/templates/listes/soptions.tpl b/templates/listes/soptions.tpl index 533b4ca..f4a2672 100644 --- a/templates/listes/soptions.tpl +++ b/templates/listes/soptions.tpl @@ -31,19 +31,15 @@
Changer les options de la liste {$details.addr}
-{if !$details.own} -

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

-{/if}

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