From 8da0d3c16b9acf8d83318e45d635b1cd17e98dd6 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Fri, 19 Jan 2007 16:13:30 +0000 Subject: [PATCH] AXLetter module. The module is not finished, but I commit in order to allow cooperative work. git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1357 839d8a87-29fc-0310-9880-83ba4fa771e5 --- configs/mails.conf | 6 +- htdocs/css/ax.css | 108 +++++++++++++++ htdocs/xorg.php | 2 +- include/massmailer.inc.php | 22 ++- modules/axletter.php | 273 ++++++++++++++++++++++++++++++++++++++ modules/axletter/axletter.inc.php | 200 ++++++++++++++++++++++++++++ templates/axletter/edit.tpl | 114 ++++++++++++++++ templates/axletter/index.tpl | 80 +++++++++++ templates/axletter/letter.tpl | 90 +++++++++++++ templates/axletter/show.tpl | 54 ++++++++ upgrade/0.9.13/04_axletter.sql | 33 +++++ 11 files changed, 972 insertions(+), 10 deletions(-) create mode 100644 htdocs/css/ax.css create mode 100644 modules/axletter.php create mode 100644 modules/axletter/axletter.inc.php create mode 100644 templates/axletter/edit.tpl create mode 100644 templates/axletter/index.tpl create mode 100644 templates/axletter/letter.tpl create mode 100644 templates/axletter/show.tpl create mode 100644 upgrade/0.9.13/04_axletter.sql diff --git a/configs/mails.conf b/configs/mails.conf index 16ec787..fb38f72 100644 --- a/configs/mails.conf +++ b/configs/mails.conf @@ -23,6 +23,6 @@ from=support@polytechnique.org from="Lettre Mensuelle Polytechnique.org" replyto=info+nlp@polytechnique.org -[emails_broken] -from="Polytechnique.org" -subject="Une de tes adresse de redirection Polytechnique.org ne marche plus !!" +[mails_ax] +from="Association des Anciens élèves de l'X" +replyto=info@amicale.polytechnique.org diff --git a/htdocs/css/ax.css b/htdocs/css/ax.css new file mode 100644 index 0000000..e35cd5d --- /dev/null +++ b/htdocs/css/ax.css @@ -0,0 +1,108 @@ +/*************************************************************************** + * Copyright (C) 2003-2007 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 * + ***************************************************************************/ + + +div.ax_mail { + margin : auto; + width : 72ex; + font-family : "Georgia", "Times New Roman", serif; + font-size : 11pt; + text-align : justify; + background-color : #fff; + color : #000; +} + +div.ax_mail a[href] { + text-decoration : none; + background-color : #fff; + color : #36c; +} + +div.ax_mail a[href]:hover { + background-color : #fff; + color : #6c0; +} + +div.ax_mail div.title { + margin : 0 0 3ex; + padding : 5ex 1ex 1ex 15ex; + font-size : 130%; + font-weight : bold; + text-align : right; + background-color : #e40; + color : #ed0; + background-repeat : no-repeat; + background-position : 0ex 0.5ex; +} + +div.ax_mail div.intro { + margin : 4ex 3ex; +} + +div.ax_mail div.body { + margin : 2ex 3ex; +} + +div.ax_mail div.body h1 { + margin : 3ex 0 1ex; + padding : 1.5ex 2ex 0.5ex 0ex; + font-size : 120%; + font-weight : bold; + color : #400; +} + +div.ax_mail div.body h2 { + margin : 0ex 0 0; + padding : 0.4ex 2ex; + font-size : 100%; + font-weight : bold; + font-style : italic; + background-color : #fff; + color : #440; +} + +div.ax_mail div.signature { + margin : 2ex 2ex 0 0ex; + font-size : 80%; + font-style: italic; + text-align : right; + +} + +div.ax_mail div.foot1 { + margin : 2ex 0 0; + padding : 0.5ex 2ex; + font-size : 90%; + background-color : #fff; + color : #999; + border-width : thin 0; + border-style : solid; + border-color : #ddd; + text-align : center; +} + +div.ax_mail div.foot2 { + padding : 1ex 0; + font-size : 90%; + background-color : #fff; + color : #999; + text-align : center; +} + diff --git a/htdocs/xorg.php b/htdocs/xorg.php index 8042b5e..9a40d01 100644 --- a/htdocs/xorg.php +++ b/htdocs/xorg.php @@ -28,7 +28,7 @@ if (!($path = Env::v('n')) || ($path{0} < 'A' || $path{0} > 'Z')) { $platal = new Platal('auth', 'banana', 'carnet', 'email', 'events', 'geoloc', 'lists', 'marketing', 'payment', 'platal', 'profile', 'register', 'search', 'stats', 'admin', - 'newsletter'); + 'newsletter', 'axletter'); $platal->run(); exit; diff --git a/include/massmailer.inc.php b/include/massmailer.inc.php index e326a31..d9ad35e 100644 --- a/include/massmailer.inc.php +++ b/include/massmailer.inc.php @@ -62,12 +62,7 @@ abstract class MassMailer $head = str_replace('', $sexe ? 'Chère' : 'Cher', $head); $head = str_replace('', $prenom, $head); $head = str_replace('', $nom, $head); - if ($type == 'text') { - $head = enriched_to_text($head, false, true, 2, 64); - } else { - $head = enriched_to_text($head, true); - } - return $head; + return format_text($head, $type, 2, 64); } } @@ -206,6 +201,14 @@ function justify($text,$n) return trim($res); } +function format_text($input, $format, $indent = 0, $width = 68) +{ + if ($format == 'text') { + return enriched_to_text($input, false, true, $indent, $width); + } + return enriched_to_text($input, true); +} + function enriched_to_text($input,$html=false,$just=false,$indent=0,$width=68) { $text = trim($input); @@ -217,6 +220,11 @@ function enriched_to_text($input,$html=false,$just=false,$indent=0,$width=68) $text = str_replace('[/i]','', $text); $text = str_replace('[u]','', $text); $text = str_replace('[/u]','', $text); + $text = preg_replace("!(\\s*\n)*\[title\]!",'

',$text); + $text = preg_replace("!\[\/title\](\\s*\n)*!", '

',$text); + $text = preg_replace("!(\\s*\n)*\[subtitle\]!",'

',$text); + $text = preg_replace("!\[\/subtitle\](\\s*\n)*!",'

',$text); + require_once('url_catcher.inc.php'); $text = url_catcher($text); return nl2br($text); @@ -224,6 +232,8 @@ function enriched_to_text($input,$html=false,$just=false,$indent=0,$width=68) $text = preg_replace('!\[\/?b\]!','*',$text); $text = preg_replace('!\[\/?u\]!','_',$text); $text = preg_replace('!\[\/?i\]!','/',$text); + $text = preg_replace('!\[\/?title\]!','***', $text); + $text = preg_replace('!\[\/?subtitle\]!','**', $text); $text = preg_replace('!(((https?|ftp)://|www\.)[^\r\n\t ]*)!','[\1]', $text); $text = preg_replace('!(([a-zA-Z0-9\-_+.]*@[a-zA-Z0-9\-_+.]*)(?:\?[^\r\n\t ]*)?)!','[mailto:\1]', $text); $text = $just ? justify($text,$width-$indent) : wordwrap($text,$width-$indent); diff --git a/modules/axletter.php b/modules/axletter.php new file mode 100644 index 0000000..4926ddb --- /dev/null +++ b/modules/axletter.php @@ -0,0 +1,273 @@ + $this->make_hook('index', AUTH_COOKIE), + 'ax/show' => $this->make_hook('show', AUTH_COOKIE), + 'ax/edit' => $this->make_hook('submit', AUTH_MDP), + 'ax/edit/cancel' => $this->make_hook('cancel', AUTH_MDP), + 'ax/edit/valid' => $this->make_hook('valid', AUTH_MDP), + 'admin/axletter/rights' => $this->make_hook('admin_rights', AUTH_MDP, 'admin'), + ); + } + + function handler_index(&$page, $action = null, $hash = null) + { + require_once dirname(__FILE__) . '/axletter/axletter.inc.php'; + + $page->changeTpl('axletter/index.tpl'); + $page->assign('xorg_title','Polytechnique.org - Envois de l\'AX'); + + switch ($action) { + case 'out': AXLetter::unsubscribe($hash); 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', $perm); + } + + function handler_submit(&$page, $action = null) + { + require_once dirname(__FILE__) . '/axletter/axletter.inc.php'; + if (!AXLetter::hasPerms()) { + return PL_FORBIDDEN; + } + + $page->changeTpl('axletter/edit.tpl'); + + $saved = Post::i('saved'); + $new = false; + $id = Post::i('id'); + $shortname = trim(Post::v('shortname')); + $subject = trim(Post::v('subject')); + $title = trim(Post::v('title')); + $body = rtrim(Post::v('body')); + $signature = trim(Post::v('signature')); + $promo_min = Post::i('promo_min'); + $promo_max = Post::i('promo_max'); + $echeance = Post::has('echeance_date') ? Post::v('echeance_date') . ' ' . Post::v('echeance_time') + : Post::v('echeance'); + $echeance_date = Post::v('echeance_date'); + $echeance_time = Post::v('echeance_time'); + + if (!$id) { + $res = XDB::query("SELECT * FROM axletter WHERE FIND_IN_SET('new', bits)"); + if ($res->numRows()) { + extract($res->fetchOneAssoc(), EXTR_OVERWRITE); + $saved = true; + } else { + XDB::execute("INSERT INTO axletter SET id = NULL"); + $id = XDB::insertId(); + } + if (!$echeance || $echeance == '0000-00-00 00:00:00') { + $saved = false; + $new = true; + } + } elseif (Post::has('valid')) { + if (!$subject && $title) { + $subject = $title; + } + if (!$title && $subject) { + $title = $subject; + } + if (!$subject || !$title || !$body) { + $page->trig("L'article doit avoir un sujet et un contenu"); + Post::kill('valid'); + } + if (($promo_min > $promo_max && $promo_max != 0)|| + ($promo_min != 0 && ($promo_min <= 1900 || $promo_min >= 2020)) || + ($promo_max != 0 && ($promo_max <= 1900 || $promo_max >= 2020))) + { + $page->trig("L'intervalle de promotions n'est pas valide"); + Post::kill('valid'); + } + if (empty($shortname)) { + $page->trig("L'annonce doit avoir un nom raccourci pour simplifier la navigation dans les archives"); + Post::kill('valid'); + } elseif (!preg_match('/^[a-z][-a-z0-9]*[a-z0-9]$/', $shortname)) { + $page->trig("Le nom raccourci n'est pas valide, il doit comporter au moins 2 caractères et n'être composé " + . "que de chiffres, lettres et tirets"); + Post::kill('valid'); + } elseif ($shortname != Post::v('old_shortname')) { + $res = XDB::query("SELECT id FROM axletter WHERE shortname = {?}", $shortname); + if ($res->numRows() && $res->fetchOneCell() != $id) { + $page->trig("Le nom $shortname est déjà utilisé, merci d'en choisir un autre"); + $shortname = Post::v('old_shortname'); + if (empty($shortname)) { + Post::kill('valid'); + } + } + } + + switch (@Post::v('valid')) { + case 'Aperçu': + require_once dirname(__FILE__) . '/axletter/axletter.inc.php'; + $al = new AXLetter(array($id, $shortname, $subject, $title, $body, $signature, + $promo_min, $promo_max, $echeance, 0, 'new')); + $al->toHtml($page, S::v('prenom'), S::v('nom'), S::v('femme')); + break; + + case 'Confirmer': + XDB::execute("REPLACE INTO axletter + SET id = {?}, shortname = {?}, subject = {?}, title = {?}, body = {?}, + signature = {?}, promo_min = {?}, promo_max = {?}, echeance = {?}", + $id, $shortname, $subject, $title, $body, $signature, $promo_min, $promo_max, $echeance); + $saved = true; + $echeance_date = null; + $echeance_time = null; + pl_redirect('ax'); + break; + } + } + $page->assign('id', $id); + $page->assign('shortname', $shortname); + $page->assign('subject', $subject); + $page->assign('title', $title); + $page->assign('body', $body); + $page->assign('signature', $signature); + $page->assign('promo_min', $promo_min); + $page->assign('promo_max', $promo_max); + $page->assign('echeance', $echeance); + $page->assign('echeance_date', $echeance_date); + $page->assign('echeance_time', $echeance_time); + $page->assign('saved', $saved); + $page->assign('new', $new); + $page->assign('is_xorg', S::has_perms()); + + if (!$saved) { + $select = ''; + $time = time() + 3600 * 24 * 2; + for ($i = 0 ; $i < 15 ; $i++) { + $time += 3600 * 24; + $p_stamp = date('Ymd', $time); + $year = date('Y', $time); + $month = date('m', $time); + $day = date('d', $time); + + if ($p_stamp == $echeance_date) { + $sel = ' selected="selected"'; + } else { + $sel = ''; + } + $select .= "\n"; + } + $page->assign('echeance_date', $select); + $select = ''; + for ($i = 0 ; $i < 24 ; $i++) { + $stamp = sprintf('%02d:00:00', $i); + if ($stamp == $echeance_time) { + $sel = ' selected="selected"'; + } else { + $sel = ''; + } + $select .= "\n"; + } + $page->assign('echeance_time', $select); + } + } + + function handler_cancel(&$page, $force = null) + { + require_once dirname(__FILE__) . '/axletter/axletter.inc.php'; + if (!AXLetter::hasPerms()) { + return PL_FORBIDDEN; + } + + $url = parse_url($_SERVER['HTTP_REFERER']); + if ($force != 'force' && trim($url['path'], '/') != 'ax/edit') { + return PL_FORBIDDEN; + } + + $waiting = AXLetter::awaiting(); + if (!$waiting) { + $page->kill("Aucune lettre en attente"); + return; + } + $al = new AXLetter($waiting); + if (!$al->invalid()) { + $page->kill("Une erreur est survenue lors de l'annulation de l'envoi"); + return; + } + + $page->kill("L'envoi de l'annonce {$al->title()} est annulé"); + } + + function handler_valid(&$page, $force = null) + { + require_once dirname(__FILE__) . '/axletter/axletter.inc.php'; + if (!AXLetter::hasPerms()) { + return PL_FORBIDDEN; + } + + $url = parse_url($_SERVER['HTTP_REFERER']); + if ($force != 'force' && trim($url['path'], '/') != 'ax/edit') { + return PL_FORBIDDEN; + } + + $waiting = AXLetter::awaiting(); + if (!$waiting) { + $page->kill("Aucune lettre en attente"); + return; + } + $al = new AXLetter($waiting); + if (!$al->valid()) { + $page->kill("Une erreur est survenue lors de la validation de l'envoi"); + return; + } + + $page->kill("L'envoi de l'annonce aura lieu dans l'heure qui vient."); + } + + function handler_show(&$page, $nid = 'last') + { + require_once dirname(__FILE__) . '/axletter/axletter.inc.php'; + $page->changeTpl('axletter/show.tpl'); + + $nl = new AXLetter($nid); + if (Get::has('text')) { + $nl->toText($page, S::v('prenom'), S::v('nom'), S::v('femme')); + } else { + $nl->toHtml($page, S::v('prenom'), S::v('nom'), S::v('femme')); + } + if (Post::has('send')) { + $nl->sendTo(S::v('prenom'), S::v('nom'), + S::v('bestalias'), S::v('femme'), + S::v('mail_fmt') != 'texte'); + } + } +} + +?> diff --git a/modules/axletter/axletter.inc.php b/modules/axletter/axletter.inc.php new file mode 100644 index 0000000..178a0d3 --- /dev/null +++ b/modules/axletter/axletter.inc.php @@ -0,0 +1,200 @@ +_head = ' ,'; + + if (!is_array($id)) { + if ($id == 'last') { + $res = XDB::query("SELECT * + FROM axletter + WHERE FIND_IN_SET('sent', bits) + ORDER BY id DESC"); + } else { + $res = XDB::query("SELECT * + FROM axletter + WHERE id = {?} OR shortname = {?}", $id, $id); + } + if (!$res->numRows()) { + $this->_id = null; + return; + } + $id = $res->fetchOneRow(); + } + list($this->_id, $this->_shortname, $this->_title_mail, $this->_title, + $this->_body, $this->_signature, $this->_promo_min, $this->_promo_max, + $this->_echeance, $this->_date, $this->_bits) = $id; + } + + protected function assignData(&$smarty) + { + $smarty->assign_by_ref('am', $this); + } + + public function body($format) + { + return format_text($this->_body, $format); + } + + public function signature($format) + { + return format_text($this->_signature, $format, 10); + } + + static public function create($subject, $title, $body, $signature, $promo_min, $promo_max, $date, $shortname = null) + { + $id = AXLetter::awaiting(); + if ($id) { + return new AXLetter($id); + } + XDB::execute("INSERT INTO axletter (shortname, echeance, promo_min, promo_max, + subject, title, body, signature, + subject_ini, title_ini, body_ini, signature_ini) + VALUES ({?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})", + $shortname, $date, $promo_min, $promo_max, + $subject, $title, $body, $signature, $subject, $title, $body, $signature); + return new AXLetter(XDB::insertId()); + } + + public function update($subject, $title, $body, $signature, $promo_min, $promo_max, $date, $shortname = null) + { + $this->_shortname = $shortname; + $this->_title = $title; + $this->_title_mail = $subject; + $this->_body = $body; + $this->_signature = $signature; + $this->_promo_min = $promo_min; + $this->_promo_max = $promo_max; + $this->_date = $date; + return XDB::execute("UPDATE axletter (shortname, subject, title, body, signature, promo_min, promo_max, echeance) + SET shorname={?}, subject={?}, title={?}, body={?}, signature={?}, + promo_min={?}, promo_max={?}, echeance={?} + WHERE id = {?}", + $shortname, $subject, $title, $body, $signature, $promo_min, $promo_max, $date, $this->_id); + } + + public function valid() + { + return XDB::execute("UPDATE axletter + SET echeance = NOW() + WHERE id = {?}", $this->_id); + } + + public function invalid() + { + return XDB::execute("UPDATE axletter + SET bits = 'invalid', date = CURDATE() + WHERE id = {?}", $this->_id); + } + + protected function setSent() + { + XDB::execute("UPDATE axletter + SET bits='sent', date=CURDATE() + WHERE id={?}", $this->_id); + } + + static public function subscriptionState($uid = null) + { + $user = is_null($uid) ? S::v('uid') : $uid; + $res = XDB::query("SELECT 1 + FROM axletter_ins + WHERE user_id={?}", $user); + return $res->fetchOneCell(); + } + + static public function unsubscribe($uid = null) + { + $user = is_null($uid) ? S::v('uid') : $uid; + XDB::execute("DELETE FROM axletter_ins + WHERE user_id={?} OR hash = {?}", $user, $user); + } + + static public function subscribe($uid = null) + { + $user = is_null($uid) ? S::v('uid') : $uid; + XDB::execute("REPLACE INTO axletter_ins (user_id,last) + VALUES ({?}, 0)", $user); + } + + static public function hasPerms() + { + if (S::has_perms()) { + return true; + } + $res = XDB::query("SELECT 1 + FROM axletter_rights + WHERE user_id = {?}", S::i('uid')); + return $res->fetchOneCell(); + } + + protected function subscriptionTable() + { + return 'axletter_ins'; + } + + protected function subscriptionWhere() + { + return 'ni.last'; + } + + static public function awaiting() + { + $res = XDB::query("SELECT id + FROM axletter + WHERE FIND_IN_SET('new', bits)"); + return $res->fetchOneCell(); + } + + static public function listSent() + { + $res = XDB::query("SELECT IF(shortname IS NULL, id, shortname) as id, date, subject AS titre + FROM axletter + WHERE NOT (FIND_IN_SET('new', bits)) + ORDER BY date DESC"); + return $res->fetchAllAssoc(); + } + + static public function listAll() + { + $res = XDB::query("SELECT IF(shortname IS NULL, id, shortname) as id, date, subject AS titre + FROM axletter + ORDER BY date DESC"); + return $res->fetchAllAssoc(); + } +} + +// vim:set et sw=4 sts=4 sws=4: +?> diff --git a/templates/axletter/edit.tpl b/templates/axletter/edit.tpl new file mode 100644 index 0000000..126852a --- /dev/null +++ b/templates/axletter/edit.tpl @@ -0,0 +1,114 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2006 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 *} +{* *} +{**************************************************************************} + +

Edition de message

+ +
+ {if $am} + {include file="axletter/letter.tpl"} + +

+ + + + {if $echeance} + + {/if} + {if !$new} + + {/if} +

+ {/if} + +
+ Sujet du mail : +

+ Titre :
+
+ Signature : +

+
+ + + + + + + + + + + + + + + + + + {if !$saved} + + + + + {else} + + + + {/if} +
Options du message
Nom raccourci + + (uniquement lettres, chiffres ou -) +
Promo min + + (0 pour pas de minimum... ex: 1947) +
Promo max + + (0 pour pas de maximum... ex: 2001) +
Echéance d'envoi + le + vers +
+ Envoi au plus tard le {$echeance|date_format:"%x vers %Hh"}
+ {if $is_xorg} + [{* + *}{icon name=thumb_up} Valider l'envoi] + {else} + [{* + *}{icon name=thumb_down} Annuler l'envoi] + {/if} +
+ +

+ + + + {if $echeance} + + {/if} + + {if !$new} + + {/if} +

+
+ +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/axletter/index.tpl b/templates/axletter/index.tpl new file mode 100644 index 0000000..b6ed9fc --- /dev/null +++ b/templates/axletter/index.tpl @@ -0,0 +1,80 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2006 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 *} +{* *} +{**************************************************************************} + + +

+ Envoi exceptionnel de l'AX +

+ +

Ton statut

+ +{if $axs} +

+Tu es actuellement inscrit aux envois exceptionnels de l'AX (pour choisir le format HTML ou texte, rends toi sur la page des préférences) +

+ +{else} +

+Tu n'es actuellement pas inscrit à la lettre mensuelle de Polytechnique.org. +

+ +{/if} + +

Les archives

+ + + + + + + {if $ax_rights && !$new} + + + + {elseif $ax_rights && $new} + + + + + {/if} + {foreach item=al from=$ax_list} + + + + + {/foreach} +
datetitre
+ {icon name=page_edit} Proposer un nouveau mail +
{icon name=page_edit} Editer la demande + {if $new->title()} + {$new->title(true)} + {/if} +
{$al.date|date_format} + {$al.titre} +
+ + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/axletter/letter.tpl b/templates/axletter/letter.tpl new file mode 100644 index 0000000..8bf2c74 --- /dev/null +++ b/templates/axletter/letter.tpl @@ -0,0 +1,90 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2006 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 *} +{* *} +{**************************************************************************} + +{if !$html_version} +{if $is_mail} +{config_load file="mails.conf" section="mails_ax"} +{from full=#from#} +{subject text=$am->title(true)} +{if isset(#replyto#)}{add_header name='Reply-To' value=#replyto#}{/if} +{if isset(#retpath#)}{add_header name='Return-Path' value=#retpath#}{/if} +{else} +
+{/if}
+====================================================================
+{$am->title()}
+====================================================================
+
+{$am->head($prenom, $nom, $sexe, 'text')}
+
+{$am->body('text')}
+
+{$am->signature('text')}
+
+--------------------------------------------------------------------
+Cette lettre est envoyée à tous les Polytechniciens sur Internet par
+l'intermédiaire de Polytechnique.org.
+
+archives         : [https://www.polytechnique.org/ax]
+ne plus recevoir : [https://www.polytechnique.org/ax/out]
+
+{if !$is_mail}
+
+{/if} +{else} +{if $is_mail} + + + + + + + + +{/if} +
+
{$am->title()}
+
{$am->head($prenom, $nom, $sexe, 'html')|smarty:nodefaults}
+
{$am->body('html')|smarty:nodefaults}
+
{$am->signature('html')|smarty:nodefaults}
+
+ Cette lettre est envoyée par l'AX grâce aux outils de Polytechnique.org. +
+ +
+{if $is_mail} + + +{/if} +{/if} + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/axletter/show.tpl b/templates/axletter/show.tpl new file mode 100644 index 0000000..ca26d87 --- /dev/null +++ b/templates/axletter/show.tpl @@ -0,0 +1,54 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2006 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 *} +{* *} +{**************************************************************************} + +

+ {if $ax->_date} + Lettre de l'AX du {$ax->_date|date_format} + {else} + Lettre de l'AX en préparation + {/if} +

+ +

+[liste des lettres] +{if $smarty.get.text} +[version HTML] +{else} +[version Texte] +{/if} +{if !$ax->_date} +[éditer] +{/if} +

+ +
+
+ +
+
+ +
+{$am->title(true)} + {include file="axletter/letter.tpl"} +
+ +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/upgrade/0.9.13/04_axletter.sql b/upgrade/0.9.13/04_axletter.sql new file mode 100644 index 0000000..4c14495 --- /dev/null +++ b/upgrade/0.9.13/04_axletter.sql @@ -0,0 +1,33 @@ +CREATE TABLE axletter ( + id int(11) unsigned NOT NULL auto_increment, + shortname varchar(16) default NULL default '', + subject varchar(255) NOT NULL default '', + title varchar(255) NOT NULL default '', + body mediumtext NOT NULL default '', + signature mediumtext NOT NULL default '', + promo_min smallint(4) NOT NULL default 0, + promo_max smallint(4) NOT NULL default 0, + echeance datetime NOT NULL default 0, + date date NOT NULL default 0, + bits set('new', 'sent', 'invalid') NOT NULL default 'new', + + PRIMARY KEY(id), + UNIQUE KEY(shortname) +); +CREATE TABLE axletter_ins ( + user_id smallint(4) NOT NULL default 0, + email varchar(255) default NULL, + flag set('femme') default '', + prenom varchar(32) default NULL, + nom varchar(255) default NULL, + last int(11) NOT NULL default 0, + hash varchar(32) default NULL, + + PRIMARY KEY(user_id, email), + KEY(last) +); +CREATE TABLE axletter_rights ( + user_id smallint(4) NOT NULL default 0, + PRIMARY KEY(user_id) +); +# vim:set syntax=mysql: -- 2.1.4