Add a function to get a set of sorted users from a set of uid.
[platal.git] / templates / xnetlists / sync.tpl
index 7d3c717..a92d7aa 100644 (file)
@@ -1,6 +1,6 @@
 {**************************************************************************}
 {*                                                                        *}
-{*  Copyright (C) 2003-2006 Polytechnique.org                             *}
+{*  Copyright (C) 2003-2008 Polytechnique.org                             *}
 {*  http://opensource.polytechnique.org/                                  *}
 {*                                                                        *}
 {*  This program is free software; you can redistribute it and/or modify  *}
 {*                                                                        *}
 {**************************************************************************}
 
-{include file='listes/header_listes.tpl' on='sync'}
-<h1>Non abonnés à la liste {$platal->argv[1]}@{$asso.mail_domain}</h1>
+{include file='lists/header_listes.tpl' on='sync'}
+<h1>Non abonnés à la liste {$platal->argv[1]}@{$asso.mail_domain}</h1>
 
 <form action="{$platal->ns}lists/sync/{$platal->argv[1]}" method="post">
-
+  {xsrf_token_field}
   <table cellspacing="2" cellpadding="0" class="tiny">
     <tr>
       <th colspan="2">Membre</th>
-      <th></th>
+      <th>
+        <a href="javascript:toggleAll()">{icon name="arrow_refresh" title="Tout (dé)cocher"}</a>
+      </th>
     </tr>
     {foreach from=$not_in_list item=u}
     <tr>
-      <td>{$u.nom|strtoupper} {$u.prenom}</td>
-      <td>{$u.promo}</td>
-      <td><input type="checkbox" name="add[{$u.email}]" /></td>
+      <td class='checkboxToggle'>{profile user=$u with_promo=false}</td>
+      <td class='checkboxToggle'>{$u->promo()}</td>
+      <td class='checkboxToggle'><input type="checkbox" class="moderate_email" name="add[{$u->forlifeEmail()}]" id="add{$u->forlifeEmail()}"/></td>
     </tr>
     {/foreach}
     <tr>
     </tr>
   </table>
 
+  <script type="text/javascript">//<![CDATA[
+  {literal}
+  var toggleState = false;
+  function toggleAll() {
+    toggleState = !toggleState;
+    var boxes = $(":checkbox.moderate_email");
+    if (toggleState) {
+      boxes.attr("checked", "checked");
+    } else {
+      boxes.removeAttr("checked");
+    }
+  }
+
+  $('.checkboxToggle').click(function (event) {
+    // Don't uncheck the checkbox when clicking it
+    if (event.target.tagName === 'INPUT') {
+      return;
+    }
+
+    var checkbox = $(this).parent().find(':checkbox');
+    checkbox = checkbox.attr('checked', !checkbox.attr('checked'));
+    event.stopPropagation();
+  });
+  {/literal}
+  //]]></script>
+
 </form>
 
-{* vim:set et sw=2 sts=2 sws=2: *}
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}