* @param $_pfx_node STRING prefix used for current node
* @param $_pfx_end STRING prefix used for children of current node
* @param $_head BOOLEAN true if first post in thread
+ *
+ * If you want to analyse subject, you can define the function hook_getSubject(&$subject) which
+ * take the subject as a reference parameter, transform this subject to be displaid in the spool
+ * view and return a string. This string will be put after the subject.
*/
function _to_html($_id, $_index, $_first=0, $_last=0, $_ref="", $_pfx_node="", $_pfx_end="", $_head=true)
{
- $spfx_f = '<img src="img/k1.gif" height="21" width="9" alt="o" />';
- $spfx_n = '<img src="img/k2.gif" height="21" width="9" alt="*" />';
- $spfx_Tnd = '<img src="img/T-direct.gif" height="21" width="12" alt="+" />';
- $spfx_Lnd = '<img src="img/L-direct.gif" height="21" width="12" alt="`" />';
- $spfx_snd = '<img src="img/s-direct.gif" height="21" width="5" alt="-" />';
- $spfx_T = '<img src="img/T.gif" height="21" width="12" alt="+" />';
- $spfx_L = '<img src="img/L.gif" height="21" width="12" alt="`" />';
- $spfx_s = '<img src="img/s.gif" height="21" width="5" alt="-" />';
- $spfx_e = '<img src="img/e.gif" height="21" width="12" alt=" " />';
- $spfx_I = '<img src="img/I.gif" height="21" width="12"alt="|" />';
+ $spfx_f = makeImg('k1.gif', 'o', 21, 9);
+ $spfx_n = makeImg('k2.gif', '*', 21, 9);
+ $spfx_Tnd = makeImg('T-direct.gif', '+', 21, 12);
+ $spfx_Lnd = makeImg('L-direct.gif', '`', 21, 12);
+ $spfx_snd = makeImg('s-direct.gif', '-', 21, 5);
+ $spfx_T = makeImg('T.gif', '+', 21, 12);
+ $spfx_L = makeImg('L.gif', '`', 21, 12);
+ $spfx_s = makeImg('s.gif', '-', 21, 5);
+ $spfx_e = makeImg('e.gif', ' ', 21, 12);
+ $spfx_I = makeImg('I.gif', '|', 21, 12);
if ($_index + $this->overview[$_id]->desc < $_first || $_index > $_last) {
return;
if (strlen($subject) == 0) {
$subject = _b_('(pas de sujet)');
}
+ $link = null;
+ if (function_exists('hook_getSubject')) {
+ $link = hook_getSubject($subject);
+ }
+ $subject = formatPlainText(htmlentities($subject));
if ($_index == $_ref) {
- $res .= '<span class="cur">'.htmlentities($subject).'</span>';
+ $res .= '<span class="cur">' . $subject . $link . '</span>';
} else {
$res .= makeHREF(Array('group' => $this->group,
'artid' => $_id),
- htmlentities($subject));
+ $subject,
+ $subject)
+ . $link;
}
$res .= "</td>\n<td class='from'>".formatFrom($this->overview[$_id]->from)."</td>\n</tr>";
{
$res = '<table class="bicol banana_thread" cellpadding="0" cellspacing="0">';
+ $new = '<div class="banana_action">'
+ . makeImgLink(Array('group' => $this->group,
+ 'action' => 'new'),
+ 'post.gif',
+ _b_('Nouveau message'));
+ $new .= '</div>';
+
if (is_null($_ref)) {
- $res .= '<tr><th>'._b_('Date').'</th>';
- $res .= '<th>'._b_('Sujet').'</th>';
- $res .= '<th>'._b_('Auteur').'</th></tr>';
+ $res .= '<tr><th>' . _b_('Date') . '</th>';
+ $res .= '<th>' . $new . _b_('Sujet') . '</th>';
+ $res .= '<th>' . _b_('Auteur') . '</th></tr>';
+ } else {
+ $res .= '<tr><th colspan="3">' . _b_('Aperçu de ')
+ . makeHREF(Array('group' => $this->group),
+ $this->group)
+ . '</th></tr>';
}
$index = 1;
$res .= '<tr><td colspan="3">'._b_('Aucun message dans ce forum').'</td></tr>';
}
+ global $banana;
+ if (is_object($banana->groups)) {
+ $res .= '<tr><td colspan="3" class="subs">'
+ . $banana->groups->to_html()
+ . '</td></tr>';
+ }
return $res .= '</table>';
}
}
return $ndx;
}
+
+ /** Return root message of the given thread
+ * @param id INTEGER id of a message
+ */
+ function root($id)
+ {
+ $id_cur = $id;
+ while (true) {
+ $id_parent = $this->overview[$id_cur]->parent;
+ if (is_null($id_parent)) break;
+ $id_cur = $id_parent;
+ }
+ return $id_cur;
+ }
+
+ /** Returns previous thread root index
+ * @param id INTEGER message number
+ */
+ function prevThread($id)
+ {
+ $root = $this->root($id);
+ $last = null;
+ foreach ($this->roots as $i) {
+ if ($i == $root) {
+ return $last;
+ }
+ $last = $i;
+ }
+ return $last;
+ }
+
+ /** Returns next thread root index
+ * @param id INTEGER message number
+ */
+ function nextThread($id)
+ {
+ $root = $this->root($id);
+ $ok = false;
+ foreach ($this->roots as $i) {
+ if ($ok) {
+ return $i;
+ }
+ if ($i == $root) {
+ $ok = true;
+ }
+ }
+ return null;
+ }
+
+ /** Return prev post in the thread
+ * @param id INTEGER message number
+ */
+ function prevPost($id)
+ {
+ $parent = $this->overview[$id]->parent;
+ if (is_null($parent)) {
+ return null;
+ }
+ $last = $parent;
+ foreach ($this->overview[$parent]->children as $child) {
+ if ($child == $id) {
+ return $last;
+ }
+ $last = $child;
+ }
+ return null;
+ }
+
+ /** Return next post in the thread
+ * @param id INTEGER message number
+ */
+ function nextPost($id)
+ {
+ if (count($this->overview[$id]->children) != 0) {
+ return $this->overview[$id]->children[0];
+ }
+
+ $cur = $id;
+ while (true) {
+ $parent = $this->overview[$cur]->parent;
+ if (is_null($parent)) {
+ return null;
+ }
+ $ok = false;
+ foreach ($this->overview[$parent]->children as $child) {
+ if ($ok) {
+ return $child;
+ }
+ if ($child == $cur) {
+ $ok = true;
+ }
+ }
+ $cur = $parent;
+ }
+ return null;
+ }
}
// vim:set et sw=4 sts=4 ts=4