+
+ public function _buildTree($id, BananaSpoolHead &$head, $current) {
+ $style = 'color:' . $head->color . '; text-decoration: none';
+ $prof = 1;
+ if ($id == $current) {
+ $text = "<strong style=\"$style\">0</strong>";
+ } else {
+ $text = Banana::$page->makeLink(Array('group' => $this->group, 'artid' => $id,
+ 'text' => 'o', 'popup' => $head->from,
+ 'style' => $style));
+ }
+ $array = array($text);
+ foreach ($head->children as $key=>&$child) {
+ list($tpr, $tree) = $this->_buildTree($child, $this->overview[$child], $current);
+ $last = $key == count($head->children) - 1;
+ foreach ($tree as $kt=>&$line) {
+ if ($kt == 0 && $key == 0) {
+ $array[0] .= '--' . $line;
+ } else if ($kt == 0 && $last) {
+ $array[] = ' !-' . $line;
+ } else if ($kt == 0) {
+ $array[] = ' |-' . $line;
+ } else if ($last) {
+ $array[] = ' ' . $line;
+ } else {
+ $array[] = ' | ' . $line;
+ }
+ }
+ if ($tpr > $prof) {
+ $prof = $tpr + 1;
+ }
+ }
+ return array($prof, $array);
+ }
+
+ /** build the spool tree associated with the given message
+ */
+ public function buildTree($id) {
+ $pos = $id;
+ $overview =& $this->overview[$id];
+ while (!is_null($overview->parent)) {
+ $pos = $overview->parent;
+ $overview =& $this->overview[$pos];
+ }
+ list($prof, $tree) = $this->_buildTree($pos, $overview, $id);
+ return implode("\n", $tree);
+ }
+