yet remove some stupid hooks.
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 19 Jul 2006 19:20:16 +0000 (19:20 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Wed, 19 Jul 2006 19:20:16 +0000 (19:20 +0000)
use some dynpostkv (and fix it at the same time)

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@544 839d8a87-29fc-0310-9880-83ba4fa771e5

hooks/skin.inc.php [deleted file]
hooks/tmp.inc.php
hooks/webredirect.inc.php [deleted file]
htdocs/javascript/xorg.js
modules/platal.php
templates/preferences.tpl
templates/webredirect.tpl

diff --git a/hooks/skin.inc.php b/hooks/skin.inc.php
deleted file mode 100644 (file)
index 60cfe06..0000000
+++ /dev/null
@@ -1,39 +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                *
- ***************************************************************************/
-
-// {{{ config HOOK
-
-function skin_prefs()
-{
-    global $globals;
-
-    return Array(
-            Array(
-                'url'    => 'skin',
-                'title'  => 'Apparence du site (skins)',
-                'text'   => 'Tu peux changer les couleurs et les images du site.',
-                'weight' => 70
-            )
-        );
-}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
index 808bd36..6f75b57 100644 (file)
@@ -68,28 +68,4 @@ function tmp_subscribe($forlife, $uid, $promo, $password)
 }
 
 // }}}
-// {{{ prfs hook
-
-function tmp_prefs()
-{
-    $fmt  = S::v('mail_fmt', 'html') == 'html' ? 'texte' : 'html';
-    $fmt2 = S::v('mail_fmt', 'html') == 'html' ? 'texte' : 'HTML';
-    return Array(
-            Array(
-                'url'    => 'prefs?mail_fmt='.$fmt,
-                'title'  => 'Recevoir les mails en format '.$fmt2,
-                'text'   => 'Tu recois les mails envoyés par le site (lettre mensuelle, carnet, ...) de préférence <strong>sous forme de '
-                            .S::v('mail_fmt', 'html').'</strong>',
-                'weight' => 80
-            ),
-            Array(
-                'url'    => 'prefs?rss='.(intval(S::v('core_rss_hash')=='')),
-                'title'  => (S::v('core_rss_hash') ? 'Désactiver' : 'Activer').' les fils rss',
-                'text'   => 'Ceci te permet d\'utiliser les fils rss du site. Attention, désactiver puis réactiver les fils en change les URL !',
-                'weight' => 90
-            )
-        );
-}
-
-// }}}
 ?>
diff --git a/hooks/webredirect.inc.php b/hooks/webredirect.inc.php
deleted file mode 100644 (file)
index 3b574b8..0000000
+++ /dev/null
@@ -1,62 +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                *
- ***************************************************************************/
-
-// {{{ config HOOK
-
-// {{{ class WebRedirConfig
-
-class WebRedirConfig
-{
-    var $domain       = '';
-}
-
-// }}}
-
-function webredirect_config()
-{
-    global $globals;
-    $globals->webredirect = new WebRedirConfig;
-}
-
-// }}}
-// {{{ prefs hook
-
-function webredirect_prefs()
-{
-    $text = "Tu peux configurer tes redirections WEB http://www.carva.org/" . S::v('bestalias');
-    if (S::v('forlife') != S::v('bestalias')) {
-        $text .= ' et http://www.carva.org/'.S::v('forlife');
-    }
-
-    return Array(
-            Array(
-                'url'    => 'prefs/webredirect',
-                'title'  => 'Ma redirection de page WEB',
-                'text'   => $text,
-                'weight' => 60
-            )
-        );
-}
-
-// }}}
-
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
-?>
index b7bcd52..0568026 100644 (file)
@@ -88,7 +88,9 @@ function dynpost(action, values)
 
 function dynpostkv(action, k, v)
 {
-    dynpost(action, {k: v});
+    var dict = {};
+    dict[k] = v;
+    dynpost(action, dict);
 }
 
 // }}}
index b8ed76b..6c9df49 100644 (file)
@@ -43,11 +43,11 @@ class PlatalModule extends PLModule
             'changelog'   => $this->make_hook('changelog', AUTH_PUBLIC),
 
             // Preferences thingies
-            'prefs'     => $this->make_hook('prefs',     AUTH_COOKIE),
-            'prefs/rss' => $this->make_hook('prefs_rss', AUTH_COOKIE),
+            'prefs'       => $this->make_hook('prefs',     AUTH_COOKIE),
+            'prefs/rss'   => $this->make_hook('prefs_rss', AUTH_COOKIE),
             'prefs/webredirect'
-                        => $this->make_hook('webredir',  AUTH_MDP),
-            'skin'      => $this->make_hook('skin',      AUTH_COOKIE),
+                          => $this->make_hook('webredir',  AUTH_MDP),
+            'prefs/skin'  => $this->make_hook('skin',      AUTH_COOKIE),
 
             // password related thingies
             'password'      => $this->make_hook('password',  AUTH_MDP),
