From 9ccc3e3f949b63e919618886c6d4a2c8bbf85a82 Mon Sep 17 00:00:00 2001
From: "Pierre Habouzit (MadCoder"
Date: Wed, 27 Apr 2005 18:52:33 +0000
Subject: [PATCH] membres-edit (deletion is OK, update and new have to be impl)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-596
---
htdocs.net/css/xnet.css | 1 +
htdocs.net/groupe/membres-edit.php | 106 +++++++++++++++++++++++++
templates/xnet/groupe/annuaire.tpl | 6 +-
templates/xnet/groupe/membres-del.tpl | 49 ++++++++++++
templates/xnet/groupe/membres-edit.tpl | 137 +++++++++++++++++++++++++++++++++
5 files changed, 296 insertions(+), 3 deletions(-)
create mode 100644 htdocs.net/groupe/membres-edit.php
create mode 100644 templates/xnet/groupe/membres-del.tpl
create mode 100644 templates/xnet/groupe/membres-edit.tpl
diff --git a/htdocs.net/css/xnet.css b/htdocs.net/css/xnet.css
index 55c9700..eb361eb 100644
--- a/htdocs.net/css/xnet.css
+++ b/htdocs.net/css/xnet.css
@@ -139,6 +139,7 @@ div.breadcrumb {
.erreur { color: red; }
.error { color: red; }
.center { text-align: center; }
+.right { text-align: right; }
.descr {
text-align: justify;
diff --git a/htdocs.net/groupe/membres-edit.php b/htdocs.net/groupe/membres-edit.php
new file mode 100644
index 0000000..9d181da
--- /dev/null
+++ b/htdocs.net/groupe/membres-edit.php
@@ -0,0 +1,106 @@
+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();
+
+?>
diff --git a/templates/xnet/groupe/annuaire.tpl b/templates/xnet/groupe/annuaire.tpl
index ce0186f..9708389 100644
--- a/templates/xnet/groupe/annuaire.tpl
+++ b/templates/xnet/groupe/annuaire.tpl
@@ -33,7 +33,7 @@ Les membres ext
Fonctionnalités visibles uniquement par les administrateurs :
{/if}
@@ -79,8 +79,8 @@ peux aussi afficher toute la liste.
{if $admin}
|
{if $m.admin}×{else} {/if} |
-  |
-  |
+  |
+  |
{/if}
{/iterate}
diff --git a/templates/xnet/groupe/membres-del.tpl b/templates/xnet/groupe/membres-del.tpl
new file mode 100644
index 0000000..1195e48
--- /dev/null
+++ b/templates/xnet/groupe/membres-del.tpl
@@ -0,0 +1,49 @@
+{***************************************************************************
+ * 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}
+
+
+retour à l'annuaire
+
+
+{else}
+
+{$asso.nom} : gestion des memebres
+
+
+ Suppression du membre : {$user.prenom} {$user.nom}
+
+
+
+
+
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2: *}
diff --git a/templates/xnet/groupe/membres-edit.tpl b/templates/xnet/groupe/membres-edit.tpl
new file mode 100644
index 0000000..76069c0
--- /dev/null
+++ b/templates/xnet/groupe/membres-edit.tpl
@@ -0,0 +1,137 @@
+{***************************************************************************
+ * 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 *
+ ***************************************************************************}
+
+{$asso.nom} : gestion des memebres
+
+
+ Édition du profil de {$user.prenom} {$user.nom}
+ {if $user.origine eq 'X'}
+ (X{$user.promo})
+
+ {/if}
+
+
+
+
+
+
+
+{* vim:set et sw=2 sts=2 sws=2: *}
--
2.1.4