Removing hooks from template one by one...
[squirrelmail.git] / templates / default / message_list.tpl
index bb155e86e858e178a89fa0222d8144ca940cb612..73e6345ab93547a9b363d662ea1bcac46d39f468 100644 (file)
@@ -3,21 +3,77 @@
 /**
  * message_list.tpl
  *
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
  * Template for viewing a messages list
  *
+ * The following variables are available in this template:
+//FIXME: need to clean (and document) this list, it is just a dump of the array keys of $t
+ *    $sTemplateID
+ *    $icon_theme_path
+ *    $javascript_on
+ *    $delayed_errors
+ *    $frames
+ *    $lang
+ *    $page_title
+ *    $header_tags
+ *    $plugin_output
+ *    $header_sent
+ *    $body_tag_js
+ *    $shortBoxName
+ *    $sm_attribute_str
+ *    $frame_top
+ *    $urlMailbox
+ *    $startMessage
+ *    $hide_sm_attributions
+ *    $uri
+ *    $text
+ *    $onclick
+ *    $class
+ *    $id
+ *    $target
+ *    $color
+ *    $form_name
+ *    $form_id
+ *    $page_selector
+ *    $page_selector_max
+ *    $messagesPerPage
+ *    $showall
+ *    $end_msg
+ *    $align
+ *    $iNumberOfMessages
+ *    $aOrder
+ *    $aFormElements
+ *    $sort
+ *    $pageOffset
+ *    $baseurl
+ *    $aMessages
+ *    $trash_folder
+ *    $sent_folder
+ *    $draft_folder
+ *    $thread_link_str
+ *    $php_self
+ *    $mailbox
+ *    $enablesort
+ *    $icon_theme
+ *    $use_icons
+ *    $alt_index_colors
+ *    $fancy_index_highlite
+ *    $compact_paginator
+ *    $aErrors
+ *
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
+ * @subpackage templates
  */
 
-include_once(SM_PATH . 'templates/util_message_list.php');
+/** add required includes */
+include_once(SM_PATH . 'functions/template/message_list_util.php');
 
 /* retrieve the template vars */
 extract($t);
 
-do_hook('mailbox_index_before');
+if (!empty($plugin_output['mailbox_index_before'])) echo $plugin_output['mailbox_index_before'];
 
 /**
  * Calculate string "Viewing message x to y (z total)"
@@ -25,21 +81,21 @@ do_hook('mailbox_index_before');
 $msg_cnt_str = '';
 if ($pageOffset < $end_msg) {
     $msg_cnt_str = sprintf(_("Viewing Messages: %s to %s (%s total)"),
-                    '<b>'.$pageOffset.'</b>', '<b>'.$end_msg.'</b>', $iNumberOfMessages);
+                    '<em>'.$pageOffset.'</em>', '<em>'.$end_msg.'</em>', $iNumberOfMessages);
 } else if ($pageOffset == $end_msg) {
-    $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"), '<b>'.$pageOffset.'</b>', $iNumberOfMessages);
+    $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"), '<em>'.$pageOffset.'</em>', $iNumberOfMessages);
 }
 
 
 
 if (!($sort & SQSORT_THREAD) && $enablesort) {
-    $aSortSupported = array(SQM_COL_SUBJ =>     array(SQSORT_SUBJ_ASC    , SQSORT_SUBJ_DESC),
-                            SQM_COL_DATE =>     array(SQSORT_DATE_ASC    , SQSORT_DATE_DESC),
-                            SQM_COL_INT_DATE => array(SQSORT_INT_DATE_ASC, SQSORT_INT_DATE_DESC),
-                            SQM_COL_FROM =>     array(SQSORT_FROM_ASC    , SQSORT_FROM_DESC),
-                            SQM_COL_TO =>       array(SQSORT_TO_ASC      , SQSORT_TO_DESC),
-                            SQM_COL_CC =>       array(SQSORT_CC_ASC      , SQSORT_CC_DESC),
-                            SQM_COL_SIZE =>     array(SQSORT_SIZE_ASC    , SQSORT_SIZE_DESC));
+    $aSortSupported = array(SQM_COL_SUBJ =>     array(SQSORT_SUBJ_ASC     , SQSORT_SUBJ_DESC),
+                            SQM_COL_DATE =>     array(SQSORT_DATE_DESC    , SQSORT_DATE_ASC),
+                            SQM_COL_INT_DATE => array(SQSORT_INT_DATE_DESC, SQSORT_INT_DATE_ASC),
+                            SQM_COL_FROM =>     array(SQSORT_FROM_ASC     , SQSORT_FROM_DESC),
+                            SQM_COL_TO =>       array(SQSORT_TO_ASC       , SQSORT_TO_DESC),
+                            SQM_COL_CC =>       array(SQSORT_CC_ASC       , SQSORT_CC_DESC),
+                            SQM_COL_SIZE =>     array(SQSORT_SIZE_ASC     , SQSORT_SIZE_DESC));
 } else {
     $aSortSupported = array();
 }
@@ -75,28 +131,30 @@ if (!($javascript_on && $fancy_index_highlite)) {
     }
 }
 
+/**
+ * All icon functionality is now handled through $icon_theme_path.
+ * $icon_theme_path will contain the path to the user-selected theme.  If it is
+ * NULL, the user and/or admin have turned off icons.
+*/
+
 // set this to an empty string to turn off extra
 // highlighting of checked rows
 //
 //$clickedColor = '';
