6 * Template for viewing a messages list
8 * The following variables are available in this template:
9 //FIXME: need to clean (and document) this list, it is just a dump of the array keys of $t
26 * $hide_sm_attributions
60 * $fancy_index_highlite
67 * $show_personal_names boolean When turned on, all email
68 * address fields should display
69 * the personal name and use the
70 * email address as a tool tip;
71 * When turned off, this logic
74 * @copyright © 1999-2006 The SquirrelMail Project Team
75 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
77 * @package squirrelmail
78 * @subpackage templates
82 /** add required includes */
83 include_once(SM_PATH . 'functions/template/message_list_util.php');
86 /* retrieve the template vars */
90 if (!empty($plugin_output['mailbox_index_before'])) echo $plugin_output['mailbox_index_before'];
94 * Calculate string "Viewing message x to y (z total)"
97 if ($pageOffset < $end_msg) {
98 $msg_cnt_str = sprintf(_("Viewing Messages: %s to %s (%s total)"),
99 '<em>' . $pageOffset . '</em>',
100 '<em>' . $end_msg . '</em>',
102 } else if ($pageOffset == $end_msg) {
103 $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"),
104 '<em>' . $pageOffset . '</em>',
110 * All icon functionality is now handled through $icon_theme_path.
111 * $icon_theme_path will contain the path to the user-selected theme. If it is
112 * NULL, the user and/or admin have turned off icons.
117 <div id="message_list">
118 <form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
119 <table class="table_empty" cellspacing="0">
122 <table class="table_standard" cellspacing="0">
125 <table class="table_empty" cellspacing="0">
127 <td class="links_paginator">
128 <!-- paginator and thread link string -->
131 * The following line gets the output from a separate
132 * template altogether (called "paginator.tpl").
133 * $this is the Template class object.
135 $paginator_str = $this->fetch('paginator.tpl');
136 echo $paginator_str . '<small>[<a href="' . $thread_link_uri
137 . '">' . $thread_name . '</a>]</small> ';
138 if (!empty($plugin_output['mailbox_paginator_after'])) echo $plugin_output['mailbox_paginator_after'];
140 <!-- end paginator and thread link string -->
142 <!-- message count string -->
143 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
144 <!-- end message count string -->
150 if (count($aFormElements)) {
152 <!-- start message list form control -->
153 <tr class="message_list_controls">
157 * The following line gets the output from a separate
158 * template altogether (called "message_list_controls.tpl").
159 * $this is the Template class object.
161 $message_list_controls = $this->fetch('message_list_controls.tpl');
162 echo $message_list_controls ."\n"; ?>
165 <!-- end message list form control -->
167 } // if (count($aFormElements))
170 <?php if (!empty($plugin_output['mailbox_form_before'])) echo $plugin_output['mailbox_form_before']; ?>
173 <tr><td class="spacer"></td></tr>
176 <table class="table_messageListWrapper" cellspacing="0">
179 <table class="table_messageList" cellspacing="0">
180 <!-- table header start -->
183 * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
184 * rendering this table if we use THEAD and TH tags. No other browser or platform has
185 * this issue. We will use TR/TD w/ another CSS class to work around this.
189 <tr class="headerRow">
192 $aWidth = calcMessageListColumnWidth($aOrder);
193 foreach($aOrder as $iCol) {
196 <td style="width:<?php echo $aWidth[$iCol]; ?>%">
201 if ($javascript_on) {
202 $checked = ($checkall ? ' checked="checked" ' : '');
203 echo '<input type="checkbox" name="toggleAll" id="toggleAll" title="'
204 . _("Toggle All") . '" onclick="toggle_all(\''
205 . $form_name . '\', \'msg\', ' . $fancy_index_highlite
206 . '); return false;" ' . $checked . '/>' . "\n";
209 . "&startMessage=$pageOffset&checkall="
210 . ($checkall ? '0' : '1');
211 echo "<a href=\"$link\">" . _("All") . '</a>';
215 echo '<label for="toggleAll">' . _("From") . "</label>\n";
217 case SQM_COL_DATE: echo _("Date") . "\n"; break;
218 case SQM_COL_SUBJ: echo _("Subject") . "\n"; break;
220 echo getIcon($icon_theme_path, 'msg_new.png', ' ', _("Message Flags")) . "\n";
222 case SQM_COL_SIZE: echo _("Size") . "\n"; break;
224 echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
226 case SQM_COL_ATTACHMENT:
227 echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
229 case SQM_COL_INT_DATE: echo _("Received") . "\n"; break;
231 echo '<label for="toggleAll">' . _("To") . "</label>\n";
233 case SQM_COL_CC: echo _("Cc") . "\n"; break;
234 case SQM_COL_BCC: echo _("Bcc") . "\n"; break;
237 // add the sort buttons
238 if (isset($aSortSupported[$iCol])) {
239 if ($sort == $aSortSupported[$iCol][0]) {
240 $newsort = $aSortSupported[$iCol][1];
241 $img = 'up_pointer.png';
242 $text_icon = '⇧'; // U+21E7 UPWARDS WHITE ARROW
243 } else if ($sort == $aSortSupported[$iCol][1]) {
245 $img = 'down_pointer.png';
246 $text_icon = '⇩'; // U+21E9 DOWNWARDS WHITE ARROW
248 $newsort = $aSortSupported[$iCol][0];
249 $img = 'sort_none.png';
250 $text_icon = '◻'; // U+25FB WHITE MEDIUM SQUARE
252 /* Now that we have everything figured out, show the actual button. */
253 echo " <a href=\"$baseurl&startMessage=1&srt=$newsort\" style=\"text-decoration:none\">" .
254 getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" .
263 <!-- end table header -->
265 <!-- Message headers start -->
269 $iColCnt = count($aOrder);
273 // this stuff does the auto row highlighting on mouseover
275 if (!empty($plugin_output['checkbox_javascript_onclick'])) $checkbox_javascript_onclick = $plugin_output['checkbox_javascript_onclick'];
276 else $checkbox_javascript_onclick = '';
278 if ($javascript_on && $fancy_index_highlite) {
279 $checkbox_javascript = ' onclick="this.checked = !this.checked; ' . $checkbox_javascript_onclick . '"';
280 } else if (!empty($checkbox_javascript_onclick)) {
281 $checkbox_javascript = ' onclick="' . $checkbox_javascript_onclick . '"';
283 $checkbox_javascript = '';
288 * main message iteration loop
290 foreach ($aMessages as $iUid => $aMsg) {
296 * Display message header row in messages list
300 $aColumns = $aMsg['columns'];
304 * Check the flags and set a class var.
306 if (isset($aColumns[SQM_COL_FLAGS])) {
307 $aFlags = $aColumns[SQM_COL_FLAGS]['value'];
308 $sFlags = getFlagIcon($aFlags, $icon_theme_path);
310 /* add the flag string to the value index */
311 $aColumns[SQM_COL_FLAGS]['value'] = $sFlags;
314 * Check the priority column
316 if (isset($aColumns[SQM_COL_PRIO])) {
317 $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
318 $aColumns[SQM_COL_PRIO]['value'] = $sValue;
322 * Check the attachment column
324 if (isset($aColumns[SQM_COL_ATTACHMENT])) {
325 $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path);
326 $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
329 $class = (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite ? 'clicked_even' : 'even');
330 $non_clicked_class = 'even';
333 * If alternating row colors is set, adapt the CSS class
335 if (isset($alt_index_colors) && $alt_index_colors) {
337 $class = (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite ? 'clicked_odd' : 'odd');
338 $non_clicked_class = 'odd';
344 * Message Highlighting Functionality
346 if (isset($aMsg['row']['color']))
348 if (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite) {
349 //FIXME: would be best not to use $color directly here; want to move this to be a CSS style-defined value only, but the problem is that this CSS class is being defined on the fly right here
350 $bgcolor = $color[16];
351 $class = 'clicked_misc'.$i;
353 $bgcolor = $aMsg['row']['color'];
356 $non_clicked_class = 'misc'.$i;
357 $non_clicked_bgcolor = $aMsg['row']['color'];
362 $non_clicked_bgcolor = '';
367 // this stuff does the auto row highlighting on mouseover
369 if ($javascript_on && $fancy_index_highlite) {
370 $row_extra = ' onmouseover="rowOver(\''.$form_id . '_msg' . $i.'\');" onmouseout="setPointer(this, ' . $i . ', \'out\', \'' . $non_clicked_class . '\', \'mouse_over\', \'clicked\');" onmousedown="setPointer(this, ' . $i . ', \'click\', \'' . $non_clicked_class . '\', \'mouse_over\', \'clicked\');"';
372 // this does the auto-checking of the checkbox no matter
373 // where on the row you click
375 $javascript_auto_click = '';
376 $row_click_extra = '';
377 if (!empty($plugin_output['row_click_extra'])) $row_click_extra = $plugin_output['row_click_extra'];
378 if ($javascript_on && $fancy_index_highlite) {
379 // include the form_id in order to show multiple messages lists. Otherwise id isn't unique
380 $javascript_auto_click = " onmousedown=\"row_click('$form_id"."_msg$i', event, '$form_name', 'msg[' + $i + ']', '$row_click_extra')\"";
385 * Message Highlighting requires a unique CSS class declaration for proper
386 * mouseover functionality. There is no harm in doing this when the mouseover
387 * functionality is disabled
389 if ($class != 'even' && $class != 'odd'
390 && $class != 'clicked_even' && $class != 'clicked_odd')
393 <style type="text/css">
395 .table_messageList tr.<?php echo $class; ?> { background:<?php echo $bgcolor; ?> }
400 if ($non_clicked_class != 'even' && $non_clicked_class != 'odd'
401 && $non_clicked_class != 'clicked_even' && $non_clicked_class != 'clicked_odd')
404 <style type="text/css">
406 .table_messageList tr.<?php echo $non_clicked_class; ?> { background:<?php echo $non_clicked_bgcolor; ?> }
414 <tr <?php echo (empty($class) ? '' : 'class="'.$class.'" '); echo $row_extra;?>>
416 // flag style mumbo jumbo
418 if (isset($aColumns[SQM_COL_FLAGS])) {
419 if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
420 $sPre = '<span class="unread">'; $sEnd = '</span>';
422 if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
423 $sPre = '<span class="deleted">' . $sPre;
426 if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
427 $sPre = '<span class="flagged">' . $sPre;
433 * Because the order of the columns and which columns to show is a user preference
434 * we have to do some php coding to display the columns in the right order
436 foreach ($aOrder as $iCol) {
437 if (in_array($iCol, $show_label_columns)) {
438 $sLabelStart = '<label for="'.$form_id."_msg$i\">";
439 $sLabelEnd = '</label>';
444 $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : array();
445 $title = (isset($aCol['title'])) ? $aCol['title'] : '';
446 $link = (isset($aCol['link'])) ? $aCol['link'] : '';
447 $link_extra = (isset($aCol['link_extra'])) ? $aCol['link_extra'] : '';
448 $onclick = (isset($aCol['onclick'])) ? $aCol['onclick'] : '';
449 $value = (isset($aCol['value'])) ? $aCol['value'] : '';
450 $target = (isset($aCol['target'])) ? $aCol['target'] : '';
451 if (!$show_personal_names
452 && ($iCol == SQM_COL_FROM
453 || $iCol == SQM_COL_TO
454 || $iCol == SQM_COL_CC
455 || $iCol == SQM_COL_BCC)) {
456 // swap title and value
461 if ($iCol !== SQM_COL_CHECK) {
462 $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
468 $checked = (($checkall || in_array($iUid, $preselected)) ? ' checked="checked" ' : '');
469 if ($javascript_on) {
470 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
471 <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript . $checked;?> /></td>
474 echo '<td class="col_check">';
475 echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
479 $indent = $aCol['indent'];
480 $sText = " <td class=\"col_subject\" $javascript_auto_click>";
481 if ($align['left'] == 'left') {
482 $sText .= str_repeat(' ',$indent);
484 $sText .= "<a href=\"$link\"";
485 if ($target) { $sText .= " target=\"$target\""; }
486 if ($title) { $sText .= " title=\"$title\""; }
487 if ($onclick) { $sText .= " onclick=\"$onclick\""; }
488 if ($link_extra) { $sText .= " $link_extra"; }
489 if ($javascript_on && $fancy_index_highlite) {
490 $sText .= " onmousedown=\"row_click('$form_id"."_msg$i', event, '$form_name', 'msg[' + $i + ']', '$row_click_extra'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
491 'parentNode.parentNode, ' . $i . ', \'click\', \''. $non_clicked_class. '\', \'mouse_over\', \'clicked\');"';
495 if ($align['left'] == 'right') {
496 $sText .= str_repeat(' ',$indent);
498 echo $sText."</td>\n";
502 $sText = " <td class=\"col_flags\" $javascript_auto_click>"
506 case SQM_COL_INT_DATE:
508 $sText = " <td class=\"col_date\" $javascript_auto_click>"
513 $sText = " <td class=\"col_text\" $javascript_auto_click";
515 $sText .= "><a href=\"$link\"";
516 if ($target) { $sText .= " target=\"$target\"";}
517 if ($title) { $sText .= " title=\"$title\"" ;}
520 if ($title) {$sText .= " title=\"$title\"";}
524 if ($link) { $sText .= '</a>';}
525 echo $sText."</td>\n";
531 $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
535 * End displaying row part
540 <!-- Message headers end -->
547 <tr><td class="spacer"></td></tr>
550 <table class="table_standard" cellspacing="0">
553 <table class="table_empty" cellspacing="0">
555 <td class="links_paginator"><?php
557 * The following line gets the output from a separate
558 * template altogether (called "paginator.tpl").
559 * $this is the Template class object.
561 $paginator_str = $this->fetch('paginator.tpl');
563 if (!empty($plugin_output['mailbox_paginator_after'])) echo $plugin_output['mailbox_paginator_after'];
565 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
575 <?php if (!empty($plugin_output['mailbox_index_after'])) echo $plugin_output['mailbox_index_after']; ?>
582 <?php if (!$hide_sm_attributions): ?>
583 <p class="sqm_squirrelcopyright">© <?php echo SM_COPYRIGHT ?> The SquirrelMail Project Team - <a href="about.php">About SquirrelMail</a></p>