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 * @copyright © 1999-2006 The SquirrelMail Project Team
68 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
70 * @package squirrelmail
71 * @subpackage templates
75 /** add required includes */
76 include_once(SM_PATH . 'functions/template/message_list_util.php');
79 /* retrieve the template vars */
83 if (!empty($plugin_output['mailbox_index_before'])) echo $plugin_output['mailbox_index_before'];
87 * Calculate string "Viewing message x to y (z total)"
90 if ($pageOffset < $end_msg) {
91 $msg_cnt_str = sprintf(_("Viewing Messages: %s to %s (%s total)"),
92 '<em>' . $pageOffset . '</em>',
93 '<em>' . $end_msg . '</em>',
95 } else if ($pageOffset == $end_msg) {
96 $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"),
97 '<em>' . $pageOffset . '</em>',
103 * All icon functionality is now handled through $icon_theme_path.
104 * $icon_theme_path will contain the path to the user-selected theme. If it is
105 * NULL, the user and/or admin have turned off icons.
110 <div id="message_list">
111 <form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
112 <table class="table_empty" cellspacing="0">
115 <table class="table_standard" cellspacing="0">
118 <table class="table_empty" cellspacing="0">
120 <td class="links_paginator">
121 <!-- paginator and thread link string -->
124 * The following line gets the output from a separate
125 * template altogether (called "paginator.tpl").
126 * $this is the Template class object.
128 $paginator_str = $this->fetch('paginator.tpl');
129 echo $paginator_str . '<small>[<a href="' . $thread_link_uri
130 . '">' . $thread_name . '</a>]</small>'; ?>
131 <!-- end paginator and thread link string -->
133 <!-- message count string -->
134 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
135 <!-- end message count string -->
141 if (count($aFormElements)) {
143 <!-- start message list form control -->
144 <tr class="message_list_controls">
148 * The following line gets the output from a separate
149 * template altogether (called "message_list_controls.tpl").
150 * $this is the Template class object.
152 $message_list_controls = $this->fetch('message_list_controls.tpl');
153 echo $message_list_controls ."\n"; ?>
156 <!-- end message list form control -->
158 } // if (count($aFormElements))
161 <?php if (!empty($plugin_output['mailbox_form_before'])) echo $plugin_output['mailbox_form_before']; ?>
164 <tr><td class="spacer"></td></tr>
167 <table class="table_messageListWrapper" cellspacing="0">
170 <table class="table_messageList" cellspacing="0">
171 <!-- table header start -->
174 * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
175 * rendering this table if we use THEAD and TH tags. No other browser or platform has
176 * this issue. We will use TR/TD w/ another CSS class to work around this.
180 <tr class="headerRow">
183 $aWidth = calcMessageListColumnWidth($aOrder);
184 foreach($aOrder as $iCol) {
187 <td style="width:<?php echo $aWidth[$iCol]; ?>%">
192 if ($javascript_on) {
193 $checked = ($checkall ? ' checked="checked" ' : '');
194 echo '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_name."',".$fancy_index_highlite.')" ' . $checked . '/>'."\n";
197 . "&startMessage=$pageOffset&checkall="
198 . ($checkall ? '0' : '1');
199 echo "<a href=\"$link\">"._("All").'</a>';
202 case SQM_COL_FROM: echo _("From")."\n"; break;
203 case SQM_COL_DATE: echo _("Date")."\n"; break;
204 case SQM_COL_SUBJ: echo _("Subject")."\n"; break;
206 echo getIcon($icon_theme_path, 'msg_new.png', ' ', _("Message Flags")) . "\n";
208 case SQM_COL_SIZE: echo _("Size")."\n"; break;
210 echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
212 case SQM_COL_ATTACHMENT:
213 echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
215 case SQM_COL_INT_DATE: echo _("Received")."\n"; break;
216 case SQM_COL_TO: echo _("To")."\n"; break;
217 case SQM_COL_CC: echo _("Cc")."\n"; break;
218 case SQM_COL_BCC: echo _("Bcc")."\n"; break;
221 // add the sort buttons
222 if (isset($aSortSupported[$iCol])) {
223 if ($sort == $aSortSupported[$iCol][0]) {
224 $newsort = $aSortSupported[$iCol][1];
225 $img = 'up_pointer.png';
226 $text_icon = '⇧'; // U+21E7 UPWARDS WHITE ARROW
227 } else if ($sort == $aSortSupported[$iCol][1]) {
229 $img = 'down_pointer.png';
230 $text_icon = '⇩'; // U+21E9 DOWNWARDS WHITE ARROW
232 $newsort = $aSortSupported[$iCol][0];
233 $img = 'sort_none.png';
234 $text_icon = '◻'; // U+25FB WHITE MEDIUM SQUARE
236 /* Now that we have everything figured out, show the actual button. */
237 echo " <a href=\"$baseurl&startMessage=1&srt=$newsort\" style=\"text-decoration:none\">" .
238 getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" .
247 <!-- end table header -->
249 <!-- Message headers start -->
253 $iColCnt = count($aOrder);
257 // this stuff does the auto row highlighting on mouseover
259 if ($javascript_on && $fancy_index_highlite) {
260 $checkbox_javascript = ' onclick="this.checked = !this.checked;"';
262 $checkbox_javascript = '';
267 * main message iteration loop
269 foreach ($aMessages as $iUid => $aMsg) {
275 * Display message header row in messages list
279 $aColumns = $aMsg['columns'];
283 * Check the flags and set a class var.
285 if (isset($aColumns[SQM_COL_FLAGS])) {
286 $aFlags = $aColumns[SQM_COL_FLAGS]['value'];
287 $sFlags = getFlagIcon($aFlags, $icon_theme_path);
289 /* add the flag string to the value index */
290 $aColumns[SQM_COL_FLAGS]['value'] = $sFlags;
293 * Check the priority column
295 if (isset($aColumns[SQM_COL_PRIO])) {
296 $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
297 $aColumns[SQM_COL_PRIO]['value'] = $sValue;
301 * Check the attachment column
303 if (isset($aColumns[SQM_COL_ATTACHMENT])) {
304 $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path);
305 $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
308 $class = ($checkall && $javascript_on && $fancy_index_highlite ? 'clicked_even' : 'even');
309 $non_clicked_class = 'even';
312 * If alternating row colors is set, adapt the CSS class
314 if (isset($alt_index_colors) && $alt_index_colors) {
316 $class = ($checkall && $javascript_on && $fancy_index_highlite ? 'clicked_odd' : 'odd');
317 $non_clicked_class = 'odd';
323 * Message Highlighting Functionality
325 if (isset($aMsg['row']['color']))
327 if ($checkall && $javascript_on && $fancy_index_highlite) {
328 //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
329 $bgcolor = $color[16];
330 $class = 'clicked_misc'.$i;
332 $bgcolor = $aMsg['row']['color'];
335 $non_clicked_class = 'misc'.$i;
336 $non_clicked_bgcolor = $aMsg['row']['color'];
341 $non_clicked_bgcolor = '';
346 // this stuff does the auto row highlighting on mouseover
348 if ($javascript_on && $fancy_index_highlite) {
349 $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\');"';
351 // this does the auto-checking of the checkbox no matter
352 // where on the row you click
354 $javascript_auto_click = '';
355 if ($javascript_on && $fancy_index_highlite) {
356 // include the form_id in order to show multiple messages lists. Otherwise id isn't unique
357 $javascript_auto_click = " onmousedown=\"row_click('$form_id"."_msg$i')\"";
362 * Message Highlighting requires a unique CSS class declaration for proper
363 * mouseover functionality. There is no harm in doing this when the mouseover
364 * functionality is disabled
366 if ($class != 'even' && $class != 'odd'
367 && $class != 'clicked_even' && $class != 'clicked_odd')
370 <style type="text/css">
372 .table_messageList tr.<?php echo $class; ?> { background:<?php echo $bgcolor; ?> }
377 if ($non_clicked_class != 'even' && $non_clicked_class != 'odd'
378 && $non_clicked_class != 'clicked_even' && $non_clicked_class != 'clicked_odd')
381 <style type="text/css">
383 .table_messageList tr.<?php echo $non_clicked_class; ?> { background:<?php echo $non_clicked_bgcolor; ?> }
391 <tr <?php echo (empty($class) ? '' : 'class="'.$class.'" '); echo $row_extra;?>>
393 // flag style mumbo jumbo
395 if (isset($aColumns[SQM_COL_FLAGS])) {
396 if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
397 $sPre = '<span class="unread">'; $sEnd = '</span>';
399 if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
400 $sPre = '<span class="deleted">' . $sPre;
403 if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
404 $sPre = '<span class="flagged">' . $sPre;
410 * Because the order of the columns and which columns to show is a user preference
411 * we have to do some php coding to display the columns in the right order
413 foreach ($aOrder as $iCol) {
414 if (in_array($iCol, $show_label_columns)) {
415 $sLabelStart = '<label for="'.$form_id."_msg$i\">";
416 $sLabelEnd = '</label>';
421 $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : array();
422 $title = (isset($aCol['title'])) ? $aCol['title'] : '';
423 $link = (isset($aCol['link'])) ? $aCol['link'] : '';
424 $link_extra = (isset($aCol['link_extra'])) ? $aCol['link_extra'] : '';
425 $onclick = (isset($aCol['onclick'])) ? $aCol['onclick'] : '';
426 $value = (isset($aCol['value'])) ? $aCol['value'] : '';
427 $target = (isset($aCol['target'])) ? $aCol['target'] : '';
428 if ($iCol !== SQM_COL_CHECK) {
429 $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
435 $checked = ($checkall ? ' checked="checked" ' : '');
436 if ($javascript_on) {
437 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
438 <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>
441 echo '<td class="col_check">';
442 echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
446 $indent = $aCol['indent'];
447 $sText = " <td class=\"col_subject\" $javascript_auto_click>";
448 if ($align['left'] == 'left') {
449 $sText .= str_repeat(' ',$indent);
451 $sText .= "<a href=\"$link\"";
452 if ($target) { $sText .= " target=\"$target\""; }
453 if ($title) { $sText .= " title=\"$title\""; }
454 if ($onclick) { $sText .= " onclick=\"$onclick\""; }
455 if ($link_extra) { $sText .= " $link_extra"; }
456 if ($javascript_on && $fancy_index_highlite) {
457 $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
458 'parentNode.parentNode, ' . $i . ', \'click\', \''. $non_clicked_class. '\', \'mouse_over\', \'clicked\');"';
462 if ($align['left'] == 'right') {
463 $sText .= str_repeat(' ',$indent);
465 echo $sText."</td>\n";
469 $sText = " <td class=\"col_flags\" $javascript_auto_click>"
473 case SQM_COL_INT_DATE:
475 $sText = " <td class=\"col_date\" $javascript_auto_click>"
480 $sText = " <td class=\"col_text\" $javascript_auto_click";
482 $sText .= "><a href=\"$link\"";
483 if ($target) { $sText .= " target=\"$target\"";}
484 if ($title) { $sText .= " title=\"$title\"" ;}
487 if ($title) {$sText .= " title=\"$title\"";}
491 if ($link) { $sText .= '</a>';}
492 echo $sText."</td>\n";
498 $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
502 * End displaying row part
507 <!-- Message headers end -->
514 <tr><td class="spacer"></td></tr>
517 <table class="table_standard" cellspacing="0">
520 <table class="table_empty" cellspacing="0">
522 <td class="links_paginator"><?php
524 * The following line gets the output from a separate
525 * template altogether (called "paginator.tpl").
526 * $this is the Template class object.
528 $paginator_str = $this->fetch('paginator.tpl');
531 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
541 <?php if (!empty($plugin_output['mailbox_index_after'])) echo $plugin_output['mailbox_index_after']; ?>
548 <?php if (!$hide_sm_attributions): ?>
549 <p class="sqm_squirrelcopyright">© 1999-2007 The SquirrelMail Project Team - <a href="about.php">About SquirrelMail</a></p>