X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fbanana%2Fhooks.inc.php;h=d8cd9f1ea30fd5e0fee9f4cea20492daa5499a80;hb=e0ee31204dbb8e43870716190e4549257416fcb8;hp=ed55ec035ea19b2fdaa0a1b18bb400506b15f441;hpb=45319df1e1765047535c950a525c76fbeda48df0;p=platal.git diff --git a/include/banana/hooks.inc.php b/include/banana/hooks.inc.php index ed55ec0..d8cd9f1 100644 --- a/include/banana/hooks.inc.php +++ b/include/banana/hooks.inc.php @@ -1,6 +1,6 @@ addJsLink("$src.js"); + Platal::page()->addJsLink("$src.js"); return ' '; } @@ -222,6 +221,26 @@ function make_Organization() function get_banana_params(array &$get, $group = null, $action = null, $artid = null) { + if ($group == 'forums') { + $group = null; + } else if ($group == 'thread') { + $group = S::v('banana_group'); + } else if ($group == 'message') { + $action = 'read'; + $group = S::v('banana_group'); + $artid = S::i('banana_artid'); + } else if ($action == 'message') { + $action = 'read'; + $artid = S::i('banana_artid'); + } else if ($group == 'subscribe' || $group == 'subscription') { + $group = null; + $action = null; + $get['action'] = 'subscribe'; + } else if ($group == 'profile') { + $group = null; + $action = null; + $get['action'] = 'profile'; + } if (!is_null($group)) { $get['group'] = $group; } @@ -253,9 +272,57 @@ function get_banana_params(array &$get, $group = null, $action = null, $artid = } } +class PlatalBananaPage extends BananaPage +{ + protected $handler; + protected $base; + + public function __construct() + { + global $platal; + Banana::$withtabs = false; + $this->handler = 'BananaHandler'; + $this->base = $platal->pl_self(0); + parent::__construct(); + } + + protected function prepare() + { + $tpl = parent::prepare(); + global $wiz; + $wiz = new PlWizard('Banana', PlPage::getCoreTpl('plwizard.tpl'), true, false); + foreach ($this->pages as $name=>&$mpage) { + $wiz->addPage($this->handler, $mpage['text'], $name); + } + $wiz->apply(Platal::page(), $this->base, $this->page); + return $tpl; + } +} + +class BananaHandler +{ + public function __construct(PlWizard &$wiz) + { + } + + public function template() + { + return 'banana/index.tpl'; + } + + public function prepare(PlPage &$page, $id) + { + } + + public function process() + { + return PlWizard::CURRENT_PAGE; + } +} + function run_banana(&$page, $class, array $args) { - $banana = new $class(S::v('forlife'), $args); + $banana = new $class(S::user(), $args); $page->assign('banana', $banana->run()); $page->addCssInline($banana->css()); $page->addCssLink('banana.css');