migrate newsletter/show.php => nl/show
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 11 Jul 2006 18:52:55 +0000 (18:52 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 11 Jul 2006 18:52:55 +0000 (18:52 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@436 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs/newsletter/show.php [deleted file]
include/login.conf.php
modules/events.php
templates/admin/newsletter_edit.tpl
templates/newsletter/index.tpl
templates/newsletter/show.tpl

diff --git a/htdocs/newsletter/show.php b/htdocs/newsletter/show.php
deleted file mode 100644 (file)
index 2a82813..0000000
+++ /dev/null
@@ -1,35 +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('newsletter/show.tpl', AUTH_COOKIE);
-require_once("newsletter.inc.php");
-
-$nid = Get::get('nid', 'last');
-$nl = new NewsLetter($nid);
-$page->assign_by_ref('nl',$nl);
-
-if (Post::has('send')) {
-    $nl->sendTo(Session::get('prenom'), Session::get('nom'), Session::get('bestalias'), Session::get('femme'), Session::get('mail_fmt')!='text');
-}
-
-$page->run();
-?>
index a1695d9..f51c0ae 100644 (file)
@@ -11,7 +11,7 @@ $pub_tjs = array(
 
 // Liens apparaissant de façon aléatoire
 $pub_rnd = array(
-    'newsletter/show.php?nid=last' => 'Afficher la dernière newsletter' ,
+    'nl/show'                      => 'Afficher la dernière newsletter' ,
     'http://www.polytechnique.net' => 'Vers les autres sites polytechniciens' ,
     "trombi/{$_SESSION["promo"]}"  => "Voir le trombi de ma promo" ,
     'banana'                       => 'Un petit tour du côté des forums !!'
index 76ff087..284e2ca 100644 (file)
@@ -25,6 +25,8 @@ class EventsModule extends PLModule
     {
         return array(
             'events/submit'  => $this->make_hook('submit', AUTH_MDP),
+
+            'nl/show'        => $this->make_hook('nl',     AUTH_COOKIE),
         );
     }
 
@@ -79,6 +81,24 @@ class EventsModule extends PLModule
 
         return PL_OK;
     }
+
+    function handler_nl(&$page, $nid = 'last')
+    {
+        $page->changeTpl('newsletter/show.tpl');
+
+        require_once 'newsletter.inc.php';
+
+        $nl  = new NewsLetter($nid);
+        $page->assign_by_ref('nl', $nl);
+
+        if (Post::has('send')) {
+            $nl->sendTo(Session::get('prenom'), Session::get('nom'),
+                        Session::get('bestalias'), Session::get('femme'),
+                        Session::get('mail_fmt') != 'text');
+        }
+
+        return PL_OK;
+    }
 }
 
 ?>
index 73504ba..0ec7166 100644 (file)
@@ -27,8 +27,8 @@
 {if !$art}
 
 <p>
-[<a href="{"admin/newsletter.php"|url}">liste</a>]
-[<a href="{"newsletter/show.php"|url}?nid={$nl->_id}">visualiser</a>]
+[<a href="{rel}/admin/newsletter.php">liste</a>]
+[<a href="{rel}/nl/show/{$nl->_id}">visualiser</a>]
 </p>
 
 <form action='{$smarty.server.PHP_SELF}?nid={$nl->_id}' method='post'>
index cb96b6e..7876b9f 100644 (file)
@@ -59,7 +59,7 @@ Tu n'es actuellement pas inscrit 
   <tr class="{cycle values="impair,pair"}">
     <td>{$nl.date|date_format}</td>
     <td>
-      <a href="{"newsletter/show.php"|url}?nid={$nl.id}">{$nl.titre}</a>
+      <a href="{rel}/nl/show/{$nl.id}">{$nl.titre}</a>
     </td>
   </tr>
   {/foreach}
index 52308f5..4e08d1c 100644 (file)
 [<a href='?nid={$nl->_id}&amp;text=1'>version Texte</a>]
 {/if}
 {perms level='admin'}
-[<a href='{"admin/newsletter_edit.php"|url}?nid={$nl->_id}'>Editer</a>]
+[<a href='{rel}/admin/newsletter_edit.php?nid={$nl->_id}'>Editer</a>]
 {/perms}
 </p>
 
-<form method="post" action="{$smarty.server.PHP_SELF}?nid={$nl->_id}">
+<form method="post" action="{rel}/{$platal->path}">
   <div class='center'>
     <input type='submit' value="me l'envoyer" name='send' />
   </div>