fix strict js/css notices (#1778815)
[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
e0a6645e 65 * $checkall
83d1e1af 66 *
47ccfad4 67 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
4b4abf93 68 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
49db257d 69 * @version $Id$
70 * @package squirrelmail
57d06b39 71 * @subpackage templates
49db257d 72 */
73
4127171c 74
f2e2aa7f 75/** add required includes */
a1d29fb8 76include_once(SM_PATH . 'functions/template/message_list_util.php');
49db257d 77
4127171c 78
49db257d 79/* retrieve the template vars */
80extract($t);
81
4127171c 82
a1d29fb8 83if (!empty($plugin_output['mailbox_index_before'])) echo $plugin_output['mailbox_index_before'];
49db257d 84
4127171c 85
49db257d 86/**
87 * Calculate string "Viewing message x to y (z total)"
88 */
89$msg_cnt_str = '';
90if ($pageOffset < $end_msg) {
91 $msg_cnt_str = sprintf(_("Viewing Messages: %s to %s (%s total)"),
4127171c 92 '<em>' . $pageOffset . '</em>',
93 '<em>' . $end_msg . '</em>',
94 $iNumberOfMessages);
49db257d 95} else if ($pageOffset == $end_msg) {
4127171c 96 $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"),
97 '<em>' . $pageOffset . '</em>',
98 $iNumberOfMessages);
49db257d 99}
100
49db257d 101
583db309 102/**
29997535 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.
4127171c 106 */
107
583db309 108
49db257d 109?>
e3812cb2 110<div id="message_list">
a73c1312 111<form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
e3812cb2 112<table class="table_empty" cellspacing="0">
49db257d 113 <tr>
e3812cb2 114 <td>
115 <table class="table_standard" cellspacing="0">
49db257d 116 <tr>
117 <td>
e3812cb2 118 <table class="table_empty" cellspacing="0">
49db257d 119 <tr>
e3812cb2 120 <td class="links_paginator">
49db257d 121<!-- paginator and thread link string -->
122 <?php
4127171c 123 /**
124 * The following line gets the output from a separate
125 * template altogether (called "paginator.tpl").
126 * $this is the Template class object.
49db257d 127 */
128 $paginator_str = $this->fetch('paginator.tpl');
cd693cf4 129 echo $paginator_str . '<small>[<a href="' . $thread_link_uri
130 . '">' . $thread_name . '</a>]</small>'; ?>
49db257d 131<!-- end paginator and thread link string -->
49db257d 132 </td>
133<!-- message count string -->
e3812cb2 134 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
49db257d 135<!-- end message count string -->
136 </tr>
137 </table>
138 </td>
139 </tr>
140<?php
141 if (count($aFormElements)) {
142?>
143<!-- start message list form control -->
d915a2ca 144 <tr class="message_list_controls">
49db257d 145 <td>
69a023cf 146 <?php
147 /**
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.
151 */
152 $message_list_controls = $this->fetch('message_list_controls.tpl');
153 echo $message_list_controls ."\n"; ?>
49db257d 154 </td>
155 </tr>
156<!-- end message list form control -->
157<?php
158 } // if (count($aFormElements))
159?>
160 </table>
4127171c 161<?php if (!empty($plugin_output['mailbox_form_before'])) echo $plugin_output['mailbox_form_before']; ?>
49db257d 162 </td>
163 </tr>
e3812cb2 164 <tr><td class="spacer"></td></tr>
49db257d 165 <tr>
166 <td>
e3812cb2 167 <table class="table_messageListWrapper" cellspacing="0">
49db257d 168 <tr>
169 <td>
e3812cb2 170 <table class="table_messageList" cellspacing="0">
49db257d 171<!-- table header start -->
e3812cb2 172<?php
173/*
174 * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
ac858073 175 * rendering this table if we use THEAD and TH tags. No other browser or platform has
e3812cb2 176 * this issue. We will use TR/TD w/ another CSS class to work around this.
177 */
178?>
4127171c 179
e3812cb2 180 <tr class="headerRow">
4127171c 181
49db257d 182<?php
183 $aWidth = calcMessageListColumnWidth($aOrder);
184 foreach($aOrder as $iCol) {
49db257d 185?>
4127171c 186
e3812cb2 187 <td style="width:<?php echo $aWidth[$iCol]; ?>%">
4127171c 188
49db257d 189<?php
190 switch ($iCol) {
191 case SQM_COL_CHECK:
192 if ($javascript_on) {
e0a6645e 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";
49db257d 195 } else {
e0a6645e 196 $link = $baseurl
197 . "&amp;startMessage=$pageOffset&amp;checkall="
198 . ($checkall ? '0' : '1');
49db257d 199 echo "<a href=\"$link\">"._("All").'</a>';
200 }
201 break;
e3812cb2 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;
583db309 205 case SQM_COL_FLAGS:
29997535 206 echo getIcon($icon_theme_path, 'msg_new.png', '&nbsp;', _("Message Flags")) . "\n";
207 break;
e3812cb2 208 case SQM_COL_SIZE: echo _("Size")."\n"; break;
583db309 209 case SQM_COL_PRIO:
29997535 210 echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
211 break;
583db309 212 case SQM_COL_ATTACHMENT:
29997535 213 echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
214 break;
e3812cb2 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;
49db257d 219 default: break;
220 }
221 // add the sort buttons
222 if (isset($aSortSupported[$iCol])) {
223 if ($sort == $aSortSupported[$iCol][0]) {
29997535 224 $newsort = $aSortSupported[$iCol][1];
225 $img = 'up_pointer.png';
8af5b50c 226 $text_icon = '&#8679;'; // U+21E7 UPWARDS WHITE ARROW
49db257d 227 } else if ($sort == $aSortSupported[$iCol][1]) {
29997535 228 $newsort = 0;
229 $img = 'down_pointer.png';
8af5b50c 230 $text_icon = '&#8681;'; // U+21E9 DOWNWARDS WHITE ARROW
49db257d 231 } else {
29997535 232 $newsort = $aSortSupported[$iCol][0];
233 $img = 'sort_none.png';
8af5b50c 234 $text_icon = '&#9723;'; // U+25FB WHITE MEDIUM SQUARE
49db257d 235 }
236 /* Now that we have everything figured out, show the actual button. */
8af5b50c 237 echo " <a href=\"$baseurl&amp;startMessage=1&amp;srt=$newsort\" style=\"text-decoration:none\">" .
6c68e276 238 getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" .
29997535 239 '</a>';
49db257d 240 }
241?>
49db257d 242 </td>
243<?php
244 }
245?>
e3812cb2 246 </tr>
247<!-- end table header -->
49db257d 248
249<!-- Message headers start -->
250<?php
3d621333 251
49db257d 252 $i = 0;
253 $iColCnt = count($aOrder);
254 $sLine = '';
255
3d621333 256
49db257d 257 // this stuff does the auto row highlighting on mouseover
258 //
259 if ($javascript_on && $fancy_index_highlite) {
cd0a9317 260 $checkbox_javascript = ' onclick="this.checked = !this.checked;"';
799ee2d5 261 } else {
262 $checkbox_javascript = '';
49db257d 263 }
3d621333 264
265
266 /**
267 * main message iteration loop
268 */
49db257d 269 foreach ($aMessages as $iUid => $aMsg) {
3d621333 270
49db257d 271 echo $sLine;
272
3d621333 273
49db257d 274/**
275* Display message header row in messages list
276*
277*/
278
279 $aColumns = $aMsg['columns'];
280
49db257d 281
282 /**
283 * Check the flags and set a class var.
284 */
285 if (isset($aColumns[SQM_COL_FLAGS])) {
286 $aFlags = $aColumns[SQM_COL_FLAGS]['value'];
29997535 287 $sFlags = getFlagIcon($aFlags, $icon_theme_path);
49db257d 288
49db257d 289 /* add the flag string to the value index */
290 $aColumns[SQM_COL_FLAGS]['value'] = $sFlags;
291 }
292 /**
293 * Check the priority column
294 */
295 if (isset($aColumns[SQM_COL_PRIO])) {
29997535 296 $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
49db257d 297 $aColumns[SQM_COL_PRIO]['value'] = $sValue;
298 }
299
300 /**
301 * Check the attachment column
302 */
303 if (isset($aColumns[SQM_COL_ATTACHMENT])) {
29997535 304 $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path);
49db257d 305 $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
306 }
307
e0a6645e 308 $class = ($checkall && $javascript_on && $fancy_index_highlite ? 'clicked_even' : 'even');
309 $non_clicked_class = 'even';
310
49db257d 311 /**
e3812cb2 312 * If alternating row colors is set, adapt the CSS class
49db257d 313 */
314 if (isset($alt_index_colors) && $alt_index_colors) {
315 if (!($i % 2)) {
e0a6645e 316 $class = ($checkall && $javascript_on && $fancy_index_highlite ? 'clicked_odd' : 'odd');
317 $non_clicked_class = 'odd';
49db257d 318 }
319
320 }
9c928f05 321
322 /**
323 * Message Highlighting Functionality
324 */
e3812cb2 325 if (isset($aMsg['row']['color']))
326 {
9c928f05 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;
331 } else {
332 $bgcolor = $aMsg['row']['color'];
333 $class = 'misc'.$i;
334 }
335 $non_clicked_class = 'misc'.$i;
336 $non_clicked_bgcolor = $aMsg['row']['color'];
337 }
338 else
339 {
340 $bgcolor = '';
341 $non_clicked_bgcolor = '';
e3812cb2 342 }
49db257d 343
344 $row_extra = '';
345
346 // this stuff does the auto row highlighting on mouseover
347 //
348 if ($javascript_on && $fancy_index_highlite) {
e0a6645e 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\');"';
49db257d 350 }
351 // this does the auto-checking of the checkbox no matter
352 // where on the row you click
353 //
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
42ad60c0 357 $javascript_auto_click = " onmousedown=\"row_click('$form_id"."_msg$i')\"";
49db257d 358 }
359
9c928f05 360
e3812cb2 361/*
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
365 */
e0a6645e 366if ($class != 'even' && $class != 'odd'
9c928f05 367 && $class != 'clicked_even' && $class != 'clicked_odd')
e3812cb2 368{
369?>
370<style type="text/css">
371<!--
372.table_messageList tr.<?php echo $class; ?> { background:<?php echo $bgcolor; ?> }
373-->
374</style>
d7f26e6e 375<?php
e3812cb2 376}
9c928f05 377if ($non_clicked_class != 'even' && $non_clicked_class != 'odd'
378 && $non_clicked_class != 'clicked_even' && $non_clicked_class != 'clicked_odd')
379{
380?>
381<style type="text/css">
382<!--
383.table_messageList tr.<?php echo $non_clicked_class; ?> { background:<?php echo $non_clicked_bgcolor; ?> }
384-->
385</style>
386<?php
387}
388
389
49db257d 390?>
e3812cb2 391<tr <?php echo (empty($class) ? '' : 'class="'.$class.'" '); echo $row_extra;?>>
49db257d 392<?php
393 // flag style mumbo jumbo
394 $sPre = $sEnd = '';
bf9e5efb 395 if (isset($aColumns[SQM_COL_FLAGS])) {
1be82af6 396 if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
e3812cb2 397 $sPre = '<span class="unread">'; $sEnd = '</span>';
f2e2aa7f 398 }
399 if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
e3812cb2 400 $sPre = '<span class="deleted">' . $sPre;
401 $sEnd .= '</span>';
f2e2aa7f 402 } else {
403 if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
e3812cb2 404 $sPre = '<span class="flagged">' . $sPre;
405 $sEnd .= '</span>';
f2e2aa7f 406 }
49db257d 407 }
408 }
409 /**
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
412 */
413 foreach ($aOrder as $iCol) {
6547ab43 414 if (in_array($iCol, $show_label_columns)) {
6d34ad62 415 $sLabelStart = '<label for="'.$form_id."_msg$i\">";
49db257d 416 $sLabelEnd = '</label>';
417 } else {
418 $sLabelStart = '';
419 $sLabelEnd = '';
420 }
02e830bd 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'] : '';
02e830bd 426 $value = (isset($aCol['value'])) ? $aCol['value'] : '';
427 $target = (isset($aCol['target'])) ? $aCol['target'] : '';
49db257d 428 if ($iCol !== SQM_COL_CHECK) {
429 $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
430 }
431
432
433 switch ($iCol) {
434 case SQM_COL_CHECK:
e0a6645e 435 $checked = ($checkall ? ' checked="checked" ' : '');
ac858073 436 if ($javascript_on) {
437 echo '<td class="col_check"'. $javascript_auto_click. '>' ?>
e0a6645e 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>
49db257d 439 <?php
ac858073 440 } else {
441 echo '<td class="col_check">';
ac858073 442 echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
443 }
49db257d 444 break;
445 case SQM_COL_SUBJ:
446 $indent = $aCol['indent'];
e3812cb2 447 $sText = " <td class=\"col_subject\" $javascript_auto_click>";
49db257d 448 if ($align['left'] == 'left') {
449 $sText .= str_repeat('&nbsp;&nbsp;',$indent);
450 }
451 $sText .= "<a href=\"$link\"";
02e830bd 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"; }
49db257d 456 if ($javascript_on && $fancy_index_highlite) {
457 $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
e0a6645e 458 'parentNode.parentNode, ' . $i . ', \'click\', \''. $non_clicked_class. '\', \'mouse_over\', \'clicked\');"';
49db257d 459 }
3d621333 460 $sText .= ">"
461 . $value . '</a>';
49db257d 462 if ($align['left'] == 'right') {
463 $sText .= str_repeat('&nbsp;&nbsp;',$indent);
464 }
465 echo $sText."</td>\n";
466 break;
467 case SQM_COL_SIZE:
468 case SQM_COL_FLAGS:
3d621333 469 $sText = " <td class=\"col_flags\" $javascript_auto_click>"
470 . "$value</td>\n";
49db257d 471 echo $sText;
472 break;
473 case SQM_COL_INT_DATE:
474 case SQM_COL_DATE:
3d621333 475 $sText = " <td class=\"col_date\" $javascript_auto_click>"
476 . $value. "</td>\n";
49db257d 477 echo $sText;
478 break;
479 default:
e3812cb2 480 $sText = " <td class=\"col_text\" $javascript_auto_click";
49db257d 481 if ($link) {
482 $sText .= "><a href=\"$link\"";
483 if ($target) { $sText .= " target=\"$target\"";}
484 if ($title) { $sText .= " title=\"$title\"" ;}
485 $sText .= ">";
486 } else {
487 if ($title) {$sText .= " title=\"$title\"";}
488 $sText .= ">";
489 }
490 $sText .= $value;
491 if ($link) { $sText .= '</a>';}
492 echo $sText."</td>\n";
493 break;
494 }
495 }
3d621333 496
497 echo '</tr>';
e3812cb2 498 $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
49db257d 499 ++$i;
500
501/*
502 * End displaying row part
503 */
504 }
505
506?>
507<!-- Message headers end -->
508 </table>
509 </td>
510 </tr>
511 </table>
512 </td>
513 </tr>
e3812cb2 514 <tr><td class="spacer"></td></tr>
49db257d 515 <tr>
516 <td>
e3812cb2 517 <table class="table_standard" cellspacing="0">
49db257d 518 <tr>
519 <td>
e3812cb2 520 <table class="table_empty" cellspacing="0">
49db257d 521 <tr>
0399a40b 522 <td class="links_paginator"><?php
523 /**
524 * The following line gets the output from a separate
525 * template altogether (called "paginator.tpl").
526 * $this is the Template class object.
527 */
528 $paginator_str = $this->fetch('paginator.tpl');
529 echo $paginator_str;
530 ?></td>
e3812cb2 531 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
49db257d 532 </tr>
533 </table>
534 </td>
535 </tr>
536 </table>
537 </td>
538 </tr>
539 <tr>
0ab04626 540 <td align="right">
3d621333 541<?php if (!empty($plugin_output['mailbox_index_after'])) echo $plugin_output['mailbox_index_after']; ?>
49db257d 542 </td>
543 </tr>
544 </table>
cd0a9317 545</form>
e3812cb2 546</div>
e6e2e7fd 547
548<?php if (!$hide_sm_attributions): ?>
549<p class="sqm_squirrelcopyright">&copy; 1999-2007 The SquirrelMail Project Team - <a href="about.php">About SquirrelMail</a></p>
550<?php endif; ?>