From 13a70d9a06a34da76b832e1db6928b5a9daa43d1 Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Mon, 17 Jan 2005 09:02:32 +0000 Subject: [PATCH] finish panel + login feeds git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-370 --- ChangeLog | 70 ++++++++++++++++++++++++---------------------- htdocs/carnet/rss.php | 31 ++++++++++++++++++++ htdocs/rss.php | 13 +++------ include/notifs.inc.php | 2 +- include/rss.inc.php | 14 ++++++---- templates/carnet/index.tpl | 3 ++ templates/carnet/panel.tpl | 5 ++++ templates/carnet/rss.tpl | 47 +++++++++++++++++++++++++++++++ templates/rss.tpl | 5 ---- 9 files changed, 136 insertions(+), 54 deletions(-) create mode 100644 htdocs/carnet/rss.php create mode 100644 templates/carnet/rss.tpl diff --git a/ChangeLog b/ChangeLog index 91089ad..7a56af9 100644 --- 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 • (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 • (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 now have title. -MC + - #99: All 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 index 0000000..3b912ea --- /dev/null +++ b/htdocs/carnet/rss.php @@ -0,0 +1,31 @@ +assign('notifs', $notifs); + +$page->run(); +?> diff --git a/htdocs/rss.php b/htdocs/rss.php index d2e0f513..5d9b58b 100644 --- a/htdocs/rss.php +++ b/htdocs/rss.php @@ -22,18 +22,13 @@ 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(); diff --git a/include/notifs.inc.php b/include/notifs.inc.php index b9167c4..16e135d 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -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; diff --git a/include/rss.inc.php b/include/rss.inc.php index a37fc54..96ad35b 100644 --- a/include/rss.inc.php +++ b/include/rss.inc.php @@ -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: diff --git a/templates/carnet/index.tpl b/templates/carnet/index.tpl index 6287c91..2fea165 100644 --- a/templates/carnet/index.tpl +++ b/templates/carnet/index.tpl @@ -61,6 +61,9 @@
Affichage de tous les évenements de camarades/promos + {if $smarty.session.core_rss_hash} + fil rss + {/if}
diff --git a/templates/carnet/panel.tpl b/templates/carnet/panel.tpl index f174198..8c84448 100644 --- a/templates/carnet/panel.tpl +++ b/templates/carnet/panel.tpl @@ -35,6 +35,11 @@ Tu peux choisir plus finement les donn Il faut pour celà se rendre sur la page de configuration des notifications.

+
+{if $smarty.session.core_rss_hash} +fil rss +{/if} +
{foreach from=$notifs->_data item=c key=cid}

{if ($c|@count) > 1} diff --git a/templates/carnet/rss.tpl b/templates/carnet/rss.tpl new file mode 100644 index 0000000..81d3230 --- /dev/null +++ b/templates/carnet/rss.tpl @@ -0,0 +1,47 @@ + +{*************************************************************************** + * 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 * + ***************************************************************************} + + + Polytechnique.org :: Carnet + fr + {#globals.baseurl#}/carnet/panel.php + Ton carnet polytechnicien... + + Polytechnique.org + {#globals.baseurl#}/images/logo.png + {#globals.baseurl#}/ + + {foreach from=$notifs->_data item=c key=cid} + {foreach from=$c item=promo} + {section name=row loop=$promo} + + + [{$notifs->_cats[$cid].short}] {$promo[row].prenom} {$promo[row].nom} (le {$promo[row].date|date_format}) + + {#globals.baseurl#}/fiche.php?user={$promo[row].bestalias} + {$promo[row]->known|rss_date} + + {/section} + {/foreach} + {/foreach} + + +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/rss.tpl b/templates/rss.tpl index 6fd0e6a..6604455 100644 --- a/templates/rss.tpl +++ b/templates/rss.tpl @@ -34,11 +34,6 @@ {$line.titre|strip_tags} {#globals.baseurl#}/login.php#newsid{$line.id} - - Polytechnique.org - {#globals.baseurl#}/images/logo.png - {#globals.baseurl#}/ - {/iterate} -- 2.1.4