maybe the most wanted feature (ask Jacques Levin, or JMY ...).
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 24 Sep 2005 17:26:07 +0000 (17:26 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 24 Sep 2005 17:26:07 +0000 (17:26 +0000)
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
htdocs.net/groupe/annuaire-admin.php [new file with mode: 0644]
include/xnet/page.inc.php
templates/xnet/groupe/annuaire-admin.tpl [new file with mode: 0644]
templates/xnet/groupe/annuaire.tpl

index 2b256ad..2c756bd 100644 (file)
--- 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 (file)
index 0000000..19b79b4
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+require_once 'xnet.inc.php';
+require_once 'lists.inc.php';
+require_once 'xnet/mail.inc.php';
+
+new_groupadmin_page('xnet/groupe/annuaire-admin.tpl');
+$client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $globals->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();
+
+?>
index 39ac9fc..5eb5d32 100644 (file)
@@ -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 (file)
index 0000000..fbc48fe
--- /dev/null
@@ -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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<h1>Abonnés à des listes non présents dans l'annuaire</h1>
+
+<h2>Polytechniciens</h2>
+
+<ul>
+  {foreach from=$not_in_group_x item=n}
+  <li>{$n} [<a href='membres-edit.php?new=x&email={$n}' class='popup'>l'inscrire</a>]</li>
+  {foreachelse}
+  <li><em>tous les polytechniciens présents sur les listes sont inscrits à l'annuaire du groupe.</em></li>
+  {/foreach}
+</ul>
+
+<h2>non Polytechniciens</h2>
+<ul>
+  {foreach from=$not_in_group_ext item=n}
+  <li>{$n} [<a href='membres-edit.php?new=ext&email={$n}' class='popup'>l'inscrire</a>]</li>
+  {foreachelse}
+  <li><em>tous les non-polytechniciens présents sur les listes sont inscrits à l'annuaire du groupe.</em></li>
+  {/foreach}
+</ul>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
index 74a06bc..f5cf344 100644 (file)
@@ -37,6 +37,7 @@ Fonctionnalit
 <ul class="descr">
   <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>
+  <li><a href="annuaire-admin.php">Synchroniser annuaire et Listes de diffusion</a></li>
 </ul>
 {/if}