From fc12cbd14113fa195948932d1e92f02d26c7c9d3 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Tue, 11 Jul 2006 02:03:37 +0000 Subject: [PATCH] migrate panel.php as well git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@430 839d8a87-29fc-0310-9880-83ba4fa771e5 --- bin/cron/notifs.send.php | 4 ++-- htdocs/carnet/panel.php | 45 --------------------------------------------- include/notifs.inc.php | 2 +- modules/carnet.php | 40 ++++++++++++++++++++++++++++++++++++++-- templates/carnet/index.tpl | 2 +- templates/carnet/rss.tpl | 2 +- 6 files changed, 43 insertions(+), 52 deletions(-) delete mode 100644 htdocs/carnet/panel.php diff --git a/bin/cron/notifs.send.php b/bin/cron/notifs.send.php index 319485b..db8ec8b 100755 --- a/bin/cron/notifs.send.php +++ b/bin/cron/notifs.send.php @@ -33,7 +33,7 @@ foreach($all->_data as $u) { . " Voici les évènements survenus dans la semaine écoulée,\n" . "et depuis ta dernière visite sur le site.\n\n" . "Tu trouveras les mêmes informations sur la page :\n" - . " {$globals->baseurl}/carnet/panel.php\n\n" + . " {$globals->baseurl}/carnet/panel\n\n" . "------------------------------------------------------------------------\n\n"; $html = <<_data as $u) {

Voici les évènements survenus dans la semaine écoulée, et depuis ta dernière visite sur le site.

-

Tu trouveras les mêmes informations sur cette page

+

Tu trouveras les mêmes informations sur cette page

EOF; foreach($u['data'] as $cid=>$d) { diff --git a/htdocs/carnet/panel.php b/htdocs/carnet/panel.php deleted file mode 100644 index e8254cb..0000000 --- a/htdocs/carnet/panel.php +++ /dev/null @@ -1,45 +0,0 @@ -assign('now',date('YmdHis')); -$notifs = new Notifs(Session::getInt('uid'), true); - -$page->assign('notifs', $notifs); -$page->assign('today', date('Y-m-d')); - -if (Session::has('core_rss_hash')) { - $page->assign('xorg_rss', - array("title" => "Polytechnique.org :: Carnet", - "href" => "/carnet/rss/".Session::get('forlife')."/".Session::get('core_rss_hash')."/rss.xml")); -} - -$page->run(); - -?> diff --git a/include/notifs.inc.php b/include/notifs.inc.php index a3f5fad..45e8531 100644 --- a/include/notifs.inc.php +++ b/include/notifs.inc.php @@ -147,7 +147,7 @@ function getNbNotifs() { $res = select_notifs(false, $uid, $watchlast, false); $n = $res->numRows(); $res->free(); - $url = $globals->baseurl."/carnet/panel.php"; + $url = $globals->baseurl."/carnet/panel"; if($n==0) { return; } if($n==1) { return "1 évènement !"; } return "$n évènements !"; diff --git a/modules/carnet.php b/modules/carnet.php index b07cd19..d0039ee 100644 --- a/modules/carnet.php +++ b/modules/carnet.php @@ -24,11 +24,47 @@ class CarnetModule extends PLModule function handlers() { return array( - 'carnet/rss' => $this->make_hook('rss', AUTH_PUBLIC), - 'carnet/ical' => $this->make_hook('ical', AUTH_PUBLIC), + 'carnet/panel' => $this->make_hook('panel', AUTH_COOKIE), + + 'carnet/rss' => $this->make_hook('rss', AUTH_PUBLIC), + 'carnet/ical' => $this->make_hook('ical', AUTH_PUBLIC), ); } + function _add_rss_link(&$page) + { + if (!Session::has('core_rss_hash')) + return; + $page->assign('xorg_rss', + array('title' => 'Polytechnique.org :: Carnet', + 'href' => '/carnet/rss/'.Session::get('forlife') + .'/'.Session::get('core_rss_hash').'/rss.xml') + ); + } + + function handler_panel(&$page) + { + $page->changeTpl('carnet/panel.tpl'); + + if (Get::has('read')) { + global $globals; + + $_SESSION['watch_last'] = Get::get('read'); + redirect($globals->baseurl.'/carnet/panel'); + } + + require_once 'notifs.inc.php'; + + $page->assign('now',date('YmdHis')); + $notifs = new Notifs(Session::getInt('uid'), true); + + $page->assign('notifs', $notifs); + $page->assign('today', date('Y-m-d')); + $this->_add_rss_link($page); + + return PL_OK; + } + function handler_rss(&$page, $user = null, $hash = null) { require_once 'rss.inc.php'; diff --git a/templates/carnet/index.tpl b/templates/carnet/index.tpl index 5783415..9905583 100644 --- a/templates/carnet/index.tpl +++ b/templates/carnet/index.tpl @@ -59,7 +59,7 @@

- Tous les évenements de la semaine + Tous les évenements de la semaine

Affichage de tous les évenements de camarades/promos diff --git a/templates/carnet/rss.tpl b/templates/carnet/rss.tpl index 6bbc939..b159212 100644 --- a/templates/carnet/rss.tpl +++ b/templates/carnet/rss.tpl @@ -44,7 +44,7 @@ Polytechnique.org :: Carnet fr - {#globals.baseurl#}/carnet/panel.php + {#globals.baseurl#}/carnet/panel Ton carnet polytechnicien... Polytechnique.org -- 2.1.4