Added support for ML archives for PlWizard powered banana
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 2 Nov 2007 16:25:00 +0000 (17:25 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 2 Nov 2007 16:25:00 +0000 (17:25 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
include/banana/hooks.inc.php
include/banana/ml.inc.php

index ef22186..4810703 100644 (file)
@@ -272,9 +272,15 @@ 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();
     }
 
@@ -284,13 +290,9 @@ class PlatalBananaPage extends BananaPage
         global $wiz, $page;
         $wiz = new PlWizard('Banana', 'core/plwizard.tpl', true, false);
         foreach ($this->pages as $name=>&$mpage) {
-            if ($text == 'profile') {
-                $wiz->addPage('BananaProfile', $mpage['text'], $name);
-            } else {
-                $wiz->addPage('BananaHandler', $mpage['text'], $name);
-            }
+            $wiz->addPage($this->handler, $mpage['text'], $name);
         }
-        $wiz->apply($page, 'banana', $this->page);
+        $wiz->apply($page, $this->base, $this->page);
         return $tpl;
     }
 }
index 1d72b5d..5370476 100644 (file)
 require_once 'banana/banana.inc.php';
 require_once 'banana/hooks.inc.php';
 
+class PlatalBananaMLPage extends PlatalBananaPage
+{
+    public function __construct()
+    {
+        parent::__construct();
+        global $platal;
+        $this->handler = 'BananaMLHandler';
+        $this->base    = $platal->pl_self(1);
+    }
+}
+
+class BananaMLHandler extends BananaHandler
+{
+    public function template()
+    {
+        return 'lists/archives.tpl';
+    }
+}
+
 class MLBanana extends Banana
 {
     static public $listname;
@@ -47,7 +66,7 @@ class MLBanana extends Banana
         MLBanana::$listname = $params['listname'];
         MLBanana::$domain   = $params['domain'];
         $params['group'] = $params['listname'] . '@' . $params['domain'];
-        parent::__construct($params, 'MLArchive');
+        parent::__construct($params, 'MLArchive', 'PlatalBananaMLPage');
     }
 
     public function run()