-if (!empty($color[16]))
-    $clickedColor = $color[16];
-else
-    $clickedColor = $color[2];
-
+$clickedColor = (empty($color[16])) ? $color[2] : $color[16];
 
 ?>
-<form id="<?php echo $form_id;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
-<table border="0" width="100%" cellpadding="0" cellspacing="0">
+<div id="message_list">
+<form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
+<table class="table_empty" cellspacing="0">
   <tr>
-    <td>
-    <table width="100%" cellpadding="1"  cellspacing="0" style="border: 1px solid <?php echo $color[0]; ?>">
+   <td>
+    <table class="table_standard" cellspacing="0">
       <tr>
         <td>
-          <table bgcolor="<?php echo $color[4]; ?>" border="0" width="100%" cellpadding="1"  cellspacing="0">
+          <table class="table_empty" cellspacing="0">
             <tr>
-              <td align="<?php echo $align['left']; ?>">
-                <small>
+              <td class="links_paginator">
 <!-- paginator and thread link string -->
                   <?php
                       /**
@@ -105,10 +163,9 @@ else
                       $paginator_str = $this->fetch('paginator.tpl');
                       echo $paginator_str . $thread_link_str ."\n"; ?>
 <!-- end paginator and thread link string -->
-                </small>
               </td>
 <!-- message count string -->
-              <td align="right"><small><?php echo $msg_cnt_str; ?></small></td>
+              <td class="message_count"><?php echo $msg_cnt_str; ?></td>
 <!-- end message count string -->
             </tr>
           </table>
@@ -118,27 +175,28 @@ else
     if (count($aFormElements)) {
 ?>
 <!-- start message list form control -->
-      <tr bgcolor="<?php echo $color[0]; ?>">
+      <tr class="message_list_controls">
         <td>
-          <table border="0" width="100%" cellpadding="1"  cellspacing="0">
+          <table class="table_empty" cellspacing="0">
             <tr>
-              <td align="<?php echo $align['left']; ?>">
-                <small>
+              <td class="message_control_buttons">
 
 <?php
         foreach ($aFormElements as $key => $value) {
             switch ($value[1]) {
             case 'submit':
-                if ($key != 'moveButton') { // add move in a different table cell
+                if ($key != 'moveButton' && $key != 'copyButton' && $key != 'delete' && $key != 'undeleteButton') { // add move in a different table cell
 ?>
-                  <input type="submit" name="<?php echo $key; ?>" value="<?php echo $value[0]; ?>" style="padding: 0px; margin: 0px" />&nbsp;
+                  <input type="submit" name="<?php echo $key; ?>" value="<?php echo $value[0]; ?>" class="message_control_button" />&nbsp;
 <?php
-            }
+                }
                 break;
             case 'checkbox':
+                if ($key != 'bypass_trash') {
 ?>
-                  <input type="checkbox" name="<?php echo $key; ?>" /><?php echo $value[0]; ?>&nbsp;
+                  <input type="checkbox" name="<?php echo $key; ?>" id="<?php echo $key; ?>" /><label for="<?php echo $key; ?>"><?php echo $value[0]; ?></label>&nbsp;
 <?php
+                }
                 break;
             case 'hidden':
                  echo '<input type="hidden" name="'.$key.'" value="'. $value[0]."\">\n";
@@ -147,25 +205,46 @@ else
             }
         }
 ?>
-                </small>
               </td>
-              <td align="<?php echo $align['right']; ?>">
+              <td class="message_control_delete">
 
 
 <?php
-        if (isset($aFormElements['moveButton'])) {
-?>              <small>&nbsp;
-                  <tt>
+        if (isset($aFormElements['delete'])) {
+?>
+                  <input type="submit" name="delete" value="<?php echo $aFormElements['delete'][0]; ?>" class="message_control_button" />&nbsp;
+ <?php
+            if (isset($aFormElements['bypass_trash'])) {
+?>
+                  <input type="checkbox" name="bypass_trash" id="bypass_trash" /><label for="bypass_trash"><?php echo $aFormElements['bypass_trash'][0]; ?></label>&nbsp;
+<?php
+            }
+            if (isset($aFormElements['undeleteButton'])) {
+?>
+                  <input type="submit" name="undeleteButton" value="<?php echo $aFormElements['undeleteButton'][0]; ?>" class="message_control_button" />&nbsp;
+<?php
+            }
+?>
+              </td>
+<?php
+        } // if (isset($aFormElements['delete']))
+        if (isset($aFormElements['moveButton']) || isset($aFormElements['copyButton'])) {
+?>
+              <td class="message_control_move">
                     <select name="targetMailbox">
                        <?php echo $aFormElements['targetMailbox'][0];?>
                     </select>
-                  </tt>
-                  <input type="submit" name="moveButton" value="<?php echo $aFormElements['moveButton'][0]; ?>" style="padding: 0px; margin: 0px" />
-                </small>
+<?php         if (isset($aFormElements['moveButton'])) { ?>
+                  <input type="submit" name="moveButton" value="<?php echo $aFormElements['moveButton'][0]; ?>" class="message_control_button" />
+<?php         }
+              if (isset($aFormElements['copyButton'])) { ?>
+                  <input type="submit" name="copyButton" value="<?php echo $aFormElements['copyButton'][0]; ?>" class="message_control_button" />
+<?php         } ?>
+              </td>
+
 <?php
         } // if (isset($aFormElements['move']))
 ?>
-              </td>
             </tr>
           </table>
         </td>
@@ -176,35 +255,39 @@ else
 ?>
     </table>
 <?php
-    do_hook('mailbox_form_before');
+    //FIXME: no hooks in templates!
+    do_hook('mailbox_form_before', $null);
 ?>
     </td>
   </tr>
-  <tr><td height="5" bgcolor="<?php echo $color[4]; ?>"></td></tr>
+  <tr><td class="spacer"></td></tr>
   <tr>
     <td>
-      <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="<?php echo $color[9]; ?>">
+      <table class="table_messageListWrapper" cellspacing="0">
         <tr>
           <td>
-            <table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="<?php echo $color[5]; ?>">
-              <tr>
-                <td>
+            <table class="table_messageList" cellspacing="0">
 <!-- table header start -->
-                  <tr>
+<?php
+/*
+ * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
+ * rendering this table if we use THEAD and TH tags.  No other browser or platform has
+ * this issue.  We will use TR/TD w/ another CSS class to work around this.
+ */
+?>
+              <tr class="headerRow">
 <?php
     $aWidth = calcMessageListColumnWidth($aOrder);
     foreach($aOrder as $iCol) {
-
 ?>
-                    <td align="<?php echo $align['left']; ?>" width="<?php echo $aWidth[$iCol]; ?>%" style="white-space:nowrap">
-                        <b>
+                    <td style="width:<?php echo $aWidth[$iCol]; ?>%">
 <?php
         switch ($iCol) {
           case SQM_COL_CHECK:
               if ($javascript_on) {
-                  echo '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_id."',".$fancy_index_highlite.",'".$clickedColor.'\');" />';
+                  echo '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_name."',".$fancy_index_highlite.')" />'."\n";
               } else {
-                  $link = $baseurl . "&amp;startMessage=$pageOffset&amp;&amp;checkall=";
+                  $link = $baseurl . "&amp;startMessage=$pageOffset&amp;checkall=";
                   if (sqgetGlobalVar('checkall',$checkall,SQ_GET)) {
                       $link .= ($checkall) ? '0' : '1';
                   } else {
@@ -213,44 +296,52 @@ else
                   echo "<a href=\"$link\">"._("All").'</a>';
               }
               break;
-          case SQM_COL_FROM:       echo _("From");     break;
-          case SQM_COL_DATE:       echo _("Date");     break;
-          case SQM_COL_SUBJ:       echo _("Subject");  break;
-          case SQM_COL_FLAGS:      echo '&nbsp;';       break;
-          case SQM_COL_SIZE:       echo  _("Size");    break;
-          case SQM_COL_PRIO:       echo  '!';          break;
-          case SQM_COL_ATTACHMENT: echo '+';           break;
-          case SQM_COL_INT_DATE:   echo _("Received"); break;
-          case SQM_COL_TO:         echo _("To");       break;
-          case SQM_COL_CC:         echo _("Cc");       break;
-          case SQM_COL_BCC:        echo _("Bcc");      break;
+          case SQM_COL_FROM:       echo _("From")."\n";     break;
+          case SQM_COL_DATE:       echo _("Date")."\n";     break;
+          case SQM_COL_SUBJ:       echo _("Subject")."\n";  break;
+          case SQM_COL_FLAGS:
+                echo getIcon($icon_theme_path, 'msg_new.png', '&nbsp;', _("Message Flags")) . "\n";
+                break;
+          case SQM_COL_SIZE:       echo  _("Size")."\n";    break;
+          case SQM_COL_PRIO:
+                echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
+                break;
+          case SQM_COL_ATTACHMENT:
+                echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
+                break;
+          case SQM_COL_INT_DATE:   echo _("Received")."\n"; break;
+          case SQM_COL_TO:         echo _("To")."\n";       break;
+          case SQM_COL_CC:         echo _("Cc")."\n";       break;
+          case SQM_COL_BCC:        echo _("Bcc")."\n";      break;
           default: break;
         }
         // add the sort buttons
         if (isset($aSortSupported[$iCol])) {
             if ($sort == $aSortSupported[$iCol][0]) {
-               $newsort = $aSortSupported[$iCol][1];
-               $img = 'up_pointer.png';
+                $newsort = $aSortSupported[$iCol][1];
+                $img = 'up_pointer.png';
+                $text_icon = '&#8679;';  // U+21E7 UPWARDS WHITE ARROW
             } else if ($sort == $aSortSupported[$iCol][1]) {
-               $newsort = 0;
-               $img = 'down_pointer.png';
+                $newsort = 0;
+                $img = 'down_pointer.png';
+                $text_icon = '&#8681;'; // U+21E9 DOWNWARDS WHITE ARROW
             } else {
-               $newsort = $aSortSupported[$iCol][0];
-               $img = 'sort_none.png';
+                $newsort = $aSortSupported[$iCol][0];
+                $img = 'sort_none.png';
+                $text_icon = '&#9723;'; // U+25FB WHITE MEDIUM SQUARE
             }
             /* Now that we have everything figured out, show the actual button. */
-            echo " <a href=\"$baseurl&amp;startMessage=1&amp;srt=$newsort\">";
-            echo '<img src="../images/' . $img
-                . '" border="0" width="12" height="10" alt="sort" title="'
-                . _("Click here to change the sorting of the message list") .'" /></a>';
+            echo " <a href=\"$baseurl&amp;startMessage=1&amp;srt=$newsort\" style=\"text-decoration:none\">" .
+                 getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" .
+                 '</a>';
         }
 ?>
-                      </b>
                     </td>
 <?php
     }
 ?>
-                  </tr>
+              </tr>
+<!-- end table header -->
 
 <!-- Message headers start -->
 <?php
@@ -270,7 +361,7 @@ else
                 //$clickedColor = '';
                 $clickedColor = (!empty($color[16])) ? $color[16] : $color[2];
 
-                $checkbox_javascript = ' onClick="this.checked = !this.checked;"';
+                $checkbox_javascript = ' onclick="this.checked = !this.checked;"';
             } else {
                 $checkbox_javascript = '';
             }
