Displays when last email to remind the user about her xnet account was sent.
authorStéphane Jacob <sj@m4x.org>
Mon, 9 Apr 2012 20:57:49 +0000 (22:57 +0200)
committerStéphane Jacob <sj@m4x.org>
Mon, 9 Apr 2012 20:57:49 +0000 (22:57 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/xnetgrp.php
templates/xnetgrp/awaiting_active.tpl [new file with mode: 0644]
upgrade/1.1.5/07_register_pending_xnet.sql [new file with mode: 0644]

index e0ea0d4..933d6d2 100644 (file)
@@ -638,6 +638,10 @@ class XnetGrpModule extends PLModule
                                       FROM  register_pending_xnet
                                      WHERE  uid = {?}',
                                    $uid);
+        XDB::execute('UPDATE  register_pending_xnet
+                         SET  last_date = NOW()
+                       WHERE  uid = {?}',
+                     $uid);
 
         $mailer = new PlMailer('xnet/account.mail.tpl');
         $mailer->addCc('validation+xnet_account@polytechnique.org');
@@ -679,10 +683,14 @@ class XnetGrpModule extends PLModule
         $registration_date = XDB::fetchAllAssoc('uid', 'SELECT  uid, date
                                                           FROM  register_pending_xnet
                                                          WHERE  uid IN {?}', $uids);
+        $last_date = XDB::fetchAllAssoc('uid', 'SELECT  uid, last_date
+                                                  FROM  register_pending_xnet
+                                                 WHERE  uid IN {?}', $uids);
 
         $users = User::getBulkUsersWithUIDs($uids);
         $page->assign('users', $users);
         $page->assign('registration_date', $registration_date);
+        $page->assign('last_date', $last_date);
 
     }
 
diff --git a/templates/xnetgrp/awaiting_active.tpl b/templates/xnetgrp/awaiting_active.tpl
new file mode 100644 (file)
index 0000000..a3cd289
--- /dev/null
@@ -0,0 +1,84 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2011 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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+{if $users|@count}
+<form action="{$platal->ns}directory/awact" method="post">
+  {xsrf_token_field}
+  <table cellspacing="2" cellpadding="0" class="tiny">
+    <tr>
+      <th>Nom</th>
+      <th>Email</th>
+      <th>Demande d'activation</th>
+      <th>Dernière relance</th>
+      <th>
+        <a href="javascript:toggleAll()">{icon name="arrow_refresh" title="Tout (dé)cocher"}</a>
+      </th>
+    </tr>
+    {foreach from=$users item=user}
+    {assign var=uid value=$user->id()}
+    <tr>
+      <td class="checkboxToggle">{profile user=$user promo=true}</td>
+      <td class="checkboxToggle">{$user->email}</td>
+      <td class="checkboxToggle">{$registration_date.$uid|date_format:"%x"}</td>
+      <td class="checkboxToggle">{$last_date.$uid|date_format:"%x"}</td>
+      <td class="checkboxToggle"><input type="checkbox" class="moderate_email" name="again[{$uid}]" /></td>
+    </tr>
+    {/foreach}
+    <tr>
+      <td colspan="5" class="center">
+        <input type="submit" value="Relancer" />
+      </td>
+    </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>
+{else}
+<p>Il n'y a aucun compte en attente d'activation pour ce groupe.</p>
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
diff --git a/upgrade/1.1.5/07_register_pending_xnet.sql b/upgrade/1.1.5/07_register_pending_xnet.sql
new file mode 100644 (file)
index 0000000..9609300
--- /dev/null
@@ -0,0 +1 @@
+ALTER TABLE register_pending_xnet ADD COLUMN last_date DATE AFTER date;