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
68 * @copyright © 1999-2006 The SquirrelMail Project Team
69 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
71 * @package squirrelmail
72 * @subpackage templates
76 /** add required includes */
77 include_once(SM_PATH . 'functions/template/message_list_util.php');
80 /* retrieve the template vars */
84 if (!empty($plugin_output['mailbox_index_before'])) echo $plugin_output['mailbox_index_before'];
88 * Calculate string "Viewing message x to y (z total)"
91 if ($pageOffset < $end_msg) {
92 $msg_cnt_str = sprintf(_("Viewing Messages: %s to %s (%s total)"),
93 '<em>' . $pageOffset . '</em>',
94 '<em>' . $end_msg . '</em>',
96 } else if ($pageOffset == $end_msg) {
97 $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"),
98 '<em>' . $pageOffset . '</em>',
104 * All icon functionality is now handled through $icon_theme_path.
105 * $icon_theme_path will contain the path to the user-selected theme. If it is
106 * NULL, the user and/or admin have turned off icons.
111 <div id="message_list">
112 <form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
113 <table class="table_empty" cellspacing="0">
116 <table class="table_standard" cellspacing="0">
119 <table class="table_empty" cellspacing="0">
121 <td class="links_paginator">
122 <!-- paginator and thread link string -->
125 * The following line gets the output from a separate
126 * template altogether (called "paginator.tpl").
127 * $this is the Template class object.
129 $paginator_str = $this->fetch('paginator.tpl');
130 echo $paginator_str . '<small>[<a href="' . $thread_link_uri
131 . '">' . $thread_name . '</a>]</small>'; ?>
132 <!-- end paginator and thread link string -->
134 <!-- message count string -->
135 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
136 <!-- end message count string -->
142 if (count($aFormElements)) {
144 <!-- start message list form control -->
145 <tr class="message_list_controls">
149 * The following line gets the output from a separate
150 * template altogether (called "message_list_controls.tpl").
151 * $this is the Template class object.
153 $message_list_controls = $this->fetch('message_list_controls.tpl');
154 echo $message_list_controls ."\n"; ?>
157 <!-- end message list form control -->
159 } // if (count($aFormElements))
162 <?php if (!empty($plugin_output['mailbox_form_before'])) echo $plugin_output['mailbox_form_before']; ?>
165 <tr><td class="spacer"></td></tr>
168 <table class="table_messageListWrapper" cellspacing="0">
171 <table class="table_messageList" cellspacing="0">
172 <!-- table header start -->
175 * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
176 * rendering this table if we use THEAD and TH tags. No other browser or platform has
177 * this issue. We will use TR/TD w/ another CSS class to work around this.
181 <tr class="headerRow">
184 $aWidth = calcMessageListColumnWidth($aOrder);
185 foreach($aOrder as $iCol) {
188 <td style="width:<?php echo $aWidth[$iCol]; ?>%">
193 if ($javascript_on) {
194 $checked = ($checkall ? ' checked="checked" ' : '');
195 echo '<input type="checkbox" name="toggleAll" id="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_name."',".$fancy_index_highlite.')" ' . $checked . '/>'."\n";
198 . "&startMessage=$pageOffset&checkall="
199 . ($checkall ? '0' : '1');
200 echo "<a href=\"$link\">"._("All").'</a>';
204 echo '<label for="toggleAll">' . _("From") . "</label>\n";
206 case SQM_COL_DATE: echo _("Date") . "\n"; break;
207 case SQM_COL_SUBJ: echo _("Subject") . "\n"; break;
209 echo getIcon($icon_theme_path, 'msg_new.png', ' ', _("Message Flags")) . "\n";
211 case SQM_COL_SIZE: echo _("Size") . "\n"; break;
213 echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
215 case SQM_COL_ATTACHMENT:
216 echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
218 case SQM_COL_INT_DATE: echo _("Received") . "\n"; break;
220 echo '<label for="toggleAll">' . _("To") . "</label>\n";
222 case SQM_COL_CC: echo _("Cc") . "\n"; break;
223 case SQM_COL_BCC: echo _("Bcc") . "\n"; break;
226 // add the sort buttons
227 if (isset($aSortSupported[$iCol])) {
228 if ($sort == $aSortSupported[$iCol][0]) {
229 $newsort = $aSortSupported[$iCol][1];
230 $img = 'up_pointer.png';
231 $text_icon = '⇧'; // U+21E7 UPWARDS WHITE ARROW
232 } else if ($sort == $aSortSupported[$iCol][1]) {
234 $img = 'down_pointer.png';
235 $text_icon = '⇩'; // U+21E9 DOWNWARDS WHITE ARROW
237 $newsort = $aSortSupported[$iCol][0];
238 $img = 'sort_none.png';
239 $text_icon = '◻'; // U+25FB WHITE MEDIUM SQUARE
241 /* Now that we have everything figured out, show the actual button. */
242 echo " <a href=\"$baseurl&startMessage=1&srt=$newsort\" style=\"text-decoration:none\">" .
243 getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" .
252 <!-- end table header -->
254 <!-- Message headers start -->
258 $iColCnt = count($aOrder);
262 // this stuff does the auto row highlighting on mouseover
264 if ($javascript_on && $fancy_index_highlite) {
265 $checkbox_javascript = ' onclick="this.checked = !this.checked;"';
267 $checkbox_javascript = '';
272 * main message iteration loop
274 foreach ($aMessages as $iUid => $aMsg) {
280 * Display message header row in messages list
284 $aColumns = $aMsg['columns'];
288 * Check the flags and set a class var.
290 if (isset($aColumns[SQM_COL_FLAGS])) {
291 $aFlags = $aColumns[SQM_COL_FLAGS]['value'];
292 $sFlags = getFlagIcon($aFlags, $icon_theme_path);
294 /* add the flag string to the value index */
295 $aColumns[SQM_COL_FLAGS]['value'] = $sFlags;
298 * Check the priority column
300 if (isset($aColumns[SQM_COL_PRIO])) {
301 $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
302 $aColumns[SQM_COL_PRIO]['value'] = $sValue;
306 * Check the attachment column
308 if (isset($aColumns[SQM_COL_ATTACHMENT])) {
309 $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path);
310 $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
313 $class = (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite ? 'clicked_even' : 'even');
314 $non_clicked_class = 'even';
317 * If alternating row colors is set, adapt the CSS class
319 if (isset($alt_index_colors) && $alt_index_colors) {
321 $class = (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite ? 'clicked_odd' : 'odd');
322 $non_clicked_class = 'odd';
328 * Message Highlighting Functionality
330 if (isset($aMsg['row']['color']))
332 if (($checkall || in_array($iUid, $preselected)) && $javascript_on && $fancy_index_highlite) {
333 //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
334 $bgcolor = $color[16];
335 $class = 'clicked_misc'.$i;
337 $bgcolor = $aMsg['row']['color'];
340 $non_clicked_class = 'misc'.$i;
341 $non_clicked_bgcolor = $aMsg['row']['color'];
346 $non_clicked_bgcolor = '';
351 // this stuff does the auto row highlighting on mouseover
353 if ($javascript_on && $fancy_index_highlite) {
354 $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\');"';
356 // this does the auto-checking of the checkbox no matter
357 // where on the row you click
359 $javascript_auto_click = '';
360 if ($javascript_on && $fancy_index_highlite) {
361 // include the form_id in order to show multiple messages lists. Otherwise id isn't unique
362 $javascript_auto_click = " onmousedown=\"row_click('$form_id"."_msg$i')\"";
367 * Message Highlighting requires a unique CSS class declaration for proper
368 * mouseover functionality. There is no harm in doing this when the mouseover
369 * functionality is disabled
371 if ($class != 'even' && $class != 'odd'
372 && $class != 'clicked_even' && $class != 'clicked_odd')
375 <style type="text/css">
377 .table_messageList tr.<?php echo $class; ?> { background:<?php echo $bgcolor; ?> }
382 if ($non_clicked_class != 'even' && $non_clicked_class != 'odd'
383 && $non_clicked_class != 'clicked_even' && $non_clicked_class != 'clicked_odd')
386 <style type="text/css">
388 .table_messageList tr.<?php echo $non_clicked_class; ?> { background:<?php echo $non_clicked_bgcolor; ?> }
396 <tr <?php echo (empty($class) ? '' : 'class="'.$class.'" '); echo $row_extra;?>>
398 // flag style mumbo jumbo
400 if (isset($aColumns[SQM_COL_FLAGS])) {
401 if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
402 $sPre = '<span class="unread">'; $sEnd = '</span>';
404 if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
405 $sPre = '<span class="deleted">' . $sPre;
408 if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
409 $sPre = '<span class="flagged">' . $sPre;
415 * Because the order of the columns and which columns to show is a user preference
416 * we have to do some php coding to display the columns in the right order
418 foreach ($aOrder as $iCol) {
419 if (in_array($iCol, $show_label_columns)) {
420 $sLabelStart = '<label for="'.$form_id."_msg$i\">";
421 $sLabelEnd = '</label>';
426 $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : array();
427 $title = (isset($aCol['title'])) ? $aCol['title'] : '';
428 $link = (isset($aCol['link'])) ? $aCol['link'] : '';
429 $link_extra = (isset($aCol['link_extra'])) ? $aCol['link_extra'] : '';
430 $onclick = (isset($aCol['onclick'])) ? $aCol['onclick'] : '';
431 $value = (isset($aCol['value'])) ? $aCol['value'] : '';
432 $target = (isset($aCol['target'])) ? $aCol['target'] : '';
433 if ($iCol !== SQM_COL_CHECK) {
434 $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
440 $checked = (($checkall || in_array($iUid, $preselected)) ? ' checked="checked" ' : '');
441 if ($javascript_on) {
442 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
443 <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>
446 echo '<td class="col_check">';
447 echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
451 $indent = $aCol['indent'];
452 $sText = " <td class=\"col_subject\" $javascript_auto_click>";
453 if ($align['left'] == 'left') {
454 $sText .= str_repeat(' ',$indent);
456 $sText .= "<a href=\"$link\"";
457 if ($target) { $sText .= " target=\"$target\""; }
458 if ($title) { $sText .= " title=\"$title\""; }
459 if ($onclick) { $sText .= " onclick=\"$onclick\""; }
460 if ($link_extra) { $sText .= " $link_extra"; }
461 if ($javascript_on && $fancy_index_highlite) {
462 $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
463 'parentNode.parentNode, ' . $i . ', \'click\', \''. $non_clicked_class. '\', \'mouse_over\', \'clicked\');"';
467 if ($align['left'] == 'right') {
468 $sText .= str_repeat(' ',$indent);
470 echo $sText."</td>\n";
474 $sText = " <td class=\"col_flags\" $javascript_auto_click>"
478 case SQM_COL_INT_DATE:
480 $sText = " <td class=\"col_date\" $javascript_auto_click>"
485 $sText = " <td class=\"col_text\" $javascript_auto_click";
487 $sText .= "><a href=\"$link\"";
488 if ($target) { $sText .= " target=\"$target\"";}
489 if ($title) { $sText .= " title=\"$title\"" ;}
492 if ($title) {$sText .= " title=\"$title\"";}
496 if ($link) { $sText .= '</a>';}
497 echo $sText."</td>\n";
503 $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
507 * End displaying row part
512 <!-- Message headers end -->
519 <tr><td class="spacer"></td></tr>
522 <table class="table_standard" cellspacing="0">
525 <table class="table_empty" cellspacing="0">
527 <td class="links_paginator"><?php
529 * The following line gets the output from a separate
530 * template altogether (called "paginator.tpl").
531 * $this is the Template class object.
533 $paginator_str = $this->fetch('paginator.tpl');
536 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
546 <?php if (!empty($plugin_output['mailbox_index_after'])) echo $plugin_output['mailbox_index_after']; ?>
553 <?php if (!$hide_sm_attributions): ?>
554 <p class="sqm_squirrelcopyright">© 1999-2007 The SquirrelMail Project Team - <a href="about.php">About SquirrelMail</a></p>