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">
150 <table class="table_empty" cellspacing="0">
152 <td class="message_control_buttons">
155 foreach ($aFormElements as $widget_name => $widget_attrs) {
156 switch ($widget_attrs['type']) {
158 if ($widget_name != 'moveButton' && $widget_name != 'copyButton' && $widget_name != 'delete' && $widget_name != 'undeleteButton') { // add these later in another table cell
159 echo '<input type="submit" name="' . $widget_name . '" value="' . $widget_attrs['value'] . '" class="message_control_button" /> ';
163 if ($widget_name != 'bypass_trash') {
164 echo '<input type="checkbox" name="' . $widget_name . '" id="' . $widget_name . '" /><label for="' . $widget_name . '">' . $widget_attrs['value'] . '</label> ';
168 echo '<input type="hidden" name="'.$widget_name.'" value="'. $widget_attrs['value']."\">\n";
175 <td class="message_control_delete">
177 if (isset($aFormElements['delete'])) {
178 echo '<input type="submit" name="delete" value="' . $aFormElements['delete']['value'] . '" class="message_control_button" /> ';
179 if (isset($aFormElements['bypass_trash'])) {
180 echo '<input type="checkbox" name="bypass_trash" id="bypass_trash" /><label for="bypass_trash">' . $aFormElements['bypass_trash']['value'] . '</label> ';
182 if (isset($aFormElements['undeleteButton'])) {
183 echo '<input type="submit" name="undeleteButton" value="' . $aFormElements['undeleteButton']['value'] . '" class="message_control_button" /> ';
190 } // if (isset($aFormElements['delete']))
191 if (isset($aFormElements['moveButton']) || isset($aFormElements['copyButton'])) {
193 <td class="message_control_move">
194 <select name="targetMailbox">
195 <?php echo $aFormElements['targetMailbox']['options_list'];?>
198 if (isset($aFormElements['moveButton'])) {
199 echo '<input type="submit" name="moveButton" value="' . $aFormElements['moveButton']['value'] . '" class="message_control_button" />';
201 if (isset($aFormElements['copyButton'])) {
202 echo '<input type="submit" name="copyButton" value="' . $aFormElements['copyButton']['value'] . '" class="message_control_button" />';
209 } // if (isset($aFormElements['moveButton']) || isset($aFormElements['copyButton']))
215 <!-- end message list form control -->
217 } // if (count($aFormElements))
220 <?php if (!empty($plugin_output['mailbox_form_before'])) echo $plugin_output['mailbox_form_before']; ?>
223 <tr><td class="spacer"></td></tr>
226 <table class="table_messageListWrapper" cellspacing="0">
229 <table class="table_messageList" cellspacing="0">
230 <!-- table header start -->
233 * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
234 * rendering this table if we use THEAD and TH tags. No other browser or platform has
235 * this issue. We will use TR/TD w/ another CSS class to work around this.
239 <tr class="headerRow">
242 $aWidth = calcMessageListColumnWidth($aOrder);
243 foreach($aOrder as $iCol) {
246 <td style="width:<?php echo $aWidth[$iCol]; ?>%">
251 if ($javascript_on) {
252 echo '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_name."',".$fancy_index_highlite.')" />'."\n";
254 $link = $baseurl . "&startMessage=$pageOffset&checkall=";
255 if (sqgetGlobalVar('checkall',$checkall,SQ_GET)) {
256 $link .= ($checkall) ? '0' : '1';
260 echo "<a href=\"$link\">"._("All").'</a>';
263 case SQM_COL_FROM: echo _("From")."\n"; break;
264 case SQM_COL_DATE: echo _("Date")."\n"; break;
265 case SQM_COL_SUBJ: echo _("Subject")."\n"; break;
267 echo getIcon($icon_theme_path, 'msg_new.png', ' ', _("Message Flags")) . "\n";
269 case SQM_COL_SIZE: echo _("Size")."\n"; break;
271 echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
273 case SQM_COL_ATTACHMENT:
274 echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
276 case SQM_COL_INT_DATE: echo _("Received")."\n"; break;
277 case SQM_COL_TO: echo _("To")."\n"; break;
278 case SQM_COL_CC: echo _("Cc")."\n"; break;
279 case SQM_COL_BCC: echo _("Bcc")."\n"; break;
282 // add the sort buttons
283 if (isset($aSortSupported[$iCol])) {
284 if ($sort == $aSortSupported[$iCol][0]) {
285 $newsort = $aSortSupported[$iCol][1];
286 $img = 'up_pointer.png';
287 $text_icon = '⇧'; // U+21E7 UPWARDS WHITE ARROW
288 } else if ($sort == $aSortSupported[$iCol][1]) {
290 $img = 'down_pointer.png';
291 $text_icon = '⇩'; // U+21E9 DOWNWARDS WHITE ARROW
293 $newsort = $aSortSupported[$iCol][0];
294 $img = 'sort_none.png';
295 $text_icon = '◻'; // U+25FB WHITE MEDIUM SQUARE
297 /* Now that we have everything figured out, show the actual button. */
298 echo " <a href=\"$baseurl&startMessage=1&srt=$newsort\" style=\"text-decoration:none\">" .
299 getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" .
308 <!-- end table header -->
310 <!-- Message headers start -->
313 $iColCnt = count($aOrder);
316 // this stuff does the auto row highlighting on mouseover
318 if ($javascript_on && $fancy_index_highlite) {
320 $mouseoverColor = $color[5];
322 // set this to an empty string to turn off extra
323 // highlighting of checked rows
325 //$clickedColor = '';
326 $clickedColor = (!empty($color[16])) ? $color[16] : $color[2];
328 $checkbox_javascript = ' onclick="this.checked = !this.checked;"';
330 $checkbox_javascript = '';
332 foreach ($aMessages as $iUid => $aMsg) {
336 * Display message header row in messages list
340 $aColumns = $aMsg['columns'];
344 * Check the flags and set a class var.
346 if (isset($aColumns[SQM_COL_FLAGS])) {
347 $aFlags = $aColumns[SQM_COL_FLAGS]['value'];
348 $sFlags = getFlagIcon($aFlags, $icon_theme_path);
350 /* add the flag string to the value index */
351 $aColumns[SQM_COL_FLAGS]['value'] = $sFlags;
354 * Check the priority column
356 if (isset($aColumns[SQM_COL_PRIO])) {
357 $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
358 $aColumns[SQM_COL_PRIO]['value'] = $sValue;
362 * Check the attachment column
364 if (isset($aColumns[SQM_COL_ATTACHMENT])) {
365 $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path);
366 $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
371 * If alternating row colors is set, adapt the CSS class
373 if (isset($alt_index_colors) && $alt_index_colors) {
379 if (isset($aMsg['row']['color']))
381 $bgcolor = $aMsg['row']['color'];
388 // this stuff does the auto row highlighting on mouseover
390 if ($javascript_on && $fancy_index_highlite) {
391 $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\');"';
393 // this does the auto-checking of the checkbox no matter
394 // where on the row you click
396 $javascript_auto_click = '';
397 if ($javascript_on && $fancy_index_highlite) {
398 // include the form_id in order to show multiple messages lists. Otherwise id isn't unique
399 $javascript_auto_click = " onMouseDown=\"row_click('$form_id"."_msg$i')\"";
403 * Message Highlighting requires a unique CSS class declaration for proper
404 * mouseover functionality. There is no harm in doing this when the mouseover
405 * functionality is disabled
407 if ($class != 'even' && $class != 'odd')
410 <style type="text/css">
412 .table_messageList tr.<?php echo $class; ?> { background:<?php echo $bgcolor; ?> }
418 <tr <?php echo (empty($class) ? '' : 'class="'.$class.'" '); echo $row_extra;?>>
420 // flag style mumbo jumbo
422 if (isset($aColumns[SQM_COL_FLAGS])) {
423 if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
424 $sPre = '<span class="unread">'; $sEnd = '</span>';
426 if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
427 $sPre = '<span class="deleted">' . $sPre;
430 if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
431 $sPre = '<span class="flagged">' . $sPre;
437 * Because the order of the columns and which columns to show is a user preference
438 * we have to do some php coding to display the columns in the right order
440 foreach ($aOrder as $iCol) {
441 if (in_array($iCol, $show_label_columns)) {
442 $sLabelStart = '<label for="'.$form_id."_msg$i\">";
443 $sLabelEnd = '</label>';
448 $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : array();
449 $title = (isset($aCol['title'])) ? $aCol['title'] : '';
450 $link = (isset($aCol['link'])) ? $aCol['link'] : '';
451 $link_extra = (isset($aCol['link_extra'])) ? $aCol['link_extra'] : '';
452 $onclick = (isset($aCol['onclick'])) ? $aCol['onclick'] : '';
453 $link = (isset($aCol['link'])) ? $aCol['link'] : '';
454 $value = (isset($aCol['value'])) ? $aCol['value'] : '';
455 $target = (isset($aCol['target'])) ? $aCol['target'] : '';
456 if ($iCol !== SQM_COL_CHECK) {
457 $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
463 if ($javascript_on) {
464 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
465 <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript;?> /></td>
468 echo '<td class="col_check">';
469 $checked = ($checkall) ? " checked=checked " : " ";
470 echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
474 $indent = $aCol['indent'];
475 $sText = " <td class=\"col_subject\" $javascript_auto_click>";
476 if ($align['left'] == 'left') {
477 $sText .= str_repeat(' ',$indent);
479 $sText .= "<a href=\"$link\"";
480 if ($target) { $sText .= " target=\"$target\""; }
481 if ($title) { $sText .= " title=\"$title\""; }
482 if ($onclick) { $sText .= " onclick=\"$onclick\""; }
483 if ($link_extra) { $sText .= " $link_extra"; }
484 if ($javascript_on && $fancy_index_highlite) {
485 $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
486 'parentNode.parentNode, ' . $i . ', \'click\', \''. $class. '\', \'mouse_over\', \'' .
487 $clickedColor .'\');"';
490 $sText .= $value . '</a>';
491 if ($align['left'] == 'right') {
492 $sText .= str_repeat(' ',$indent);
494 echo $sText."</td>\n";
498 $sText = " <td class=\"col_flags\" $javascript_auto_click>";
499 $sText .= "$value</td>\n";
502 case SQM_COL_INT_DATE:
504 $sText = " <td class=\"col_date\" $javascript_auto_click>";
505 $sText .= $value. "</td>\n";
509 $sText = " <td class=\"col_text\" $javascript_auto_click";
511 $sText .= "><a href=\"$link\"";
512 if ($target) { $sText .= " target=\"$target\"";}
513 if ($title) { $sText .= " title=\"$title\"" ;}
516 if ($title) {$sText .= " title=\"$title\"";}
520 if ($link) { $sText .= '</a>';}
521 echo $sText."</td>\n";
528 $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
532 * End displaying row part
537 <!-- Message headers end -->
544 <tr><td class="spacer"></td></tr>
547 <table class="table_standard" cellspacing="0">
550 <table class="table_empty" cellspacing="0">
552 <td class="links_paginator"><?php echo $paginator_str; ?></td>
553 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
563 <?php /* FIXME: no hooks in templates!! */ do_hook('mailbox_index_after', $null); ?>