@@ -284,30 +375,14 @@ else
 
     $aColumns = $aMsg['columns'];
 
-    /**
-     * Check usage of images for attachments, flags and priority
-     * Aaaaaaaaaah fix me. DO NOT USE the string "None" if you mean FALSE, no icon theme
-     */
-    $bIcons = ($use_icons && $icon_theme) ? true : false;
-
-    /**
-     * Location of icon images
-     */
-    if ($bIcons) {
-        $sImageLocation = SM_PATH . 'images/themes/' . $icon_theme . '/';
-    }
 
     /**
      * Check the flags and set a class var.
      */
     if (isset($aColumns[SQM_COL_FLAGS])) {
         $aFlags = $aColumns[SQM_COL_FLAGS]['value'];
-        if ($bIcons) {
+        $sFlags = getFlagIcon($aFlags, $icon_theme_path);
 
-            $sFlags = getFlagIcon($aFlags, $sImageLocation);
-        } else {
-            $sFlags = getFlagText($aFlags);
-        }
         /* add the flag string to the value index */
         $aColumns[SQM_COL_FLAGS]['value'] = $sFlags;
     }
@@ -315,24 +390,7 @@ else
      * Check the priority column
      */
     if (isset($aColumns[SQM_COL_PRIO])) {
-        /* FIX ME, we should use separate templates for icons */
-        if ($bIcons) {
-            $sValue = '<img src="' . $sImageLocation;
-            switch ($aColumns[SQM_COL_PRIO]['value']) {
-                case 1:
-                case 2:  $sValue .= 'prio_high.png" border="0" height="10" width="5" alt="" /> ' ; break;
-                case 5:  $sValue .= 'prio_low.png" border="0" height="10" width="5" alt="" /> '  ; break;
-                default: $sValue .= 'transparent.png" border="0" width="5" alt="" /> '           ; break;
-            }
-        } else {
-            $sValue = '';
-            switch ($aColumns[SQM_COL_PRIO]['value']) {
-                case 1:
-                case 2: $sValue .= "<font color=\"$color[1]\">!</font>"; break;
-                case 5: $sValue .= "<font color=\"$color[8]\">?</font>"; break;
-                default: break;
-            }
-        }
+        $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
         $aColumns[SQM_COL_PRIO]['value'] = $sValue;
     }
 
