Add message subject in a tooltip in spool view
[banana.git] / banana / spool.inc.php
index 7c70727..d8171fe 100644 (file)
@@ -104,11 +104,15 @@ class BananaSpool
         $this->_readFromFile();
 
         $do_save = false;
-        $first   = $banana->maxspool ? max($groupinfo[2]-$banana->maxspool, $groupinfo[1]) : $groupinfo[1];
-        $last    = $groupinfo[2];        
+        $first   = $banana->maxspool ? max($groupinfo[2] - $banana->maxspool, $groupinfo[1]) : $groupinfo[1];
+        $last    = $groupinfo[2]; 
+
         if ($this->version == BANANA_SPOOL_VERSION && is_array($this->overview)) {
-            if (count($this->overview)) {
-                for ($id = min(array_keys($this->overview)); $id<$first; $id++) { 
+            $mids = array_keys($this->overview);
+            foreach ($mids as $id) {
+                if (($first <= $last && ($id < $first || $id > $last))
+                        || ($first > $last && $id < $first && $id > $last))
+                {
                     $this->delid($id, false);
                     $do_save = true;
                 }
@@ -309,16 +313,16 @@ class BananaSpool
 
     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="&nbsp;" />';
-        $spfx_I   = '<img src="img/I.gif" height="21" width="12"alt="|" />';
+        $spfx_f   = makeImg('k1',       'o', 21, 9)
+        $spfx_n   = makeImg('k2',       '*', 21, 9);
+        $spfx_Tnd = makeImg('T-direct', '+', 21, 12);
+        $spfx_Lnd = makeImg('L-direct', '`', 21, 12);
+        $spfx_snd = makeImg('s-direct', '-', 21, 5);
+        $spfx_T   = makeImg('T',        '+', 21, 12);
+        $spfx_L   = makeImg('L',        '`', 21, 12);
+        $spfx_s   = makeImg('s',        '-', 21, 5);
+        $spfx_e   = makeImg('e',        '&nbsp;', 21, 12);
+        $spfx_I   = makeImg('I',        '|', 21, 12);
 
         if ($_index + $this->overview[$_id]->desc < $_first || $_index > $_last) {
             return;
@@ -342,8 +346,9 @@ class BananaSpool
                 $res .= '<span class="cur">'.htmlentities($subject).'</span>';
             } else {
                 $res .= makeHREF(Array('group' => $this->group,
-                                                                          'artid' => $_id),
-                                                                htmlentities($subject));
+                                       'artid' => $_id),
+                                 htmlentities($subject),
+                                 htmlentities($subject));
             }
             $res .= "</td>\n<td class='from'>".formatFrom($this->overview[$_id]->from)."</td>\n</tr>";
 
@@ -399,6 +404,16 @@ class BananaSpool
             $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>';
+        }
+        $res .= '<tr><th colspan="3" class="subs">'
+             . makeHREF(Array('subscribe' => 1), _b_('GĂ©rer mes abonnements'))
+             . '</th></tr>';
+
         return $res .= '</table>';
     }
 
@@ -434,4 +449,5 @@ class BananaSpool
     }
 }
 
+// vim:set et sw=4 sts=4 ts=4
 ?>