migrate panel.php as well
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 11 Jul 2006 02:03:37 +0000 (02:03 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 11 Jul 2006 02:03:37 +0000 (02:03 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@430 839d8a87-29fc-0310-9880-83ba4fa771e5

bin/cron/notifs.send.php
htdocs/carnet/panel.php [deleted file]
include/notifs.inc.php
modules/carnet.php
templates/carnet/index.tpl
templates/carnet/rss.tpl

index 319485b..db8ec8b 100755 (executable)
@@ -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  = <<<EOF
@@ -43,7 +43,7 @@ foreach($all->_data as $u) {
   </head>
   <body>
     <p>Voici les évènements survenus dans la semaine écoulée, et depuis ta dernière visite sur le site.</p>
-    <p>Tu trouveras les mêmes informations sur <a href='{$globals->baseurl}/carnet/panel.php'>cette page</a></p>
+    <p>Tu trouveras les mêmes informations sur <a href='{$globals->baseurl}/carnet/panel'>cette page</a></p>
 EOF;
 
     foreach($u['data'] as $cid=>$d) {
diff --git a/htdocs/carnet/panel.php b/htdocs/carnet/panel.php
deleted file mode 100644 (file)
index e8254cb..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 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");
-new_skinned_page('carnet/panel.tpl', AUTH_COOKIE);
-require_once('notifs.inc.php');
-
-if(Get::has('read')) {
-    $_SESSION['watch_last'] = Get::get('read');
-    redirect("panel.php");
-}
-
-$page->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();
-
-?>
index a3f5fad..45e8531 100644 (file)
@@ -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 "<a href='$url'>1 évènement !</a>"; }
     return "<a href='$url'>$n évènements !</a>";
index b07cd19..d0039ee 100644 (file)
@@ -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';
index 5783415..9905583 100644 (file)
@@ -59,7 +59,7 @@
   <tr class="pair">
     <td class='half'>
       <h3>
-        <a href="{"carnet/panel.php"|url}">Tous les évenements de la semaine</a>
+        <a href="{rel}/carnet/panel">Tous les évenements de la semaine</a>
       </h3>
       <div class="explication">
         Affichage de tous les évenements de camarades/promos
index 6bbc939..b159212 100644 (file)
@@ -44,7 +44,7 @@
   <channel>
     <title>Polytechnique.org :: Carnet</title>
     <language>fr</language>
-    <link>{#globals.baseurl#}/carnet/panel.php</link>
+    <link>{#globals.baseurl#}/carnet/panel</link>
     <description>Ton carnet polytechnicien...</description>
     <image>
       <title>Polytechnique.org</title>