From 229cb653322da79730973adc94244afe36b48c82 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Wed, 19 Oct 2005 16:54:05 +0000 Subject: [PATCH] I think JMY will be happy : groups can now syncrhonize MLs and the directory : * either put ppls that are in MLs and not in the directory in it * or force subscription of some people to some ML `en masse` git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@110 839d8a87-29fc-0310-9880-83ba4fa771e5 --- ChangeLog | 5 ++-- htdocs.net/groupe/annuaire-admin.php | 1 + htdocs.net/groupe/listes-sync.php | 51 ++++++++++++++++++++++++++++++++ include/xnet/page.inc.php | 1 - templates/listes/header_listes.tpl | 10 +++++++ templates/xnet/groupe/annuaire-admin.tpl | 17 +++++++++++ templates/xnet/groupe/listes-sync.tpl | 48 ++++++++++++++++++++++++++++++ 7 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 htdocs.net/groupe/listes-sync.php create mode 100644 templates/xnet/groupe/listes-sync.tpl diff --git a/ChangeLog b/ChangeLog index 3d2ce36..dbb6444 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,13 +7,14 @@ New : - Documentation now use Wiki -Car * Profile : - - User can now accept synchronisatio from AX by admin. -Car + - User can now accept synchronisation from AX by admin. -Car - Address will try to display as the country standard. -Car * Xnet : - Groups can be non subscribable. -Car - - Most Wanted Feature : directories syncrhonization with lists. -MC + - Most Wanted Feature : directories synchronization with lists. -MC - Various bug fixes in events management. -Car + - Groups can now synchronize MLs and the directory. -MC Bug/Wish : diff --git a/htdocs.net/groupe/annuaire-admin.php b/htdocs.net/groupe/annuaire-admin.php index 34e0406..22a7fe8 100644 --- a/htdocs.net/groupe/annuaire-admin.php +++ b/htdocs.net/groupe/annuaire-admin.php @@ -41,6 +41,7 @@ foreach ($subscribers as $mail) { $page->assign('not_in_group_ext', $not_in_group_ext); $page->assign('not_in_group_x', $not_in_group_x); +$page->assign('lists', $lists); $page->run(); ?> diff --git a/htdocs.net/groupe/listes-sync.php b/htdocs.net/groupe/listes-sync.php new file mode 100644 index 0000000..1862a7e --- /dev/null +++ b/htdocs.net/groupe/listes-sync.php @@ -0,0 +1,51 @@ +asso('mail_domain')); + +if (Env::has('add')) { + $client->mass_subscribe($liste, array_keys(Env::getMixed('add'))); +} + +list(,$members) = $client->get_members($liste); +$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(); + +$ann = $globals->xdb->iterator( + "SELECT IF(m.origine='X',IF(u.nom_usage<>'', u.nom_usage, u.nom) ,m.nom) AS nom, + IF(m.origine='X',u.prenom,m.prenom) AS prenom, + IF(m.origine='X',u.promo,'extérieur') AS promo, + IF(m.origine='X',CONCAT(a.alias, '@polytechnique.org'),m.email) AS email, + IF(m.origine='X',FIND_IN_SET('femme', u.flags),0) AS femme, + m.perms='admin' AS admin, + m.origine='X' AS x + FROM groupex.membres AS m + LEFT JOIN auth_user_md5 AS u ON ( u.user_id = m.uid ) + LEFT JOIN aliases AS a ON ( a.id = m.uid AND a.type='a_vie' ) + WHERE m.asso_id = {?}", $globals->asso('id')); + +$not_in_list = array(); + +while ($tmp = $ann->next()) { + if (!in_array($tmp['email'], $subscribers)) { + $not_in_list[] = $tmp; + } +} + +$page->assign('not_in_list', $not_in_list); +$page->run(); + +?> diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index cbc4f84..39ac9fc 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -91,7 +91,6 @@ class XnetPage extends PlatalPage $sub = array(); $sub['modifier l\'accueil'] = "$dim/edit.php"; if ($globals->asso('mail_domain')) { - $sub['synchro. 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/listes/header_listes.tpl b/templates/listes/header_listes.tpl index 12672e2..bdb538b 100644 --- a/templates/listes/header_listes.tpl +++ b/templates/listes/header_listes.tpl @@ -100,6 +100,16 @@ {/if} + {if $it_is_xnet} + + Synchroniser + {if $on neq sync} + [Synchroniser avec l'annuaire] + {else} + [Synchroniser avec l'annuaire] + {/if} + + {/if} diff --git a/templates/xnet/groupe/annuaire-admin.tpl b/templates/xnet/groupe/annuaire-admin.tpl index fbc48fe..dff2883 100644 --- a/templates/xnet/groupe/annuaire-admin.tpl +++ b/templates/xnet/groupe/annuaire-admin.tpl @@ -41,4 +41,21 @@ {/foreach} +

Comparer une liste et l'annuaire

+ + + + + + + + {foreach from=$lists item=l} + + + + + + {/foreach} +
ListeDescription
{$l.list}{$l.desc}synchro
+ {* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/xnet/groupe/listes-sync.tpl b/templates/xnet/groupe/listes-sync.tpl new file mode 100644 index 0000000..c6ab65f --- /dev/null +++ b/templates/xnet/groupe/listes-sync.tpl @@ -0,0 +1,48 @@ +{**************************************************************************} +{* *} +{* 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 *} +{* *} +{**************************************************************************} + +{include file='listes/header_listes.tpl' on='sync'} +

Non abonnés à la liste {$smarty.request.liste}@{$asso.mail_domain}

+ +
+ + + + + + + {foreach from=$not_in_list item=u} + + + + + {/foreach} + + + +
Membre
{$u.prenom} {$u.nom}
+ +
+ +
+ +{* vim:set et sw=2 sts=2 sws=2: *} -- 2.1.4