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
59 * $fancy_index_highlite
65 * @copyright © 1999-2006 The SquirrelMail Project Team
66 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
68 * @package squirrelmail
69 * @subpackage templates
73 /** add required includes */
74 include_once(SM_PATH . 'functions/template/message_list_util.php');
77 /* retrieve the template vars */
81 if (!empty($plugin_output['mailbox_index_before'])) echo $plugin_output['mailbox_index_before'];
85 * Calculate string "Viewing message x to y (z total)"
88 if ($pageOffset < $end_msg) {
89 $msg_cnt_str = sprintf(_("Viewing Messages: %s to %s (%s total)"),
90 '<em>' . $pageOffset . '</em>',
91 '<em>' . $end_msg . '</em>',
93 } else if ($pageOffset == $end_msg) {
94 $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"),
95 '<em>' . $pageOffset . '</em>',
101 * All icon functionality is now handled through $icon_theme_path.
102 * $icon_theme_path will contain the path to the user-selected theme. If it is
103 * NULL, the user and/or admin have turned off icons.
107 // set this to an empty string to turn off extra
108 // highlighting of checked rows
110 //$clickedColor = '';
111 $clickedColor = (empty($color[16])) ? $color[2] : $color[16];
115 <div id="message_list">
116 <form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
117 <table class="table_empty" cellspacing="0">
120 <table class="table_standard" cellspacing="0">
123 <table class="table_empty" cellspacing="0">
125 <td class="links_paginator">
126 <!-- paginator and thread link string -->
129 * The following line gets the output from a separate
130 * template altogether (called "paginator.tpl").
131 * $this is the Template class object.
133 $paginator_str = $this->fetch('paginator.tpl');
134 echo $paginator_str . $thread_link_str ."\n"; ?>
135 <!-- end paginator and thread link string -->
137 <!-- message count string -->
138 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
139 <!-- end message count string -->
145 if (count($aFormElements)) {
147 <!-- start message list form control -->
148 <tr class="message_list_controls">
152 * The following line gets the output from a separate
153 * template altogether (called "message_list_controls.tpl").
154 * $this is the Template class object.
156 $message_list_controls = $this->fetch('message_list_controls.tpl');
157 echo $message_list_controls ."\n"; ?>
160 <!-- end message list form control -->
162 } // if (count($aFormElements))
165 <?php if (!empty($plugin_output['mailbox_form_before'])) echo $plugin_output['mailbox_form_before']; ?>
168 <tr><td class="spacer"></td></tr>
171 <table class="table_messageListWrapper" cellspacing="0">
174 <table class="table_messageList" cellspacing="0">
175 <!-- table header start -->
178 * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
179 * rendering this table if we use THEAD and TH tags. No other browser or platform has
180 * this issue. We will use TR/TD w/ another CSS class to work around this.
184 <tr class="headerRow">
187 $aWidth = calcMessageListColumnWidth($aOrder);
188 foreach($aOrder as $iCol) {
191 <td style="width:<?php echo $aWidth[$iCol]; ?>%">
196 if ($javascript_on) {
197 echo '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_name."',".$fancy_index_highlite.')" />'."\n";
199 $link = $baseurl . "&startMessage=$pageOffset&checkall=";
200 if (sqgetGlobalVar('checkall',$checkall,SQ_GET)) {
201 $link .= ($checkall) ? '0' : '1';
205 echo "<a href=\"$link\">"._("All").'</a>';
208 case SQM_COL_FROM: echo _("From")."\n"; break;
209 case SQM_COL_DATE: echo _("Date")."\n"; break;
210 case SQM_COL_SUBJ: echo _("Subject")."\n"; break;
212 echo getIcon($icon_theme_path, 'msg_new.png', ' ', _("Message Flags")) . "\n";
214 case SQM_COL_SIZE: echo _("Size")."\n"; break;
216 echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
218 case SQM_COL_ATTACHMENT:
219 echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
221 case SQM_COL_INT_DATE: echo _("Received")."\n"; break;
222 case SQM_COL_TO: echo _("To")."\n"; break;
223 case SQM_COL_CC: echo _("Cc")."\n"; break;
224 case SQM_COL_BCC: echo _("Bcc")."\n"; break;
227 // add the sort buttons
228 if (isset($aSortSupported[$iCol])) {
229 if ($sort == $aSortSupported[$iCol][0]) {
230 $newsort = $aSortSupported[$iCol][1];
231 $img = 'up_pointer.png';
232 $text_icon = '⇧'; // U+21E7 UPWARDS WHITE ARROW
233 } else if ($sort == $aSortSupported[$iCol][1]) {
235 $img = 'down_pointer.png';
236 $text_icon = '⇩'; // U+21E9 DOWNWARDS WHITE ARROW
238 $newsort = $aSortSupported[$iCol][0];
239 $img = 'sort_none.png';
240 $text_icon = '◻'; // U+25FB WHITE MEDIUM SQUARE
242 /* Now that we have everything figured out, show the actual button. */
243 echo " <a href=\"$baseurl&startMessage=1&srt=$newsort\" style=\"text-decoration:none\">" .
244 getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" .
253 <!-- end table header -->
255 <!-- Message headers start -->
259 $iColCnt = count($aOrder);
263 // this stuff does the auto row highlighting on mouseover
265 if ($javascript_on && $fancy_index_highlite) {
266 $mouseoverColor = $color[5];
267 $checkbox_javascript = ' onclick="this.checked = !this.checked;"';
268 // $clickedColor is defined at top of this file
270 $checkbox_javascript = '';
275 * main message iteration loop
277 foreach ($aMessages as $iUid => $aMsg) {
283 * Display message header row in messages list
287 $aColumns = $aMsg['columns'];
291 * Check the flags and set a class var.
293 if (isset($aColumns[SQM_COL_FLAGS])) {
294 $aFlags = $aColumns[SQM_COL_FLAGS]['value'];
295 $sFlags = getFlagIcon($aFlags, $icon_theme_path);
297 /* add the flag string to the value index */
298 $aColumns[SQM_COL_FLAGS]['value'] = $sFlags;
301 * Check the priority column
303 if (isset($aColumns[SQM_COL_PRIO])) {
304 $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
305 $aColumns[SQM_COL_PRIO]['value'] = $sValue;
309 * Check the attachment column
311 if (isset($aColumns[SQM_COL_ATTACHMENT])) {
312 $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path);
313 $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
318 * If alternating row colors is set, adapt the CSS class
320 if (isset($alt_index_colors) && $alt_index_colors) {
326 if (isset($aMsg['row']['color']))
328 $bgcolor = $aMsg['row']['color'];
335 // this stuff does the auto row highlighting on mouseover
337 if ($javascript_on && $fancy_index_highlite) {
338 $row_extra = ' onmouseover="rowOver(\''.$form_id . '_msg' . $i.'\');" onmouseout="setPointer(this, ' . $i . ', \'out\', \'' . $class . '\', \'mouse_over\', \'clicked\');" onmousedown="setPointer(this, ' . $i . ', \'click\', \'' . $class . '\', \'mouse_over\', \'clicked\');"';
340 // this does the auto-checking of the checkbox no matter
341 // where on the row you click
343 $javascript_auto_click = '';
344 if ($javascript_on && $fancy_index_highlite) {
345 // include the form_id in order to show multiple messages lists. Otherwise id isn't unique
346 $javascript_auto_click = " onMouseDown=\"row_click('$form_id"."_msg$i')\"";
350 * Message Highlighting requires a unique CSS class declaration for proper
351 * mouseover functionality. There is no harm in doing this when the mouseover
352 * functionality is disabled
354 if ($class != 'even' && $class != 'odd')
357 <style type="text/css">
359 .table_messageList tr.<?php echo $class; ?> { background:<?php echo $bgcolor; ?> }
365 <tr <?php echo (empty($class) ? '' : 'class="'.$class.'" '); echo $row_extra;?>>
367 // flag style mumbo jumbo
369 if (isset($aColumns[SQM_COL_FLAGS])) {
370 if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
371 $sPre = '<span class="unread">'; $sEnd = '</span>';
373 if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
374 $sPre = '<span class="deleted">' . $sPre;
377 if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
378 $sPre = '<span class="flagged">' . $sPre;
384 * Because the order of the columns and which columns to show is a user preference
385 * we have to do some php coding to display the columns in the right order
387 foreach ($aOrder as $iCol) {
388 if (in_array($iCol, $show_label_columns)) {
389 $sLabelStart = '<label for="'.$form_id."_msg$i\">";
390 $sLabelEnd = '</label>';
395 $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : array();
396 $title = (isset($aCol['title'])) ? $aCol['title'] : '';
397 $link = (isset($aCol['link'])) ? $aCol['link'] : '';
398 $link_extra = (isset($aCol['link_extra'])) ? $aCol['link_extra'] : '';
399 $onclick = (isset($aCol['onclick'])) ? $aCol['onclick'] : '';
400 $value = (isset($aCol['value'])) ? $aCol['value'] : '';
401 $target = (isset($aCol['target'])) ? $aCol['target'] : '';
402 if ($iCol !== SQM_COL_CHECK) {
403 $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
409 if ($javascript_on) {
410 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
411 <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript;?> /></td>
414 echo '<td class="col_check">';
415 $checked = ($checkall) ? ' checked=checked ' : '';
416 echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
420 $indent = $aCol['indent'];
421 $sText = " <td class=\"col_subject\" $javascript_auto_click>";
422 if ($align['left'] == 'left') {
423 $sText .= str_repeat(' ',$indent);
425 $sText .= "<a href=\"$link\"";
426 if ($target) { $sText .= " target=\"$target\""; }
427 if ($title) { $sText .= " title=\"$title\""; }
428 if ($onclick) { $sText .= " onclick=\"$onclick\""; }
429 if ($link_extra) { $sText .= " $link_extra"; }
430 if ($javascript_on && $fancy_index_highlite) {
431 $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
432 'parentNode.parentNode, ' . $i . ', \'click\', \''. $class. '\', \'mouse_over\', \'' .
433 $clickedColor .'\');"';
437 if ($align['left'] == 'right') {
438 $sText .= str_repeat(' ',$indent);
440 echo $sText."</td>\n";
444 $sText = " <td class=\"col_flags\" $javascript_auto_click>"
448 case SQM_COL_INT_DATE:
450 $sText = " <td class=\"col_date\" $javascript_auto_click>"
455 $sText = " <td class=\"col_text\" $javascript_auto_click";
457 $sText .= "><a href=\"$link\"";
458 if ($target) { $sText .= " target=\"$target\"";}
459 if ($title) { $sText .= " title=\"$title\"" ;}
462 if ($title) {$sText .= " title=\"$title\"";}
466 if ($link) { $sText .= '</a>';}
467 echo $sText."</td>\n";
473 $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
477 * End displaying row part
482 <!-- Message headers end -->
489 <tr><td class="spacer"></td></tr>
492 <table class="table_standard" cellspacing="0">
495 <table class="table_empty" cellspacing="0">
497 <td class="links_paginator"><?php
499 * The following line gets the output from a separate
500 * template altogether (called "paginator.tpl").
501 * $this is the Template class object.
503 $paginator_str = $this->fetch('paginator.tpl');
506 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
516 <?php if (!empty($plugin_output['mailbox_index_after'])) echo $plugin_output['mailbox_index_after']; ?>