/**
* mailbox_display.php
*
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
+ * Copyright (c) 1999-2005 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This contains functions that display mailbox information, such as the
$email_address,
$show_recipient_instead, /* show recipient name instead of default identity */
$use_icons, /* indicates to use icons or text markers */
- $icon_theme; /* icons theming */
+ $icon_theme, /* icons theming */
+ $javascript_on,
+ $fancy_index_highlite;
$color_string = $color[4];
$sSubject = str_replace(' ', ' ', decodeHeader($sSubject));
$subject = processSubject($sSubject, $iIndent);
- echo html_tag( 'tr','','','','valign="top"') . "\n";
+
+ $row_extra = 'valign="top"';
+
+
+ // this stuff does the auto row highlighting on mouseover
+ //
+ if ($javascript_on && $fancy_index_highlite) {
+
+ $mouseoverColor = $color[5];
+
+ // set this to an empty string to turn off extra
+ // highlighting of checked rows
+ //
+ //$clickedColor = '';
+ $clickedColor = $color[2];
+
+ $row_extra .= ' onmouseover="setPointer(this, ' . $t . ', \'over\', \'' . $hlt_color . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');" onmouseout="setPointer(this, ' . $t . ', \'out\', \'' . $hlt_color . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');" onmousedown="setPointer(this, ' . $t . ', \'click\', \'' . $hlt_color . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');"';
+
+ }
+
+
+ echo html_tag( 'tr','','','',$row_extra) . "\n";
+
+
+ // this does the auto-checking of the checkbox no matter
+ // where on the row you click
+ //
+ $javascript_auto_click = '';
+ if ($javascript_on && $fancy_index_highlite)
+ $javascript_auto_click = ' onMouseDown="row_click(\'msg[' . $t . ']\')"';
+
if (sizeof($index_order)) {
+
+ // figure out which columns should serve as labels for checkbox:
+ // we try to grab the two columns before and after the checkbox,
+ // except the subject column, since it is the link that opens
+ // the message view
+ //
+ // if $javascript_on is set, then the highlighting code takes
+ // care of this; just skip it
+ //
+ $show_label_columns = array();
+ if (!($javascript_on && $fancy_index_highlite)) {
+ $get_next_two = 0;
+ $last_order_part = 0;
+ $last_last_order_part = 0;
+ foreach ($index_order as $index_order_part) {
+
+ if ($index_order_part == 1) {
+ $get_next_two = 1;
+ if ($last_last_order_part != 4)
+ $show_label_columns[] = $last_last_order_part;
+ if ($last_order_part != 4)
+ $show_label_columns[] = $last_order_part;
+
+ } else if ($get_next_two > 0 && $get_next_two < 3 && $index_order_part != 4) {
+ $show_label_columns[] = $index_order_part;
+ $get_next_two++;
+ }
+ $last_last_order_part = $last_order_part;
+ $last_order_part = $index_order_part;
+ }
+ }
+
+
+ // build the actual columns for display
+ //
foreach ($index_order as $index_order_part) {
+ if (in_array($index_order_part, $show_label_columns)) {
+ $label_start = '<label for="msg[' . $t . ']">';
+ $label_end = '</label>';
+ } else {
+ $label_start = '';
+ $label_end = '';
+ }
switch ($index_order_part) {
case 1: /* checkbox */
echo html_tag( 'td',
case 2: /* from */
if ($senderAddress != $senderName) {
$senderAddress = strtr($senderAddress, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
- $title = ' title="' . str_replace('"', "''", $senderAddress) . '"';
+ $title = ' title="' . str_replace(array('"', '<', '>'), array("''", '<', '>'), $senderAddress) . '"';
} else {
$title = '';
}
echo html_tag( 'td',
- $italic . $bold . $flag . $fontstr . $senderName .
- $fontstr_end . $flag_end . $bold_end . $italic_end,
+ $label_start . $italic . $bold . $flag . $fontstr . $senderName .
+ $fontstr_end . $flag_end . $bold_end . $italic_end . $label_end,
'left',
- $hlt_color, $title );
+ $hlt_color, $title . $javascript_auto_click);
break;
case 3: /* date */
if ($sDate == '') {
$sDate = _("Unknown date");
}
echo html_tag( 'td',
- $bold . $flag . $fontstr . $sDate .
- $fontstr_end . $flag_end . $bold_end,
+ $label_start . $bold . $flag . $fontstr . $sDate .
+ $fontstr_end . $flag_end . $bold_end . $label_end,
'center',
$hlt_color,
- 'nowrap' );
+ 'style="white-space: nowrap;"' . $javascript_auto_click );
break;
case 4: /* subject */
$td_str = $bold;
$td_str .= '<a href="read_body.php?mailbox='.$urlMailbox
. '&passed_id='. $iId
. '&startMessage='.$start_msg.$searchstr.'"';
+
+ // don't highlight the row or check the checkbox
+ // when clicking subject link (when fancy highlighting is on)
+ //
+ // parentNode property is DOM Level 1
+ //
+ if ($javascript_on && $fancy_index_highlite)
+ $td_str .= ' onClick="row_click(\'msg[' . $t . ']\'); setPointer(this.parentNode.parentNode, ' . $t . ', \'click\', \'' . $hlt_color . '\', \'' . $mouseoverColor . '\', \'' . $clickedColor . '\');"';
+
$td_str .= ' ' .concat_hook_function('subject_link', array($start_msg, $searchstr));
if ($subject != $sSubject) {
$title = get_html_translation_table(HTML_SPECIALCHARS);
$title = array_flip($title);
$title = strtr($sSubject, $title);
- $title = str_replace('"', "''", $title);
+ $title = str_replace(array('"', '<', '>'), array("''", '<', '>'), $title);
$td_str .= " title=\"$title\"";
}
$td_str .= ">$flag$subject$flag_end</a>$bold_end";
- echo html_tag( 'td', $td_str, 'left', $hlt_color );
+ echo html_tag( 'td', $td_str, 'left', $hlt_color, $javascript_auto_click );
break;
case 5: /* flags */
$td_str .= '<img src="' . $msg_icon . '.png" border="0" alt="'. $msg_alt . '" title="' . $msg_title . '" height="12" width="18" />';
$td_str .= '</small></b>';
echo html_tag( 'td',
- $td_str,
+ $label_start . $td_str . $label_end,
'right',
$hlt_color,
- 'nowrap' );
+ 'style="white-space: nowrap;"' . $javascript_auto_click );
}
// plain text message markers
}
$td_str .= '</small></b>';
echo html_tag( 'td',
- $td_str,
+ $label_start . $td_str . $label_end,
'center',
$hlt_color,
- 'nowrap' );
+ 'style="white-space: nowrap;"' . $javascript_auto_click );
}
break;
case 6: /* size */
echo html_tag( 'td',
- $bold . $fontstr . show_readable_size($iSize) .
- $fontstr_end . $bold_end,
+ $label_start . $bold . $fontstr . show_readable_size($iSize) .
+ $fontstr_end . $bold_end . $label_end,
'right',
- $hlt_color );
+ $hlt_color, $javascript_auto_click );
break;
}
++$col;
}
// initialize the fields we want to retrieve:
- $aHeaderFields = array('Date', 'To', 'Cc', 'From', 'Subject', 'X-Priority', 'Content-Type');
+ $aHeaderFields = array('Date', 'To', 'Cc', 'From', 'Subject', 'X-Priority', 'Importance', 'Priority', 'Content-Type');
$aFetchItems = array('FLAGS', 'RFC822.SIZE');
// Are we sorting on internaldate then retrieve the internaldate value as well
. "}\n"
. "</script>\n"
. "<!-- end of compact paginator javascript -->\n";
- } ?>
-
-<table border="0" width="100%" cellpadding="0" cellspacing="0">
-<tr>
- <td>
- <?php mail_message_listing_beginning($imapConnection, $aMailbox, $msg_cnt_str, $paginator_str); ?>
- </td>
-</tr>
+ }
+ mail_message_listing_beginning($imapConnection, $aMailbox, $msg_cnt_str, $paginator_str);
+?>
<tr><td height="5" bgcolor="<?php echo $color[4]; ?>"></td></tr>
<tr>
<td>
<tr>
<td>
<table width="100%" cellpadding="1" cellspacing="0" align="center" border="0" bgcolor="<?php echo $color[5]; ?>">
- <tr>
- <td>
<?php
printHeader($aMailbox);
displayMessageArray($imapConnection, $aMailbox);
?>
- </td>
- </tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
-<tr>
- <td>
<?php
mail_message_listing_end($aMailbox, $paginator_str, $msg_cnt_str);
?>
- </td>
-</tr>
-</table>
+</table></form>
<?php
}
} else {
$source_url = $php_self;
}
+ $php_self = str_replace('&', '&', $php_self);
if (!isset($msg)) {
$msg = '';
$sort = $aMailbox['SORT'] + SQSORT_THREAD;
}
$thread_link_str = '<small>[<a href="' . $source_url . '?srt='
- . $sort . '&start_messages=1'
- . '&mailbox=' . urlencode($aMailbox['NAME']) . '">' . $thread_name
+ . $sort . '&start_messages=1'
+ . '&mailbox=' . urlencode($aMailbox['NAME']) . '">' . $thread_name
. '</a>]</small>';
} else {
$thread_link_str ='';
echo '<form name="' . $form_name . '" method="post" action="'.$php_self.'">' ."\n"
. $moveFields;
+ echo '<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr><td>';
$button_str = '';
// display flag buttons only if supported
<table bgcolor="<?php echo $color[4]; ?>" border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<?php echo html_tag('td', '<small>' . $paginator . $thread_link_str . '</small>', 'left') . "\n"; ?>
- <?php echo html_tag('td', '', 'center') . "\n"; ?>
+ <?php echo html_tag('td', ' ', 'center') . "\n"; ?>
<?php echo html_tag('td', '<small>' . $msg_cnt_str . '</small>', 'right') . "\n"; ?>
</tr>
</table>
</td>
</tr>
- <tr width="100%" cellpadding="1" cellspacing="0" border="0" bgcolor="<?php echo $color[0]; ?>">
+ <tr bgcolor="<?php echo $color[0]; ?>">
<td>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
</td>
</tr>
</table>
+</td></tr>
<?php
do_hook('mailbox_form_before');
}
<td>
<table bgcolor="<?php echo $color[4]; ?>" border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
- <?php echo html_tag('td', '<small>' . $paginator_str . '</small>', 'left'); ?>
- <?php echo html_tag('td', '<small>' . $msg_cnt_str . '</small>', 'right'); ?>
+ <?php echo html_tag('td', '<small>' . $paginator_str . '</small>', 'left'); ?>
+ <?php echo html_tag('td', '<small>' . $msg_cnt_str . '</small>', 'right'); ?>
</tr>
</table>
</td>
/* End of message-list table */
do_hook('mailbox_index_after');
- echo "</form>\n";
}
/**
echo html_tag( 'td',get_selectall_link($aMailbox) , '', '', 'width="1%"' );
break;
case 5: /* flags */
- echo html_tag( 'td','' , '', '', 'width="1%"' );
+ echo html_tag( 'td',' ' , '', '', 'width="1%"' );
break;
case 2: /* from */
if (handleAsSent($aMailbox['NAME'])) {
echo "</td>\n";
break;
case 3: /* date */
- echo html_tag( 'td' ,'' , 'left', '', 'width="5%" nowrap' )
+ echo html_tag( 'td' ,'' , 'left', '', 'width="5%" style="white-space: nowrap;"' )
. '<b>' . _("Date") . '</b>';
if ($showsort) {
if ($internal_date_sort) {
echo "</td>\n";
break;
case 6: /* size */
- echo html_tag( 'td', '', 'center','','width="5%" nowrap')
+ echo html_tag( 'td', '', 'center','','width="5%" style="white-space: nowrap;"')
. '<b>' . _("Size") . '</b>';
if ($showsort) {
ShowSortButton($aMailbox, SQSORT_SIZE_ASC, SQSORT_SIZE_DEC);
. "//-->\n"
. '</script>'
. '<input type="checkbox" name="toggleAll" title="'._("Toggle All").'" onclick="'.$func_name.'();" />';
-// . <a href="javascript:void(0)" onClick="' . $func_name . '();">' . _("Toggle All")
+// . <a href="javascript:void(0)" onclick="' . $func_name . '();">' . _("Toggle All")
// . "</a>\n";
} else {
$result .= "<a href=\"$PHP_SELF";
$result = preg_replace("/checkall=(\d)/","checkall=$checkall_val",$result);
}
- // FIXME: I suspect that search pages use different variables in 1.5.1cvs
+ // FIXME: I suspect that search pages use different variables in 1.5.1cvs
// and these variables are present in $PHP_SELF.
if (isset($aMailbox['SEARCH']) && isset($aMailbox['SEARCH'][0]) && ! sqgetGlobalVar('where',$tmp,SQ_GET)) {
$result .= '&where=' . urlencode($aMailbox['SEARCH'][0]);
$result .= $spc . '<select name="startMessage"';
if ($javascript_on) {
$result .= ' onchange="JavaScript:SubmitOnSelect'
- . '(this, \'' . $pg_url . '&startMessage=\')"';
+ . '(this, \'' . $pg_url . '&startMessage=\')"';
}
$result .='>';
return call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_strimwidth', $subject, $trim_val);
}
- return substr_replace($subject, '...', $trim_val);
+ return substr_replace($subject, '...', $trim_val + 1);
}
/**
'<small>' . $string . ': </small>',
$align,
'',
- 'nowrap' );
+ 'style="white-space: nowrap;"' );
}
/**
if (($aMailbox['PAGEOFFSET']-1) >= $aMailbox['EXISTS']) {
$aMailbox['PAGEOFFSET'] = ($aMailbox['PAGEOFFSET'] > $aMailbox['LIMIT']) ?
$aMailbox['PAGEOFFSET'] - $aMailbox['LIMIT'] : 1;
- $aMailbox['OFFSET'] = $aMailbox['PAGEOFFSET'] - 1 ;
+ $aMailbox['OFFSET'] = $aMailbox['PAGEOFFSET'] - 1 ;
}
}
}
}
// vim: et ts=4
-?>
\ No newline at end of file
+?>