From 9b242f1745890afcbd3c7b8c08a43894d068d0f0 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Thu, 22 Feb 2007 16:52:54 +0000 Subject: [PATCH] Many fixes in AXLetter: -> do not show the "edit" link to everybody -> send a mail to letter admins when a new mail is created -> show the number of subscribers to admins git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1511 839d8a87-29fc-0310-9880-83ba4fa771e5 --- ChangeLog | 1 + modules/axletter.php | 28 ++++++++++++++++++++++++++++ modules/axletter/axletter.inc.php | 3 +++ templates/axletter/index.tpl | 3 +++ templates/axletter/show.tpl | 6 +++--- 5 files changed, 38 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4619a52..290a5f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ New: * Core: - UTF-8 -FRU + - New Backtrace tool -FRU * Search: - Search Engine IE7 compatible -FRU diff --git a/modules/axletter.php b/modules/axletter.php index 6209a3a..523b09a 100644 --- a/modules/axletter.php +++ b/modules/axletter.php @@ -62,6 +62,8 @@ class AXLetterModule extends PLModule $perm = AXLetter::hasPerms(); if ($perm) { + $res = XDB::query("SELECT * FROM axletter_ins"); + $page->assign('count', $res->numRows()); $page->assign('new', AXLetter::awaiting()); } $page->assign('axs', AXLetter::subscriptionState()); @@ -155,6 +157,32 @@ class AXLetterModule extends PLModule SET id = {?}, shortname = {?}, subject = {?}, title = {?}, body = {?}, signature = {?}, promo_min = {?}, promo_max = {?}, echeance = {?}", $id, $shortname, $subject, $title, $body, $signature, $promo_min, $promo_max, $echeance); + if (!$saved) { + $mailer = new PlMailer(); + $mailer->setFrom("support@polytechnique.org"); + $mailer->setSubject("Un nouveau projet de mail de l'AX vient d'être proposé"); + $mailer->setTxtBody("Un nouveau mail vient d'être rédigé en prévision d'un envoi prochain. Vous pouvez " + . "le modifier jusqu'à ce qu'il soit verrouillé pour l'envoi\n\n" + . "Le sujet du mail : $subject\n" + . "L'échéance d'envoi est fixée à $echeance.\n" + . "Le mail pourra néanmoins partir avant cette échéance si un administrateur de " + . "Polytechnique.org le valide.\n\n" + . "Pour modifier, valider ou annuler le mail :\n" + . "https://www.polytechnique.org/ax/edit\n" + . "-- \n" + . "Association Polytechnique.org\n"); + $res = XDB::iterRow("SELECT IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom, + u.prenom, a.alias AS bestalias + FROM axletter_rights AS ar + INNER JOIN auth_user_md5 AS u USING(user_id) + INNER JOIN aliases AS a ON (u.user_id = a.id + AND FIND_IN_SET('bestalias', a.flags))"); + global $globals; + while (list($nom, $prenom, $alias) = $res->next()) { + $mailer->addTo("$nom $prenom <$alias@{$globals->mail->domain}>"); + } + $mailer->send(); + } $saved = true; $echeance_date = null; $echeance_time = null; diff --git a/modules/axletter/axletter.inc.php b/modules/axletter/axletter.inc.php index e795bcc..e405f3b 100644 --- a/modules/axletter/axletter.inc.php +++ b/modules/axletter/axletter.inc.php @@ -56,6 +56,9 @@ class AXLetter extends MassMailer 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; + if ($this->_date == '0000-00-00') { + $this->_date = 0; + } } protected function assignData(&$smarty) diff --git a/templates/axletter/index.tpl b/templates/axletter/index.tpl index 4fb12b8..e9e854d 100644 --- a/templates/axletter/index.tpl +++ b/templates/axletter/index.tpl @@ -76,5 +76,8 @@ Tu n'es actuellement pas inscrit aux envois exceptionnels de l'AX. {/foreach} +{if $ax_rights} +

Il y a actuellement {$count} inscrits aux envois

+{/if} {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/axletter/show.tpl b/templates/axletter/show.tpl index 4b256a8..25ed9e0 100644 --- a/templates/axletter/show.tpl +++ b/templates/axletter/show.tpl @@ -21,8 +21,8 @@ {**************************************************************************}

- {if $ax->_date} - Lettre de l'AX du {$ax->_date|date_format} + {if $am->_date} + Lettre de l'AX du {$am->_date|date_format} {else} Lettre de l'AX en préparation {/if} @@ -35,7 +35,7 @@ {else} [version Texte] {/if} -{if !$ax->_date} +{if !$am->_date} [éditer] {/if}

-- 2.1.4