'Sites Polytechniciens' => 'http://www.polytechnique.net/'
),
'Informations' => Array (
- 'Lettres mensuelles' => 'newsletter.php',
+ 'Lettres mensuelles' => 'newsletter/',
'Documentations' => 'docs/',
'Nous contacter ' => "docs/contacts.php",
'Emploi' => 'http://www.manageurs.com/'
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: newsletter.php,v 1.7 2004-09-04 21:58:22 x2000habouzit Exp $
+ $Id: index.php,v 1.1 2004-10-15 12:57:10 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
-new_skinned_page('newsletter.tpl', AUTH_COOKIE);
-
-if (isset($_REQUEST['last']))
- $res=$globals->db->query("SELECT UNIX_TIMESTAMP(date),titre,text FROM newsletter ORDER BY id DESC LIMIT 1");
-elseif (isset($_REQUEST['nl_id']))
- $res=$globals->db->query("SELECT UNIX_TIMESTAMP(date),titre,text FROM newsletter WHERE id='{$_REQUEST['nl_id']}'");
-else
- $res="";
-
-if (($res)&&(list($nl_date, $nl_titre, $nl_text) = mysql_fetch_row($res))) {
- $page->assign('nl_date', $nl_date);
- $page->assign('nl_titre', $nl_titre);
- $page->assign('nl_text', $nl_text);
-
- if (isset($_REQUEST['send_mail'])) {
- require('diogenes.mailer.inc.php');
- $mymail = new DiogenesMailer("info_newsletter@polytechnique.org",
- $_SESSION['forlife']."@polytechnique.org",
- "[polytechnique.org] ".$nl_titre);
- $mymail->addHeader("From: \"Equipe polytechnique.org\" <info_newsletter@polytechnique.org>");
- $mymail->setBody("Suite à ta demande sur le site web, nous te réexpédions cette lettre d'informations archivée.\r\n\r\n".strip_tags($nl_text));
- $mymail->send();
- $page->assign('erreur', 'Mail envoyé.');
- }
-}
-
-$sql = "SELECT id,date,titre FROM newsletter ORDER BY date DESC";
-$page->mysql_assign($sql, 'nl_list');
+new_skinned_page('newsletter/index.tpl', AUTH_COOKIE);
+require("newsletter.inc.php");
+$page->assign_by_ref('nl_list',get_nl_list());
$page->run();
?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************
- $Id: newsletter_req.php,v 1.4 2004-09-03 00:08:48 x2000habouzit Exp $
- ***************************************************************************/
-
-require("auto.prepend.inc.php");
-new_skinned_page('newsletter_req.tpl', AUTH_MDP);
-
-if (isset($_POST["action"]) && (($_POST["action"]=="Tester")
- or ($_POST["action"]=="valider"))){
- $article=(isset($_POST["article"])?
- stripslashes(strip_tags($_POST["article"])):"");
- $titre=(isset($_POST["titre"])?
- stripslashes(strip_tags($_POST["titre"])):"");
- $bonus=(isset($_POST["bonus"])?
- stripslashes(strip_tags($_POST["bonus"])):"");
-
- $page->assign('article', $article);
- $page->assign('titre', $titre);
- $page->assign('bonus', $bonus);
-
- if (empty($_POST["titre"])) {
- $page->assign('erreur', '<p class="erreur">Tu n\'as pas mentionné de titre !!</p>');
- } elseif (empty($_POST["article"])) {
- $page->assign('erreur', '<p class="erreur"> ton annonce est vide !!</p>');
- } else {
- $exec="echo ".escapeshellarg($article)." | perl "
- ."-MText::Autoformat -e 'autoformat "
- ."{left=>1, right=>68, all=>1, justify=>full };'";
- exec($exec,$result);
- $page->assign('preview', join("\n",$result));
-
- $page->assign('nb_lines', count($result));
-
- if ((count($result)<9) and ($_POST["action"]=="valider")) {
- require_once("diogenes.mailer.inc.php");
- $mailer = new DiogenesMailer($_SESSION['forlife']."@polytechnique.org",
- "info+nl@polytechnique.org",
- "Proposition d'article pour la newsletter",
- false);
- $mailer->setbody(
- wordwrap($titre,72)."\n\n".
- join("\n",$result)."\n\n".
- wordwrap($bonus,72));
- $mailer->send();
- $page->assign('sent', 1);
- }
- }
-}
-
-$page->run();
-?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: newsletter.inc.php,v 1.1 2004-10-14 22:16:01 x2000habouzit Exp $
+ $Id: newsletter.inc.php,v 1.2 2004-10-15 12:57:10 x2000habouzit Exp $
***************************************************************************/
class NewsLetter {
function NewsLetter() { }
}
+function get_nl_list() {
+ global $globals;
+ $res = $globals->db->query("SELECT id,date,titre FROM newsletter ORDER BY date DESC");
+ $ans = Array();
+ while($tmp = mysql_fetch_assoc($res)) $ans[] = $tmp;
+ mysql_free_result($res);
+ return $ans;
+}
+
function get_nl_state() {
global $globals;
$res = $globals->db->query("SELECT COUNT(*)>0 FROM newsletter_ins WHERE user_id={$_SESSION['uid']}");
--- /dev/null
+alter table newsletter change id id int not null;
+alter table newsletter change `date` `date` date not null;
+alter table newsletter add column bits enum('old','sent','new') default 'new' not null;
+
+alter table newsletter_ins add column last int;
+alter table newsletter_ins add index (last);
+++ /dev/null
-{***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************
- $Id: newsletter.tpl,v 1.8 2004-09-04 21:58:22 x2000habouzit Exp $
- ***************************************************************************}
-
-
-{dynamic}
-
-<p class="erreur">{$erreur}</p>
-
-{if $nl_titre}
-
-<p class="center">
-[<a href="{$smarty.server.REQUEST_URI}&send_mail=1">me l'envoyer par mail</a>]
-</p>
-<table class="bicol" summary="Archives de la NL">
- <tr>
- <th>
- {$nl_titre} - {$nl_date|date_format:"%d/%m/%Y"}
- </th>
- </tr>
- <tr>
- <td style="padding: 1em;">
- <tt style="white-space:pre;">{$nl_text|smarty:nodefaults|replace:"<u>":"<span style='text-decoration:underline;'>"|replace:"</u>":"</span>"|nl2br}</tt>
- </td>
- </tr>
-</table>
-<p class="center">
-[<a href="{$smarty.server.PHP_SELF}">retour à la liste</a>]
-</p>
-
-{else}
-
-<div class="rubrique">
- Lettre de Polytechnique.org
-</div>
-<p>
-Tu trouveras ici les archives de la lettre d'information de Polytechnique.org. Pour t'abonner à
-cette lettre, il te suffit de te <a href="listes/">rendre sur la page des listes</a> et de cocher la
-case "newsletter". Enfin, <strong>pour demander l'ajout d'une annonce dans la prochaine lettre
- mensuelle</strong>, <a href="mailto:info_newsletter@polytechnique.org">écris-nous !</a>
-</p>
-
-{include file=include/newsletter.list.tpl nl_list=$nl_list}
-
-{/if}
-
-{/dynamic}
-{* vim:set et sw=2 sts=2 sws=2: *}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: newsletter.list.tpl,v 1.5 2004-08-31 11:25:40 x2000habouzit Exp $
+ $Id: index.tpl,v 1.1 2004-10-15 12:57:11 x2000habouzit Exp $
***************************************************************************}
+<div class="rubrique">
+ Lettre de Polytechnique.org
+</div>
+<p>
+Tu trouveras ici les archives de la lettre d'information de Polytechnique.org. Pour t'abonner à
+cette lettre, il te suffit de te <a href="{"listes/"|url}">rendre sur la page des listes</a>.
+</p>
+<p>
+<strong>Pour demander l'ajout d'une annonce dans la prochaine lettre mensuelle</strong>,
+<a href="mailto:info_newsletter@polytechnique.org">écris-nous !</a>
+</p>
+
+{dynamic}
<table class="bicol" cellpadding="3" cellspacing="0" summary="liste des NL">
<tr>
<th>date</th>
<th>titre</th>
- <th> </th>
</tr>
{foreach item=nl from=$nl_list}
<tr class="{cycle values="impair,pair"}">
<td>{$nl.date|date_format:"%Y-%m-%d"}</td>
<td>
- <a href="{"newsletter.php"|url}?nl_id={$nl.id}">{$nl.titre}</a>
- </td>
- {if $admin}
- <td>
- <form method="post" action="{$smarty.server.PHP_SELF}">
- <div>
- <input type="hidden" name="nl_id" value="{$nl.id}" />
- <input type="hidden" name="action" value="edit" />
- <input type="submit" value="edit" />
- <input type="submit" value="del" />
- </div>
- </form>
+ <a href="{"newsletter/show.php"|url}?nid={$nl.id}">{$nl.titre}</a>
</td>
- {else}
- <td>
-
- </td>
- {/if}
</tr>
{/foreach}
</table>
+{/dynamic}
+
{* vim:set et sw=2 sts=2 sws=2: *}
+++ /dev/null
-{***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************
- $Id: newsletter_req.tpl,v 1.7 2004-08-31 11:25:39 x2000habouzit Exp $
- ***************************************************************************}
-
-
-<div class="rubrique">
- Proposer un article pour la newsletter
-</div>
-
-<p>
- La newsletter mensuelle est un excellent moyen de faire passer une
- information. Nous devons cependant nous astreindre à certaines règles
- dans la rédaction pour en conserver la qualité et l'efficacité.
-</p>
-<ul>
- <li>
- Longueur maximale du texte justifié (hors téléphone, adresses, liens
- internet) : <strong>8 lignes de 68 caractères</strong>
- </li>
- <li>
- Les liens internet (URL, mail) et adresses, téléphones, apparaîtront
- en-dessous pour plus de clarté
- </li>
- <li>
- L'équipe de rédaction se réserve le droit de modifier la mise en
- forme des articles
- </li>
-</ul>
-
-{dynamic}
-{if $smarty.request.action}
- {if $erreur}
- {$erreur}
- {/if}
-
- {if $preview}
- <p>
- Le texte de ton annonce aura sensiblement l'allure suivante :
- </p>
- <div styleclass="center">
- <table class="bicol">
- <tr>
- <td "padding: 1em;">
- <tt>
- <------------------------------------------------------------------><br />
- <br />
- {$preview|replace:" ":" "|nl2br}
- <br />
- <br />
- <------------------------------------------------------------------>
- </tt>
- </td>
- </tr>
- </table>
-
- {if $sent}
- <p class="erreur">
- Ton annonce a été envoyée à l'équipe de rédaction. Merci de ta contribution !
- </p>
- <p>
- Félicitations, ton article respecte les règles de pagination de la
- newsletter !!! Il pourra cependant être revu en fonction des
- nécéssités de la newsletter.
- </p>
- <p>
- Tu peux le soumettre à l'équipe de validation en validant ta demande.
- Tu seras recontacté par mail par un rédacteur pour te confirmer la
- bonne récéption de ta demande.
- </p>
- <form action="{$smarty.server.PHP_SELF}" method="post">
- <input type="hidden" name="titre" value="{$titre}" />
- <input type="hidden" name="article" value="{$article}" />
- <input type="hidden" name="bonus" value="{$bonus}" />
- <input type="submit" name="action" value="valider" />
- </form>
- <p>
- Si tu n'es pas satisfait de ton annonce, tu peux la retravailler :
- </p>
- {elseif $nb_lines > 9}
- <p class="erreur">
- Ton annonce est trop longue, il faut que tu la modifie pour qu'elle fasse moins de huit lignes
- </p>
- {/if}
- {/if}
-
-{/if}
-
-{if !$sent}
-<form action="{$smarty.server.PHP_SELF}" method="post">
- <table class="bicol" cellpadding="3" cellspacing="0" summary="Proposition d'article newsletter">
- <thead>
- <tr>
- <th>
- Proposition d'article
- </th>
- </tr>
- </thead>
- <tbody>
- <tr class="pair">
- <td class="titre">
- Titre
- </td>
- </tr>
- <tr class="pair">
- <td>
- <input type="text" value="{$titre}" name="titre" size="68" />
- </td>
- </tr>
- <tr class="impair">
- <td class="titre">
- Article :
- </td>
- </tr>
- <tr class="impair">
- <td>
- <textarea cols="70" rows="10" name="article">{$article}</textarea>
- </td>
- </tr>
- <tr class="pair">
- <td class="titre">
- Adresses, url, mail, contact, téléphone, etc. :
- </td>
- </tr>
- <tr class="pair">
- <td>
- <textarea cols="70" rows="10" name="bonus">{$bonus}</textarea>
- </td>
- </tr>
- <tr class="impair">
- <td class="center">
- <input type="submit" name="action" value="Tester" />
- </td>
- </tr>
- </tbody>
- </table>
-</form>
-{/if}
-
-{/dynamic}
-{* vim:set et sw=2 sts=2 sws=2: *}