- $overview =& $this->overview[$_id];
- if ($_index + $overview->desc < $_first || $_index > $_last) {
- return '';
- }
-
- $res = '';
- if ($_index >= $_first) {
- $hc = empty($overview->children);
-
- $res .= '<tr id="'.$_pfx_id.$_id.'" class="' . ($_index%2 ? 'pair' : 'impair') . ($overview->isread ? '' : ' new') . "\">\n";
- $res .= '<td class="date">' . $this->formatDate($overview->date) . " </td>\n";
- $res .= '<td class="subj' . ($_index == $_ref ? ' cur' : '') . '"><div class="tree">'
- . $_pfx_node .($hc ? ($_head ? $spfx_f : ($overview->parent_direct ? $spfx_s : $spfx_snd)) : $spfx_n)
- . '</div>';
- $popup = $subject = $overview->subject;
- if (function_exists('hook_formatDisplayHeader')) {
- list($subject, $link) = hook_formatDisplayHeader('subject', $subject, true);
- } else {
- $subject = banana_catchFormats(banana_entities(stripslashes($subject)));
- $link = null;
- }
- if (empty($subject)) {
- $subject = _b_('(pas de sujet)');
- }
- if ($_index != $_ref) {
- $subject = Banana::$page->makeLink(Array('group' => $this->group, 'artid' => $_id,
- 'text' => $subject, 'popup' => $popup));
- }
- $res .= ' ' . $subject . $link;
- $res .= "</td>\n<td class='from'>" . BananaMessage::formatFrom($overview->from) . "</td>\n</tr>";
-
- if ($hc) {
- return $res;
- }
- }
-
- $_index ++;
- $children = $overview->children;
- while ($child = array_shift($children)) {
- $overview =& $this->overview[$child];
- if ($_index > $_last) {
- return $res;
- }
- if ($_index + $overview->desc >= $_first) {
- if (sizeof($children)) {
- $res .= $this->_to_html($child, $_index, $_first, $_last, $_ref,
- $_pfx_end . ($overview->parent_direct ? $spfx_T : $spfx_Tnd),
- $_pfx_end . $spfx_I, false,$_id.'_');
- } else {
- $res .= $this->_to_html($child, $_index, $_first, $_last, $_ref,
- $_pfx_end . ($overview->parent_direct ? $spfx_L : $spfx_Lnd),
- $_pfx_end . $spfx_e, false,$_id.'_');
- }
- }
- $_index += $overview->desc;
- }
-
- return $res;
- }
-
- /** Displays overview
- * @param $_first INTEGER MSGNUM of first post
- * @param $_last INTEGER MSGNUM of last post
- * @param $_ref STRING MSGNUM of current/selectionned post
- */
- public function toHtml($first = 0, $overview = false)
- {
- $res = Banana::$page->makeJs('jquery');
- $res .= Banana::$page->makeJs('spool_toggle');
-
- if (!$overview) {
- $_first = $first;
- $_last = $first + Banana::$spool_tmax - 1;
- $_ref = null;
- } else {
- $_ref = $this->getNdx($first);
- $_last = $_ref + Banana::$spool_tafter;
- $_first = $_ref - Banana::$spool_tbefore;
- if ($_first < 0) {
- $_last -= $_first;
- }
- }
- $index = 1;
- foreach ($this->roots as $id) {
- $res .= $this->_to_html($id, $index, $_first, $_last, $_ref);
- $index += $this->overview[$id]->desc ;
- if ($index > $_last) {
- break;
- }
- }
- return $res;
- }
-
-
- public function _buildTree($id, BananaSpoolHead &$head, $current) {