Enable link to NL pages in X.net groups. (Closes #774)
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Sat, 29 Jan 2011 23:37:49 +0000 (00:37 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Sun, 30 Jan 2011 00:05:15 +0000 (01:05 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/group.php
classes/xnetpage.php

index 0149d9b..e3ed9b6 100644 (file)
@@ -113,9 +113,11 @@ class Group
         }
         $res = XDB::query('SELECT  a.*, d.nom AS domnom,
                                    FIND_IN_SET(\'wiki_desc\', a.flags) AS wiki_desc,
-                                   FIND_IN_SET(\'notif_unsub\', a.flags) AS notif_unsub
+                                   FIND_IN_SET(\'notif_unsub\', a.flags) AS notif_unsub,
+                                   (nls.id IS NOT NULL) AS has_nl
                              FROM  groups AS a
                         LEFT JOIN  group_dom  AS d ON d.id = a.dom
+                        LEFT JOIN  newsletters AS nls ON (nls.group_id = a.id)
                             WHERE  ' . $where);
         if ($res->numRows() != 1) {
             if ($can_be_shortname && (is_int($id) || ctype_digit($id))) {
index 0ef5cfb..42bf9e9 100644 (file)
@@ -100,6 +100,9 @@ class XnetPage extends PlPage
                 if ($globals->asso('mail_domain')) {
                     $sub['listes de diffusion'] = "$dim/lists";
                 }
+                if ($globals->asso('has_nl')) {
+                    $sub['newsletter'] = "$dim/nl";
+                }
             }
             $sub['événement'] = "$dim/events";
             if ($perms->hasFlag('groupmember')) {