git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-380
* Validations :
- #137: Now possible to add comments without any action. -MC
- #191, #256: Marketing now uses the validation process. -MC
+ - #267: Newsletter uses the validation process too. -MC
================================================================================
VERSION 0.9.3 27 Dec 2004
require_once("xorg.inc.php");
new_admin_page('admin/newsletter_edit.tpl');
-$page->addCssLink('css/nl.css');
require_once("newsletter.inc.php");
$nid = Get::get('nid', 'last');
***************************************************************************/
require_once("xorg.inc.php");
-require_once("validations.inc.php");
new_admin_page('admin/valider.tpl');
+require_once("validations.inc.php");
if(Env::has('uid') && Env::has('type') && Env::has('stamp')) {
$req = Validate::get_request(Env::get('uid'), Env::get('type'), Env::get('stamp'));
require_once("xorg.inc.php");
new_skinned_page('newsletter/show.tpl', AUTH_COOKIE);
-$page->addCssLink('css/nl.css');
require_once("newsletter.inc.php");
$nid = Get::get('nid', 'last');
require_once("xorg.inc.php");
new_skinned_page('newsletter/submit.tpl', AUTH_COOKIE);
-$page->addCssLink('css/nl.css');
require_once("newsletter.inc.php");
if (Post::has('see')) {
$art = new NLArticle(Post::get('title'), Post::get('body'), Post::get('append'));
$page->assign('art', $art);
} elseif (Post::has('valid')) {
- $nl = new Newsletter();
- $art = new NLArticle(Post::get('title'), Post::get('body'), Post::get('append'));
- $nl->saveArticle($art);
-
- require_once("diogenes/diogenes.hermes.inc.php");
- $from = sprintf('"%s %s (%s)" <%s@%s>', Session::get('prenom'), Session::get('nom'),
- Session::get('promo'), Session::get('bestalias'), $globals->mail->domain);
- $mailer = new HermesMailer();
- $mailer->setSubject("proposition d'article dans la NL");
- $mailer->addTo('"Equipe Newsletter Polytechnique.org" <info+nlp@polytechnique.org>');
- $mailer->setFrom($from);
- $mailer->addCc($from);
- $text = "l'article suivant a été proposé par:\n\n $from\n\n\n".$art->toText();
- $mailer->setTxtBody($text);
- $mailer->send();
+ require_once('validations.inc.php');
+ $art = new NLReq(Session::getInt('uid'), Post::get('title'), Post::get('body'), Post::get('append'));
+ $art->submit();
$page->assign('submited', true);
}
require_once("xorg.misc.inc.php");
require_once("diogenes/diogenes.misc.inc.php");
+if (isset($page)) {
+ $page->addCssLink('css/nl.css');
+}
+
define('FEMME', 1);
define('HOMME', 0);
$a->_title, $a->_body, $a->_append);
$this->_arts['a'.$a->_aid] = $a;
} else {
- $globals->xdb->executey(
+ $globals->xdb->execute(
'INSERT INTO newsletter_art
SELECT {?},MAX(aid)+1,{?},'.($a->_pos ? intval($a->_pos) : 'MAX(pos)+1').',{?},{?},{?}
FROM newsletter_art AS a
function EvtReq($_titre, $_texte, $_pmin, $_pmax, $_peremption, $_comment, $_uid) {
global $globals;
- $this->Validate($_uid, false, 'evts', $_stamp);
+ $this->Validate($_uid, false, 'evts');
$this->titre = $_titre;
$this->texte = $_texte;
$this->pmin = $_pmin;
--- /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 *
+ ***************************************************************************/
+
+// {{{ class NLReq
+
+require_once("newsletter.inc.php");
+
+class NLReq extends Validate
+{
+ // {{{ properties
+
+ var $art;
+
+ // }}}
+ // {{{ constructor
+
+ function NlReq($uid, $title, $body, $append) {
+ $this->Validate($uid, false, 'nl');
+ $this->art = new NLArticle($title, $body, $append);
+ }
+
+ // }}}
+ // {{{ function formu()
+
+ function formu()
+ {
+ return 'include/form.valid.nl.tpl';
+ }
+
+ // }}}
+ // {{{ function _mail_subj
+
+ function _mail_subj()
+ {
+ return "[Polytechnique.org/NL] Proposition d'article dans la NL";
+ }
+
+ // }}}
+ // {{{ function _mail_body
+
+ function _mail_body($isok)
+ {
+ if ($isok) {
+ return " L'annonce que tu avais proposée ({$this->title}) vient d'être validée.";
+ } else {
+ return " L'annonce que tu avais proposée ({$this->title}) a été refusée.";
+ }
+ }
+
+ // }}}
+ // {{{ function commit()
+
+ function commit()
+ {
+ $nl = new Newsletter();
+ $nl->saveArticle($this->art);
+ return true;
+ }
+
+ // }}}
+}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
--- /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 *
+ ***************************************************************************}
+
+<tr class="pair">
+ <td class="titre">Version texte</td>
+ <td style='border: 1px dotted #888'><pre>{$valid->art->toText()}</pre></td>
+</tr>
+<tr class="pair">
+ <td class="titre">Version html</td>
+ <td style='border: 1px dotted #888'>
+ <div class='nl'>
+ {$valid->art->toHtml()|smarty:nodefaults}
+ </div>
+ </td>
+</tr>
+
+{* vim:set et sw=2 sts=2 sws=2: *}