2 /***************************************************************************
3 * Copyright (C) 2003-2014 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
22 Platal
::load('newsletter');
23 require_once 'comletter.inc.php';
26 * Newsletter for community
28 class ComLetterModule
extends NewsletterModule
33 'comletter' => $this->make_hook('nl', AUTH_COOKIE
, 'user'),
34 'comletter/submit' => $this->make_hook('coml_submit', AUTH_PASSWD
, 'user'),
35 'comletter/remaining' => $this->make_hook('coml_remaining', AUTH_PASSWD
, 'user'),
36 'comletter/out' => $this->make_hook('out', AUTH_PUBLIC
),
37 'comletter/show' => $this->make_hook('nl_show', AUTH_COOKIE
, 'user'),
38 'comletter/search' => $this->make_hook('nl_search', AUTH_COOKIE
, 'user'),
39 'comletter/admin' => $this->make_hook('admin_nl', AUTH_PASSWD
, 'user'),
40 'comletter/admin/edit' => $this->make_hook('admin_nl_edit', AUTH_PASSWD
, 'user'),
41 'comletter/admin/edit/valid' => $this->make_hook('admin_nl_valid', AUTH_PASSWD
, 'user'),
42 'comletter/admin/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_PASSWD
, 'user'),
43 'comletter/admin/edit/delete' => $this->make_hook('admin_nl_delete', AUTH_PASSWD
, 'user'),
44 'comletter/admin/categories' => $this->make_hook('admin_nl_cat', AUTH_PASSWD
, 'user'),
45 'comletter/stat' => $this->make_hook('stat_nl', AUTH_PASSWD
, 'user')
49 protected function getNl()
51 require_once 'newsletter.inc.php';
52 return NewsLetter
::forGroup(NewsLetter
::GROUP_COMMUNITY
);
55 function handler_coml_submit($page)
57 $page->changeTpl('comletter/submit.tpl');
64 $wp = new PlWikiPage('Xorg.LettreCommunaute');
67 if (Post
::has('see') ||
(Post
::has('valid') && (!trim(Post
::v('title')) ||
!trim(Post
::v('body'))))) {
68 if (!Post
::has('see')) {
69 $page->trigError("L'article doit avoir un titre et un contenu");
71 $art = new ComLArticle(Post
::v('title'), Post
::v('body'), Post
::v('append'));
72 $page->assign('art', $art);
73 } elseif (Post
::has('valid')) {
74 $art = new ComLReq(S
::user(), Post
::v('title'),
75 Post
::v('body'), Post
::v('append'));
77 $page->assign('submited', true
);
79 $page->addCssLink($nl->cssFile());
82 function handler_coml_remaining($page)
84 pl_content_headers('text/html');
85 $page->changeTpl('newsletter/remaining.tpl', NO_SKIN
);
87 $article = new ComLArticle('', Post
::t('body'), '');
88 $rest = $article->remain();
90 $page->assign('too_long', $rest['remaining_lines'] < 0);
91 $page->assign('last_line', ($rest['remaining_lines'] == 0));
92 $page->assign('remaining', ($rest['remaining_lines'] == 0) ?
$rest['remaining_characters_for_last_line'] : $rest['remaining_lines']);
95 function handler_out($page, $hash = null
, $issue_id = null
)
102 return $this->handler_nl($page, 'out', $hash, $issue_id);
106 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: