From 3c8acb8e7c4151358965b4467952e8268cc5643e Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sat, 24 Sep 2005 17:26:07 +0000 Subject: [PATCH] maybe the most wanted feature (ask Jacques Levin, or JMY ...). now you can list members that are on lists, but are not listed in the group's directory. UI is not perfect, and a bit laborious, but everithyng can be done in a few clicks. Aliases are ignored atm (like quite everywhere on the site). TODO (but not urgent): * beeing notified while subscribing someone to a list, and him not beeing in the group already. * list people in the directory but in no list at all. git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@54 839d8a87-29fc-0310-9880-83ba4fa771e5 --- ChangeLog | 1 + htdocs.net/groupe/annuaire-admin.php | 44 ++++++++++++++++++++++++++++++++ include/xnet/page.inc.php | 1 + templates/xnet/groupe/annuaire-admin.tpl | 44 ++++++++++++++++++++++++++++++++ templates/xnet/groupe/annuaire.tpl | 1 + 5 files changed, 91 insertions(+) create mode 100644 htdocs.net/groupe/annuaire-admin.php create mode 100644 templates/xnet/groupe/annuaire-admin.tpl diff --git a/ChangeLog b/ChangeLog index 2b256ad..2c756bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ New : * Xnet : - Groups can be non subscribable. -Car + - Most Wanted Feature : directories syncrhonization with lists. -MC Bug/Wish : diff --git a/htdocs.net/groupe/annuaire-admin.php b/htdocs.net/groupe/annuaire-admin.php new file mode 100644 index 0000000..19b79b4 --- /dev/null +++ b/htdocs.net/groupe/annuaire-admin.php @@ -0,0 +1,44 @@ +asso('mail_domain')); +$listes = array_map(create_function('$arr', 'return $arr["list"];'), $client->get_lists()); + +$subscribers = array(); + +foreach ($listes as $list) { + list(,$members) = $client->get_members($list); + $mails = array_map(create_function('$arr', 'return $arr[1];'), $members); + $subscribers = array_unique(array_merge($subscribers, $mails)); +} + +$not_in_group_x = array(); +$not_in_group_ext = array(); + +foreach ($subscribers as $mail) { + $res = $globals->xdb->query( + 'SELECT COUNT(*) + FROM groupex.membres AS m + LEFT JOIN auth_user_md5 AS u ON (m.uid=u.user_id AND m.uid<50000) + LEFT JOIN aliases AS a ON (a.id=u.user_id and a.type="a_vie") + WHERE asso_id = {?} AND + (m.email = {?} OR CONCAT(a.alias, "@polytechnique.org") = {?})', + $globals->asso('id'), $mail, $mail); + if ($res->fetchOneCell() == 0) { + if (strstr($mail, '@polytechnique.org') === false) { + $not_in_group_ext[] = $mail; + } else { + $not_in_group_x = $mail; + } + } +} + +$page->assign('not_in_group_ext', $not_in_group_ext); +$page->assign('not_in_group_x', $not_in_group_x); +$page->run(); + +?> diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 39ac9fc..5eb5d32 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -91,6 +91,7 @@ class XnetPage extends PlatalPage $sub = array(); $sub['modifier l\'accueil'] = "$dim/edit.php"; if ($globals->asso('mail_domain')) { + $sub['syncrho annuaire'] = "$dim/annuaire-admin.php"; $sub['envoyer un mail'] = "$dim/mail.php"; $sub['créer une liste'] = "$dim/listes-create.php"; $sub['créer un alias'] = "$dim/alias-create.php"; diff --git a/templates/xnet/groupe/annuaire-admin.tpl b/templates/xnet/groupe/annuaire-admin.tpl new file mode 100644 index 0000000..fbc48fe --- /dev/null +++ b/templates/xnet/groupe/annuaire-admin.tpl @@ -0,0 +1,44 @@ +{**************************************************************************} +{* *} +{* 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 *} +{* *} +{**************************************************************************} + +

Abonnés à des listes non présents dans l'annuaire

+ +

Polytechniciens

+ + + +

non Polytechniciens

+ + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/xnet/groupe/annuaire.tpl b/templates/xnet/groupe/annuaire.tpl index 74a06bc..f5cf344 100644 --- a/templates/xnet/groupe/annuaire.tpl +++ b/templates/xnet/groupe/annuaire.tpl @@ -37,6 +37,7 @@ Fonctionnalit {/if} -- 2.1.4