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
73 * $accesskey_mailbox_toggle_selected The access key to use for the toggle all checkbox
74 * $accesskey_mailbox_thread The access key to use for the Thread/Unthread links
76 * @copyright 1999-2021 The SquirrelMail Project Team
77 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
79 * @package squirrelmail
80 * @subpackage templates
84 /** add required includes */
85 include_once(SM_PATH . 'functions/template/message_list_util.php');
88 /* retrieve the template vars */
92 if (!empty($plugin_output['mailbox_index_before'])) echo $plugin_output['mailbox_index_before'];
96 * Calculate string "Viewing message x to y (z total)"
99 if ($pageOffset < $end_msg) {
100 $msg_cnt_str = sprintf(_("Viewing Messages: %s to %s (%s total)"),
101 '<em>' . $pageOffset . '</em>',
102 '<em>' . $end_msg . '</em>',
104 } else if ($pageOffset == $end_msg) {
105 $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"),
106 '<em>' . $pageOffset . '</em>',
112 * All icon functionality is now handled through $icon_theme_path.
113 * $icon_theme_path will contain the path to the user-selected theme. If it is
114 * NULL, the user and/or admin have turned off icons.
119 <div id="message_list">
120 <form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
121 <input type="hidden" name="smtoken" value="<?php echo sm_generate_security_token(); ?>" />
122 <table class="table_empty" cellspacing="0">
125 <table class="table_standard" cellspacing="0">
128 <table class="table_empty" cellspacing="0">
130 <td class="links_paginator">
131 <!-- paginator and thread link string -->
134 * The following line gets the output from a separate
135 * template altogether (called "paginator.tpl").
136 * $this is the Template class object.
138 $paginator_str = $this->fetch('paginator.tpl');
139 echo $paginator_str . '<small>[<a href="' . $thread_link_uri
140 . ($accesskey_mailbox_thread != 'NONE'
141 ? '" accesskey="' . $accesskey_mailbox_thread . '">'
143 . $thread_name . '</a>]</small> ';
144 if (!empty($plugin_output['mailbox_paginator_after'])) echo $plugin_output['mailbox_paginator_after'];
146 <!-- end paginator and thread link string -->
148 <!-- message count string -->
149 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
150 <!-- end message count string -->
156 if (count($aFormElements)) {
158 <!-- start message list form control -->
159 <tr class="message_list_controls">
163 * The following line gets the output from a separate
164 * template altogether (called "message_list_controls.tpl").
165 * $this is the Template class object.
167 $message_list_controls = $this->fetch('message_list_controls.tpl');
168 echo $message_list_controls ."\n"; ?>
171 <!-- end message list form control -->
173 } // if (count($aFormElements))
176 <?php if (!empty($plugin_output['mailbox_form_before'])) echo $plugin_output['mailbox_form_before']; ?>
179 <tr><td class="spacer"></td></tr>
182 <table class="table_messageListWrapper" cellspacing="0">
185 <table class="table_messageList" cellspacing="0">
186 <!-- table header start -->
189 * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
190 * rendering this table if we use THEAD and TH tags. No other browser or platform has
191 * this issue. We will use TR/TD w/ another CSS class to work around this.
195 <tr class="headerRow">
198 $aWidth = calcMessageListColumnWidth($aOrder);
199 foreach($aOrder as $iCol) {
202 <td style="width:<?php echo $aWidth[$iCol]; ?>%">
208 if ($javascript_on) {
209 $checked = ($checkall ? ' checked="checked" ' : '');
210 $accesskey = ($accesskey_mailbox_toggle_selected == 'NONE' ? ''
211 : ' accesskey="' . $accesskey_mailbox_toggle_selected . '" ');
212 echo '<input type="checkbox" name="toggleAll" id="toggleAll" title="'
213 . _("Toggle All") . '" onclick="toggle_all(\''
214 . $form_name . '\', \'msg\', ' . $fancy_index_highlite
215 . '); return false;" ' . $checked . $accesskey . '/>' . "\n";
218 . "&startMessage=$pageOffset&checkall="
219 . ($checkall ? '0' : '1');
220 echo "<a href=\"$link\">" . _("All") . '</a>';
224 // was: echo '<label for="toggleAll">' . _("From") . "</label>\n";
225 $colNameText = _("From");
228 // was: echo _("Date") . "\n";
229 $colNameText = _("Date");
232 // was: echo _("Subject") . "\n";
233 $colNameText = _("Subject");
236 echo getIcon($icon_theme_path, 'msg_new.png', ' ', _("Message Flags")) . "\n";
239 // echo _("Size") . "\n";
240 $colNameText = _("Size");
243 echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
245 case SQM_COL_ATTACHMENT:
246 echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
248 case SQM_COL_INT_DATE:
249 // was: echo _("Received") . "\n";
250 $colNameText = _("Received");
253 // was: echo '<label for="toggleAll">' . _("To") . "</label>\n";
254 $colNameText = _("To");
256 case SQM_COL_CC: echo _("Cc") . "\n"; break;
257 case SQM_COL_BCC: echo _("Bcc") . "\n"; break;
260 // add the sort buttons
261 if (isset($aSortSupported[$iCol])) {
262 if ($sort == $aSortSupported[$iCol][0]) {
263 $newsort = $aSortSupported[$iCol][1];
264 $img = 'up_pointer.png';
265 $text_icon = '⇧'; // U+21E7 UPWARDS WHITE ARROW
266 } else if ($sort == $aSortSupported[$iCol][1]) {
268 $img = 'down_pointer.png';
269 $text_icon = '⇩'; // U+21E9 DOWNWARDS WHITE ARROW
271 $newsort = $aSortSupported[$iCol][0];
272 $img = 'sort_none.png';
273 $text_icon = '◻'; // U+25FB WHITE MEDIUM SQUARE
275 /* Now that we have everything figured out, show the actual button. */
276 echo " <a href=\"$baseurl&startMessage=1&srt=$newsort\" style=\"text-decoration:none;color:inherit\">";
279 if (isset($aSortSupported[$iCol])) {
280 echo ' ' . getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n</a>";
288 <!-- end table header -->
290 <!-- Message headers start -->
294 $iColCnt = count($aOrder);
298 // this stuff does the auto row highlighting on mouseover
300 if (!empty($plugin_output['checkbox_javascript_onclick'])) $checkbox_javascript_onclick = $plugin_output['checkbox_javascript_onclick'];
301 else $checkbox_javascript_onclick = '';
303 if ($javascript_on && $fancy_index_highlite) {
304 $checkbox_javascript = ' onclick="this.checked = !this.checked; ' . $checkbox_javascript_onclick . '"';
305 } else if (!empty($checkbox_javascript_onclick)) {
306 $checkbox_javascript = ' onclick="' . $checkbox_javascript_onclick . '"';
308 $checkbox_javascript = '';
313 * main message iteration loop
315 foreach ($aMessages as $iUid => $aMsg) {
321 * Display message header row in messages list
325 $aColumns = $aMsg['columns'];
329 * Check the flags and set a class var.
331 if (isset($aColumns[SQM_COL_FLAGS])) {
332 $aFlags = $aColumns[SQM_COL_FLAGS]['value'];
333 $sFlags = getFlagIcon($aFlags, $icon_theme_path);
335 /* add the flag string to the value index */
336 $aColumns[SQM_COL_FLAGS]['value'] = $sFlags;
339 * Check the priority column
341 if (isset($aColumns[SQM_COL_PRIO])) {
342 $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
343 $aColumns[SQM_COL_PRIO]['value'] = $sValue;
347 * Check the attachment column
349 if (isset($aColumns[SQM_COL_ATTACHMENT])) {
350 $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path);
351 $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
354 $class = (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite ? 'clicked_even' : 'even');
355 $non_clicked_class = 'even';
358 * If alternating row colors is set, adapt the CSS class
360 if (isset($alt_index_colors) && $alt_index_colors) {
362 $class = (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite ? 'clicked_odd' : 'odd');
363 $non_clicked_class = 'odd';
369 * Message Highlighting Functionality
371 if (isset($aMsg['row']['color']))
373 if (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite) {
374 //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
375 $bgcolor = $color[16];
376 $class = 'clicked_misc'.$i;
378 $bgcolor = $aMsg['row']['color'];
381 $non_clicked_class = 'misc'.$i;
382 $non_clicked_bgcolor = $aMsg['row']['color'];
387 $non_clicked_bgcolor = '';
392 // this stuff does the auto row highlighting on mouseover
394 if ($javascript_on && $fancy_index_highlite) {
395 $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\');"';
397 // this does the auto-checking of the checkbox no matter
398 // where on the row you click
400 $javascript_auto_click = '';
401 $row_click_extra = '';
402 if (!empty($plugin_output['row_click_extra'])) $row_click_extra = $plugin_output['row_click_extra'];
403 if ($javascript_on && $fancy_index_highlite) {
404 // include the form_id in order to show multiple messages lists. Otherwise id isn't unique
405 $javascript_auto_click = " onmousedown=\"row_click('$form_id"."_msg$i', event, '$form_name', 'msg[' + $i + ']', '$row_click_extra')\"";
410 * Message Highlighting requires a unique CSS class declaration for proper
411 * mouseover functionality. There is no harm in doing this when the mouseover
412 * functionality is disabled
414 if ($class != 'even' && $class != 'odd'
415 && $class != 'clicked_even' && $class != 'clicked_odd')
418 <style type="text/css">
420 .table_messageList tr.<?php echo $class; ?> { background:<?php echo $bgcolor; ?> }
425 if ($non_clicked_class != 'even' && $non_clicked_class != 'odd'
426 && $non_clicked_class != 'clicked_even' && $non_clicked_class != 'clicked_odd')
429 <style type="text/css">
431 .table_messageList tr.<?php echo $non_clicked_class; ?> { background:<?php echo $non_clicked_bgcolor; ?> }
439 <tr <?php echo (empty($class) ? '' : 'class="'.$class.'" '); echo $row_extra;?>>
441 // flag style mumbo jumbo
443 if (isset($aColumns[SQM_COL_FLAGS])) {
444 if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
445 $sPre = '<span class="unread">'; $sEnd = '</span>';
447 if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
448 $sPre = '<span class="deleted">' . $sPre;
451 if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
452 $sPre = '<span class="flagged">' . $sPre;
458 * Because the order of the columns and which columns to show is a user preference
459 * we have to do some php coding to display the columns in the right order
461 foreach ($aOrder as $iCol) {
462 if (in_array($iCol, $show_label_columns)) {
463 $sLabelStart = '<label for="'.$form_id."_msg$i\">";
464 $sLabelEnd = '</label>';
469 $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : array();
470 $title = (isset($aCol['title'])) ? $aCol['title'] : '';
471 $link = (isset($aCol['link'])) ? $aCol['link'] : '';
472 $link_extra = (isset($aCol['link_extra'])) ? $aCol['link_extra'] : '';
473 $onclick = (isset($aCol['onclick'])) ? $aCol['onclick'] : '';
474 $value = (isset($aCol['value'])) ? $aCol['value'] : '';
475 $target = (isset($aCol['target'])) ? $aCol['target'] : '';
476 if (!$show_personal_names
478 && ($iCol == SQM_COL_FROM
479 || $iCol == SQM_COL_TO
480 || $iCol == SQM_COL_CC
481 || $iCol == SQM_COL_BCC)) {
482 // swap title and value
487 if ($iCol !== SQM_COL_CHECK) {
488 $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
494 $checked = (($checkall || in_array($iUid, $preselected)) ? ' checked="checked" ' : '');
495 if ($javascript_on) {
496 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
497 <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>
500 echo '<td class="col_check">';
501 echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
505 $indent = $aCol['indent'];
506 $sText = " <td class=\"col_subject\" $javascript_auto_click>";
507 if ($align['left'] == 'left') {
508 $sText .= str_repeat(' ',$indent);
510 $sText .= "<a href=\"$link\"";
511 if ($target) { $sText .= " target=\"$target\""; }
512 if ($title) { $sText .= " title=\"$title\""; }
513 if ($onclick) { $sText .= " onclick=\"$onclick\""; }
514 if ($link_extra) { $sText .= " $link_extra"; }
515 if ($javascript_on && $fancy_index_highlite) {
516 $sText .= " onmousedown=\"row_click('$form_id"."_msg$i', event, '$form_name', 'msg[' + $i + ']', '$row_click_extra'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
517 'parentNode.parentNode, ' . $i . ', \'click\', \''. $non_clicked_class. '\', \'mouse_over\', \'clicked\');"';
521 if ($align['left'] == 'right') {
522 $sText .= str_repeat(' ',$indent);
524 echo $sText."</td>\n";
528 $sText = " <td class=\"col_flags\" $javascript_auto_click>"
532 case SQM_COL_INT_DATE:
534 $sText = " <td class=\"col_date\" $javascript_auto_click";
535 if ($title) {$sText .= " title=\"$title\"";}
536 $sText .= ">" . $value. "</td>\n";
540 $sText = " <td class=\"col_text\" $javascript_auto_click";
542 $sText .= "><a href=\"$link\"";
543 if ($target) { $sText .= " target=\"$target\"";}
544 if ($title) { $sText .= " title=\"$title\"" ;}
547 if ($title) {$sText .= " title=\"$title\"";}
551 if ($link) { $sText .= '</a>';}
552 echo $sText."</td>\n";
558 $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
562 * End displaying row part
567 <!-- Message headers end -->
574 <tr><td class="spacer"></td></tr>
577 <table class="table_standard" cellspacing="0">
580 <table class="table_empty" cellspacing="0">
582 <td class="links_paginator"><?php
584 * The following line gets the output from a separate
585 * template altogether (called "paginator.tpl").
586 * $this is the Template class object.
588 $paginator_str = $this->fetch('paginator.tpl');
590 if (!empty($plugin_output['mailbox_paginator_after'])) echo $plugin_output['mailbox_paginator_after'];
592 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
602 <?php if (!empty($plugin_output['mailbox_index_after'])) echo $plugin_output['mailbox_index_after']; ?>
609 <?php if (!$hide_sm_attributions): ?>
610 <p class="sqm_squirrelcopyright">© <?php echo SM_COPYRIGHT ?> The SquirrelMail Project Team - <a href="about.php">About SquirrelMail</a></p>