Enable FX letter.
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 14 Nov 2011 20:58:58 +0000 (21:58 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 14 Nov 2011 21:25:25 +0000 (22:25 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/xorg.php
configs/mails.conf
htdocs/css/nl.FX.css [new file with mode: 0644]
include/newsletter.inc.php
modules/fxletter.php [new file with mode: 0644]
templates/newsletter/nl.FX.mail.tpl [new file with mode: 0644]
templates/skin/common.menu.tpl

index c53f31a..17a350a 100644 (file)
@@ -37,6 +37,7 @@ class Xorg extends Platal
             'events',
             'forums',
             'fusionax',
+            'fxletter',
             'gadgets',
             'geoloc',
             'googleapps',
index fc294d4..29d632e 100644 (file)
@@ -44,6 +44,10 @@ to=non-geoloc@staff.polytechnique.org
 from="Amicale des Anciens de l'X" <reponses@amicale.polytechnique.org>
 replyto=reponses@amicale.polytechnique.org
 
+[mails_fx]
+from="Fondation de l'Ecole polytechnique" <reponses@fondationx.fr>
+replyto=reponses@fondationx.fr
+
 [marketing]
 from="Marketing Polytechnique.org" <register@polytechnique.org>
 
diff --git a/htdocs/css/nl.FX.css b/htdocs/css/nl.FX.css
new file mode 100644 (file)
index 0000000..dcbab87
--- /dev/null
@@ -0,0 +1,83 @@
+/***************************************************************************
+ *  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                *
+ ***************************************************************************/
+
+
+div.fx_mail {
+    margin : auto;
+    width : 72ex;
+    font-family : "Georgia", "Times New Roman", serif;
+    font-size : 10pt;
+    text-align : justify;
+    background-color : #fff;
+    color : #000;
+}
+
+/* Links */
+div.fx_mail a[href] {
+    background-color: transparent;
+    color : #444;
+    text-decoration : none;
+    background-image: none;
+}
+
+div.fx_mail a[href]:hover {
+    background-color: transparent;
+    color : #D44;
+    text-decoration : none;
+    background-image: none;
+}
+
+/* Title */
+div.fx_mail .title {
+    background-color: #FA2;
+    margin : 0 0 3ex;
+    padding : 4.5ex 1ex 1ex 15ex;
+    font-size : 130%;
+    font-weight : bold;
+    text-align : left;
+}
+
+/* Intro */
+div.fx_mail div.intro {
+    margin : 4ex 2ex 2ex 2ex;
+}
+
+div.fx_mail div.signature {
+    margin : 3ex 2ex 0 0;
+    font-size : 90%;
+    font-style: italic;
+    text-align : right;
+}
+
+/* Give */
+div.fx_mail div.give {
+    font-weight: bold;
+    text-align: center;
+    padding: 0.5ex 0 0.5ex 0;
+    border-top: solid 2ex #FA2;
+}
+
+/* Footer */
+div.fx_mail div.foot1, div.fx_mail div.foot2 {
+    background-color: #FA2;
+    text-align: center;
+    font-size: 90%;
+    padding: 0.5ex 0;
+}
index 5dbe438..a51aeae 100644 (file)
@@ -46,6 +46,7 @@ class NewsLetter
     const GROUP_XORG = 'Polytechnique.org';
     const GROUP_AX = 'AX';
     const GROUP_EP = 'Ecole';
+    const GROUP_FX = 'FX';
 
     // Searches on mutiple fields
     const SEARCH_ALL = 'all';
@@ -551,6 +552,8 @@ class NewsLetter
             return 'ax';
         case self::GROUP_EP:
             return 'epletter';
+        case self::GROUP_FX:
+            return 'fxletter';
         default:
             // Don't display groups NLs on X.org
             assert(!$enforce_xnet);
@@ -575,6 +578,8 @@ class NewsLetter
             return 'ax/admin';
         case self::GROUP_EP:
             return 'epletter/admin';
+        case self::GROUP_FX:
+            return 'fxletter/admin';
         default:
             // Don't display groups NLs on X.org
             assert(!$enforce_xnet);
@@ -599,6 +604,8 @@ class NewsLetter
             return 'ax/stat';
         case self::GROUP_EP:
             return 'epletter/stat';
+        case self::GROUP_FX:
+            return 'fxletter/stat';
         default:
             // Don't display groups NLs on X.org
             assert(!$enforce_xnet);
@@ -642,6 +649,7 @@ class NewsLetter
           case self::GROUP_XORG:
           case self::GROUP_AX:
           case self::GROUP_EP:
+          case self::GROUP_FX:
             return false;
           default:
             return true;
diff --git a/modules/fxletter.php b/modules/fxletter.php
new file mode 100644 (file)
index 0000000..defcd0a
--- /dev/null
@@ -0,0 +1,61 @@
+<?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 FXLetterModule extends NewsletterModule
+{
+    function handlers()
+    {
+        return array(
+            'fxletter'                   => $this->make_hook('nl',              AUTH_COOKIE, 'user'),
+            'fxletter/out'               => $this->make_hook('out',             AUTH_PUBLIC),
+            'fxletter/show'              => $this->make_hook('nl_show',         AUTH_COOKIE, 'user'),
+            'fxletter/search'            => $this->make_hook('nl_search',       AUTH_COOKIE, 'user'),
+            'fxletter/admin'             => $this->make_hook('admin_nl',        AUTH_PASSWD, 'user'),
+            'fxletter/admin/edit'        => $this->make_hook('admin_nl_edit',   AUTH_PASSWD, 'user'),
+            'fxletter/admin/edit/valid'  => $this->make_hook('admin_nl_valid',  AUTH_PASSWD, 'user'),
+            'fxletter/admin/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_PASSWD, 'user'),
+            'fxletter/admin/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_PASSWD, 'user'),
+            'fxletter/admin/categories'  => $this->make_hook('admin_nl_cat',    AUTH_PASSWD, 'user'),
+            'fxletter/stat'              => $this->make_hook('stat_nl',         AUTH_PASSWD, 'user')
+        );
+    }
+
+    protected function getNl()
+    {
+        require_once 'newsletter.inc.php';
+        return NewsLetter::forGroup(NewsLetter::GROUP_FX);
+    }
+
+    function handler_out($page, $hash = null, $issue_id = null)
+    {
+        if (!$hash) {
+            if (!S::logged()) {
+                return PL_DO_AUTH;
+            }
+        }
+        return $this->handler_nl($page, 'out', $hash, $issue_id);
+    }
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
diff --git a/templates/newsletter/nl.FX.mail.tpl b/templates/newsletter/nl.FX.mail.tpl
new file mode 100644 (file)
index 0000000..8332667
--- /dev/null
@@ -0,0 +1,99 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="mails_fx"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{subject text=$issue->title(true)}
+{if isset(#replyto#)}{add_header name='Reply-To' value=#replyto#}{/if}
+{if isset(#retpath#)}{add_header name='Return-Path' value=#retpath#}{/if}
+{elseif $mail_part eq 'text'}
+{if !$is_mail}
+<pre style="width : 72ex; margin: auto">
+{/if}
+====================================================================
+{$issue->title()}
+====================================================================
+
+{$issue->head($user, 'text')}
+
+{$issue->signature('text')}
+
+--------------------------------------------------------------------
+{if $is_mail}
+Pour faire un don : <http://fondationx.fr/fond/paiement.php>
+{else}
+Pour faire un don : &lt;http://fondationx.fr/fond/paiement.php&gt;
+{/if}
+Cette lettre est envoyée par la FX grâce aux outils de Polytechnique.org.
+
+{if $is_mail}
+archives         : <https://www.polytechnique.org/fxletter>
+ne plus recevoir : <https://www.polytechnique.org/fxletter/out/{if $hash}{$hash}{else}nohash{/if}/{$issue->id}>
+{else}
+archives         : &lt;https://www.polytechnique.org/fxletter&gt;
+ne plus recevoir : &lt;https://www.polytechnique.org/fxletter/out/{if $hash}{$hash}{else}nohash{/if}/{$issue->id}&gt;
+{/if}
+
+{if !$is_mail}
+</pre>
+{/if}
+{elseif $mail_part eq 'html'}
+{if $is_mail}
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <title>Lettre d'information de la Fondation de l'École polytechnique</title>
+    <style type="text/css">
+      {literal}
+      body      { background-color: #ddd; color: #000; }
+      {/literal}
+    <!--
+      {$issue->css()}
+    -->
+    </style>
+  </head>
+  <body>
+    <div class="fx_background">
+{/if}
+    <div class='fx_mail'>
+      <div class="title">{$issue->title()}</div>
+      <div class="intro">{$issue->head($user, 'html')|smarty:nodefaults}</div>
+      <div class="signature">{$issue->signature('html')|smarty:nodefaults}</div>
+      <div class="give"><a href="http://fondationx.fr/fond/paiement.php">Faire un don</a></div>
+      <div class="foot1">
+        Cette lettre est envoyée par la FX grâce aux outils de Polytechnique.org.
+      </div>
+      <div class="foot2">
+        [<a href="https://www.polytechnique.org/fxletter">archives</a>&nbsp;|
+        <a href="https://www.polytechnique.org/fxletter/out/{if $hash}{$hash}{else}nohash{/if}/{$issue->id}">ne plus recevoir</a>]
+      </div>
+    </div>
+{if $is_mail}
+    </div>
+  </body>
+</html>
+{/if}
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index a50c9f4..3ef2d78 100644 (file)
 <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="fxletter">Lettres de la FX</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>