--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2013 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 ComLArticle
+
+class ComLArticle
+{
+ // {{{ properties
+
+ public $aid;
+ public $cid;
+ public $pos;
+ public $title;
+ public $body;
+ public $append;
+
+ // }}}
+ // {{{ constructor
+
+ function __construct($title='', $body='', $append='', $aid=-1, $cid=0, $pos=0)
+ {
+ $this->body = $body;
+ $this->title = $title;
+ $this->append = $append;
+ $this->aid = $aid;
+ $this->cid = $cid;
+ $this->pos = $pos;
+ }
+
+ // }}}
+ // {{{ function title()
+
+ public function title()
+ { return trim($this->title); }
+
+ // }}}
+ // {{{ function body()
+
+ public function body()
+ { return trim($this->body); }
+
+ // }}}
+ // {{{ function append()
+
+ public function append()
+ { return trim($this->append); }
+
+ // }}}
+ // {{{ function toText()
+
+ public function toText($hash = null, $login = null)
+ {
+ $title = '*'.$this->title().'*';
+ $body = MiniWiki::WikiToText($this->body, true);
+ $app = MiniWiki::WikiToText($this->append, false, 4);
+ $text = trim("$title\n\n$body\n\n$app")."\n";
+ if (!is_null($hash) && !is_null($login)) {
+ $text = str_replace('%HASH%', "$hash/$login", $text);
+ } else {
+ $text = str_replace('%HASH%', '', $text);
+ }
+ return $text;
+ }
+
+ // }}}
+ // {{{ function toHtml()
+
+ public function toHtml($hash = null, $login = null)
+ {
+ $title = "<h2 class='xorg_nl'><a id='art{$this->aid}'></a>".pl_entities($this->title()).'</h2>';
+ $body = MiniWiki::WikiToHTML($this->body);
+ $app = MiniWiki::WikiToHTML($this->append);
+
+ $art = "$title\n";
+ $art .= "<div class='art'>\n$body\n";
+ if ($app) {
+ $art .= "<div class='app'>$app</div>";
+ }
+ $art .= "</div>\n";
+ if (!is_null($hash) && !is_null($login)) {
+ $art = str_replace('%HASH%', "$hash/$login", $art);
+ } else {
+ $art = str_replace('%HASH%', '', $art);
+ }
+
+ return $art;
+ }
+
+ // }}}
+}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 enc=utf-8:
+?>
*/
public function maySubmit($user = null)
{
- // Submission of new articles is only enabled for the X.org NL (and forbidden when viewing issues on X.net)
- return ($this->group == self::GROUP_XORG && !isset($GLOBALS['IS_XNET_SITE']));
+ // Submission of new articles is only enabled for the X.org NL and the
+ // community letter (and forbidden when viewing issues on X.net)
+ return (
+ ($this->group == self::GROUP_XORG || $this->group == self::GROUP_COMMUNITY)
+ && !isset($GLOBALS['IS_XNET_SITE']));
}
// }}}
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2013 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");
+require_once("comletter.inc.php");
+require_once("nl.inc.php");
+
+class ComLReq extends NLReq
+{
+ // {{{ properties
+
+ public $rules = "Laisser valider par le NL-MASTER";
+
+ // }}}
+ // {{{ constructor
+
+ public function __construct(User $_user, $_title, $_body, $_append)
+ {
+ Validate::__construct($_user, false, 'community-letter');
+ $this->art = new ComLArticle($_title, $_body, $_append);
+ }
+
+ // }}}
+ // {{{ function _mail_subj
+
+ protected function _mail_subj()
+ {
+ return "[Polytechnique.org/LettreCommunauté] Proposition d'article dans la Lettre de la communauté";
+ }
+
+ // }}}
+ // {{{ function commit()
+
+ public function commit()
+ {
+ $nl = NewsLetter::forGroup(NewsLetter::GROUP_COMMUNITY)->getPendingIssue(true);
+ $nl->saveArticle($this->art);
+ return true;
+ }
+
+ // }}}
+}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
***************************************************************************/
Platal::load('newsletter');
+require_once 'comletter.inc.php';
/**
* Newsletter for community
{
return array(
'comletter' => $this->make_hook('nl', AUTH_COOKIE, 'user'),
+ 'comletter/submit' => $this->make_hook('coml_submit', AUTH_PASSWD, 'user'),
'comletter/out' => $this->make_hook('out', AUTH_PUBLIC),
'comletter/show' => $this->make_hook('nl_show', AUTH_COOKIE, 'user'),
'comletter/search' => $this->make_hook('nl_search', AUTH_COOKIE, 'user'),
return NewsLetter::forGroup(NewsLetter::GROUP_COMMUNITY);
}
+ function handler_coml_submit($page)
+ {
+ $page->changeTpl('comletter/submit.tpl');
+
+ $nl = $this->getNl();
+ if (!$nl) {
+ return PL_NOT_FOUND;
+ }
+
+ $wp = new PlWikiPage('Xorg.LettreCommunaute');
+ $wp->buildCache();
+
+ if (Post::has('see') || (Post::has('valid') && (!trim(Post::v('title')) || !trim(Post::v('body'))))) {
+ if (!Post::has('see')) {
+ $page->trigError("L'article doit avoir un titre et un contenu");
+ }
+ $art = new ComLArticle(Post::v('title'), Post::v('body'), Post::v('append'));
+ $page->assign('art', $art);
+ } elseif (Post::has('valid')) {
+ $art = new ComLReq(S::user(), Post::v('title'),
+ Post::v('body'), Post::v('append'));
+ $art->submit();
+ $page->assign('submited', true);
+ }
+ $page->addCssLink($nl->cssFile());
+ }
+
function handler_out($page, $hash = null, $issue_id = null)
{
if (!$hash) {
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2013 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 *}
+{* *}
+{**************************************************************************}
+
+<h1>Proposer un article pour la prochaine Lettre de la communauté</h1>
+
+{if t($submited)}
+
+<p>
+Ton article a bien été pris en compte.
+</p>
+
+<p>
+Nous te recontacterons éventuellement si nous avons des renseignements à te demander à son sujet !
+</p>
+
+{else}
+
+
+{if t($art)}
+<form action="comletter/submit" method='post'>
+ <table class='bicol'>
+ <tr><th>Version texte</th></tr>
+ <tr id='text'>
+ <td><pre>{$art->toText()}</pre></td>
+ </tr>
+ <tr><th>Version html</th></tr>
+ <tr id='html'>
+ <td>
+ <div class='nl'>
+ {$art->toHtml()|smarty:nodefaults}
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <th>Soumettre</th>
+ </tr>
+ <tr>
+ <td>
+ Si tu es content de ton article, tu peux le soumettre.
+ Sinon, tu peux continuer à l'éditer en dessous.
+ </td>
+ </tr>
+ <tr>
+ <td class='center'>
+ <input type='hidden' value="{$smarty.request.title}" name='title' />
+ <input type='hidden' value="{$art->body()}" name="body" />
+ <input type='hidden' value="{$art->append()}" name='append' />
+ <input type='submit' name='valid' value='Soumettre' />
+ </td>
+ </tr>
+ </table>
+</form>
+
+<br />
+
+{/if}
+
+<h2>Proposer un article</h2>
+
+<p>
+Tu peux <a href='comletter/submit#conseils'>lire les conseils de rédaction</a> avant de proposer ton article.
+</p>
+<form action="comletter/submit" method='post'>
+ <table class="bicol" cellpadding="3" cellspacing="0" summary="proposer un article">
+ <tr>
+ <th colspan='2'>Proposer un article</th>
+ </tr>
+ <tr class="impair">
+ <td class='titre'>Sujet</td>
+ <td>
+ <input size='60' maxlength='60' type='text' value='{$smarty.request.title}' name='title' />
+ </td>
+ </tr>
+ <tr class="pair">
+ <td class='titre'>Contenu</td>
+ <td>
+ <textarea cols="68" rows="8" name="body" >{if t($art)}{$art->body()}{/if}</textarea>
+ </td>
+ </tr>
+ <tr class="pair">
+ <td id="remaining" class="center" colspan="2"></td>
+ </tr>
+ <tr class="impair">
+ <td class='titre'>Ajouts (emails, contacts, tarifs, site web…)</td>
+ <td>
+ <textarea cols="68" rows="3" name='append'>{if t($art)}{$art->append()}{/if}</textarea>
+ </td>
+ </tr>
+ <tr class="pair smaller">
+ <td></td>
+ <td>
+ <a href="wiki_help/notitle" class="popup3">
+ {icon name=information title="Syntaxe wiki"} Voir les marqueurs de mise en forme autorisés
+ </a>
+ </td>
+ </tr>
+ <tr class='pair'>
+ <td colspan='2' class='center'>
+ <input type='submit' name='see' value='Visualiser' />
+ </td>
+ </tr>
+ </table>
+</form>
+
+<a id='conseils'></a>
+{include wiki=Xorg.LettreCommunaute}
+
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
--- /dev/null
+ALTER TABLE requests_answers MODIFY COLUMN category ENUM('alias','liste','usage','photo','evts','gapps-unsuspend','marketing','orange','homonyme','nl','paiements','medal','broken','surveys', 'entreprise','account','address','bulkaccounts', 'community-letter') NOT NULL DEFAULT 'alias';
+
+-- vim:set syntax=mysql: