git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-578
td { vertical-align: top; }
h1 { font-size: 150%; }
-h2 { font-size: 135%; }
+h2 { font-size: 130%; }
/***************************************************************************
* DEBUG
.erreur { color: red; }
.error { color: red; }
-
+.center { text-align: center; }
.descr {
text-align: justify;
--- /dev/null
+<?php
+require 'xnet.inc.php';
+
+new_groupadmin_page('xnet/groupe/alias-admin.tpl');
+$page->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();
+?>
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: ../");
}
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();
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();
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();
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();
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();
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();
--- /dev/null
+<?php
+
+require_once 'xnet.inc.php';
+
+new_group_page('xnet/groupe/listes.tpl');
+$page->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();
+?>
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')) {
--- /dev/null
+{***************************************************************************
+ * 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 *
+ ***************************************************************************}
+
+<p>[<a href='listes.php'>retour à la page des listes</a>]</p>
+
+<h1>Membres de {$smarty.request.liste}</h1>
+
+<table style="width:80%; margin: 0px 10%;">
+ <tr>
+ <th>Membres</th>
+ <td>
+ {if $mem->total()}
+ {iterate from=$mem item=m}
+ {$m.redirect}
+ <a href='?liste={$smarty.request.liste}&del_member={$m.redirect}'>
+ <img src='{rel}/images/del.png' alt='retirer membre' title='retirer membre' />
+ </a>
+ <br />
+ {/iterate}
+ {else}
+ <em>aucun membres ...</em>
+ {/if}
+ </td>
+ </tr>
+ <tr>
+ <td><strong>Ajouter</strong></td>
+ <td>
+ <form method="post" action="{$smarty.server.REQUEST_URI}">
+ <input type='text' name='add_member' />
+
+ <input type='submit' value='ajouter' />
+ </form>
+ </td>
+ </tr>
+</table>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
--- /dev/null
+{***************************************************************************
+ * 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}
+
+<p class="error">Est tu sur de supprimer l'alias {$smarty.get.del_alias} ?</p>
+<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method="post">
+ <div class="center">
+ <input type='submit' value="Oui, je suis sur" />
+ <input type='hidden' name='del_alias' value="{$smarty.get.del_alias}" />
+ </div>
+</form>
+<p>[<a href='listes.php'>retour à la page des listes</a>]</p>
+
+{else}
+
+<h1>{$asso.nom} : Listes de diffusion</h1>
+
+<h2>Listes de diffusion du groupe {$asso.nom} :</h2>
+
+<p class="descr">
+Une liste dont <strong>la diffusion</strong> 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
+<strong>l'inscription</strong> est modérée est une liste pour laquelle l'abonnement est soumis à
+l'accord préalable des responsables du groupe.
+</p>
+<p class="descr">
+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.
+</p>
+
+<table cellpadding="0" cellspacing="0" style="width: 100%;">
+ <tr>
+ <th>Liste</th>
+ <th>Description</th>
+ <th>Diffusion</th>
+ <th>Inscription</th>
+ <th>Nb</th>
+ <th> </th>
+ </tr>
+ {foreach from=$listes item=l}
+ <tr>
+ <td>
+ <a href="mailto:{$l.list}@{$asso.mail_domain}"><img src="{rel}/images/mail.png" alt='[mail]' /></a>
+ <a href='listes-members.php?liste={$l.list}'>{$l.list}{if $l.priv} <sup>‡</sup>{/if}{if $l.own} <sup>*</sup>{/if}</a>
+ </td>
+ <td>{$l.desc}</td>
+ <td class='center'>
+ {if $l.diff eq 2}modérée{elseif $l.diff eq 1}restreinte{else}libre{/if}
+ </td>
+ <td class='center'>{if $l.ins}modérée{else}libre{/if}</td>
+ <td align='right'>{$l.nbsub}</td>
+ <td align='right'>
+ {if $l.sub eq 2}
+ <a href="?del={$l.list}"><img src="{rel}/images/del.png" alt="[désinscrire]" title="me désinscrire" /></a>
+ {elseif $l.sub eq 1}
+ <img src="{rel}/images/flag.png" alt="[en attente]" title="en attente de modération" />
+ {else}
+ <a href="?add={$l.list}"><img src="{rel}/images/ajouter.gif" alt="[m'inscrire]" title="m'inscrire" /></a>
+ {/if}
+ </td>
+ </tr>
+ {foreachelse}
+ <tr><td colspan='6'>Pas de listes pour ce groupe</td></tr>
+ {/foreach}
+ {/if}
+</table>
+
+<p class="descr">
+*: tu es {if $smarty.session.femme}modératrice{else}moderateur{/if} sur cette liste<br />
+<sup>‡</sup>: 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.
+</p>
+
+<h2>Voici les alias existants pour le groupe {$asso.nom} :</h2>
+
+{if $alias->total()}
+<p>
+{iterate from=$alias item=a}
+{if $may_update}
+<a href='mailto:{$a.alias}'><img src='{rel}/images/mail.png' alt='[mail]' /></a>
+<a href="alias-admin.php?liste={$a.alias}">{$a.alias}</a>
+<a href="?del_alias={$a.alias}"><img src='{rel}/images/del.png' alt='[supprimer]' /></a><br />
+{else}
+<a href='mailto:{$a.alias}'><img src='{rel}/images/mail.png' alt='[mail]' /> {$a.alias}</a><br />
+{/if}
+{/iterate}
+</p>
+{else}
+<p>Aucun alias pour ce groupe</p>
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}