Fixes the gapps reminder.
authorStéphane Jacob <sj@m4x.org>
Thu, 16 Jul 2009 23:15:29 +0000 (01:15 +0200)
committerStéphane Jacob <sj@m4x.org>
Fri, 17 Jul 2009 13:22:06 +0000 (15:22 +0200)
include/reminder/gapps.inc.php
templates/reminder/gapps.tpl [new file with mode: 0644]

index de0c0e9..a420070 100644 (file)
@@ -25,7 +25,7 @@ class ReminderGapps extends Reminder
     {
         switch ($action) {
           case 'yes':
-            $this->UpdateOnYes();
+            $this->UpdateOnDismiss();
             pl_redirect('googleapps');
             break;
 
@@ -39,12 +39,9 @@ class ReminderGapps extends Reminder
         }
     }
 
-    public function text()
+    public function template()
     {
-        return "Polytechnique.org te fournit un compte Google Apps qui te permet
-            de disposer des applications web de Google (GMail, Google Calendar,
-            Google Docs, et bien d'autres) sur ton adresse Polytechnique.org
-            habituelle (en savoir plus).";
+        return 'reminder/gapps.tpl';
     }
     public function title()
     {
@@ -59,6 +56,9 @@ class ReminderGapps extends Reminder
     {
         require_once 'googleapps.inc.php';
         $isSubscribed = GoogleAppsAccount::account_status($user->id());
+        if ($isSubscribed == 'disabled') {
+            $isSubscribed = false;
+        }
         if ($isSubscribed) {
             Reminder::MarkCandidateAsAccepted($user->id(), $candidate);
         }
diff --git a/templates/reminder/gapps.tpl b/templates/reminder/gapps.tpl
new file mode 100644 (file)
index 0000000..1320861
--- /dev/null
@@ -0,0 +1,42 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  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 style="margin-bottom: 0.5em">
+  Polytechnique.org te fournit un compte Google Apps qui te permet
+  de disposer des applications web de Google (GMail, Google Calendar,
+  Google Docs, et bien d'autres) sur ton adresse Polytechnique.org
+  habituelle (en savoir plus).
+</div>
+<div class="center">
+  <a href="{$reminder->baseurl()}/yes" style="text-decoration: none">
+    {icon name=add} M'inscrire
+  </a> -
+  <a href="" onclick="Ajax.update_html('reminder', '{$reminder->baseurl()}/no'); return false" style="text-decoration: none">
+    {icon name=delete} Ne pas m'inscrire
+  </a> -
+  <a href="" onclick="Ajax.update_html('reminder', '{$reminder->baseurl()}/dismiss'); return false" style="text-decoration: none">
+    {icon name=cross} Décider plus tard
+  </a> -
+  <a class="popup2" style="text-decoration: none" href="Xorg/GoogleApps">{icon name=information} En savoir plus</a>
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}