Stupid stupid stupid
[squirrelmail.git] / templates / default / message_list.tpl
index cb04f12a1398f2c28492d5003598b16ccda61e4a..01aab28b3a7600c3726f6aac6474206b90c0441c 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 */
@@ -75,22 +76,30 @@ if (!($javascript_on && $fancy_index_highlite)) {
     }
 }
 
+/**
+ * Check usage of images for attachments, flags and priority
+ */
+$bIcons = ($use_icons && $icon_theme) ? true : false;
+
+/**
+ * Location of icon images
+ */
+if ($bIcons) {
+    $sImageLocation = SM_PATH . 'images/themes/' . $icon_theme . '/';
+}
+
 // 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">
   <tr>
     <td>
-    <table width="100%" cellpadding="1"  cellspacing="0" style="border: 1px solid <?php echo $color[0]; ?>">
+    <table width="100%" cellpadding="1"  cellspacing="0" style="border: 1px solid <?php echo $color[0]; ?>;">
       <tr>
         <td>
           <table bgcolor="<?php echo $color[4]; ?>" border="0" width="100%" cellpadding="1"  cellspacing="0">
@@ -131,7 +140,7 @@ else
             case 'submit':
                 if ($key != 'moveButton') { // 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]; ?>" style="padding: 0px; margin: 0px;" />&nbsp;
 <?php
             }
                 break;
@@ -160,7 +169,7 @@ else
                        <?php echo $aFormElements['targetMailbox'][0];?>
                     </select>
                   </tt>
-                  <input type="submit" name="moveButton" value="<?php echo $aFormElements['moveButton'][0]; ?>" style="padding: 0px; margin: 0px" />
+                  <input type="submit" name="moveButton" value="<?php echo $aFormElements['moveButton'][0]; ?>" style="padding: 0px; margin: 0px;" />
                 </small>
 <?php
         } // if (isset($aFormElements['move']))
@@ -196,7 +205,7 @@ else
     foreach($aOrder as $iCol) {
 
 ?>
-                    <td align="<?php echo $align['left']; ?>" width="<?php echo $aWidth[$iCol]; ?>%" style="white-space:nowrap">
+                    <td align="<?php echo $align['left']; ?>" width="<?php echo $aWidth[$iCol]; ?>%" style="white-space: nowrap;">
                         <b>
 <?php
         switch ($iCol) {
@@ -216,10 +225,28 @@ 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:
+               if ($bIcons) {
+                  echo '<img src="' . $sImageLocation. 'msg_new.png" border="0" height="12" width="18" alt="!" title="'. _("Message Flags") . '" />';
+               } else {
+                  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_PRIO:
+               if ($bIcons) {
+                  echo '<img src="' . $sImageLocation. 'prio_high.png" border="0" height="10" width="5" alt="!" title="'. _("Priority") . '" />';
+               } else {
+                  echo  '!';
+               }
+               break;
+          case SQM_COL_ATTACHMENT:
+               if ($bIcons) {
+                  echo '<img src="' . $sImageLocation. 'attach.png" border="0" height="10" width="6" alt="+" title="' . _("Attachment") . '"/>';
+               } else {
+                  echo  '+';
+               }
+               break;
           case SQM_COL_INT_DATE:   echo _("Received"); break;
           case SQM_COL_TO:         echo _("To");       break;
           case SQM_COL_CC:         echo _("Cc");       break;
@@ -284,18 +311,6 @@ 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.
@@ -391,16 +406,18 @@ 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;
+    if (isset($aColumns[SQM_COL_FLAGS])) {
+        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>';
+            }
         }
     }
     /**
@@ -408,8 +425,7 @@ else
      * we have to do some php coding to display the columns in the right order
      */
     foreach ($aOrder as $iCol) {
-        // FIXME: first parameter cannot be an array in PHP < 4.2
-        if (in_array($index_order_part, $show_label_columns)) {
+        if (in_array($iCol, $show_label_columns)) {
             $sLabelStart = '<label for="msg[' . $i . ']">';
             $sLabelEnd = '</label>';
         } else {
@@ -428,7 +444,7 @@ else
 
         switch ($iCol) {
           case SQM_COL_CHECK:
-            echo '<td align="' .$align['left'] .'"'. $javascript_auto_click. ' bgcolor="'.$bgcolor.'" style="white-space: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;
@@ -455,18 +471,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 = "    <td class=\"col_flags\" align=\"$align[left]\" $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_date\" align=\"center\" $javascript_auto_click  bgcolor=\"$bgcolor\" style=\"white-space: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_text\" align=\"$align[left]\" style=\"white-space: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\"";}
@@ -504,7 +520,7 @@ else
       <tr><td height="5" bgcolor="<?php echo $color[4]; ?>" colspan="1"></td></tr>
       <tr>
         <td>
-          <table width="100%" cellpadding="1"  cellspacing="0" style="border: 1px solid <?php echo $color[0]; ?>">
+          <table width="100%" cellpadding="1"  cellspacing="0" style="border: 1px solid <?php echo $color[0]; ?>;">
             <tr>
               <td>
                 <table bgcolor="<?php echo $color[4]; ?>" border="0" width="100%" cellpadding="1"  cellspacing="0">