git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-596
.erreur { color: red; }
.error { color: red; }
.center { text-align: center; }
+.right { text-align: right; }
.descr {
text-align: justify;
--- /dev/null
+<?php
+
+ require 'xnet.inc.php';
+
+ function get_infos($email)
+ {
+ global $globals;
+
+ $email = strtolower($email);
+ if (strpos($email, '@') === false) {
+ $email .= '@m4x.org';
+ }
+ list($mbox,$dom) = split('@', $email);
+
+ if ($dom == 'polytechnique.org' || $dom == 'm4x.org') {
+ $res = $globals->xdb->query(
+ "SELECT user_id AS uid, u.promo, u.nom, u.prenom, b.alias,
+ CONCAT(b.alias, '@m4x.org') AS email,
+ CONCAT(b.alias, '@polytechnique.org') AS email2,
+ m.perms='admin', m.origine
+ FROM auth_user_md5 AS u
+ INNER JOIN aliases AS a ON ( u.user_id = a.id AND a.type != 'homonyme' )
+ INNER JOIN aliases AS b ON ( u.user_id = b.id AND b.type = 'a_vie' )
+ INNER JOIN groupex.membres AS m ON ( m.uid = u.user_id )
+ WHERE a.alias = {?} AND u.user_id < 50000", $mbox);
+ $user = $res->fetchOneAssoc();
+ } else {
+ $res = $globals->xdb->query(
+ "SELECT uid, nom, prenom, email, email AS email2, perms='admin', origine
+ FROM groupex.membres
+ WHERE email = {?} AND asso_id = {?}", $email, $globals->asso('id'));
+ $user = $res->fetchOneAssoc();
+ }
+
+ return $user;
+ }
+
+ if (Env::has('edit'))
+ {
+ new_groupadmin_page('xnet/groupe/membres-edit.tpl');
+
+ $user = get_infos(Env::get('edit'));
+ if (empty($user)) { header("Location: annuaire.php"); }
+ $page->assign('user', $user);
+
+ require 'lists.inc.php';
+ $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $globals->asso('mail_domain'));
+
+ if (false) {
+ // TODO : deal with form
+ }
+
+ $listes = $client->get_lists($user['email2']);
+ $page->assign('listes', $listes);
+
+ $res = $globals->xdb->query(
+ 'SELECT alias, redirect IS NOT NULL as sub
+ FROM virtual AS v
+ LEFT JOIN virtual_redirect AS vr ON(v.vid=vr.vid AND redirect={?})
+ WHERE alias LIKE {?} AND type="user"', $user['email'], '%@'.$globals->asso('mail_domain'));
+ $page->assign('alias', $res->fetchAllAssoc());
+ }
+ elseif (Env::has('del'))
+ {
+ new_groupadmin_page('xnet/groupe/membres-del.tpl');
+ $user = get_infos(Env::get('del'));
+ if (empty($user)) { header("Location: annuaire.php"); }
+ $page->assign('user', $user);
+
+ if (Post::has('confirm')) {
+ require 'lists.inc.php';
+ $client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $globals->asso('mail_domain'));
+ $listes = $client->get_lists($user['email2']);
+
+ foreach ($listes as $liste) {
+ if ($liste['sub'] == 2) {
+ $client->mass_unsubscribe($liste['list'], Array($user['email2']));
+ $page->trig("{$user['prenom']} {$user['nom']} a été désinscrit de {$liste['list']}");
+ } elseif ($liste['sub']) {
+ $page->trig("{$user['prenom']} {$user['nom']} a une demande d'inscription en cours sur la liste {$liste['list']}@ !");
+ }
+ }
+
+ $globals->xdb->execute(
+ "DELETE FROM virtual_redirect
+ USING virtual_redirect
+ INNER JOIN virtual USING(vid)
+ WHERE redirect={?} AND alias LIKE {?}", $user['email'], '%@'.$globals->asso('mail_domain'));
+ if (mysql_affected_rows()) {
+ $page->trig("{$user['prenom']} {$user['nom']} a été désabonné des alias du groupe !");
+ }
+
+ $globals->xdb->execute(
+ "DELETE FROM groupex.membres WHERE uid={?} AND asso_id={?}",
+ $user['uid'], $globals->asso('id'));
+ $page->trig("{$user['prenom']} {$user['nom']} a été retiré du groupe !");
+ }
+ }
+ else
+ {
+ header("Location: annuaire.php");
+ }
+
+ $page->run();
+
+?>
Fonctionnalités visibles uniquement par les administrateurs :
</p>
<ul class="descr">
- <li><a href="membresx-edit.php?new=x">Ajouter un membre X</a></li>
+ <li><a href="membres-edit.php?new=x">Ajouter un membre X</a></li>
<li><a href="membres-edit.php?new=ext">Ajouter un membre extérieur</a></li>
</ul>
{/if}
{if $admin}
<td></td>
<td>{if $m.admin}×{else} {/if}</td>
- <td><a href="{if $m.x}membresx{else}membres{/if}-edit.php?edit={$m.email}"><img src="{rel}/images/profil.png" alt="Edition du profil" /></a></td>
- <td><a href="{if $m.x}membresx{else}membres{/if}-edit.php?del={$m.email}"><img src="{rel}/images/del.png" alt="Suppression de {$m.prenom} {$m.nom}" /></a></td>
+ <td><a href="membres-edit.php?edit={$m.email}"><img src="{rel}/images/profil.png" alt="Edition du profil" /></a></td>
+ <td><a href="membres-edit.php?del={$m.email}"><img src="{rel}/images/del.png" alt="Suppression de {$m.prenom} {$m.nom}" /></a></td>
{/if}
</tr>
{/iterate}
--- /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.post.confirm}
+
+<p class="descr">
+<a href="annuaire.php">retour à l'annuaire</a>
+</p>
+
+{else}
+
+<h1>{$asso.nom} : gestion des memebres</h1>
+
+<h2>
+ Suppression du membre : {$user.prenom} {$user.nom}
+</h2>
+
+
+<form method="post" action="{$smarty.server.REQUEST_URI}">
+ <div class="center">
+ <p class="descr">
+ Etes-vous sûr de vouloir supprimer {$user.prenom} {$user.nom} du groupe,
+ lui retirer tous les droits associés à son statut de membre,
+ et le désabonner de toutes les listes de diffusion du groupe ?
+ </p>
+ <input type='submit' name='confirm' value='Oui, je le désinscris complètement du groupe !' />
+ </div>
+</form>
+
+{/if}
+
+{* 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 *
+ ***************************************************************************}
+
+<h1>{$asso.nom} : gestion des memebres</h1>
+
+<h2>
+ Édition du profil de {$user.prenom} {$user.nom}
+ {if $user.origine eq 'X'}
+ (X{$user.promo})
+ <a href="https://www.polytechnique.org/fiche.php?user={$user.alias}"><img src="{rel}/images/loupe.gif" alt="Voir la fiche"></a>
+ {/if}
+ <a href="?del={$user.email}"><img src="{rel}/images/del.png" alt="Suppression du compte"></a>
+ <a href="mailto:{$user.email}"><img src="{rel}/images/mail.png" alt="Ecrire un mail"></a>
+</h2>
+
+<form method="post" action="{$smarty.server.REQUEST_URI}">
+ <table cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="titre">
+ Permissions :
+ </td>
+ <td>
+ <select name="is_admin">";
+ <option value="0" {if $user.perms neq admin}selected="selected"{/if}>Membre</option>
+ <option value="1" {if $user.perms eq admin}selected="selected"{/if}>Administrateur</option>
+ </select>
+ </td>
+ </tr>
+ {if $user.origine neq X}
+ <tr>
+ <td class="titre">
+ Prénom:
+ </td>
+ <td>
+ <input type="text" value="{$user.prenom}" name="prenom" size="40" />
+ </td>
+ </tr>
+ <tr>
+ <td class="titre">
+ Nom:
+ </td>
+ <td>
+ <input type="text" value="{$user.nom}" name="nom" size="40" />
+ </td>
+ </tr>
+ <tr>
+ <td class="titre">
+ Email:
+ </td>
+ <td>
+ <input type="text" value="{$user.email}" name="email" size="40" />
+ </td>
+ </tr>
+ {/if}
+ </table>
+
+ <h2>Abonnement aux listes</h2>
+
+ <table cellpadding="0" cellspacing="0">
+ <tr>
+ <th> </th>
+ <th>Liste</th>
+ <th>Description</th>
+ <th>Nb</th>
+ </tr>
+ {foreach from=$listes item=liste}
+ <tr>
+ <td class='right'>
+ <input type='hidden' name='ml1[{$liste.list}]' value='{$liste.sub}' />
+ <input type='checkbox' name='ml2[{$liste.list}]' {if $liste.sub eq 2}checked="checked"{/if} />
+ </td>
+ <td>
+ <a href='listes-members.php?liste={$liste.list}'>
+ {$liste.list}
+ {if $liste.priv} <sup>‡</sup>{/if}
+ {if $liste.own} <sup>‡</sup>{/if}
+ </a>
+ </td>
+ <td>{$liste.desc}</td>
+ <td class='right'>{$liste.nbsub}</td>
+ </tr>
+ {foreachelse}
+ <tr><td colspan='4'>Pas de listes pour ce groupe</td></tr>
+ {/foreach}
+ </table>
+
+ <h2>Abonnement aux alias</h2>
+
+ <table cellpadding="0" cellspacing="0">
+ <tr>
+ <th> </th>
+ <th>Alias</th>
+ </tr>
+
+ {foreach from=$alias item=a}
+ <tr>
+ <td align='right'>
+ <input type='hidden' name='ml3[{$a.alias}]' value='{$a.sub}' />
+ <input type='checkbox' name='ml4[{$a.alias}]' {if $a.sub}checked="checked"{/if} />
+ </td>
+ <td>
+ <a href='alias-admin.php?liste={$a.alias}'>{$a.alias}</a>
+ </td>
+ </tr>
+ {foreachelse}
+ <tr><td colspan='2'>Pas d'alias pour ce groupe</td></tr>
+ {/foreach}
+ </table>
+
+ <br />
+ <div class="center">
+ <input type="submit" name='change' value="Valider ces changements" />
+
+ <input type="reset" value="Annuler ces changements" />
+ </div>
+
+</form>
+
+
+{* vim:set et sw=2 sts=2 sws=2: *}