@@ -340,42 +398,33 @@ else
      * Check the attachment column
      */
     if (isset($aColumns[SQM_COL_ATTACHMENT])) {
-        /* FIX ME, we should use separate templates for icons */
-        if ($bIcons) {
-            $sValue = '<img src="' . $sImageLocation;
-            $sValue .= ($aColumns[SQM_COL_ATTACHMENT]['value'])
-                    ? 'attach.png" border="0" height="10" width="6" alt=""/>'
-                    : 'transparent.png" border="0" width="6" alt="" />';
-        } else {
-            $sValue = ($aColumns[SQM_COL_ATTACHMENT]['value']) ? '+' : '';
-        }
+        $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path); 
         $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
     }
 
-
-    $bgcolor = $color[4];
-
+       $class = 'even';
     /**
-     * If alternating row colors is set, adapt the bgcolor
+     * If alternating row colors is set, adapt the CSS class
      */
     if (isset($alt_index_colors) && $alt_index_colors) {
         if (!($i % 2)) {
-            if (!isset($color[12])) {
-                $color[12] = '#EAEAEA';
-            }
-            $bgcolor = $color[12];
+               $class = 'odd';
         }
 
     }
-    $bgcolor = (isset($aMsg['row']['color'])) ? $aMsg['row']['color']: $bgcolor;
-    $class = 'msg_row';
+    if (isset($aMsg['row']['color']))
+    {
+       $bgcolor = $aMsg['row']['color'];
+       $class = 'misc'.$i;
+    }
+    else $bgcolor = '';
 
     $row_extra = '';
 
     // this stuff does the auto row highlighting on mouseover
     //
     if ($javascript_on && $fancy_index_highlite) {
-        $row_extra .= ' onmouseover="rowOver(\''.$form_id . "_msg$i','". $mouseoverColor . '\', \'' . $clickedColor . '\');" onmouseout="setPointer(this, ' . $i . ', \'out\', \'' . $bgcolor . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');" onmousedown="setPointer(this, ' . $i . ', \'click\', \'' . $bgcolor . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');"';
+        $row_extra .= ' onmouseover="rowOver(\''.$form_id . '_msg' . $i.'\');" onmouseout="setPointer(this, ' . $i . ', \'out\', \'' . $class . '\', \'mouse_over\', \'clicked\');" onmousedown="setPointer(this, ' . $i . ', \'click\', \'' . $class . '\', \'mouse_over\', \'clicked\');"';
     }
     // this does the auto-checking of the checkbox no matter
     // where on the row you click
