finish panel + login feeds
authorPierre Habouzit (MadCoder <pierre.habouzit@m4x.org>
Mon, 17 Jan 2005 09:02:32 +0000 (09:02 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:46 +0000 (23:27 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-370

ChangeLog
htdocs/carnet/rss.php [new file with mode: 0644]
htdocs/rss.php
include/notifs.inc.php
include/rss.inc.php
templates/carnet/index.tpl
templates/carnet/panel.tpl
templates/carnet/rss.tpl [new file with mode: 0644]
templates/rss.tpl

index 91089ad..7a56af9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@ New :
 
        * Notifications :
                - Use Pascal's work to enable a simple, nicer html mail.                        -MC
+               - Use the new RSS engine to provide a feed of the panel.                        -MC
 
        * Photo Submission :
                - Rework of the form.                                                                                           -MC
@@ -44,6 +45,7 @@ Bug/Wish :
                - #180: Change the list order using name, promo or last change date.-Car
                
        * Core :
+           - #153: rework the RSS engine.                                                                              -MC
                - #145: Use melix address to log in.                                                            -Car
                - #212: Various font-sizes fixed.                                   -Car
                - #245: Use PEAR::Date to avoid 1970-2038 php limitations.                      -MC
@@ -56,7 +58,7 @@ Bug/Wish :
                - #238: Links and Mailto are now active.                                                        -Car
 
        * Fiche :
-               - #218 : Quit fiche using Escape key.                                                           -Car
+               - #218: Quit fiche using Escape key.                                                            -Car
 
        * Marketing :
                - #256, #255: Mail are now correctly sent.                                              -MC/Car
@@ -70,13 +72,13 @@ Bug/Wish :
                - #232: Add a link to the fiche.                                                                -MC/Car
        
        * Profile :
-               - #65 : Add professionnal cellphone.                                                            -Car
-               - #170 : Remove region display for french departments.                          -Car
-               - #204 : Add nicknames (searchable too).                                                        -MC
-               - #210 : Add medals and orders.                                                                         -MC
+               - #65: Add professionnal cellphone.                                                                     -Car
+               - #170: Remove region display for french departments.                           -Car
+               - #204: Add nicknames (searchable too).                                                         -MC
+               - #210: Add medals and orders.                                                                          -MC
 
        * Search :
-               - #249, #251, #253 : Some tweaks to be more accurate.                           -MC
+               - #249, #251, #253: Some tweaks to be more accurate.                            -MC
 
        * Stats :
                - #261: Stats of registrations over the time.                       -Car
@@ -128,36 +130,36 @@ New :
 Bug/Wish :
 
        * Admin :
-               - #186 : Users are reachable by melix, redirects, aliases...            -MC
+               - #186: Users are reachable by melix, redirects, aliases...                     -MC
 
        * Bestalias :
-               - #206 : Use only the bestalias and the forlife in vcard and fiche.     -MC
-               - #207 : Enable for the user the choice of his prefered alias.          -MC
+               - #206: Use only the bestalias and the forlife in vcard and fiche.      -MC
+               - #207: Enable for the user the choice of his prefered alias.           -MC
 
        * Core :
-               - #183,185 : Implement perms levels : 'pending'+'disabled'.                     -MC
-               - #154 : Birth fields are now of type DATE.                                                     -MC
+               - #183,185: Implement perms levels : 'pending'+'disabled'.                      -MC
+               - #154: Birth fields are now of type DATE.                                                      -MC
 
        * Fiche :
-               - #83,208,222 : New fiche.                                                                                      -MC
+               - #83,208,222: New fiche.                                                                                       -MC
 
        * Lists :
-               - #86 : Yet another old old wish : lists archives are online !          -MC
-               - #144 : Users can subscribe from members/trombi page too.                      -MC
-               - #184 : Owners can now delete their lists.                                                     -MC
-               - #231 : Add a link to the user's fiche on moderation page.                     -MC
+               - #86: Yet another old old wish : lists archives are online !           -MC
+               - #144: Users can subscribe from members/trombi page too.                       -MC
+               - #184: Owners can now delete their lists.                                                      -MC
+               - #231: Add a link to the user's fiche on moderation page.                      -MC
 
        * Newsletter :
-               - #242 : Newsletter is standalone.                                                                      -MC
+               - #242: Newsletter is standalone.                                                                       -MC
 
        * Search :
-               - #56 : Search on referent.                                                                                     -JS
-               - #189 : Selection of diplomas depends on schools.                                      -JS
-               - #195 : Better heuristic for google like (thanks OG).                          -MC
-               - #203 : New fields in search (alive, subscriber, free).                        -JS
+               - #56: Search on referent.                                                                                      -JS
+               - #189: Selection of diplomas depends on schools.                                       -JS
+               - #195: Better heuristic for google like (thanks OG).                           -MC
+               - #203: New fields in search (alive, subscriber, free).                         -JS
 
        * User Interface :
-               - #211 : All imgs in the skins are links to login.php.                          -MC
+               - #211: All imgs in the skins are links to login.php.                           -MC
 
 
 Fixes (from 0.9.2 branch) :
@@ -189,30 +191,30 @@ New :
 Bug/Wish :
 
        * Docs :
-               - #156 : Exit Netscape4 (no more supported), Mozilla enters.            -MC
+               - #156: Exit Netscape4 (no more supported), Mozilla enters.                     -MC
 
        * Carnet :
-               - #29,147 : Possible to watch subscribings, deaths, `fiche` modifs.     -MC
+               - #29,147: Possible to watch subscribings, deaths, `fiche` modifs.      -MC
        
        * Core :
-               - #135 : First instance of the plugin class : class Trombi.                     -MC
-               - #158 : A photo change updates last `fiche` edition stamp.                     -MC
-               - #100,199 : Kludge to determine if a link is popup or not.                     -MC
+               - #135: First instance of the plugin class : class Trombi.                      -MC
+               - #158: A photo change updates last `fiche` edition stamp.                      -MC
+               - #100,199: Kludge to determine if a link is popup or not.                      -MC
 
        * Lists :
-               - #138 : Refusal message is shown on mail moderation page.                      -MC
-               - #161 : Now supports non-X natively.                                                           -MC
+               - #138: Refusal message is shown on mail moderation page.                       -MC
+               - #161: Now supports non-X natively.                                                            -MC
 
        * Search :
                - #112,113,126,133,167,171: google like search + some rewrite.          -MC
 
        * Search+Contacts :
-               - #122 : Women now have a &bull; (no more dirty gender icons).          -MC
-               - #124 : Homeland is now a flag.                                                                        -MC
-               - #164 : Married women are now well sorted (by their spouse name).      -MC
+               - #122: Women now have a &bull; (no more dirty gender icons).           -MC
+               - #124: Homeland is now a flag.                                                                         -MC
+               - #164: Married women are now well sorted (by their spouse name).       -MC
 
        * Stats :
-               - #8,134 : Return of the stats pages.                                                           -VP
+               - #8,134: Return of the stats pages.                                                            -VP
 
 Fixes (from 0.9.1 branch) :
 
@@ -233,7 +235,7 @@ New :
                - 1-click moderation for accept and reject cases.                                       -MC
        
        * Usability :
-               - #99 : All <a><img ... /></a> now have title.                                          -MC
+               - #99: All <a><img ... /></a> now have title.                                           -MC
 
        * NewsLetter :
                - Brand New NewsLetter module.                                                                          -MC
diff --git a/htdocs/carnet/rss.php b/htdocs/carnet/rss.php
new file mode 100644 (file)
index 0000000..3b912ea
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/***************************************************************************
+ *  Copyright (C) 2003-2004 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                *
+ ***************************************************************************/
+
+require_once('xorg.inc.php');
+require_once('rss.inc.php');
+require_once('notifs.inc.php');
+
+$uid    = init_rss('carnet/rss.tpl');
+$notifs = new Notifs($uid, false);
+$page->assign('notifs', $notifs);
+
+$page->run();
+?> 
index d2e0f51..5d9b58b 100644 (file)
 require_once('xorg.inc.php');
 require_once('rss.inc.php');
 
-list($alias, $hash) = init_rss('rss.tpl');
+$uid = init_rss('rss.tpl');
 
 $rss = $globals->xdb->iterator(
         'SELECT  e.id, e.titre, e.texte, e.creation_date
-           FROM  evenements      AS e
-     INNER JOIN  aliases         AS a ON ( a.alias = {?} AND a.type != "homonyme" )
-     INNER JOIN  auth_user_quick AS q ON ( a.id = q.user_id AND core_rss_hash = {?} )
-     INNER JOIN  auth_user_md5   AS u USING(user_id)
-          WHERE  FIND_IN_SET(e.flags, "valide") AND peremption >= NOW()
-                 AND (e.promo_min = 0 || e.promo_min <= u.promo)
-                 AND (e.promo_max = 0 || e.promo_max >= u.promo)',
-        $alias, $hash);
+           FROM  auth_user_md5   AS u
+     INNER JOIN  evenements      AS e ON ( (e.promo_min = 0 || e.promo_min <= u.promo) AND (e.promo_max = 0 || e.promo_max >= u.promo) )
+          WHERE  u.user_id = {?} AND FIND_IN_SET(e.flags, "valide") AND peremption >= NOW()', $uid);
 $page->assign('rss', $rss);
 
 $page->run();
index b9167c4..16e135d 100644 (file)
@@ -190,7 +190,7 @@ class Notifs {
     var $_cats = Array();
     var $_data = Array();
     
-    function Notifs($uid,$up=false) {
+    function Notifs($uid, $up=false) {
        global $globals;
        $this->_uid = $uid;
        
index a37fc54..96ad35b 100644 (file)
@@ -32,10 +32,9 @@ function to_rss ($s)
     }
 }
 
-
 function init_rss($template)
 {
-    global $page;
+    global $page, $globals;
     new_nonhtml_page($template, AUTH_PUBLIC);
     $page->register_modifier('rss_date', '_rss_encode_date');
     $page->default_modifiers = Array('@to_rss');
@@ -43,12 +42,17 @@ function init_rss($template)
     if (preg_match(',^/([^/]+)/([^/]+)\.xml$,', $_SERVER['PATH_INFO'], $m)) {
         $alias = $m[1];
         $hash  = $m[2];
-    } else {
-        exit;
+        $res = $globals->xdb->query(
+            'SELECT  a.id
+               FROM  aliases         AS a
+         INNER JOIN  auth_user_quick AS q ON ( a.id = q.user_id AND q.core_rss_hash = {?} )
+              WHERE  a.alias = {?} AND a.type != "homonyme"', $hash, $alias);
+        $uid = $res->fetchOneCell();
     }
+    if (empty($uid)) { exit; }
 
     header('Content-Type: application/rss+xml; charset=utf8');
-    return Array($alias, $hash);
+    return $uid;
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
index 6287c91..2fea165 100644 (file)
@@ -61,6 +61,9 @@
       </h3>
       <div class="explication">
         Affichage de tous les évenements de camarades/promos
+        {if $smarty.session.core_rss_hash}
+        <a href='{rel}/carnet/rss.php/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' /></a>
+        {/if}
       </div>
     </td>
     <td class='half'>
index f174198..8c84448 100644 (file)
@@ -35,6 +35,11 @@ Tu peux choisir plus finement les donn
 Il faut pour celà se rendre sur la page de <a href='notifs.php'>configuration des notifications</a>.
 </p>
 
+<div class="right">
+{if $smarty.session.core_rss_hash}
+<a href='{rel}/carnet/rss.php/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' /></a>
+{/if}
+</div>
 
 {foreach from=$notifs->_data item=c key=cid}
 <h2>{if ($c|@count) > 1}
diff --git a/templates/carnet/rss.tpl b/templates/carnet/rss.tpl
new file mode 100644 (file)
index 0000000..81d3230
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+{***************************************************************************
+ *  Copyright (C) 2003-2004 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                *
+ ***************************************************************************}
+<rss version="2.0">
+  <channel>
+    <title>Polytechnique.org :: Carnet</title>
+    <language>fr</language>
+    <link>{#globals.baseurl#}/carnet/panel.php</link>
+    <description>Ton carnet polytechnicien...</description>
+    <image>
+      <title>Polytechnique.org</title>
+      <url>{#globals.baseurl#}/images/logo.png</url>
+      <link>{#globals.baseurl#}/</link>
+    </image>
+    {foreach from=$notifs->_data item=c key=cid}
+    {foreach from=$c item=promo}
+    {section name=row loop=$promo}
+    <item>
+      <title>
+        [{$notifs->_cats[$cid].short}] {$promo[row].prenom} {$promo[row].nom} (le {$promo[row].date|date_format})
+      </title>
+      <link>{#globals.baseurl#}/fiche.php?user={$promo[row].bestalias}</link>
+      <pubDate>{$promo[row]->known|rss_date}</pubDate>
+    </item>
+    {/section}
+    {/foreach}
+    {/foreach}
+  </channel>
+</rss>
+{* vim:set et sw=2 sts=2 sws=2: *}
index 6fd0e6a..6604455 100644 (file)
       <title>{$line.titre|strip_tags}</title>
       <link>{#globals.baseurl#}/login.php#newsid{$line.id}</link>
       <description><![CDATA[{$line.texte|nl2br}]]></description>
-      <image>
-        <title>Polytechnique.org</title>
-        <url>{#globals.baseurl#}/images/logo.png</url>
-        <link>{#globals.baseurl#}/</link>
-      </image>
     </item>
     {/iterate}
   </channel>