Adds no_redirection reminder.
authorStéphane Jacob <jacou@melix.net>
Sat, 9 May 2009 09:00:16 +0000 (11:00 +0200)
committerStéphane Jacob <jacou@melix.net>
Sat, 9 May 2009 09:00:16 +0000 (11:00 +0200)
include/reminder/no_redirection.inc.php [new file with mode: 0644]
templates/events/index.tpl
templates/reminder/no_redirection.tpl [new file with mode: 0644]
upgrade/0.10.1/00_inscription.sql

diff --git a/include/reminder/no_redirection.inc.php b/include/reminder/no_redirection.inc.php
new file mode 100644 (file)
index 0000000..917c651
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2009 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                *
+ ***************************************************************************/
+
+class ReminderNoRedirection extends Reminder
+{
+    public function HandleAction($action)
+    {
+        if ($action == 'dismiss') {
+            $this->UpdateOnDismiss();
+        }
+    }
+
+    protected function GetDisplayText() {}
+
+    public function Display(&$page)
+    {
+        header('Content-Type: text/html; charset=utf-8');
+        $page->changeTpl('reminder/no_redirection.tpl', NO_SKIN);
+        $page->assign('baseurl', $this->GetBaseUrl());
+    }
+
+    public static function IsCandidate(User &$user)
+    {
+        return S::v('no_redirect');
+    }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
index 8c0914a..7381314 100644 (file)
@@ -45,18 +45,6 @@ Bienvenue {$smarty.session.prenom}{if $birthday}
 {$reminder|smarty:nodefaults}
 {/if}
 
-{if $smarty.session.no_redirect}
-<div class="errors">
-  <ul>
-    <li>
-      Tu n'as plus de redirection valide ce qui rend ton adresse Polytechnique.org
-      inutilisable. Rends-toi au plus vite sur <a href="emails/redirect">la page de 
-      gestion des emails</a> pour corriger ce problème.
-    </li>
-  </ul>
-</div>
-{/if}
-
 {if $fiche_incitation || $photo_incitation || ($geoloc_incitation > 0)}
 <div class="warnings">
   <ul>
@@ -88,7 +76,7 @@ Bienvenue {$smarty.session.prenom}{if $birthday}
 {/if}
 
 {include file="include/tips.tpl" full=true}
-  
+
   <table class="tinybicol" id="menu-evts">
     {foreach from=$events name=events key=category item=evenement}
     <tr class="pair" style="height: 18px">
@@ -166,7 +154,7 @@ Bienvenue {$smarty.session.prenom}{if $birthday}
   -->
   {/literal}
   </script>
+
   {foreach from=$events key=category item=evenement}
   {foreach item=ev from=$evenement}
   {if $ev.nonlu}
diff --git a/templates/reminder/no_redirection.tpl b/templates/reminder/no_redirection.tpl
new file mode 100644 (file)
index 0000000..b27e0fa
--- /dev/null
@@ -0,0 +1,34 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2009 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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<div class="warnings reminder">
+  <span style="float: right">
+    <a href="" onclick="Ajax.update_html('reminder', '{$baseurl}/dismiss')">
+      {icon name=cross title="Cacher cet avertissement."}
+    </a>
+  </span>
+  {icon name=error} Tu n'as plus de redirection valide ce qui rend ton adresse Polytechnique.org
+  inutilisable. Rends-toi au plus vite sur <a href="emails/redirect">la page de
+  gestion des emails</a> pour corriger ce problème.
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index a284b57..4534770 100644 (file)
@@ -13,6 +13,7 @@ CREATE TABLE IF NOT EXISTS reminder_type (
 
 INSERT INTO  reminder_type (name, weight, remind_delay_yes, remind_delay_no, remind_delay_dismiss)
      VALUES  ('email_warning', 100, 0, 0,   7),
+             ('no_redirection', 100, 0, 0,  1),
              ('profile_update', 90, 0, 0,   2),
              ('nl',             80, 0, 365, 7),
              ('promotion_ml',   70, 0, 365, 7),