From: x2003bruneau Date: Thu, 1 Mar 2007 21:44:23 +0000 (+0000) Subject: Can read the forum of the group directly from Xnet X-Git-Tag: xorg/0.9.14~247 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;ds=sidebyside;h=4f355064724a95757bb5ca023f1da9950a04013d;p=platal.git Can read the forum of the group directly from Xnet git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1535 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/ChangeLog b/ChangeLog index 8a8b6fd..6e9f58e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,9 @@ New: * Search: - Search Engine IE7 compatible -FRU + * Xnetgrp: + - Direct access to the group forum (if exists) -FRU + Bug/Wish: * Banana: diff --git a/htdocs/css/keynote.css b/htdocs/css/keynote.css index 7d7a02b..1114d81 100644 --- a/htdocs/css/keynote.css +++ b/htdocs/css/keynote.css @@ -42,6 +42,7 @@ td { vertical-align: top; } li { padding-left: 3px; padding-right: 3px; text-align: justify; } hr { text-align: center; } +dt { font-weight: bold; } fieldset { border-top: 1px solid #fff; @@ -536,7 +537,7 @@ div.adresse { #body-bottom { - border-top: 1px solid #fff; + border-top: 1px solid #aaa; text-align: center; padding: 4px; font-size: 75%; diff --git a/include/banana/forum.inc.php b/include/banana/forum.inc.php index 3061c7a..1abeafb 100644 --- a/include/banana/forum.inc.php +++ b/include/banana/forum.inc.php @@ -96,15 +96,20 @@ class ForumsBanana extends Banana $time, S::i('uid')); } - // Register custom Banana links and tabs - if (!Banana::$profile['autoup']) { - Banana::$page->registerAction('path . '", "updateall", ' . time() . ')\'>' - . 'Marquer tous les messages comme lus' - . '', array('forums', 'thread', 'message')); - } - Banana::$page->registerPage('profile', 'Préférences', null); - + if (!empty($GLOBALS['IS_XNET_SITE'])) { + Banana::$page->killPage('forums'); + Banana::$page->killPage('subscribe'); + Banana::$spool_boxlist = false; + } else { + // Register custom Banana links and tabs + if (!Banana::$profile['autoup']) { + Banana::$page->registerAction('path . '", "updateall", ' . time() . ')\'>' + . 'Marquer tous les messages comme lus' + . '', array('forums', 'thread', 'message')); + } + Banana::$page->registerPage('profile', 'Préférences', null); + } // Run Banana return parent::run(); diff --git a/include/banana/hooks.inc.php b/include/banana/hooks.inc.php index 493e560..fe000d5 100644 --- a/include/banana/hooks.inc.php +++ b/include/banana/hooks.inc.php @@ -125,12 +125,15 @@ function hook_makeImg($img, $alt, $height, $width) return '' . $alt . ''; } +if (!function_exists('hook_makeLink')) { function hook_makeLink($params) { global $globals, $platal; - if (Banana::$protocole->name() == 'NNTP') { + $xnet = !empty($GLOBALS['IS_XNET_SITE']); + $feed = (@$params['action'] == 'rss' || @$params['action'] == 'rss2' || @$params['action'] == 'atom'); + if (Banana::$protocole->name() == 'NNTP' && !$xnet) { $base = $globals->baseurl . '/banana'; - if (@$params['action'] == 'rss' || @$params['action'] == 'rss2' || @$params['action'] == 'atom') { + if ($feed) { return $base . hook_platalRSS(@$params['group']); } if (isset($params['page'])) { @@ -144,9 +147,14 @@ function hook_makeLink($params) return $base; } $base .= '/' . $params['group']; + } else if (Banana::$protocole->name() == 'NNTP' && $xnet) { + if ($feed) { + return 'http://www.polytechnique.org/banana' . hook_platalRSS(@$params['group']); + } + $base = $globals->baseurl . '/' . $platal->ns . 'forum'; } else if (Banana::$protocole->name() == 'MLArchives') { $base = $globals->baseurl . '/' . $platal->ns . 'lists/archives'; - if (@$params['action'] == 'rss' || @$params['action'] == 'rss2' || @$params['action'] == 'atom') { + if ($feed) { return $base . hook_platalRSS(MLBanana::$listname); } $base .= '/' . MLBanana::$listname; @@ -157,6 +165,60 @@ function hook_makeLink($params) } return $base; } +} + +function get_banana_params(array &$get, $group = null, $action = null, $artid = null) +{ + if (!is_null($group)) { + $get['group'] = $group; + } + if (!is_null($action)) { + if ($action == 'new') { + $get['action'] = 'new'; + } elseif (!is_null($artid)) { + $get['artid'] = $artid; + if ($action == 'reply') { + $get['action'] = 'new'; + } elseif ($action == 'cancel') { + $get['action'] = $action; + } elseif ($action == 'from') { + $get['first'] = $artid; + unset($get['artid']); + } elseif ($action == 'read') { + $get['part'] = @$_GET['part']; + } elseif ($action == 'source') { + $get['part'] = 'source'; + } elseif ($action == 'xface') { + $get['part'] = 'xface'; + } elseif ($action) { + $get['part'] = str_replace('.', '/', $action); + } + if (Get::v('action') == 'showext') { + $get['action'] = 'showext'; + } + } + } +} + +function run_banana(&$page, $class, array $args) +{ + $banana = new $class($args); + $page->assign('banana', $banana->run()); + $page->addCssInline($banana->css()); + $page->addCssLink('banana.css'); + $rss = $banana->feed(); + if ($rss) { + if (Banana::$group) { + $page->setRssLink('Banana :: ' . Banana::$group, $rss); + } else { + $page->setRssLink('Banana :: Abonnements', $rss); + } + } + $bt = $banana->backtrace(); + if ($bt) { + new PlBacktrace(Banana::$protocole->name(), $banana->backtrace(), 'response', 'time'); + } +} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?> diff --git a/include/banana/moderate.inc.php b/include/banana/moderate.inc.php index e4c03af..2c743ac 100644 --- a/include/banana/moderate.inc.php +++ b/include/banana/moderate.inc.php @@ -56,10 +56,10 @@ class ModerationBanana extends Banana static public $domain; static public $client; - function __construct($params = null, &$client) + function __construct($params = null) { global $globals; - ModerationBanana::$client = $client; + ModerationBanana::$client = $params['client']; ModerationBanana::$listname = $params['listname']; ModerationBanana::$domain = isset($params['domain']) ? $params['domain'] : $globals->mail->domain; $params['group'] = ModerationBanana::$listname . '@' . ModerationBanana::$domain; diff --git a/include/xnet/page.inc.php b/include/xnet/page.inc.php index 8e19fa2..2874af8 100644 --- a/include/xnet/page.inc.php +++ b/include/xnet/page.inc.php @@ -82,8 +82,13 @@ class XnetPage extends PlatalPage $sub['trombinoscope'] = "$dim/trombi"; $sub['carte'] = "$dim/geoloc"; } - if ((is_member() || may_update()) && $globals->asso('mail_domain')) { - $sub['listes de diffusion'] = "$dim/lists"; + if (is_member() || may_update()) { + if ($globals->asso('forum')) { + $sub['forum'] = "$dim/forum"; + } + if ($globals->asso('mail_domain')) { + $sub['listes de diffusion'] = "$dim/lists"; + } } $sub['événement'] = "$dim/events"; if (may_update() || is_member()) { diff --git a/modules/banana.php b/modules/banana.php index 85f8db7..6a82468 100644 --- a/modules/banana.php +++ b/modules/banana.php @@ -59,37 +59,16 @@ class BananaModule extends PLModule function handler_banana(&$page, $group = null, $action = null, $artid = null) { + $page->changeTpl('banana/index.tpl'); + $page->assign('xorg_title','Polytechnique.org - Forums & PA'); + $get = Array(); - if (!is_null($group)) { - $get['group'] = $group; - } if (Post::has('updateall')) { $get['updateall'] = Post::v('updateall'); } - if (!is_null($action)) { - if ($action == 'new') { - $get['action'] = 'new'; - } elseif (!is_null($artid)) { - $get['artid'] = $artid; - if ($action == 'reply') { - $get['action'] = 'new'; - } elseif ($action == 'cancel') { - $get['action'] = $action; - } elseif ($action == 'from') { - $get['first'] = $artid; - unset($get['artid']); - } elseif ($action == 'read') { - $get['part'] = @$_GET['part']; - } elseif ($action == 'source') { - $get['part'] = 'source'; - } elseif ($action == 'xface') { - $get['part'] = 'xface'; - } elseif ($action) { - $get['part'] = str_replace('.', '/', $action); - } - } - } - return BananaModule::run_banana($page, $get); + require_once 'banana/forum.inc.php'; + get_banana_params($get, $group, $action, $artid); + run_banana($page, 'ForumsBanana', $get); } function handler_profile(&$page, $action = null) @@ -133,7 +112,11 @@ class BananaModule extends PLModule function handler_subscription(&$page) { - return $this->run_banana($page, Array('action' => 'subscribe')); + $page->changeTpl('banana/index.tpl'); + $page->assign('xorg_title','Polytechnique.org - Forums & PA'); + + require_once 'banana/forum.inc.php'; + run_banana($page, 'ForumsBanana', Array('action' => 'subscribe')); } function handler_rss(&$page, $group, $alias, $hash, $file = null) @@ -157,7 +140,7 @@ class BananaModule extends PLModule require_once 'banana/forum.inc.php'; $banana = new ForumsBanana(array('group' => $group, 'action' => 'rss2')); - echo $banana->run(); + $banana->run(); exit; } @@ -167,22 +150,7 @@ class BananaModule extends PLModule $page->assign('xorg_title','Polytechnique.org - Forums & PA'); require_once 'banana/forum.inc.php'; - - $banana = new ForumsBanana($params); - $res = $banana->run(); - $page->assign_by_ref('banana', $banana); - $page->assign('banana_res', $res); - $page->addCssInline($banana->css()); - $page->addCssLink('banana.css'); - $rss = $banana->feed(); - if ($rss) { - if (@$params['group']) { - $page->setRssLink('Banana :: ' . $params['group'], $rss); - } else { - $page->setRssLink('Banana :: Abonnements', $rss); - } - } - new PlBacktrace('NNTP', $banana->backtrace(), 'response', 'time'); + run_banana($page, 'ForumsBanana', $params); } } diff --git a/modules/lists.php b/modules/lists.php index da280b3..cfd66e1 100644 --- a/modules/lists.php +++ b/modules/lists.php @@ -362,42 +362,9 @@ class ListsModule extends PLModule if (Post::has('updateall')) { $get['updateall'] = Post::v('updateall'); } - if (!is_null($action)) { - if ($action == 'new') { - $get['action'] = 'new'; - } elseif (!is_null($artid)) { - $get['artid'] = $artid; - if ($action == 'reply') { - $get['action'] = 'new'; - } elseif ($action == 'cancel') { - $get['action'] = $action; - } elseif ($action == 'from') { - $get['first'] = $artid; - unset($get['artid']); - } elseif ($action == 'read') { - $get['part'] = @$_GET['part']; - } elseif ($action == 'source') { - $get['part'] = 'source'; - } elseif ($action == 'xface') { - $get['part'] = 'xface'; - } elseif ($action) { - $get['part'] = str_replace('.', '/', $action); - } - if (Get::v('action') == 'showext') { - $get['action'] = 'showext'; - } - } - } - require_once('banana/ml.inc.php'); - $banana = new MLBanana($get); - $page->assign('banana', $banana->run()); - $page->addCssInline($banana->css()); - $page->addCssLink('banana.css'); - $rss = $banana->feed(); - if ($rss) { - $page->setRssLink('Banana :: ' . $list, $rss); - } - new PlBacktrace('MBox', $banana->backtrace(), 'response', 'time'); + require_once 'banana/ml.inc.php'; + get_banana_params($get, null, $action, $artid); + run_banana($page, 'MLBanana', $get); } else { $page->kill("La liste n'existe pas ou tu n'as pas le droit de la consulter"); } @@ -426,7 +393,7 @@ class ListsModule extends PLModule } require_once('banana/ml.inc.php'); $banana = new MLBanana(Array('listname' => $liste, 'domain' => $domain, 'action' => 'rss2')); - echo $banana->run(); + $banana->run(); } exit; } @@ -503,12 +470,12 @@ class ListsModule extends PLModule } } elseif (Env::has('mid')) { if (Get::has('mid') && !Env::has('mok') && !Env::has('mdel')) { + $page->changeTpl('lists/moderate_mail.tpl'); require_once('banana/moderate.inc.php'); $params = array('listname' => $liste, 'domain' => $domain, 'artid' => Get::i('mid'), 'part' => Get::v('part'), 'action' => Get::v('action')); - $banana = new ModerationBanana($params, $this->client); - $res = $banana->run(); - $page->addCssInline($banana->css()); + $params['client'] = $this->client; + run_banana($page, 'ModerationBanana', $params); $msg = file_get_contents('/etc/mailman/fr/refuse.txt'); $msg = str_replace("%(adminaddr)s", "$liste-owner@{$domain}", $msg); @@ -516,10 +483,6 @@ class ListsModule extends PLModule $msg = str_replace("%(reason)s", "<< TON EXPLICATION >>", $msg); $msg = str_replace("%(listname)s", $liste, $msg); $page->assign('msg', $msg); - - $page->addCssLink('banana.css'); - $this->changeTpl('lists/moderate_mail.tpl'); - $page->assign_by_ref('mail', $res); return; } diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index 2383b30..f340068 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -78,6 +78,7 @@ class XnetGrpModule extends PLModule '%grp/logo' => $this->make_hook('logo', AUTH_PUBLIC), '%grp/edit' => $this->make_hook('edit', AUTH_MDP), '%grp/mail' => $this->make_hook('mail', AUTH_MDP), + '%grp/forum' => $this->make_hook('forum', AUTH_MDP), '%grp/annuaire' => $this->make_hook('annuaire', AUTH_MDP), '%grp/annuaire/vcard' => $this->make_hook('vcard', AUTH_MDP), '%grp/trombi' => $this->make_hook('trombi', AUTH_MDP), @@ -294,6 +295,19 @@ class XnetGrpModule extends PLModule } } + function handler_forum(&$page, $group = null, $artid = null) + { + global $globals; + new_group_page('xnetgrp/forum.tpl'); + if (!$globals->asso('forum')) { + return PL_NOT_FOUND; + } + require_once 'banana/forum.inc.php'; + $get = array(); + get_banana_params($get, $globals->asso('forum'), $group, $artid); + run_banana($page, 'ForumsBanana', $get); + } + function handler_annuaire(&$page) { global $globals; diff --git a/templates/banana/index.tpl b/templates/banana/index.tpl index 7581b47..153cf7a 100644 --- a/templates/banana/index.tpl +++ b/templates/banana/index.tpl @@ -21,6 +21,6 @@ {**************************************************************************}
-{$banana_res|smarty:nodefaults} +{$banana|smarty:nodefaults} {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/templates/lists/moderate_mail.tpl b/templates/lists/moderate_mail.tpl index fbe7b64..216fd94 100644 --- a/templates/lists/moderate_mail.tpl +++ b/templates/lists/moderate_mail.tpl @@ -26,7 +26,7 @@ Contenu du mail en attente -{$mail|smarty:nodefaults} +{$banana|smarty:nodefaults}
diff --git a/templates/xnetgrp/asso.tpl b/templates/xnetgrp/asso.tpl index be5194f..7750a7a 100644 --- a/templates/xnetgrp/asso.tpl +++ b/templates/xnetgrp/asso.tpl @@ -53,7 +53,7 @@ Forum: diff --git a/templates/xnetgrp/forum.tpl b/templates/xnetgrp/forum.tpl new file mode 100644 index 0000000..3108c63 --- /dev/null +++ b/templates/xnetgrp/forum.tpl @@ -0,0 +1,33 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2007 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 *} +{* *} +{**************************************************************************} + +

{$asso.nom} : Forum

+ +{$banana|smarty:nodefaults} + +

+ Cette page utiliser les préférences de Polytechnique.org.
+ Tu peux également retrouver tous les forums en te rendant à la rubrique + Forums & PA +

+ +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
- par le web + par le web ou par nntp