@@ -386,21 +435,38 @@ else
         $javascript_auto_click = " onMouseDown=\"row_click('$form_id"."_msg$i')\"";
     }
 
+/*
+ * Message Highlighting requires a unique CSS class declaration for proper
+ * mouseover functionality.  There is no harm in doing this when the mouseover
+ * functionality is disabled
+ */
+if ($class != 'even' && $class != 'odd')
+{
+?>
+<style type="text/css">
+<!--
+.table_messageList     tr.<?php echo $class; ?>        { background:<?php echo $bgcolor; ?> }
+-->
+</style>
+<?php
+}
 ?>
-<tr class="<?php echo $class;?>" valign="top" bgcolor="<?php echo $bgcolor; ?>"<?php echo $row_extra;?>>
+<tr <?php echo (empty($class) ? '' : 'class="'.$class.'" ');  echo $row_extra;?>>
 <?php
     // flag style mumbo jumbo
     $sPre = $sEnd = '';
-    if (!in_array('seen',$aFlags)) {
-        $sPre = '<b>'; $sEnd = '</b>';
-    }
-    if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
-        $sPre = "<font color=\"$color[9]\">" . $sPre;
-        $sEnd .= '</font>';
-    } else {
-        if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
-            $sPre = "<font color=\"$color[2]\">" . $sPre;
-            $sEnd .= '</font>';
+    if (isset($aColumns[SQM_COL_FLAGS])) {
+        if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
+            $sPre = '<span class="unread">'; $sEnd = '</span>';
+        }
+        if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
+            $sPre = '<span class="deleted">' . $sPre;
+            $sEnd .= '</span>';
+        } else {
+            if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
+                $sPre = '<span class="flagged">' . $sPre;
+                $sEnd .= '</span>';
+            }
         }
     }
     /**
@@ -408,18 +474,21 @@ else
      * we have to do some php coding to display the columns in the right order
      */
     foreach ($aOrder as $iCol) {
-        if (in_array($index_order_part, $show_label_columns)) {
-            $sLabelStart = '<label for="msg[' . $i . ']">';
+        if (in_array($iCol, $show_label_columns)) {
+            $sLabelStart = '<label for="'.$form_id."_msg$i\">";
             $sLabelEnd = '</label>';
         } else {
             $sLabelStart = '';
             $sLabelEnd = '';
         }
-        $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : '';
-        $title  = (isset($aCol['title']))  ? $aCol['title']  : '';
-        $link   = (isset($aCol['link']))   ? $aCol['link']   : '';
-        $value  = (isset($aCol['value']))  ? $aCol['value']  : '';
-        $target = (isset($aCol['target'])) ? $aCol['target'] : '';
+        $aCol       = (isset($aColumns[$iCol]))    ? $aColumns[$iCol]    : array();
+        $title      = (isset($aCol['title']))      ? $aCol['title']      : '';
+        $link       = (isset($aCol['link']))       ? $aCol['link']       : '';
+        $link_extra = (isset($aCol['link_extra'])) ? $aCol['link_extra'] : '';
+        $onclick    = (isset($aCol['onclick']))    ? $aCol['onclick']    : '';
+        $link       = (isset($aCol['link']))       ? $aCol['link']       : '';
+        $value      = (isset($aCol['value']))      ? $aCol['value']      : '';
+        $target     = (isset($aCol['target']))     ? $aCol['target']     : '';
         if ($iCol !== SQM_COL_CHECK) {
             $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
         }
@@ -427,22 +496,30 @@ else
 
         switch ($iCol) {
           case SQM_COL_CHECK:
-            echo '<td align="' .$align['left'] .'"'. $javascript_auto_click. ' bgcolor="'.$bgcolor.'" style="white-space:nowrap">' ?>
-            <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript;?> /></td>
+            if ($javascript_on) {
+                echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
+                <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript;?> /></td>
             <?php
+            } else {
+                echo '<td class="col_check">';
+                $checked = ($checkall) ? " checked=checked " : " ";
+                echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
+            }
             break;
           case SQM_COL_SUBJ:
             $indent = $aCol['indent'];
-            $sText = "    <td class=\"col_subject\" align=\"$align[left]\" $javascript_auto_click bgcolor=\"$bgcolor\">";
+            $sText = "    <td class=\"col_subject\" $javascript_auto_click>";
             if ($align['left'] == 'left') {
                 $sText .= str_repeat('&nbsp;&nbsp;',$indent);
             }
             $sText .= "<a href=\"$link\"";
-            if ($target) { $sText .= " target=\"$target\"";}
-            if ($title)  { $sText .= " title=\"$title\""  ;}
+            if ($target)     { $sText .= " target=\"$target\"";   }
+            if ($title)      { $sText .= " title=\"$title\"";     }
+            if ($onclick)    { $sText .= " onclick=\"$onclick\""; }
+            if ($link_extra) { $sText .= " $link_extra";          }
             if ($javascript_on && $fancy_index_highlite) {
                   $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
-                            'parentNode.parentNode, ' . $i . ', \'click\', \'' . $bgcolor . '\', \'' . $mouseoverColor . '\', \'' .
+                            'parentNode.parentNode, ' . $i . ', \'click\', \''. $class. '\', \'mouse_over\', \'' .
                              $clickedColor .'\');"';
             }
             $sText .= ">";
@@ -454,18 +531,18 @@ else
             break;
           case SQM_COL_SIZE:
           case SQM_COL_FLAGS:
-            $sText = "    <td class=\"col_flags\" align=\"$align[right]\" $javascript_auto_click bgcolor=\"$bgcolor\" style=\"white-space:nowrap\">";
-            $sText .= "<small>$value</small></td>\n";
+            $sText = "    <td class=\"col_flags\" $javascript_auto_click>";
+            $sText .= "$value</td>\n";
             echo $sText;
             break;
           case SQM_COL_INT_DATE:
           case SQM_COL_DATE:
-            $sText = "    <td class=\"col_date\" align=\"center\" $javascript_auto_click  bgcolor=\"$bgcolor\" style=\"white-space:nowrap\">";
+            $sText = "    <td class=\"col_date\" $javascript_auto_click>";
             $sText .= $value. "</td>\n";
             echo $sText;
             break;
           default:
-            $sText = "    <td class=\"col_text\" align=\"$align[left]\" style=\"white-space:nowrap\" $javascript_auto_click bgcolor=\"$bgcolor\"";
+            $sText = "    <td class=\"col_text\" $javascript_auto_click";
             if ($link) {
                 $sText .= "><a href=\"$link\"";
                 if ($target) { $sText .= " target=\"$target\"";}
@@ -484,7 +561,7 @@ else
 ?>
                   </tr>
 <?php
-            $sLine = "<tr><td colspan=\"$iColCnt\" height=\"1\" bgcolor=\"$color[0]\"></td></tr>";
+            $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
             ++$i;
 
 /*
@@ -500,16 +577,16 @@ else
           </table>
         </td>
       </tr>
-      <tr><td height="5" bgcolor="<?php echo $color[4]; ?>" colspan="1"></td></tr>
+      <tr><td class="spacer"></td></tr>
       <tr>
         <td>
-          <table width="100%" cellpadding="1"  cellspacing="0" style="border: 1px solid <?php echo $color[0]; ?>">
+          <table class="table_standard" cellspacing="0">
             <tr>
               <td>
-                <table bgcolor="<?php echo $color[4]; ?>" border="0" width="100%" cellpadding="1"  cellspacing="0">
+                <table class="table_empty" cellspacing="0">
                   <tr>
-                    <td align="left"><small><?php echo $paginator_str; ?></small></td>
-                    <td align="right"><small><?php echo $msg_cnt_str; ?></small></td>
+                    <td class="links_paginator"><?php echo $paginator_str; ?></td>
+                    <td class="message_count"><?php echo $msg_cnt_str; ?></td>
                   </tr>
                 </table>
               </td>
@@ -519,8 +596,9 @@ else
       </tr>
       <tr>
         <td>
-        <?php do_hook('mailbox_index_after');?>
+        <?php /* FIXME: no hooks in templates!! */ do_hook('mailbox_index_after', $null); ?>
         </td>
       </tr>
     </table>
 </form>
+</div>