I think JMY will be happy :
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 19 Oct 2005 16:54:05 +0000 (16:54 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 19 Oct 2005 16:54:05 +0000 (16:54 +0000)
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
htdocs.net/groupe/annuaire-admin.php
htdocs.net/groupe/listes-sync.php [new file with mode: 0644]
include/xnet/page.inc.php
templates/listes/header_listes.tpl
templates/xnet/groupe/annuaire-admin.tpl
templates/xnet/groupe/listes-sync.tpl [new file with mode: 0644]

index 3d2ce36..dbb6444 100644 (file)
--- 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 :
 
index 34e0406..22a7fe8 100644 (file)
@@ -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 (file)
index 0000000..1862a7e
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+
+require_once 'xnet.inc.php';
+require_once 'lists.inc.php';
+require_once 'xnet/mail.inc.php';
+
+if (!Env::has('liste')) {
+    header('Location: annuaire-admin.php');
+}
+$liste = Env::get('liste');
+
+new_groupadmin_page('xnet/groupe/listes-sync.tpl');
+
+$client =& lists_xmlrpc(Session::getInt('uid'), Session::get('password'), $globals->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();
+
+?>
index cbc4f84..39ac9fc 100644 (file)
@@ -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";
index 12672e2..bdb538b 100644 (file)
     </td>
   </tr>
   {/if}
+  {if $it_is_xnet}
+  <tr>
+    <td><strong>Synchroniser</strong></td>
+    {if $on neq sync}
+    <td>[<a href="listes-sync.php?liste={$smarty.get.liste}">Synchroniser avec l'annuaire</a>]</td>
+    {else}
+    <td>[Synchroniser avec l'annuaire]</td>
+    {/if}
+  </tr>
+  {/if}
 </table>
 
 
index fbc48fe..dff2883 100644 (file)
   {/foreach}
 </ul>
 
+<h2>Comparer une liste et l'annuaire</h2>
+
+<table cellspacing="2" cellpadding="0" class="tiny">
+  <tr>
+    <th>Liste</th>
+    <th>Description</th>
+    <th></th>
+  </tr>
+  {foreach from=$lists item=l}
+  <tr>
+    <td>{$l.list}</td>
+    <td>{$l.desc}</td>
+    <td><a href="listes-sync.php?liste={$l.list}">synchro</a></td>
+  </tr>
+  {/foreach}
+</table>
+
 {* 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 (file)
index 0000000..c6ab65f
--- /dev/null
@@ -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'}
+<h1>Non abonnés à la liste {$smarty.request.liste}@{$asso.mail_domain}</h1>
+
+<form action="{$smarty.server.REQUEST_URI}" method="post">
+
+  <table cellspacing="2" cellpadding="0" class="tiny">
+    <tr>
+      <th>Membre</th>
+      <th></th>
+    </tr>
+    {foreach from=$not_in_list item=u}
+    <tr>
+      <td>{$u.prenom} {$u.nom}</td>
+      <td><input type="checkbox" name="add[{$u.email}]" /></td>
+    </tr>
+    {/foreach}
+    <tr>
+      <td colspan='2' class="center">
+        <input type='submit' value='forcer inscription' />
+      </td>
+    </tr>
+  </table>
+
+</form>
+
+{* vim:set et sw=2 sts=2 sws=2: *}