Many fixes in AXLetter:
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 22 Feb 2007 16:52:54 +0000 (16:52 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Thu, 22 Feb 2007 16:52:54 +0000 (16:52 +0000)
-> 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
modules/axletter.php
modules/axletter/axletter.inc.php
templates/axletter/index.tpl
templates/axletter/show.tpl

index 4619a52..290a5f4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ New:
 
     * Core:
         - UTF-8                                                            -FRU
+        - New Backtrace tool                                               -FRU
 
     * Search:
         - Search Engine IE7 compatible                                     -FRU
index 6209a3a..523b09a 100644 (file)
@@ -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;
index e795bcc..e405f3b 100644 (file)
@@ -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)
index 4fb12b8..e9e854d 100644 (file)
@@ -76,5 +76,8 @@ Tu n'es actuellement pas inscrit aux envois exceptionnels de l'AX.
   {/foreach}
 </table>
 
+{if $ax_rights}
+<p>Il y a actuellement {$count} inscrits aux envois</p>
+{/if}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 4b256a8..25ed9e0 100644 (file)
@@ -21,8 +21,8 @@
 {**************************************************************************}
 
 <h1>
-  {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}
 [<a href='{$platal->pl_self()}?text=1'>version Texte</a>]
 {/if}
-{if !$ax->_date}
+{if !$am->_date}
 [<a href='ax/edit'>éditer</a>]
 {/if}
 </p>