From bee33d93c402f9b5107c7e59e04ad686e43a40e7 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Wed, 19 Jul 2006 19:20:16 +0000 Subject: [PATCH] yet remove some stupid hooks. 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 | 39 ----------------------------- hooks/tmp.inc.php | 24 ------------------ hooks/webredirect.inc.php | 62 ----------------------------------------------- htdocs/javascript/xorg.js | 4 ++- modules/platal.php | 19 ++++++++------- templates/preferences.tpl | 51 ++++++++++++++++++++++++++++++++++++++ templates/webredirect.tpl | 12 ++++----- 7 files changed, 70 insertions(+), 141 deletions(-) delete mode 100644 hooks/skin.inc.php delete mode 100644 hooks/webredirect.inc.php diff --git a/hooks/skin.inc.php b/hooks/skin.inc.php deleted file mode 100644 index 60cfe06..0000000 --- a/hooks/skin.inc.php +++ /dev/null @@ -1,39 +0,0 @@ - '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: -?> diff --git a/hooks/tmp.inc.php b/hooks/tmp.inc.php index 808bd36..6f75b57 100644 --- a/hooks/tmp.inc.php +++ b/hooks/tmp.inc.php @@ -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 sous forme de ' - .S::v('mail_fmt', 'html').'', - '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 index 3b574b8..0000000 --- a/hooks/webredirect.inc.php +++ /dev/null @@ -1,62 +0,0 @@ -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: -?> diff --git a/htdocs/javascript/xorg.js b/htdocs/javascript/xorg.js index b7bcd52..0568026 100644 --- a/htdocs/javascript/xorg.js +++ b/htdocs/javascript/xorg.js @@ -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); } // }}} diff --git a/modules/platal.php b/modules/platal.php index b8ed76b..6c9df49 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -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()); diff --git a/templates/preferences.tpl b/templates/preferences.tpl index 1f444bc..56007a7 100644 --- a/templates/preferences.tpl +++ b/templates/preferences.tpl @@ -45,6 +45,57 @@ {/if} {/foreach} + + +

Ma redirection de page WEB

+
+ Tu peux configurer tes redirections WEB + http://www.carva.org/{$smarty.session.bestalias}. +
+ + +

Apparence du site (skins)

+
+ Tu peux changer les couleurs et les images du site. +
+ + + + + {if $smarty.session.mail_fmt eq html} +

+ Recevoir les mails en format texte +

+
+ Tu recois tous les mails envoyés par le site + (lettre mensuelle, carnet, ...) de préférence + sous forme de html +
+ {else} +

+ Recevoir les mails en HTML +

+
+ Tu recois tous les mails envoyés par le site + (lettre mensuelle, carnet, ...) de préférence + sous forme de texte +
+ {/if} + + +

+ {if $smarty.session.core_rss_hash} + Désactiver les fils rss + {else} + Activer les fils rss + {/if} +

+
+ Ceci te permet d'utiliser les fils rss du site. + Attention, désactiver puis réactiver les fils en change les URL ! +
+ +
diff --git a/templates/webredirect.tpl b/templates/webredirect.tpl index 169e051..68587bf 100644 --- a/templates/webredirect.tpl +++ b/templates/webredirect.tpl @@ -27,8 +27,8 @@

Dans la lignée du service de redirection d'emails de Polytechnique.org, il est possible de faire pointer - les adresses http://{#globals.webredirect.domain#}/{$smarty.session.bestalias} - et http://{#globals.webredirect.domain#}/{$smarty.session.forlife} + les adresses http://www.carva.org/{$smarty.session.bestalias} + et http://www.carva.org/{$smarty.session.forlife} vers la page WEB de ton choix. Pour de plus amples détails, consulte cette page

@@ -47,10 +47,10 @@

{if $carva} Actuellement, les adresses - - http://{#globals.webredirect.domain#}/{$smarty.session.bestalias} - et - http://{#globals.webredirect.domain#}/{$smarty.session.forlife} + + http://www.carva.org/{$smarty.session.bestalias} + et + http://www.carva.org/{$smarty.session.forlife} sont redirigées sur http://{$carva} {else} La redirection n'est pas utilisée ... -- 2.1.4