$sub['créer une liste'] = "$dim/lists/create";
$sub['créer un alias'] = "$dim/alias/create";
}
+ if (!$globals->asso('has_nl')) {
+ $sub['créer la newsletter'] = "$dim/admin/nl/enable";
+ }
if (S::admin()) {
$sub['gérer les groupes'] = array('href' => 'admin', 'style' => 'color: gray;');
$sub['clear cache'] = array('href' => 'purge_cache?token=' . S::v('xsrf_token'), 'style' => 'color: gray;');
from="Gestion des NLs" <support@polytechnique.org>
to=br@staff.polytechnique.org
+[newsletter_group_enable]
+from="Gestion des NLs" <support@polytechnique.org>
+to=br@staff.polytechnique.org
+
[xnet_registration]
from=register@polytechnique.org
subject="Inscription à Polytechnique.net"
'%grp/nl/show' => $this->make_hook('nl_show', AUTH_MDP),
'%grp/nl/search' => $this->make_hook('nl_search', AUTH_MDP),
'%grp/admin/nl' => $this->make_hook('admin_nl', AUTH_MDP, 'groupadmin'),
+ '%grp/admin/nl/enable' => $this->make_hook('admin_nl_enable', AUTH_MDP, 'groupadmin'),
'%grp/admin/nl/edit' => $this->make_hook('admin_nl_edit', AUTH_MDP, 'groupadmin'),
'%grp/admin/nl/edit/cancel' => $this->make_hook('admin_nl_cancel', AUTH_MDP, 'groupadmin'),
'%grp/admin/nl/edit/valid' => $this->make_hook('admin_nl_valid', AUTH_MDP, 'groupadmin'),
$group = $globals->asso('shortname');
return NewsLetter::forGroup($group);
}
+
+ public function handler_admin_nl_enable($page)
+ {
+ global $globals;
+ $nl = $this->getNl();
+ if ($nl) {
+ return PL_FORBIDDEN;
+ }
+
+ if (Post::has('title')) {
+ if (!S::has_xsrf_token()) {
+ return PL_FORBIDDEN;
+ }
+
+ XDB::execute('INSERT INTO newsletters
+ SET group_id = {?}, name = {?}',
+ $globals->asso('id'), Post::s('title'));
+
+ $mailer = new PlMailer();
+ $mailer->assign('group', $globals->asso('nom'));
+ $mailer->assign('user', S::user());
+ $mailer->send();
+
+ $page->trigSuccessRedirect("La lettre d'informations du groupe " .
+ $globals->asso('nom') . " a bien été créée",
+ $globals->asso('shortname') . '/admin/nl');
+ }
+ $page->setTitle('Activation de la newsletter');
+ $page->changeTpl('newsletter/enable.tpl');
+ }
}
// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2011 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 *}
+{* *}
+{**************************************************************************}
+
+{config_load file="mails.conf" section="newsletter_group_enable"}
+{if $mail_part eq 'head'}
+{from full=#from#}
+{to addr=#to#}
+{subject text="Activation de la newsletter du groupe $group"}
+{elseif $mail_part eq 'text'}
+
+La newsletter du groupe $group a été activée par {$user->fullName()}.
+{/if}
+
+{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
+
--- /dev/null
+{**************************************************************************}
+{* *}
+{* Copyright (C) 2003-2011 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>
+ Mise en place de la lettre d'informations du groupe {$asso->nom}
+</h1>
+
+<p>
+Tu peux demander sur cette page la mise en place d'une newsletter pour le groupe.
+
+Tu pourras ensuite envoyer aux membres du groupe qui auront choisi de s'y inscrire,
+ avec une structure plus adaptée que l'outil d'envoi de mails.
+</p>
+
+<p>
+Si le titre par défaut de la newsletter ne te convient pas, n'hésite pas à
+le modifier.
+
+<form method="post" action="{$platal->ns}admin/nl/enable">
+{xsrf_token_field}
+<p>
+ <label for='title'>Titre de la newsletter</label>
+ <input name='title' id='title' size="40" value="Lettre d'informations du groupe {$asso->nom}" />
+</p>
+<p>
+ <input type="submit" value="Créer" />
+</p>
+</form>
+