XHTML is case sensitive. onLoad != onload
[squirrelmail.git] / templates / default / message_list.tpl
CommitLineData
49db257d 1<?php
2
3/**
4 * message_list.tpl
5 *
49db257d 6 * Template for viewing a messages list
7 *
83d1e1af 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
10 * $sTemplateID
11 * $icon_theme_path
12 * $javascript_on
13 * $delayed_errors
14 * $frames
15 * $lang
16 * $page_title
17 * $header_tags
18 * $plugin_output
19 * $header_sent
20 * $body_tag_js
21 * $shortBoxName
e6e2e7fd 22 * $provider_link
83d1e1af 23 * $frame_top
24 * $urlMailbox
25 * $startMessage
26 * $hide_sm_attributions
27 * $uri
28 * $text
29 * $onclick
30 * $class
31 * $id
32 * $target
33 * $color
34 * $form_name
35 * $form_id
36 * $page_selector
37 * $page_selector_max
38 * $messagesPerPage
39 * $showall
40 * $end_msg
41 * $align
42 * $iNumberOfMessages
43 * $aOrder
44 * $aFormElements
45 * $sort
46 * $pageOffset
47 * $baseurl
48 * $aMessages
49 * $trash_folder
50 * $sent_folder
51 * $draft_folder
cd693cf4 52 * $thread_link_uri
53 * $thread_name
83d1e1af 54 * $php_self
55 * $mailbox
56 * $enablesort
57 * $icon_theme
58 * $use_icons
59 * $alt_index_colors
60 * $fancy_index_highlite
4127171c 61 * $aSortSupported
62 * $show_label_columns
83d1e1af 63 * $compact_paginator
64 * $aErrors
65 *
47ccfad4 66 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
4b4abf93 67 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
49db257d 68 * @version $Id$
69 * @package squirrelmail
57d06b39 70 * @subpackage templates
49db257d 71 */
72
4127171c 73
f2e2aa7f 74/** add required includes */
a1d29fb8 75include_once(SM_PATH . 'functions/template/message_list_util.php');
49db257d 76
4127171c 77
49db257d 78/* retrieve the template vars */
79extract($t);
80
4127171c 81
a1d29fb8 82if (!empty($plugin_output['mailbox_index_before'])) echo $plugin_output['mailbox_index_before'];
49db257d 83
4127171c 84
49db257d 85/**
86 * Calculate string "Viewing message x to y (z total)"
87 */
88$msg_cnt_str = '';
89if ($pageOffset < $end_msg) {
90 $msg_cnt_str = sprintf(_("Viewing Messages: %s to %s (%s total)"),
4127171c 91 '<em>' . $pageOffset . '</em>',
92 '<em>' . $end_msg . '</em>',
93 $iNumberOfMessages);
49db257d 94} else if ($pageOffset == $end_msg) {
4127171c 95 $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"),
96 '<em>' . $pageOffset . '</em>',
97 $iNumberOfMessages);
49db257d 98}
99
49db257d 100
583db309 101/**
29997535 102 * All icon functionality is now handled through $icon_theme_path.
103 * $icon_theme_path will contain the path to the user-selected theme. If it is
104 * NULL, the user and/or admin have turned off icons.
4127171c 105 */
106
583db309 107
49db257d 108// set this to an empty string to turn off extra
109// highlighting of checked rows
110//
111//$clickedColor = '';
583db309 112$clickedColor = (empty($color[16])) ? $color[2] : $color[16];
ac858073 113
4127171c 114
49db257d 115?>
e3812cb2 116<div id="message_list">
a73c1312 117<form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
e3812cb2 118<table class="table_empty" cellspacing="0">
49db257d 119 <tr>
e3812cb2 120 <td>
121 <table class="table_standard" cellspacing="0">
49db257d 122 <tr>
123 <td>
e3812cb2 124 <table class="table_empty" cellspacing="0">
49db257d 125 <tr>
e3812cb2 126 <td class="links_paginator">
49db257d 127<!-- paginator and thread link string -->
128 <?php
4127171c 129 /**
130 * The following line gets the output from a separate
131 * template altogether (called "paginator.tpl").
132 * $this is the Template class object.
49db257d 133 */
134 $paginator_str = $this->fetch('paginator.tpl');
cd693cf4 135 echo $paginator_str . '<small>[<a href="' . $thread_link_uri
136 . '">' . $thread_name . '</a>]</small>'; ?>
49db257d 137<!-- end paginator and thread link string -->
49db257d 138 </td>
139<!-- message count string -->
e3812cb2 140 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
49db257d 141<!-- end message count string -->
142 </tr>
143 </table>
144 </td>
145 </tr>
146<?php
147 if (count($aFormElements)) {
148?>
149<!-- start message list form control -->
d915a2ca 150 <tr class="message_list_controls">
49db257d 151 <td>
69a023cf 152 <?php
153 /**
154 * The following line gets the output from a separate
155 * template altogether (called "message_list_controls.tpl").
156 * $this is the Template class object.
157 */
158 $message_list_controls = $this->fetch('message_list_controls.tpl');
159 echo $message_list_controls ."\n"; ?>
49db257d 160 </td>
161 </tr>
162<!-- end message list form control -->
163<?php
164 } // if (count($aFormElements))
165?>
166 </table>
4127171c 167<?php if (!empty($plugin_output['mailbox_form_before'])) echo $plugin_output['mailbox_form_before']; ?>
49db257d 168 </td>
169 </tr>
e3812cb2 170 <tr><td class="spacer"></td></tr>
49db257d 171 <tr>
172 <td>
e3812cb2 173 <table class="table_messageListWrapper" cellspacing="0">
49db257d 174 <tr>
175 <td>
e3812cb2 176 <table class="table_messageList" cellspacing="0">
49db257d 177<!-- table header start -->
e3812cb2 178<?php
179/*
180 * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
ac858073 181 * rendering this table if we use THEAD and TH tags. No other browser or platform has
e3812cb2 182 * this issue. We will use TR/TD w/ another CSS class to work around this.
183 */
184?>
4127171c 185
e3812cb2 186 <tr class="headerRow">
4127171c 187
49db257d 188<?php
189 $aWidth = calcMessageListColumnWidth($aOrder);
190 foreach($aOrder as $iCol) {
49db257d 191?>
4127171c 192
e3812cb2 193 <td style="width:<?php echo $aWidth[$iCol]; ?>%">
4127171c 194
49db257d 195<?php
196 switch ($iCol) {
197 case SQM_COL_CHECK:
198 if ($javascript_on) {
be4f8940 199 echo '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_name."',".$fancy_index_highlite.')" />'."\n";
49db257d 200 } else {
ac858073 201 $link = $baseurl . "&amp;startMessage=$pageOffset&amp;checkall=";
49db257d 202 if (sqgetGlobalVar('checkall',$checkall,SQ_GET)) {
203 $link .= ($checkall) ? '0' : '1';
204 } else {
205 $link .= '1';
206 }
207 echo "<a href=\"$link\">"._("All").'</a>';
208 }
209 break;
e3812cb2 210 case SQM_COL_FROM: echo _("From")."\n"; break;
211 case SQM_COL_DATE: echo _("Date")."\n"; break;
212 case SQM_COL_SUBJ: echo _("Subject")."\n"; break;
583db309 213 case SQM_COL_FLAGS:
29997535 214 echo getIcon($icon_theme_path, 'msg_new.png', '&nbsp;', _("Message Flags")) . "\n";
215 break;
e3812cb2 216 case SQM_COL_SIZE: echo _("Size")."\n"; break;
583db309 217 case SQM_COL_PRIO:
29997535 218 echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
219 break;
583db309 220 case SQM_COL_ATTACHMENT:
29997535 221 echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
222 break;
e3812cb2 223 case SQM_COL_INT_DATE: echo _("Received")."\n"; break;
224 case SQM_COL_TO: echo _("To")."\n"; break;
225 case SQM_COL_CC: echo _("Cc")."\n"; break;
226 case SQM_COL_BCC: echo _("Bcc")."\n"; break;
49db257d 227 default: break;
228 }
229 // add the sort buttons
230 if (isset($aSortSupported[$iCol])) {
231 if ($sort == $aSortSupported[$iCol][0]) {
29997535 232 $newsort = $aSortSupported[$iCol][1];
233 $img = 'up_pointer.png';
8af5b50c 234 $text_icon = '&#8679;'; // U+21E7 UPWARDS WHITE ARROW
49db257d 235 } else if ($sort == $aSortSupported[$iCol][1]) {
29997535 236 $newsort = 0;
237 $img = 'down_pointer.png';
8af5b50c 238 $text_icon = '&#8681;'; // U+21E9 DOWNWARDS WHITE ARROW
49db257d 239 } else {
29997535 240 $newsort = $aSortSupported[$iCol][0];
241 $img = 'sort_none.png';
8af5b50c 242 $text_icon = '&#9723;'; // U+25FB WHITE MEDIUM SQUARE
49db257d 243 }
244 /* Now that we have everything figured out, show the actual button. */
8af5b50c 245 echo " <a href=\"$baseurl&amp;startMessage=1&amp;srt=$newsort\" style=\"text-decoration:none\">" .
6c68e276 246 getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" .
29997535 247 '</a>';
49db257d 248 }
249?>
49db257d 250 </td>
251<?php
252 }
253?>
e3812cb2 254 </tr>
255<!-- end table header -->
49db257d 256
257<!-- Message headers start -->
258<?php
3d621333 259
49db257d 260 $i = 0;
261 $iColCnt = count($aOrder);
262 $sLine = '';
263
3d621333 264
49db257d 265 // this stuff does the auto row highlighting on mouseover
266 //
267 if ($javascript_on && $fancy_index_highlite) {
49db257d 268 $mouseoverColor = $color[5];
cd0a9317 269 $checkbox_javascript = ' onclick="this.checked = !this.checked;"';
3d621333 270 // $clickedColor is defined at top of this file
799ee2d5 271 } else {
272 $checkbox_javascript = '';
49db257d 273 }
3d621333 274
275
276 /**
277 * main message iteration loop
278 */
49db257d 279 foreach ($aMessages as $iUid => $aMsg) {
3d621333 280
49db257d 281 echo $sLine;
282
3d621333 283
49db257d 284/**
285* Display message header row in messages list
286*
287*/
288
289 $aColumns = $aMsg['columns'];
290
49db257d 291
292 /**
293 * Check the flags and set a class var.
294 */
295 if (isset($aColumns[SQM_COL_FLAGS])) {
296 $aFlags = $aColumns[SQM_COL_FLAGS]['value'];
29997535 297 $sFlags = getFlagIcon($aFlags, $icon_theme_path);
49db257d 298
49db257d 299 /* add the flag string to the value index */
300 $aColumns[SQM_COL_FLAGS]['value'] = $sFlags;
301 }
302 /**
303 * Check the priority column
304 */
305 if (isset($aColumns[SQM_COL_PRIO])) {
29997535 306 $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
49db257d 307 $aColumns[SQM_COL_PRIO]['value'] = $sValue;
308 }
309
310 /**
311 * Check the attachment column
312 */
313 if (isset($aColumns[SQM_COL_ATTACHMENT])) {
29997535 314 $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path);
49db257d 315 $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
316 }
317
e3812cb2 318 $class = 'even';
49db257d 319 /**
e3812cb2 320 * If alternating row colors is set, adapt the CSS class
49db257d 321 */
322 if (isset($alt_index_colors) && $alt_index_colors) {
323 if (!($i % 2)) {
e3812cb2 324 $class = 'odd';
49db257d 325 }
326
327 }
e3812cb2 328 if (isset($aMsg['row']['color']))
329 {
330 $bgcolor = $aMsg['row']['color'];
331 $class = 'misc'.$i;
332 }
333 else $bgcolor = '';
49db257d 334
335 $row_extra = '';
336
337 // this stuff does the auto row highlighting on mouseover
338 //
339 if ($javascript_on && $fancy_index_highlite) {
3d621333 340 $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\');"';
49db257d 341 }
342 // this does the auto-checking of the checkbox no matter
343 // where on the row you click
344 //
345 $javascript_auto_click = '';
346 if ($javascript_on && $fancy_index_highlite) {
347 // include the form_id in order to show multiple messages lists. Otherwise id isn't unique
348 $javascript_auto_click = " onMouseDown=\"row_click('$form_id"."_msg$i')\"";
349 }
350
e3812cb2 351/*
352 * Message Highlighting requires a unique CSS class declaration for proper
353 * mouseover functionality. There is no harm in doing this when the mouseover
354 * functionality is disabled
355 */
356if ($class != 'even' && $class != 'odd')
357{
358?>
359<style type="text/css">
360<!--
361.table_messageList tr.<?php echo $class; ?> { background:<?php echo $bgcolor; ?> }
362-->
363</style>
d7f26e6e 364<?php
e3812cb2 365}
49db257d 366?>
e3812cb2 367<tr <?php echo (empty($class) ? '' : 'class="'.$class.'" '); echo $row_extra;?>>
49db257d 368<?php
369 // flag style mumbo jumbo
370 $sPre = $sEnd = '';
bf9e5efb 371 if (isset($aColumns[SQM_COL_FLAGS])) {
1be82af6 372 if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
e3812cb2 373 $sPre = '<span class="unread">'; $sEnd = '</span>';
f2e2aa7f 374 }
375 if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
e3812cb2 376 $sPre = '<span class="deleted">' . $sPre;
377 $sEnd .= '</span>';
f2e2aa7f 378 } else {
379 if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
e3812cb2 380 $sPre = '<span class="flagged">' . $sPre;
381 $sEnd .= '</span>';
f2e2aa7f 382 }
49db257d 383 }
384 }
385 /**
386 * Because the order of the columns and which columns to show is a user preference
387 * we have to do some php coding to display the columns in the right order
388 */
389 foreach ($aOrder as $iCol) {
6547ab43 390 if (in_array($iCol, $show_label_columns)) {
6d34ad62 391 $sLabelStart = '<label for="'.$form_id."_msg$i\">";
49db257d 392 $sLabelEnd = '</label>';
393 } else {
394 $sLabelStart = '';
395 $sLabelEnd = '';
396 }
02e830bd 397 $aCol = (isset($aColumns[$iCol])) ? $aColumns[$iCol] : array();
398 $title = (isset($aCol['title'])) ? $aCol['title'] : '';
399 $link = (isset($aCol['link'])) ? $aCol['link'] : '';
400 $link_extra = (isset($aCol['link_extra'])) ? $aCol['link_extra'] : '';
401 $onclick = (isset($aCol['onclick'])) ? $aCol['onclick'] : '';
02e830bd 402 $value = (isset($aCol['value'])) ? $aCol['value'] : '';
403 $target = (isset($aCol['target'])) ? $aCol['target'] : '';
49db257d 404 if ($iCol !== SQM_COL_CHECK) {
405 $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
406 }
407
408
409 switch ($iCol) {
410 case SQM_COL_CHECK:
ac858073 411 if ($javascript_on) {
412 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
413 <input type="checkbox" name="<?php echo "msg[$i]";?>" id="<?php echo $form_id."_msg$i";?>" value="<?php echo $iUid;?>" <?php echo $checkbox_javascript;?> /></td>
49db257d 414 <?php
ac858073 415 } else {
416 echo '<td class="col_check">';
3d621333 417 $checked = ($checkall) ? ' checked=checked ' : '';
ac858073 418 echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
419 }
49db257d 420 break;
421 case SQM_COL_SUBJ:
422 $indent = $aCol['indent'];
e3812cb2 423 $sText = " <td class=\"col_subject\" $javascript_auto_click>";
49db257d 424 if ($align['left'] == 'left') {
425 $sText .= str_repeat('&nbsp;&nbsp;',$indent);
426 }
427 $sText .= "<a href=\"$link\"";
02e830bd 428 if ($target) { $sText .= " target=\"$target\""; }
429 if ($title) { $sText .= " title=\"$title\""; }
430 if ($onclick) { $sText .= " onclick=\"$onclick\""; }
431 if ($link_extra) { $sText .= " $link_extra"; }
49db257d 432 if ($javascript_on && $fancy_index_highlite) {
433 $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
e3812cb2 434 'parentNode.parentNode, ' . $i . ', \'click\', \''. $class. '\', \'mouse_over\', \'' .
49db257d 435 $clickedColor .'\');"';
436 }
3d621333 437 $sText .= ">"
438 . $value . '</a>';
49db257d 439 if ($align['left'] == 'right') {
440 $sText .= str_repeat('&nbsp;&nbsp;',$indent);
441 }
442 echo $sText."</td>\n";
443 break;
444 case SQM_COL_SIZE:
445 case SQM_COL_FLAGS:
3d621333 446 $sText = " <td class=\"col_flags\" $javascript_auto_click>"
447 . "$value</td>\n";
49db257d 448 echo $sText;
449 break;
450 case SQM_COL_INT_DATE:
451 case SQM_COL_DATE:
3d621333 452 $sText = " <td class=\"col_date\" $javascript_auto_click>"
453 . $value. "</td>\n";
49db257d 454 echo $sText;
455 break;
456 default:
e3812cb2 457 $sText = " <td class=\"col_text\" $javascript_auto_click";
49db257d 458 if ($link) {
459 $sText .= "><a href=\"$link\"";
460 if ($target) { $sText .= " target=\"$target\"";}
461 if ($title) { $sText .= " title=\"$title\"" ;}
462 $sText .= ">";
463 } else {
464 if ($title) {$sText .= " title=\"$title\"";}
465 $sText .= ">";
466 }
467 $sText .= $value;
468 if ($link) { $sText .= '</a>';}
469 echo $sText."</td>\n";
470 break;
471 }
472 }
3d621333 473
474 echo '</tr>';
e3812cb2 475 $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
49db257d 476 ++$i;
477
478/*
479 * End displaying row part
480 */
481 }
482
483?>
484<!-- Message headers end -->
485 </table>
486 </td>
487 </tr>
488 </table>
489 </td>
490 </tr>
e3812cb2 491 <tr><td class="spacer"></td></tr>
49db257d 492 <tr>
493 <td>
e3812cb2 494 <table class="table_standard" cellspacing="0">
49db257d 495 <tr>
496 <td>
e3812cb2 497 <table class="table_empty" cellspacing="0">
49db257d 498 <tr>
0399a40b 499 <td class="links_paginator"><?php
500 /**
501 * The following line gets the output from a separate
502 * template altogether (called "paginator.tpl").
503 * $this is the Template class object.
504 */
505 $paginator_str = $this->fetch('paginator.tpl');
506 echo $paginator_str;
507 ?></td>
e3812cb2 508 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
49db257d 509 </tr>
510 </table>
511 </td>
512 </tr>
513 </table>
514 </td>
515 </tr>
516 <tr>
0ab04626 517 <td align="right">
3d621333 518<?php if (!empty($plugin_output['mailbox_index_after'])) echo $plugin_output['mailbox_index_after']; ?>
49db257d 519 </td>
520 </tr>
521 </table>
cd0a9317 522</form>
e3812cb2 523</div>
e6e2e7fd 524
525<?php if (!$hide_sm_attributions): ?>
526<p class="sqm_squirrelcopyright">&copy; 1999-2007 The SquirrelMail Project Team - <a href="about.php">About SquirrelMail</a></p>
527<?php endif; ?>