<?php
/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
+ * Copyright (C) 2003-2007 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
'admin/newsletter' => $this->make_hook('admin_nl', AUTH_MDP, 'admin'),
'admin/newsletter/categories' => $this->make_hook('admin_nl_cat', AUTH_MDP, 'admin'),
'admin/newsletter/edit' => $this->make_hook('admin_nl_edit', AUTH_MDP, 'admin'),
-
- 'ax' => $this->make_hook('ax', AUTH_COOKIE),
- 'ax/show' => $this->make_hook('ax_show', AUTH_COOKIE),
- 'ax/submit' => $this->make_hook('ax_submit', AUTH_MDP),
- 'ax/edit' => $this->make_hook('ax_submit', AUTH_MDP),
- 'admin/axletter/rights' => $this->make_hook('admin_ax_rights', AUTH_MDP, 'admin'),
);
}
$page->changeTpl('newsletter/submit.tpl');
require_once 'newsletter.inc.php';
+ require_once 'wiki.inc.php';
+ wiki_require_page('Xorg.LettreMensuelle');
- if (Post::has('see')) {
+ if (Post::has('see') || (Post::has('valid') && (!trim(Post::v('title')) || !trim(Post::v('body'))))) {
+ if (!Post::has('see')) {
+ $page->trig("L'article doit avoir un titre et un contenu");
+ }
$art = new NLArticle(Post::v('title'), Post::v('body'), Post::v('append'));
$page->assign('art', $art);
} elseif (Post::has('valid')) {
$art->submit();
$page->assign('submited', true);
}
+ $page->addCssLink('nl.css');
}
function handler_admin_nl(&$page, $new = false) {
$page->changeTpl('newsletter/admin.tpl');
$page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : liste');
require_once("newsletter.inc.php");
-
+
if($new) {
Newsletter::create();
pl_redirect("admin/newsletter");
}
-
+
$page->assign('nl_list', Newsletter::listAll());
}
-
+
function handler_admin_nl_edit(&$page, $nid = 'last', $aid = null, $action = 'edit') {
$page->changeTpl('newsletter/edit.tpl');
- $page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : Edition');
+ $page->addCssLink('nl.css');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : Edition');
require_once("newsletter.inc.php");
-
+
$nl = new NewsLetter($nid);
-
+
if($action == 'delete') {
$nl->delArticle($aid);
pl_redirect("admin/newsletter/edit/$nid");
}
-
+
if($aid == 'update') {
$nl->_title = Post::v('title');
$nl->_title_mail= Post::v('title_mail');
pl_redirect('admin/newsletter/edit/' . $nl->_id);
}
}
-
+
if(Post::v('save')) {
$art = new NLArticle(Post::v('title'), Post::v('body'), Post::v('append'),
$aid, Post::v('cid'), Post::v('pos'));
$nl->saveArticle($art);
pl_redirect("admin/newsletter/edit/$nid");
}
-
+
if($action == 'edit' && $aid != 'update') {
$eaid = $aid;
if(Post::has('title')) {
}
$page->assign('art', $art);
}
-
+
$page->assign_by_ref('nl',$nl);
}
function handler_admin_nl_cat(&$page, $action = 'list', $id = null) {
- $page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : Catégories');
- $page->assign('title', 'Gestion des catégories de la newsletter');
+ $page->assign('xorg_title','Polytechnique.org - Administration - Newsletter : Catégories');
+ $page->assign('title', 'Gestion des catégories de la newsletter');
$table_editor = new PLTableEditor('admin/newsletter/categories','newsletter_cat','cid');
- $table_editor->describe('titre','intitulé',true);
+ $table_editor->describe('titre','intitulé',true);
$table_editor->describe('pos','position',true);
$table_editor->apply($page, $action, $id);
}
-
- function handler_ax(&$page, $action = null)
- {
- require_once 'newsletter.inc.php';
-
- $page->changeTpl('newsletter/ax.tpl');
- $page->assign('xorg_title','Polytechnique.org - Envois de l\'AX');
-
- switch ($action) {
- case 'out': AXLetter::unsubscribe(); break;
- case 'in': AXLetter::subscribe(); break;
- default: ;
- }
-
- $perm = AXLetter::hasPerms();
- if ($perm) {
- $waiting = AXLetter::awaiting();
- if ($waiting) {
- $new = new AXLetter($waiting);
- $page->assign('new', $new);
- }
- }
- $page->assign('axs', AXLetter::subscriptionState());
- $page->assign('ax_list', AXLetter::listSent());
- $page->assign('ax_rights', AXLetter::hasPerms());
- }
-
- function handler_ax_submit(&$page)
- {
- require_once('newsletter.inc.php');
- if (!AXLetter::hasPerms()) {
- return PL_FORBIDDEN;
- }
- }
}
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
?>