make sure that $aFlags is set. maybe is_array() is needed too.
[squirrelmail.git] / templates / default / message_list.tpl
index e6cf2882fb1b3f94a1872d030c1ff2bef3f870ac..15b47d174d0b179639b10dd4884eddcec530a763 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * message_list.tpl
  *
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Template for viewing a messages list
@@ -12,6 +12,7 @@
  * @package squirrelmail
  */
 
+/** add required includes */
 include_once(SM_PATH . 'templates/util_message_list.php');
 
 /* retrieve the template vars */
@@ -196,13 +197,13 @@ else
     foreach($aOrder as $iCol) {
 
 ?>
-                    <td align="<?php echo $align['left']; ?>" width="<?php echo $aWidth[$iCol]; ?>%" nowrap>
+                    <td align="<?php echo $align['left']; ?>" width="<?php echo $aWidth[$iCol]; ?>%" style="white-space:nowrap">
                         <b>
 <?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_id."',".$fancy_index_highlite.",'".$clickedColor.'\');" />';
               } else {
                   $link = $baseurl . "&amp;startMessage=$pageOffset&amp;&amp;checkall=";
                   if (sqgetGlobalVar('checkall',$checkall,SQ_GET)) {
@@ -216,7 +217,7 @@ else
           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_FLAGS:      echo '&nbsp;';       break;
           case SQM_COL_SIZE:       echo  _("Size");    break;
           case SQM_COL_PRIO:       echo  '!';          break;
           case SQM_COL_ATTACHMENT: echo '+';           break;
@@ -269,9 +270,10 @@ else
                 //
                 //$clickedColor = '';
                 $clickedColor = (!empty($color[16])) ? $color[16] : $color[2];
-            }
-            if ($javascript_on) {
+
                 $checkbox_javascript = ' onClick="this.checked = !this.checked;"';
+            } else {
+                $checkbox_javascript = '';
             }
             foreach ($aMessages as $iUid => $aMsg) {
                 echo $sLine;
@@ -285,7 +287,6 @@ else
 
     /**
      * 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;
 
@@ -390,16 +391,19 @@ else
 <?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;
+    // make sure that flags column is used by end user
+    if (isset($aFlags)) {
+        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>';
+            }
         }
     }
     /**
@@ -407,14 +411,14 @@ 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)) {
+        if (in_array($iCol, $show_label_columns)) {
             $sLabelStart = '<label for="msg[' . $i . ']">';
             $sLabelEnd = '</label>';
         } else {
             $sLabelStart = '';
             $sLabelEnd = '';
         }
-        $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : '';
+        $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : array();
         $title  = (isset($aCol['title']))  ? $aCol['title']  : '';
         $link   = (isset($aCol['link']))   ? $aCol['link']   : '';
         $value  = (isset($aCol['value']))  ? $aCol['value']  : '';
@@ -426,7 +430,7 @@ else
 
         switch ($iCol) {
           case SQM_COL_CHECK:
-            echo '<td align="' .$align['left'] .'"'. $javascript_auto_click. ' bgcolor="'.$bgcolor.'" nowrap>' ?>
+            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>
             <?php
             break;
@@ -453,18 +457,18 @@ else
             break;
           case SQM_COL_SIZE:
           case SQM_COL_FLAGS:
-            $sText = "    <td class=\"col_\" align=\"$align[right]\" $javascript_auto_click bgcolor=\"$bgcolor\" nowrap>";
+            $sText = "    <td class=\"col_flags\" align=\"$align[right]\" $javascript_auto_click bgcolor=\"$bgcolor\" style=\"white-space:nowrap\">";
             $sText .= "<small>$value</small></td>\n";
             echo $sText;
             break;
           case SQM_COL_INT_DATE:
           case SQM_COL_DATE:
-            $sText = "    <td class=\"col_\" align=\"center\" $javascript_auto_click  bgcolor=\"$bgcolor\" nowrap>";
+            $sText = "    <td class=\"col_date\" align=\"center\" $javascript_auto_click  bgcolor=\"$bgcolor\" style=\"white-space:nowrap\">";
             $sText .= $value. "</td>\n";
             echo $sText;
             break;
           default:
-            $sText = "    <td class=\"col_\" align=\"$align[left]\" nowrap $javascript_auto_click bgcolor=\"$bgcolor\"";
+            $sText = "    <td class=\"col_text\" align=\"$align[left]\" style=\"white-space:nowrap\" $javascript_auto_click bgcolor=\"$bgcolor\"";
             if ($link) {
                 $sText .= "><a href=\"$link\"";
                 if ($target) { $sText .= " target=\"$target\"";}