@@ -105,22 +105,23 @@ class PlatalModule extends PLModule
     {
         global $globals;
 
+        var_export($_POST);
+
         $page->changeTpl('preferences.tpl');
         $page->assign('xorg_title','Polytechnique.org - Mes préférences');
 
-        if (Env::has('mail_fmt')) {
-            $fmt = Env::get('mail_fmt');
+        if (Post::has('mail_fmt')) {
+            $fmt = Post::get('mail_fmt');
             if ($fmt != 'texte') $fmt = 'html';
             XDB::execute("UPDATE auth_user_quick
                                        SET core_mail_fmt = '$fmt'
                                      WHERE user_id = {?}",
                                      S::v('uid'));
             $_SESSION['mail_fmt'] = $fmt;
-            redirect($globals->baseurl.'/preferences');
         }
 
-        if (Env::has('rss')) {
-            $this->__set_rss_state(Env::getBool('rss'));
+        if (Post::has('rss')) {
+            $this->__set_rss_state(Post::getBool('rss'));
         }
 
         $page->assign('prefs', $globals->hook->prefs());
index 1f444bc..56007a7 100644 (file)
   </tr>
   {/if}
   {/foreach}
+  <tr class="pair">
+    <td class="half">
+      <h3><a href="prefs/webredirect">Ma redirection de page WEB</a></h3>
+      <div class='explication'>
+        Tu peux configurer tes redirections WEB
+        http://www.carva.org/{$smarty.session.bestalias}.
+      </div>
+    </td>
+    <td class="half">
+      <h3><a href="prefs/skin">Apparence du site (skins)</a></h3>
+      <div class='explication'>
+        Tu peux changer les couleurs et les images du site.
+      </div>
+    </td>
+  </tr>
+  <tr class="impair">
+    <td class="half">
+      {if $smarty.session.mail_fmt eq html}
+      <h3>
+        <a href="javascript:dynpostkv('prefs', 'mail_fmt', 'texte')">Recevoir les mails en format texte</a>
+      </h3>
+      <div class='explication'>
+        Tu recois tous les mails envoyés par le site
+        (lettre mensuelle, carnet, ...) de préférence
+        <strong>sous forme de html</strong>
+      </div>
+      {else}
+      <h3>
+        <a href="javascript:dynpostkv('prefs', 'mail_fmt', 'html')">Recevoir les mails en HTML</a>
+      </h3>
+      <div class='explication'>
+        Tu recois tous les mails envoyés par le site
+        (lettre mensuelle, carnet, ...) de préférence
+        <strong>sous forme de texte</strong>
+      </div>
+      {/if}
+    </td>
+    <td class="half">
+      <h3>
+        {if $smarty.session.core_rss_hash}
+        <a href="javascript:dynpostkv('prefs', 'rss', 0)">Désactiver les fils rss</a>
+        {else}
+        <a href="javascript:dynpostkv('prefs', 'rss', 1)">Activer les fils rss</a>
+        {/if}
+      </h3>
+      <div class='explication'>
+        Ceci te permet d'utiliser les fils rss du site.
+        Attention, désactiver puis réactiver les fils en change les URL !
+      </div>
+    </td>
+  </tr>
 </table>
 
 <br />
index 169e051..68587bf 100644 (file)
@@ -27,8 +27,8 @@
 <p>
   Dans la lignée du service de redirection d'emails de <strong>Polytechnique.org</strong>,
   il est possible de faire pointer
-    les adresses <strong>http://{#globals.webredirect.domain#}/{$smarty.session.bestalias}</strong>
-  et <strong>http://{#globals.webredirect.domain#}/{$smarty.session.forlife}</strong>
+    les adresses <strong>http://www.carva.org/{$smarty.session.bestalias}</strong>
+  et <strong>http://www.carva.org/{$smarty.session.forlife}</strong>
     vers la page WEB de ton choix. Pour de plus amples détails, consulte
   <a href="Docs/MaRedirectionDePageWEB">cette page</a>
 </p>
 <p>
 {if $carva}
   Actuellement, les adresses
-  <a href="http://{#globals.webredirect.domain#}/{$smarty.session.bestalias}">
-    http://{#globals.webredirect.domain#}/{$smarty.session.bestalias}
-  </a> et <a href="http://{#globals.webredirect.domain#}/{$smarty.session.forlife}">
-    http://{#globals.webredirect.domain#}/{$smarty.session.forlife}
+  <a href="http://www.carva.org/{$smarty.session.bestalias}">
+    http://www.carva.org/{$smarty.session.bestalias}
+  </a> et <a href="http://www.carva.org/{$smarty.session.forlife}">
+    http://www.carva.org/{$smarty.session.forlife}
   </a> sont redirigées sur <a href="http://{$carva}">http://{$carva}</a>
 {else}
   La redirection n'est pas utilisée ...