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