Doc update... needs to be finished
[squirrelmail.git] / templates / default / message_list.tpl
index 62808fffde4b0b25656fc760635ca90678404676..6040788559f3e3bcf06594dbfa1f3e4e7bf646ab 100644 (file)
@@ -5,6 +5,61 @@
  *
  * 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$
@@ -18,7 +73,9 @@ include_once(SM_PATH . 'templates/util_message_list.php');
 /* retrieve the template vars */
 extract($t);
 
-do_hook('mailbox_index_before');
+//FIXME: no hooks in templates!
+global $null;
+do_hook('mailbox_index_before', $null);
 
 /**
  * Calculate string "Viewing message x to y (z total)"
@@ -77,26 +134,20 @@ 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 . '/';
-}
+ * 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 = '';
 $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
-       
+
 ?>
 <div id="message_list">
-<form id="<?php echo $form_id;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
+<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>
@@ -126,17 +177,17 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
     if (count($aFormElements)) {
 ?>
 <!-- start message list form control -->
-      <tr class="message_list_controls" cellspacing="0">
+      <tr class="message_list_controls">
         <td>
           <table class="table_empty" cellspacing="0">
             <tr>
-              <td class="message_control_buttons" cellspacing="0">
+              <td class="message_control_buttons">
 
 <?php
         foreach ($aFormElements as $key => $value) {
             switch ($value[1]) {
             case 'submit':
-                if ($key != 'moveButton' && $key != 'delete' && $key != 'undeleteButton') { // 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]; ?>" class="message_control_button" />&nbsp;
 <?php
@@ -145,7 +196,7 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
             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;
@@ -167,7 +218,7 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
  <?php
             if (isset($aFormElements['bypass_trash'])) {
 ?>
-                  <input type="checkbox" name="bypass_trash" /><?php echo $aFormElements['bypass_trash'][0]; ?>&nbsp;
+                  <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'])) {
@@ -179,13 +230,18 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
               </td>
 <?php
         } // if (isset($aFormElements['delete']))
-        if (isset($aFormElements['moveButton'])) {
+        if (isset($aFormElements['moveButton']) || isset($aFormElements['copyButton'])) {
 ?>
               <td class="message_control_move">
                     <select name="targetMailbox">
                        <?php echo $aFormElements['targetMailbox'][0];?>
                     </select>
+<?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
@@ -201,7 +257,8 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
 ?>
     </table>
 <?php
-    do_hook('mailbox_form_before');
+    //FIXME: no hooks in templates!
+    do_hook('mailbox_form_before', $null);
 ?>
     </td>
   </tr>
@@ -216,7 +273,7 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
 <?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 
+ * 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.
  */
 ?>
@@ -230,9 +287,9 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
         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.')" />'."\n";
+                  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 {
@@ -245,27 +302,15 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
           case SQM_COL_DATE:       echo _("Date")."\n";     break;
           case SQM_COL_SUBJ:       echo _("Subject")."\n";  break;
           case SQM_COL_FLAGS:
-               if ($bIcons) {
-                  echo '<img src="' . $sImageLocation. 'msg_new.png" border="0" height="12" width="18" alt="!" title="'. _("Message Flags") . '" />'."\n";
-               } else {
-                  echo  '&nbsp;'."\n";
-               }
-               break;
+                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:
-               if ($bIcons) {
-                  echo '<img src="' . $sImageLocation. 'prio_high.png" border="0" height="10" width="5" alt="!" title="'. _("Priority") . '" />'."\n";
-               } else {
-                  echo  '!'."\n";
-               }
-               break;
+                echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
+                break;
           case SQM_COL_ATTACHMENT:
-               if ($bIcons) {
-                  echo '<img src="' . $sImageLocation. 'attach.png" border="0" height="10" width="6" alt="+" title="' . _("Attachment") . '"/>'."\n";
-               } else {
-                  echo  '+'."\n";
-               }
-               break;
+                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;
@@ -275,20 +320,22 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
         // 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>'."\n";
+            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>';
         }
 ?>
                     </td>
@@ -336,12 +383,8 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
      */
     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;
     }
@@ -349,25 +392,7 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
      * 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 .= '<span class="high_priority">!</span>'; break;
-        // use downwards arrow for low priority emails
-                case 5: $sValue .= '<span class="low_priority">&#8595;</span>'; break;
-                default: break;
-            }
-        }
+        $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
         $aColumns[SQM_COL_PRIO]['value'] = $sValue;
     }
 
@@ -375,15 +400,7 @@ $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
      * 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;
     }
 
@@ -441,7 +458,7 @@ if ($class != 'even' && $class != 'odd')
     // flag style mumbo jumbo
     $sPre = $sEnd = '';
     if (isset($aColumns[SQM_COL_FLAGS])) {
-        if (!in_array('seen',$aFlags)) {
+        if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
             $sPre = '<span class="unread">'; $sEnd = '</span>';
         }
         if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
@@ -481,9 +498,15 @@ if ($class != 'even' && $class != 'odd')
 
         switch ($iCol) {
           case SQM_COL_CHECK:
-            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>
+            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'];
@@ -575,7 +598,7 @@ if ($class != 'even' && $class != 'odd')
       </tr>
       <tr>
         <td>
-        <?php do_hook('mailbox_index_after');?>
+        <?php /* FIXME: no hooks in templates!! */ do_hook('mailbox_index_after', $null); ?>
         </td>
       </tr>
     </table>