Bug 339: Modification des logos RSS pour permettre l'activation des fils RSS.
authorx2001elahdab <x2001elahdab@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 7 Oct 2005 17:38:36 +0000 (17:38 +0000)
committerx2001elahdab <x2001elahdab@839d8a87-29fc-0310-9880-83ba4fa771e5>
Fri, 7 Oct 2005 17:38:36 +0000 (17:38 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@86 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs/carnet/index.php
htdocs/filrss.php [new file with mode: 0644]
htdocs/images/rssact.gif [new file with mode: 0644]
htdocs/login.php
templates/carnet/index.tpl
templates/filrss.tpl [new file with mode: 0644]
templates/login.tpl

index a5a72eb..3698e8d 100644 (file)
@@ -26,6 +26,8 @@ if (Session::has('core_rss_hash')) {
     $page->assign('xorg_rss', Array("title" => "Polytechnique.org :: Carnet", "href" => "/carnet/rss.php/".Session::get('forlife')."/".Session::get('core_rss_hash').".xml"));
 }
 
+$page->assign('refe',$_SERVER['PHP_SELF']);
+
 $page->run();
 
 ?>
diff --git a/htdocs/filrss.php b/htdocs/filrss.php
new file mode 100644 (file)
index 0000000..55d4c0b
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/***************************************************************************
+ *  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                *
+ ***************************************************************************/
+
+require_once("xorg.inc.php");
+new_skinned_page('filrss.tpl',AUTH_MDP);
+
+if (Env::has('referer')) {
+    $param = Env::get('referer');
+    $page->assign('goback',$param);
+}
+
+if (Env::has('referer')) {
+    $act = Env::get('act_rss');
+    if ($act == 'Activer'){
+        $page->trig("Ton Fil RSS est activé.");
+        $_SESSION['core_rss_hash'] = rand_url_id(16);
+        $globals->xdb->execute('UPDATE auth_user_quick SET core_rss_hash={?} WHERE user_id={?}',
+                                Session::get('core_rss_hash'), Session::getInt('uid'));
+    }                                
+}
+
+if (Session::get('core_rss_hash') > '')
+{
+    $page->assign('rsshash','oui');
+}
+
+$page->run();
+
+// vim:set et sws=4 sw=4 sts=4:
+?>
diff --git a/htdocs/images/rssact.gif b/htdocs/images/rssact.gif
new file mode 100644 (file)
index 0000000..00f1192
Binary files /dev/null and b/htdocs/images/rssact.gif differ
index 3dd277e..d67ee86 100644 (file)
@@ -86,6 +86,8 @@ $sql = "SELECT  e.id,e.titre,e.texte,a.user_id,a.nom,a.prenom,a.promo,l.alias AS
       ORDER BY  (e.promo_min != 0 AND  e.promo_max != 0) DESC,  e.peremption";
 $page->assign('evenement', $globals->xdb->iterator($sql, $promo, $promo));
 
+$page->assign('refe',$_SERVER['PHP_SELF']);
+
 $page->run();
 
 // vim:set et sws=4 sw=4 sts=4:
index 0a3176e..cf22db6 100644 (file)
       </h3>
       <div class="explication">
         Affichage de tous les évenements de camarades/promos
-        {if $smarty.session.core_rss_hash}
-        <a href='{rel}/carnet/rss.php/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' /></a>
-        {/if}
+  {if $smarty.session.core_rss_hash}
+  <div class="right">
+    <a href='{rel}/rss.php/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' /></a>
+  </div>
+  {else}
+  <div class="right">
+    <a href='{rel}/filrss.php?referer={$refe}'><img src='{rel}/images/rssact.gif' alt='fil rss' /></a>
+  </div>
+  {/if}
       </div>
     </td>
     <td class='half'>
diff --git a/templates/filrss.tpl b/templates/filrss.tpl
new file mode 100644 (file)
index 0000000..1a311c8
--- /dev/null
@@ -0,0 +1,72 @@
+{**************************************************************************}
+{*                                                                        *}
+{*  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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<h1>Fil RSS</h1>
+
+{if !$rsshash }
+Tu viens de cliquer sur le lien d'activation des fils RSS. Les fils RSS du site <br/>
+ne sont pas activés dans tes préférences.
+<ul>
+  <li>
+ Tu peux le faire tout de suite en cliquant sur Activer ci-dessous.
+  </li>
+  <li>
+ Qu'est-ce qu'un <a href="http://www.weblogger.ch/blog/archives/2004/06/23/syndication-pas-pas/">fil RSS</a> ?
+  </li>
+  <li>
+ Comment configurer un <a href="http://www.ac-reims.fr/ia52/rss/lire_rss.htm">agregateur RSS</a> ?
+  </li>
+</ul>
+
+<table>
+  <td>
+      <form method="GET" action="filrss.php">
+        <input type="hidden" name="referer" value="{$goback}" />
+        <input type="submit" name="act_rss" value="Activer">
+      </form>
+  </td>
+  <td>
+      <form method="GET" action="{$goback}">
+        <input type="hidden" name="referer" value="{$goback}" />
+        <input type="submit" name="" value="Retour">
+      </form>
+  </td>
+</table>
+
+{else}
+En voici l'adresse: <a href='{rel}/carnet/rss.php/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' /></a>
+<p>
+Tu peux le désactiver en allant dans Préférences et en cliquant sur "désactiver les fils RSS".
+<p>
+Attention: désactiver, puis réactiver le fil RSS en change l'adresse.
+<p>
+<form method="GET" action="{$goback}">
+  <table>
+    <tr class="center">
+      <td>
+        <input type="submit" name="" value="Retour">
+      </td>
+    </tr>
+  </table>
+</form>
+{/if}
+{* vim:set et sw=2 sts=2 sws=2: *}
index e319c4a..30f5246 100644 (file)
@@ -121,6 +121,10 @@ Bienvenue {$smarty.session.prenom}
   <div class="right">
     <a href='{rel}/rss.php/{$smarty.session.forlife}/{$smarty.session.core_rss_hash}.xml'><img src='{rel}/images/rssicon.gif' alt='fil rss' /></a>
   </div>
+  {else}
+  <div class="right">
+    <a href='{rel}/filrss.php?referer={$refe}'><img src='{rel}/images/rssact.gif' alt='fil rss' /></a>
+  </div>
   {/if}
 {/if}