Enable links to EP letter in the menu.
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Thu, 27 Jan 2011 23:47:01 +0000 (00:47 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sun, 30 Jan 2011 00:05:15 +0000 (01:05 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/xorg.php
modules/epletter.php [new file with mode: 0644]
templates/skin/common.menu.tpl

index 6c85f3c..593af76 100644 (file)
@@ -26,7 +26,7 @@ class Xorg extends Platal
         parent::__construct('auth', 'carnet', 'email', 'events', 'forums',
                             'lists', 'marketing', 'payment', 'platal',
                             'profile', 'register', 'search', 'stats', 'admin',
-                            'newsletter', 'axletter', 'bandeau', 'survey',
+                            'newsletter', 'axletter', 'epletter', 'bandeau', 'survey',
                             'fusionax', 'gadgets', 'googleapps', 'poison',
                             'openid', 'reminder');
     }
diff --git a/modules/epletter.php b/modules/epletter.php
new file mode 100644 (file)
index 0000000..9907260
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+/***************************************************************************
+ *  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                *
+ ***************************************************************************/
+
+Platal::load('newsletter');
+
+class EPLetterModule extends NewsletterModule
+{
+    function handlers()
+    {
+        return array(
+            'epletter'                   => $this->make_hook('nl',  AUTH_COOKIE),
+            'epletter/out'               => $this->make_hook('out',    AUTH_PUBLIC),
+            'epletter/show'              => $this->make_hook('nl_show',   AUTH_COOKIE),
+            'epletter/admin'             => $this->make_hook('admin_nl', AUTH_MDP),
+            'epletter/admin/edit'        => $this->make_hook('admin_nl_edit', AUTH_MDP),
+            'epletter/admin/edit/valid'  => $this->make_hook('admin_nl_valid', AUTH_MDP),
+            'epletter/admin/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_MDP),
+            'epletter/admin/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_MDP),
+        );
+    }
+
+    protected function getNl()
+    {
+        require_once 'newsletter.inc.php';
+        return NewsLetter::forGroup(NewsLetter::GROUP_EP);
+    }
+
+    function handler_out(&$page, $hash = null)
+    {
+        if (!$hash) {
+            if (!S::logged()) {
+                return PL_DO_AUTH;
+            }
+        }
+        return $this->handler_nl($page, 'out', $hash);
+    }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
index d9e53a4..d5eda4f 100644 (file)
@@ -91,6 +91,7 @@
 <div class="menu_item"><a href="Xorg/">Documentations</a></div>
 <div class="menu_item"><a href="nl">Lettres mensuelles</a></div>
 <div class="menu_item"><a href="ax">Lettres de l'AX</a></div>
+<div class="menu_item"><a href="epletter">Lettres de l'École</a></div>
 <div class="menu_item"><a href="Xorg/NousContacter">Nous contacter</a></div>
 <div class="menu_item"><a href="send_bug/{ $smarty.server.REQUEST_URI }" class="popup2">Signaler un bug</a></div>