From: Pierre Habouzit (MadCoder Date: Thu, 21 Apr 2005 13:38:33 +0000 (+0000) Subject: listes.php + alias-admin.php X-Git-Tag: xorg/old~184 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=06bc4e8f3e8e8ee35b76da700c2faa9ff8f69b3a;p=platal.git listes.php + alias-admin.php git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-578 --- diff --git a/htdocs.net/css/xnet.css b/htdocs.net/css/xnet.css index 338635a..59a4fa2 100644 --- a/htdocs.net/css/xnet.css +++ b/htdocs.net/css/xnet.css @@ -42,7 +42,7 @@ img { vertical-align: middle; } td { vertical-align: top; } h1 { font-size: 150%; } -h2 { font-size: 135%; } +h2 { font-size: 130%; } /*************************************************************************** * DEBUG @@ -132,7 +132,7 @@ td#menu { .erreur { color: red; } .error { color: red; } - +.center { text-align: center; } .descr { text-align: justify; diff --git a/htdocs.net/groupe/alias-admin.php b/htdocs.net/groupe/alias-admin.php new file mode 100644 index 0000000..71f1950 --- /dev/null +++ b/htdocs.net/groupe/alias-admin.php @@ -0,0 +1,67 @@ +useMenu(); +$page->setType($globals->asso('cat')); + +if (!Get::has('liste')) { + header("Location: listes.php"); +} + +$lfull = strtolower(Get::get('liste')); + +if (Env::has('add_member')) { + $add = Env::get('add_member'); + if(strstr($add, '@')) { + list($mbox,$dom) = split('@', strtolower($add)); + } else { + $mbox = $add; + $dom = 'm4x.org'; + } + if($dom == 'polytechnique.org' || $dom == 'm4x.org') { + $res = $globals->xdb->query( + "SELECT a.alias, b.alias + FROM x4dat.aliases AS a + LEFT JOIN x4dat.aliases AS b ON (a.id=b.id AND b.type = 'a_vie') + WHERE a.alias={?} AND a.type!='homonyme'", $mbox); + if (list($alias, $blias) = $res->fetchOneRow()) { + $alias = empty($blias) ? $alias : $blias; + $globals->xdb->query( + "INSERT INTO x4dat.virtual_redirect (vid,redirect) + SELECT vid, {?} + FROM x4dat.virtual + WHERE alias={?}", "$alias@m4x.org", $lfull); + $page->trig("$alias@m4x.org ajouté"); + } else { + $page->trig("$mbox@polytechnique.org n'existe pas."); + } + } else { + $globals->xdb->query( + "INSERT INTO x4dat.virtual_redirect (vid,redirect) + SELECT vid,{?} + FROM x4dat.virtual + WHERE alias={?}", "$mbox@$dom", $lfull); + $page->trig("$mbox@$dom ajouté"); + } +} + +if (Env::has('del_member')) { + $globals->xdb->query( + "DELETE FROM x4dat.virtual_redirect + USING x4dat.virtual_redirect + INNER JOIN x4dat.virtual USING(vid) + WHERE redirect={?} AND alias={?}", Env::get('del_member'), $lfull); + header("Location: ?liste=$lfull"); +} + +$res = $globals->xdb->iterator( + "SELECT redirect + FROM x4dat.virtual_redirect AS vr + INNER JOIN x4dat.virtual AS v USING(vid) + WHERE v.alias={?} + ORDER BY redirect", $lfull); +$page->assign('mem', $res); + +$page->run(); +?> diff --git a/htdocs.net/groupe/asso.php b/htdocs.net/groupe/asso.php index b809768..b86c465 100644 --- a/htdocs.net/groupe/asso.php +++ b/htdocs.net/groupe/asso.php @@ -2,7 +2,7 @@ require 'xnet.inc.php'; -new_page('xnet/groupe/asso.tpl', AUTH); +new_page('xnet/groupe/asso.tpl', AUTH_PUBLIC); if (!$globals->asso('id')) { header("Location: ../"); } diff --git a/htdocs.net/groupe/listes-admin.php b/htdocs.net/groupe/listes-admin.php index 827f226..30e719f 100644 --- a/htdocs.net/groupe/listes-admin.php +++ b/htdocs.net/groupe/listes-admin.php @@ -23,7 +23,7 @@ require_once 'xnet.inc.php'; if (!Env::has('liste')) header('Location: listes.php'); $liste = strtolower(Env::get('liste')); -new_page('listes/admin.tpl', AUTH_MDP); +new_group_page('listes/admin.tpl'); $page->setType($globals->asso('cat')); $page->useMenu(); diff --git a/htdocs.net/groupe/listes-archives.php b/htdocs.net/groupe/listes-archives.php index db288f9..15b1c70 100644 --- a/htdocs.net/groupe/listes-archives.php +++ b/htdocs.net/groupe/listes-archives.php @@ -23,7 +23,7 @@ require_once 'xnet.inc.php'; if (!Env::has('liste')) header('Location: listes.php'); $liste = strtolower(Env::get('liste')); -new_page('listes/archives.tpl'); +new_group_page('listes/archives.tpl'); $page->setType($globals->asso('cat')); $page->useMenu(); diff --git a/htdocs.net/groupe/listes-delete.php b/htdocs.net/groupe/listes-delete.php index 309ee07..e6dc9aa 100644 --- a/htdocs.net/groupe/listes-delete.php +++ b/htdocs.net/groupe/listes-delete.php @@ -23,7 +23,7 @@ require_once 'xnet.inc.php'; if (!Env::has('liste')) header('Location: listes.php'); $liste = strtolower(Env::get('liste')); -new_page('listes/delete.tpl', AUTH_MDP); +new_group_page('listes/delete.tpl'); $page->setType($globals->asso('cat')); $page->useMenu(); diff --git a/htdocs.net/groupe/listes-members.php b/htdocs.net/groupe/listes-members.php index c6dc60c..117aa84 100644 --- a/htdocs.net/groupe/listes-members.php +++ b/htdocs.net/groupe/listes-members.php @@ -23,7 +23,7 @@ require_once 'xnet.inc.php'; if (!Env::has('liste')) header('Location: listes.php'); $liste = strtolower(Env::get('liste')); -new_page('listes/members.tpl', AUTH_MDP); +new_group_page('listes/members.tpl'); $page->setType($globals->asso('cat')); $page->useMenu(); diff --git a/htdocs.net/groupe/listes-moderate.php b/htdocs.net/groupe/listes-moderate.php index 8a1f20f..5a2e906 100644 --- a/htdocs.net/groupe/listes-moderate.php +++ b/htdocs.net/groupe/listes-moderate.php @@ -27,7 +27,7 @@ if (preg_match("!(?:[a-z0-9]+\\.)?{".$globals->asso('mail_domain')."}_(.*)!", $l header("Location: {$_SERVER['PHP_SELF']}?liste={$matches[1]}"); } -new_page('listes/moderate.tpl', AUTH_MDP); +new_group_page('listes/moderate.tpl'); $page->setType($globals->asso('cat')); $page->useMenu(); diff --git a/htdocs.net/groupe/listes-options.php b/htdocs.net/groupe/listes-options.php index c5cd1ee..b16c004 100644 --- a/htdocs.net/groupe/listes-options.php +++ b/htdocs.net/groupe/listes-options.php @@ -23,7 +23,7 @@ require_once 'xnet.inc.php'; if (!Env::has('liste')) header('Location: listes.php'); $liste = strtolower(Env::get('liste')); -new_page('listes/options.tpl', AUTH_MDP); +new_group_page('listes/options.tpl'); $page->setType($globals->asso('cat')); $page->useMenu(); diff --git a/htdocs.net/groupe/listes.php b/htdocs.net/groupe/listes.php new file mode 100644 index 0000000..20715c2 --- /dev/null +++ b/htdocs.net/groupe/listes.php @@ -0,0 +1,55 @@ +setType($globals->asso('cat')); +$page->useMenu(); +$page->assign('asso', $globals->asso()); + +require_once('lists.inc.php'); +$client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $globals->asso('mail_domain')); + + +if(Get::has('del')) { + $client->unsubscribe(Get::get('del')); + header('Location: listes.php'); +} +if(Get::has('add')) { + $client->subscribe(Get::get('add')); + header('Location: listes.php'); +} +if(Post::has('promo_add')) { + $promo = Post::getInt('promo_add'); + if ($promo>=1900 and $promo<2100) { + $client->subscribe("promo$promo"); + } else { + $page->trig("promo incorrecte, il faut une promo sur 4 chiffres."); + } +} + + +if (Post::has('del_alias')) { + $globals->xdb->query( + 'DELETE FROM x4dat.virtual_redirect, x4dat.virtual + USING x4dat.virtual AS v + INNER JOIN x4dat.virtual_redirect USING(vid) + WHERE v.alias={?}', Post::get('del_alias')); + $page->trig(Post::get('del_alias')." supprimé !"); +} + +$listes = $client->get_lists(); +$page->assign('listes',$listes); + +$alias = $globals->xdb->iterator( + 'SELECT alias,type + FROM x4dat.virtual + WHERE alias + LIKE {?} AND type="user" + ORDER BY alias', '%@'.$globals->asso('mail_domain')); +$page->assign('alias', $alias); + +$page->assign('may_update', may_update()); + +$page->run(); +?> diff --git a/htdocs/listes/moderate.php b/htdocs/listes/moderate.php index 5b50977..a2609b9 100644 --- a/htdocs/listes/moderate.php +++ b/htdocs/listes/moderate.php @@ -38,7 +38,7 @@ $page->register_modifier('qpd','quoted_printable_decode'); if(Env::has('sadd')) { $client->handle_request($liste,Env::get('sadd'),4,''); /* 4 = SUBSCRIBE */ - header("Location: moderate.php?liste=$liste"); + header("Location: {$_SERVER['PHP_SELF']}?liste=$liste"); } if(Post::has('sdel')) { diff --git a/templates/xnet/groupe/alias-admin.tpl b/templates/xnet/groupe/alias-admin.tpl new file mode 100644 index 0000000..4af3af8 --- /dev/null +++ b/templates/xnet/groupe/alias-admin.tpl @@ -0,0 +1,54 @@ +{*************************************************************************** + * 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 * + ***************************************************************************} + +

[retour à la page des listes]

+ +

Membres de {$smarty.request.liste}

+ + + + + + + + + + +
Membres + {if $mem->total()} + {iterate from=$mem item=m} + {$m.redirect} + + retirer membre + +
+ {/iterate} + {else} + aucun membres ... + {/if} +
Ajouter +
+ +   + +
+
+ +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/xnet/groupe/listes.tpl b/templates/xnet/groupe/listes.tpl new file mode 100644 index 0000000..3f96996 --- /dev/null +++ b/templates/xnet/groupe/listes.tpl @@ -0,0 +1,112 @@ +{*************************************************************************** + * 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 * + ***************************************************************************} + + +{if $smarty.get.del_alias} + +

Est tu sur de supprimer l'alias {$smarty.get.del_alias} ?

+
' method="post"> +
+ + +
+
+

[retour à la page des listes]

+ +{else} + +

{$asso.nom} : Listes de diffusion

+ +

Listes de diffusion du groupe {$asso.nom} :

+ +

+Une liste dont la diffusion est modérée est une liste dont les mails sont validés +par les administrateurs avant d'être transmis aux membres de la liste. Une liste dont +l'inscription est modérée est une liste pour laquelle l'abonnement est soumis à +l'accord préalable des responsables du groupe. +

+

+La dernière colonne du tableau t'indique si tu es inscrit{if $smarty.session.femme}e{/if} ou non à +la liste. Dans le premier cas, une croix rouge te permet de te désabonner. Dans le second cas, une +croix verte te permet de t'inscrire, après accord des responsables si l'inscription est modérée. +

+ + + + + + + + + + + {foreach from=$listes item=l} + + + + + + + + + {foreachelse} + + {/foreach} + {/if} +
ListeDescriptionDiffusionInscriptionNb 
+ [mail] + {$l.list}{if $l.priv} {/if}{if $l.own} *{/if} + {$l.desc} + {if $l.diff eq 2}modérée{elseif $l.diff eq 1}restreinte{else}libre{/if} + {if $l.ins}modérée{else}libre{/if}{$l.nbsub} + {if $l.sub eq 2} + [désinscrire] + {elseif $l.sub eq 1} + [en attente] + {else} + [m'inscrire] + {/if} +
Pas de listes pour ce groupe
+ +

+*: tu es {if $smarty.session.femme}modératrice{else}moderateur{/if} sur cette liste
+: cette liste est invisible aux non-membres du groupe. S'en désabonner +t'empêcherait de t'y réabonner par la suite sans l'aide d'un administrateur. +

+ +

Voici les alias existants pour le groupe {$asso.nom} :

+ +{if $alias->total()} +

+{iterate from=$alias item=a} +{if $may_update} +[mail] +{$a.alias} +[supprimer]
+{else} +[mail] {$a.alias}
+{/if} +{/iterate} +

+{else} +

Aucun alias pour ce groupe

+{/if} + +{* vim:set et sw=2 sts=2 sws=2: *}