From: Florent Bruneau Date: Fri, 4 Jul 2008 20:24:07 +0000 (+0200) Subject: Can define the suffix to use in the tree for both read and unread messages. X-Git-Tag: 1.8.1~4 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=c254ab487126564b7111ce8a0026192dedec9b16;hp=fdee5f352e1a08e3003a9b847236816ebe7cc51a;p=banana.git Can define the suffix to use in the tree for both read and unread messages. Signed-off-by: Florent Bruneau --- diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index 1311029..a419909 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -37,6 +37,10 @@ class Banana static public $spool_tmax = 10; static public $spool_boxlist = true; +### Tree options ### + static public $tree_read = ''; + static public $tree_unread = 'r'; + ### Message processing ### static public $msgparse_headers = array('content-disposition', 'content-transfer-encoding', 'content-type', 'content-id', 'date', 'followup-to', diff --git a/banana/tree.inc.php b/banana/tree.inc.php index 703f200..6a3d1cc 100644 --- a/banana/tree.inc.php +++ b/banana/tree.inc.php @@ -88,6 +88,21 @@ class BananaTree file_put_contents(BananaTree::filename($id), serialize($this)); } + /** Create a reference to a tree image. + */ + static private function makeTreeImg($img, $alt) + { + return Banana::$page->makeImg(Array('img' => $img, 'alt' => $alt, 'height' => 18, 'width' => 14)); + } + + /** Add an entry to the static tree association table. + */ + static private function addTreeKind(array& $tree, $ascii, $img) + { + $tree[$ascii] = array(self::makeTreeImg($img . Banana::$tree_unread, $ascii), + self::makeTreeImg($img . Banana::$tree_read, $ascii)); + } + /** Return html to display the tree */ public function &show() @@ -98,18 +113,13 @@ class BananaTree static $t_e, $tree; //$u_h, $u_ht, $u_vt, $u_l, $u_f, $r_h, $r_ht, $r_vt, $r_l, $r_f; if (!isset($t_e)) { + $t_e = self::makeTreeImg('e', ' '); $tree = array(); - $t_e = Banana::$page->makeImg(Array('img' => 'e', 'alt' => ' ', 'height' => 18, 'width' => 14)); - $tree['+'] = array(Banana::$page->makeImg(Array('img' => 'p2', 'alt' => '-', 'height' => 18, 'width' => 14)), - Banana::$page->makeImg(Array('img' => 'p2r', 'alt' => '+', 'height' => 18, 'width' => 14))); - $tree['-'] = array(Banana::$page->makeImg(Array('img' => 'm2', 'alt' => '-', 'height' => 18, 'width' => 14)), - Banana::$page->makeImg(Array('img' => 'm2r', 'alt' => '-', 'height' => 18, 'width' => 14))); - $tree['|'] = array(Banana::$page->makeImg(Array('img' => 'l2', 'alt' => '|', 'height' => 18, 'width' => 14)), - Banana::$page->makeImg(Array('img' => 'l2r', 'alt' => '|', 'height' => 18, 'width' => 14))); - $tree['`'] = array(Banana::$page->makeImg(Array('img' => 'a2', 'alt' => '`', 'height' => 18, 'width' => 14)), - Banana::$page->makeImg(Array('img' => 'a2r', 'alt' => '`', 'height' => 18, 'width' => 14))); - $tree['t'] = array(Banana::$page->makeImg(Array('img' => 't2', 'alt' => 't', 'height' => 18, 'width' => 14)), - Banana::$page->makeImg(Array('img' => 't2r', 'alt' => 't', 'height' => 18, 'width' => 14))); + self::addTreeKind($tree, '+', 'p2'); + self::addTreeKind($tree, '-', 'm2'); + self::addTreeKind($tree, '|', 'l2'); + self::addTreeKind($tree, '`', 'a2'); + self::addTreeKind($tree, 't', 't2'); } $text = '
'; foreach ($this->data as &$line) {