Add a function to get a set of sorted users from a set of uid.
[platal.git] / templates / xnetlists / sync.tpl
index 4c313f4..a92d7aa 100644 (file)
   <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><label for="add{$u.email}">{$u.nom|strtoupper} {$u.prenom}</label></td>
-      <td><label for="add{$u.email}">{$u.promo}</label></td>
-      <td><input type="checkbox" name="add[{$u.email}]" id="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 enc=utf-8: *}