remove useless check for unset user_is_logged_in, since that is
[squirrelmail.git] / templates / default / message_list.tpl
... / ...
CommitLineData
1<?php
2
3/**
4 * message_list.tpl
5 *
6 * Template for viewing a messages list
7 *
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
22 * $provider_link
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
52 * $thread_link_uri
53 * $thread_name
54 * $php_self
55 * $mailbox
56 * $enablesort
57 * $icon_theme
58 * $use_icons
59 * $alt_index_colors
60 * $fancy_index_highlite
61 * $aSortSupported
62 * $show_label_columns
63 * $compact_paginator
64 * $aErrors
65 *
66 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
67 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
68 * @version $Id$
69 * @package squirrelmail
70 * @subpackage templates
71 */
72
73
74/** add required includes */
75include_once(SM_PATH . 'functions/template/message_list_util.php');
76
77
78/* retrieve the template vars */
79extract($t);
80
81
82if (!empty($plugin_output['mailbox_index_before'])) echo $plugin_output['mailbox_index_before'];
83
84
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)"),
91 '<em>' . $pageOffset . '</em>',
92 '<em>' . $end_msg . '</em>',
93 $iNumberOfMessages);
94} else if ($pageOffset == $end_msg) {
95 $msg_cnt_str = sprintf(_("Viewing Message: %s (%s total)"),
96 '<em>' . $pageOffset . '</em>',
97 $iNumberOfMessages);
98}
99
100
101/**
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.
105 */
106
107
108// set this to an empty string to turn off extra
109// highlighting of checked rows
110//
111//$clickedColor = '';
112$clickedColor = (empty($color[16])) ? $color[2] : $color[16];
113
114
115?>
116<div id="message_list">
117<form id="<?php echo $form_name;?>" name="<?php echo $form_name;?>" method="post" action="<?php echo $php_self;?>">
118<table class="table_empty" cellspacing="0">
119 <tr>
120 <td>
121 <table class="table_standard" cellspacing="0">
122 <tr>
123 <td>
124 <table class="table_empty" cellspacing="0">
125 <tr>
126 <td class="links_paginator">
127<!-- paginator and thread link string -->
128 <?php
129 /**
130 * The following line gets the output from a separate
131 * template altogether (called "paginator.tpl").
132 * $this is the Template class object.
133 */
134 $paginator_str = $this->fetch('paginator.tpl');
135 echo $paginator_str . '<small>[<a href="' . $thread_link_uri
136 . '">' . $thread_name . '</a>]</small>'; ?>
137<!-- end paginator and thread link string -->
138 </td>
139<!-- message count string -->
140 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
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 -->
150 <tr class="message_list_controls">
151 <td>
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"; ?>
160 </td>
161 </tr>
162<!-- end message list form control -->
163<?php
164 } // if (count($aFormElements))
165?>
166 </table>
167<?php if (!empty($plugin_output['mailbox_form_before'])) echo $plugin_output['mailbox_form_before']; ?>
168 </td>
169 </tr>
170 <tr><td class="spacer"></td></tr>
171 <tr>
172 <td>
173 <table class="table_messageListWrapper" cellspacing="0">
174 <tr>
175 <td>
176 <table class="table_messageList" cellspacing="0">
177<!-- table header start -->
178<?php
179/*
180 * As an FYI, Firefox on Windows seems to have an issue w/ putting wierd breaks while
181 * rendering this table if we use THEAD and TH tags. No other browser or platform has
182 * this issue. We will use TR/TD w/ another CSS class to work around this.
183 */
184?>
185
186 <tr class="headerRow">
187
188<?php
189 $aWidth = calcMessageListColumnWidth($aOrder);
190 foreach($aOrder as $iCol) {
191?>
192
193 <td style="width:<?php echo $aWidth[$iCol]; ?>%">
194
195<?php
196 switch ($iCol) {
197 case SQM_COL_CHECK:
198 if ($javascript_on) {
199 echo '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="toggle_all(\''.$form_name."',".$fancy_index_highlite.')" />'."\n";
200 } else {
201 $link = $baseurl . "&amp;startMessage=$pageOffset&amp;checkall=";
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;
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;
213 case SQM_COL_FLAGS:
214 echo getIcon($icon_theme_path, 'msg_new.png', '&nbsp;', _("Message Flags")) . "\n";
215 break;
216 case SQM_COL_SIZE: echo _("Size")."\n"; break;
217 case SQM_COL_PRIO:
218 echo getIcon($icon_theme_path, 'prio_high.png', '!', _("Priority")) . "\n";
219 break;
220 case SQM_COL_ATTACHMENT:
221 echo getIcon($icon_theme_path, 'attach.png', '+', _("Attachment")) . "\n";
222 break;
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;
227 default: break;
228 }
229 // add the sort buttons
230 if (isset($aSortSupported[$iCol])) {
231 if ($sort == $aSortSupported[$iCol][0]) {
232 $newsort = $aSortSupported[$iCol][1];
233 $img = 'up_pointer.png';
234 $text_icon = '&#8679;'; // U+21E7 UPWARDS WHITE ARROW
235 } else if ($sort == $aSortSupported[$iCol][1]) {
236 $newsort = 0;
237 $img = 'down_pointer.png';
238 $text_icon = '&#8681;'; // U+21E9 DOWNWARDS WHITE ARROW
239 } else {
240 $newsort = $aSortSupported[$iCol][0];
241 $img = 'sort_none.png';
242 $text_icon = '&#9723;'; // U+25FB WHITE MEDIUM SQUARE
243 }
244 /* Now that we have everything figured out, show the actual button. */
245 echo " <a href=\"$baseurl&amp;startMessage=1&amp;srt=$newsort\" style=\"text-decoration:none\">" .
246 getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" .
247 '</a>';
248 }
249?>
250 </td>
251<?php
252 }
253?>
254 </tr>
255<!-- end table header -->
256
257<!-- Message headers start -->
258<?php
259
260 $i = 0;
261 $iColCnt = count($aOrder);
262 $sLine = '';
263
264
265 // this stuff does the auto row highlighting on mouseover
266 //
267 if ($javascript_on && $fancy_index_highlite) {
268 $mouseoverColor = $color[5];
269 $checkbox_javascript = ' onclick="this.checked = !this.checked;"';
270 // $clickedColor is defined at top of this file
271 } else {
272 $checkbox_javascript = '';
273 }
274
275
276 /**
277 * main message iteration loop
278 */
279 foreach ($aMessages as $iUid => $aMsg) {
280
281 echo $sLine;
282
283
284/**
285* Display message header row in messages list
286*
287*/
288
289 $aColumns = $aMsg['columns'];
290
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'];
297 $sFlags = getFlagIcon($aFlags, $icon_theme_path);
298
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])) {
306 $sValue = getPriorityIcon($aColumns[SQM_COL_PRIO]['value'], $icon_theme_path);
307 $aColumns[SQM_COL_PRIO]['value'] = $sValue;
308 }
309
310 /**
311 * Check the attachment column
312 */
313 if (isset($aColumns[SQM_COL_ATTACHMENT])) {
314 $sValue = getAttachmentIcon($aColumns[SQM_COL_ATTACHMENT]['value'], $icon_theme_path);
315 $aColumns[SQM_COL_ATTACHMENT]['value'] = $sValue;
316 }
317
318 $class = 'even';
319 /**
320 * If alternating row colors is set, adapt the CSS class
321 */
322 if (isset($alt_index_colors) && $alt_index_colors) {
323 if (!($i % 2)) {
324 $class = 'odd';
325 }
326
327 }
328 if (isset($aMsg['row']['color']))
329 {
330 $bgcolor = $aMsg['row']['color'];
331 $class = 'misc'.$i;
332 }
333 else $bgcolor = '';
334
335 $row_extra = '';
336
337 // this stuff does the auto row highlighting on mouseover
338 //
339 if ($javascript_on && $fancy_index_highlite) {
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\');"';
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
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>
364<?php
365}
366?>
367<tr <?php echo (empty($class) ? '' : 'class="'.$class.'" '); echo $row_extra;?>>
368<?php
369 // flag style mumbo jumbo
370 $sPre = $sEnd = '';
371 if (isset($aColumns[SQM_COL_FLAGS])) {
372 if (!in_array('seen',$aFlags) || !$aFlags['seen']) {
373 $sPre = '<span class="unread">'; $sEnd = '</span>';
374 }
375 if (in_array('deleted',$aFlags) && $aFlags['deleted']) {
376 $sPre = '<span class="deleted">' . $sPre;
377 $sEnd .= '</span>';
378 } else {
379 if (in_array('flagged',$aFlags) && $aFlags['flagged']) {
380 $sPre = '<span class="flagged">' . $sPre;
381 $sEnd .= '</span>';
382 }
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) {
390 if (in_array($iCol, $show_label_columns)) {
391 $sLabelStart = '<label for="'.$form_id."_msg$i\">";
392 $sLabelEnd = '</label>';
393 } else {
394 $sLabelStart = '';
395 $sLabelEnd = '';
396 }
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'] : '';
402 $value = (isset($aCol['value'])) ? $aCol['value'] : '';
403 $target = (isset($aCol['target'])) ? $aCol['target'] : '';
404 if ($iCol !== SQM_COL_CHECK) {
405 $value = $sLabelStart.$sPre.$value.$sEnd.$sLabelEnd;
406 }
407
408
409 switch ($iCol) {
410 case SQM_COL_CHECK:
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>
414 <?php
415 } else {
416 echo '<td class="col_check">';
417 $checked = ($checkall) ? ' checked=checked ' : '';
418 echo "<input type=\"checkbox\" name=\"msg[".$i."]\" id=\"".$form_id."_msg$i\" value=\"$iUid\" $checked/></td>";
419 }
420 break;
421 case SQM_COL_SUBJ:
422 $indent = $aCol['indent'];
423 $sText = " <td class=\"col_subject\" $javascript_auto_click>";
424 if ($align['left'] == 'left') {
425 $sText .= str_repeat('&nbsp;&nbsp;',$indent);
426 }
427 $sText .= "<a href=\"$link\"";
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"; }
432 if ($javascript_on && $fancy_index_highlite) {
433 $sText .= " onmousedown=\"row_click('$form_id"."_msg$i'); setPointer(this." . (empty($bold) ? '' : 'parentNode.') .
434 'parentNode.parentNode, ' . $i . ', \'click\', \''. $class. '\', \'mouse_over\', \'' .
435 $clickedColor .'\');"';
436 }
437 $sText .= ">"
438 . $value . '</a>';
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:
446 $sText = " <td class=\"col_flags\" $javascript_auto_click>"
447 . "$value</td>\n";
448 echo $sText;
449 break;
450 case SQM_COL_INT_DATE:
451 case SQM_COL_DATE:
452 $sText = " <td class=\"col_date\" $javascript_auto_click>"
453 . $value. "</td>\n";
454 echo $sText;
455 break;
456 default:
457 $sText = " <td class=\"col_text\" $javascript_auto_click";
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 }
473
474 echo '</tr>';
475 $sLine = "<tr><td colspan=\"$iColCnt\" class=\"spacer\"></td></tr>\n";
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>
491 <tr><td class="spacer"></td></tr>
492 <tr>
493 <td>
494 <table class="table_standard" cellspacing="0">
495 <tr>
496 <td>
497 <table class="table_empty" cellspacing="0">
498 <tr>
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>
508 <td class="message_count"><?php echo $msg_cnt_str; ?></td>
509 </tr>
510 </table>
511 </td>
512 </tr>
513 </table>
514 </td>
515 </tr>
516 <tr>
517 <td align="right">
518<?php if (!empty($plugin_output['mailbox_index_after'])) echo $plugin_output['mailbox_index_after']; ?>
519 </td>
520 </tr>
521 </table>
522</form>
523</div>
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; ?>