From: Pierre Habouzit (MadCoder Date: Sat, 15 Jan 2005 13:55:57 +0000 (+0000) Subject: a real bad part of plat/al vanish. (closes FS#236) X-Git-Tag: xorg/old~416 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=6a609d2454f672f30daeca68da8844671a8b61d7;p=platal.git a real bad part of plat/al vanish. (closes FS#236) no more creation of preferences.tpl by rendez-vous in preferences.tpl.d it solves the skin pb. git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-340 --- diff --git a/hooks/README b/hooks/README index 764717b..86ad06b 100644 --- a/hooks/README +++ b/hooks/README @@ -8,3 +8,6 @@ menu() subscribe($forlife, $uid, $promo, $pass) triggered when a user subscription is sucessfull +prefs() + function used to add boxes in htdocs/preferences.php + must return a dictionnary : url, title, text, weight. diff --git a/hooks/emails.inc.php b/hooks/emails.inc.php index 464c96f..687cf25 100644 --- a/hooks/emails.inc.php +++ b/hooks/emails.inc.php @@ -67,5 +67,31 @@ function emails_menu() } // }}} +// {{{ prefs HOOK +function emails_prefs() +{ + global $globals; + + $res[] = Array( + 'url' => 'emails.php', + 'title' => 'Mes adresses de redirection', + 'text' => 'Tu peux configurer tes différentes redirections de mails ici.', + 'weight' => 10 + ); + + if ($globals->mail->alias_dom) { + $res [] = Array( + 'url' => 'alias.php', + 'title' => 'Mon alias mail @'.$globals->mail->alias_dom, + 'text' => "Pour choisir un alias @{$globals->mail->alias_dom}/{$globals->mail->alias_dom2} (en choisir un nouveau annule l'ancien).", + 'weight' => 20 + ); + } + + + return $res; +} + +// }}} ?> diff --git a/hooks/skin.inc.php b/hooks/skin.inc.php index c3d92ad..d6c7870 100644 --- a/hooks/skin.inc.php +++ b/hooks/skin.inc.php @@ -39,6 +39,25 @@ function skin_config() } // }}} +// {{{ prefs hook + +function skin_prefs() +{ + global $globals; + if (empty($globals->skin->enable)) { + return null; + } + return Array( + Array( + 'url' => 'skins.php', + 'title' => 'Apparence du site (skins)', + 'text' => 'Tu peux changer les couleurs et les images du site.', + 'weight' => 90 + ) + ); +} + +// }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: ?> diff --git a/hooks/tmp.inc.php b/hooks/tmp.inc.php index 2dfc311..9ab5d2a 100644 --- a/hooks/tmp.inc.php +++ b/hooks/tmp.inc.php @@ -47,5 +47,21 @@ function tmp_subscribe($forlife, $uid, $promo, $password) } // }}} +// {{{ prfs hook +function tmp_prefs() +{ + $fmt = Session::get('mail_fmt', 'html') == 'html' ? 'texte' : 'html'; + $fmt2 = Session::get('mail_fmt', 'html') == 'html' ? 'texte' : 'HTML'; + return Array( + Array( + 'url' => 'preferences.php?mail_fmt='.$fmt, + 'title' => 'Recevoir les mails en format '.$fmt2, + 'text' => 'Les mails envoyés par le site (lettre mensuelle, carnet, ...) le sont de préférence en format '.Session::get('mail_fmt', 'html'), + 'weight' => 30 + ) + ); +} + +// }}} ?> diff --git a/hooks/webredirect.inc.php b/hooks/webredirect.inc.php index c49fe49..74b5d02 100644 --- a/hooks/webredirect.inc.php +++ b/hooks/webredirect.inc.php @@ -37,6 +37,26 @@ function webredirect_config() } // }}} +// {{{ prefs hook + +function webredirect_prefs() +{ + $text = "Tu peux configurer tes redirections WEB http://www.carva.org/" . Session::get('bestalias'); + if (Session::get('forlife') != Session::get('bestalias')) { + $text .= ' et http://www.carva.org/'.Session::get('forlife'); + } + + return Array( + Array( + 'url' => 'webredirect.php', + 'title' => 'Ma redirection de page WEB', + 'text' => $text, + 'weight' => 80 + ) + ); +} + +// }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: ?> diff --git a/htdocs/preferences.php b/htdocs/preferences.php index 1a3eed1..f74f1b6 100644 --- a/htdocs/preferences.php +++ b/htdocs/preferences.php @@ -48,7 +48,8 @@ if (Env::has('mail_fmt')) { $_SESSION['mail_fmt'] = $fmt; } -$page->run($has_cookie); +$page->assign('prefs', $globals->hook->prefs()); +$page->run(); // vim:set et sw=4 sts=4 sws=4: ?> diff --git a/include/xorg/hook.inc.php b/include/xorg/hook.inc.php index 5e0510c..d64dd81 100644 --- a/include/xorg/hook.inc.php +++ b/include/xorg/hook.inc.php @@ -84,6 +84,9 @@ class XOrgHook } } + // }}} + // {{{ function menu + function menu() { foreach ($this->_mods as $mod) { @@ -92,6 +95,9 @@ class XOrgHook } } + // }}} + // {{{ function subscribe + function subscribe($forlife, $uid, $promo, $pass) { foreach ($this->_mods as $mod) { @@ -101,6 +107,20 @@ class XOrgHook } // }}} + // {{{ function prefs + + function prefs() + { + $res = Array(); + foreach ($this->_mods as $mod) { + if (!function_exists($mod.'_prefs')) continue; + $res = array_merge($res, call_user_func($mod.'_prefs')); + } + usort($res, create_function('$a, $b', 'return strcmp($a["weight"], $b["weight"]);')); + return $res; + } + + // }}} } // }}} diff --git a/plugins/modifier.glob.php b/plugins/modifier.glob.php deleted file mode 100644 index c06b985..0000000 --- a/plugins/modifier.glob.php +++ /dev/null @@ -1,36 +0,0 @@ -root.'/templates/'.$string); -} - -// }}} - -?> diff --git a/templates/preferences.tpl b/templates/preferences.tpl index 38c8570..f555359 100644 --- a/templates/preferences.tpl +++ b/templates/preferences.tpl @@ -28,12 +28,13 @@ Configuration des différents services du site - {foreach from="preferences.tpl.d/*.tpl"|glob item=inc key=id name=glob} + {foreach from=$prefs item=pref key=id name=glob} {if $id is even} - {/if} + {/if} - {include file=$inc} +

{$pref.title}

+
{$pref.text|smarty:nodefaults}
{if $id is even && $smarty.foreach.glob.last} diff --git a/templates/preferences.tpl.d/10.mails.tpl b/templates/preferences.tpl.d/10.mails.tpl deleted file mode 100644 index d94448a..0000000 --- a/templates/preferences.tpl.d/10.mails.tpl +++ /dev/null @@ -1,26 +0,0 @@ -{*************************************************************************** - * 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 * - ***************************************************************************} - -

Mes adresses de redirection

-
- Tu peux configurer tes différentes redirections de mails ici. -
- -{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/preferences.tpl.d/20.alias.tpl b/templates/preferences.tpl.d/20.alias.tpl deleted file mode 100644 index 3e891a4..0000000 --- a/templates/preferences.tpl.d/20.alias.tpl +++ /dev/null @@ -1,28 +0,0 @@ -{*************************************************************************** - * 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 * - ***************************************************************************} - -{if #globals.mail.alias_dom#} -

Mon alias mail {#globals.mail.alias_dom#}

-
- Pour choisir un alias {#globals.mail.alias_dom#} et {#globals.mail.alias_dom2#} (en choisir un nouveau annule l'ancien). -
-{/if} - -{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/preferences.tpl.d/30.mailformat.tpl b/templates/preferences.tpl.d/30.mailformat.tpl deleted file mode 100644 index bab457c..0000000 --- a/templates/preferences.tpl.d/30.mailformat.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{*************************************************************************** - * 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 * - ***************************************************************************} - -{if $smarty.session.mail_fmt eq 'texte'} -

Recevoir les mails en format HTML

-{else} -

Recevoir les mails en format texte

-{/if} -
- Les mails envoyés par le site (lettre mensuelle, carnet, ...) le sont de préférence en format {$smarty.session.mail_fmt}. -
- -{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/preferences.tpl.d/80.webredirect.tpl b/templates/preferences.tpl.d/80.webredirect.tpl deleted file mode 100644 index 31b499b..0000000 --- a/templates/preferences.tpl.d/80.webredirect.tpl +++ /dev/null @@ -1,28 +0,0 @@ -{*************************************************************************** - * 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 * - ***************************************************************************} - -

Ma redirection de page WEB

-
- Tu peux configurer tes redirections WEB - http://www.carva.org/{$smarty.session.bestalias} - et http://www.carva.org/{$smarty.session.forlife} -
- -{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/preferences.tpl.d/90.skin.tpl b/templates/preferences.tpl.d/90.skin.tpl deleted file mode 100644 index ac09516..0000000 --- a/templates/preferences.tpl.d/90.skin.tpl +++ /dev/null @@ -1,28 +0,0 @@ -{*************************************************************************** - * 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 * - ***************************************************************************} - -{if #globals.skin.enable#} -

Apparence du site (skins)

-
- Tu peux changer les couleurs et les images du site. -
-{/if} - -{* vim:set et sw=2 sts=2 sws=2: *}