Use new URI scheme for event read/unread state
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 30 Jul 2006 20:03:18 +0000 (20:03 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 30 Jul 2006 20:03:18 +0000 (20:03 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@731 839d8a87-29fc-0310-9880-83ba4fa771e5

ChangeLog
modules/events.php
templates/login.tpl

index 6ac127a..05ebe8a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,7 +24,7 @@ New:
         - Switch to the new URI scheme.                                     -MC
 
     * Events:
-        - Switch to the new URI scheme.                                     -MC
+        - Switch to the new URI scheme.                                 -MC/FRU
 
     * Geoloc:
         - Switch to the new URI scheme.                                 -MC/Car
index 8fa4f28..38ef519 100644 (file)
@@ -43,7 +43,7 @@ class EventsModule extends PLModule
         subscribe_nl($uid);
     }
 
-    function handler_ev(&$page)
+    function handler_ev(&$page, $action = 'list', $eid = null)
     {
         $page->changeTpl('login.tpl');
 
@@ -107,18 +107,18 @@ class EventsModule extends PLModule
         }
 
         // cache les evenements lus et raffiche les evenements a relire
-        if (Env::has('lu')){
+        if ($action == 'read' && $eid) {
             XDB::execute('DELETE FROM evenements_vus AS ev 
                                      INNER JOIN evenements AS e ON e.id = ev.evt_id
                                           WHERE peremption < NOW)');
             XDB::execute('REPLACE INTO evenements_vus VALUES({?},{?})',
-                                   Env::v('lu'), S::v('uid'));
+                                   $eid, S::v('uid'));
         }
 
-        if (Env::has('nonlu')){
+        if ($action == 'unread' && $eid) {
             XDB::execute('DELETE FROM evenements_vus
                                           WHERE evt_id = {?} AND user_id = {?}',
-                                   Env::v('nonlu'), S::v('uid'));
+                                   $eid, S::v('uid'));
         }
 
         // affichage des evenements
index 93d210d..6e793e8 100644 (file)
@@ -87,7 +87,7 @@ Bienvenue {$smarty.session.prenom}
           {if $smarty.session.perms eq 'admin'}
           <a href="admin/events/edit/{$ev.id}">{icon name=page_edit title="Editer cet article"}</a>
           {/if}
-          <a href="events?lu={$ev.id}{if $previd}#newsid{$previd}{/if}">{icon name=cross title="Cacher cet article"}</a>
+          <a href="events/read/{$ev.id}{if $previd}#newsid{$previd}{/if}">{icon name=cross title="Cacher cet article"}</a>
         </div>
         {assign var="previd" value=$ev.id}
         <a id="newsid{$ev.id}"></a>
@@ -133,7 +133,7 @@ Bienvenue {$smarty.session.prenom}
     <tr class="{cycle values="impair,pair"}">
       <td class="half">
         &bull;
-        <a href="{if !$ev.nonlu}events?nonlu={$ev.id}{/if}#newsid{$ev.id}">
+        <a href="{if !$ev.nonlu}events/unread/{$ev.id}{/if}#newsid{$ev.id}">
         {if $ev.nonlu}<strong>{/if}
         {tidy}
           {$ev.titre|nl2br}