Index: roundcubemail/program/steps/mail/func.inc
===================================================================
--- roundcubemail/program/steps/mail/func.inc (revision 2308)
+++ roundcubemail/program/steps/mail/func.inc (working copy)
@@ -80,7 +80,7 @@
}
// make sure the message count is refreshed (for default view)
- $IMAP->messagecount($mbox_name, 'ALL', true);
+ $IMAP->messagecount($mbox_name,rcmail::get_instance()->config->get('message_threading',false)?'THREADS':'ALL', true);
}
// set current mailbox in client environment
@@ -152,7 +152,6 @@
// add col definition
$out .= '
';
- $out .= '';
foreach ($a_show_cols as $col)
$out .= ($col!='attachment') ? sprintf('', $col) : '';
@@ -160,7 +159,7 @@
$out .= "\n";
// add table title
- $out .= "\n| | \n";
+ $out .= "\n";
$javascript = '';
foreach ($a_show_cols as $col)
@@ -257,6 +256,9 @@
$js_row_arr['forwarded'] = true;
if ($header->flagged)
$js_row_arr['flagged'] = true;
+ if ($header->has_children)
+ $js_row_arr['has_children'] = true;
+ $js_row_arr['depth'] = $header->depth;
// set message icon
if ($attrib['deletedicon'] && $header->deleted)
@@ -284,19 +286,28 @@
if ($attrib['attachmenticon'] && preg_match("/multipart\/m/i", $header->ctype))
$attach_icon = $attrib['attachmenticon'];
- $out .= sprintf('
'."\n",
+ $out .= sprintf('
'."\n",
$header->uid,
$header->seen ? '' : ' unread',
$header->deleted ? ' deleted' : '',
$header->flagged ? ' flagged' : '',
- $zebra_class);
+ $zebra_class,
+ ($header->depth > 1) ? ' style="display: none"' : '');
- $out .= sprintf("| %s | \n", $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : '');
+ $tree = '';
+ $depth = $header->depth;
+ if ($depth > 0)
+ {
+ for ($i=1;$i<$depth;$i++)
+ $tree .= ' 
';
+ $tree .= $header->has_children?'
':'
';
+ }
+ $tree .= $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : '';
-
$IMAP->set_charset(!empty($header->charset) ? $header->charset : $CONFIG['default_charset']);
// format each col
+ $first = true;
foreach ($a_show_cols as $col)
{
if ($col=='from' || $col=='to')
@@ -318,6 +329,10 @@
else
$cont = Q($header->$col);
+ if ($first) {
+ $first = false;
+ $cont = $tree . $cont;
+ }
if ($col!='attachment')
$out .= '' . $cont . " | \n";
else
@@ -333,7 +348,7 @@
// complete message table
$out .= "\n";
- $message_count = $IMAP->messagecount();
+ $message_count = $IMAP->messagecount(NULL, rcmail::get_instance()->config->get('message_threading',false)?'THREADS':'ALL');
// set client env
$OUTPUT->add_gui_object('mailcontframe', 'mailcontframe');
@@ -393,6 +408,12 @@
$OUTPUT->command('set_message_coltypes', $a_show_cols);
+ // remove 'attachment' and 'flag' columns, we don't need them here
+ if(($key = array_search('attachment', $a_show_cols)) !== FALSE)
+ unset($a_show_cols[$key]);
+ if(($key = array_search('flag', $a_show_cols)) !== FALSE)
+ unset($a_show_cols[$key]);
+
// loop through message headers
foreach ($a_headers as $n => $header)
{
@@ -404,12 +425,6 @@
$IMAP->set_charset(!empty($header->charset) ? $header->charset : $CONFIG['default_charset']);
- // remove 'attachment' and 'flag' columns, we don't need them here
- if(($key = array_search('attachment', $a_show_cols)) !== FALSE)
- unset($a_show_cols[$key]);
- if(($key = array_search('flag', $a_show_cols)) !== FALSE)
- unset($a_show_cols[$key]);
-
// format each col; similar as in rcmail_message_list()
foreach ($a_show_cols as $col)
{
@@ -438,6 +453,8 @@
$a_msg_flags['replied'] = $header->answered ? 1 : 0;
$a_msg_flags['forwarded'] = $header->forwarded ? 1 : 0;
$a_msg_flags['flagged'] = $header->flagged ? 1 : 0;
+ $a_msg_flags['has_children'] = $header->has_children ? 1 : 0;
+ $a_msg_cols['depth'] = $header->depth;
$OUTPUT->command('add_message_row',
$header->uid,
@@ -446,6 +463,7 @@
preg_match("/multipart\/m/i", $header->ctype),
$insert_top);
}
+ $OUTPUT->command('expand_threads');
}
@@ -565,23 +583,24 @@
{
global $IMAP, $MESSAGE;
+ $message_threading = rcmail::get_instance()->config->get('message_threading',false);
if (isset($MESSAGE->index))
{
return rcube_label(array('name' => 'messagenrof',
'vars' => array('nr' => $MESSAGE->index+1,
- 'count' => $count!==NULL ? $count : $IMAP->messagecount())));
+ 'count' => $count!==NULL ? $count : $IMAP->messagecount(NULL, $message_threading?'THREADS':'ALL'))));
}
if ($page===NULL)
$page = $IMAP->list_page;
$start_msg = ($page-1) * $IMAP->page_size + 1;
- $max = $count!==NULL ? $count : $IMAP->messagecount();
+ $max = $count!==NULL ? $count : $IMAP->messagecount(NULL, $message_threading?'THREADS':'ALL');
if ($max==0)
$out = rcube_label('mailboxempty');
else
- $out = rcube_label(array('name' => 'messagesfromto',
+ $out = rcube_label(array('name' => $message_threading?'threadsfromto':'messagesfromto',
'vars' => array('from' => $start_msg,
'to' => min($max, $start_msg + $IMAP->page_size - 1),
'count' => $max)));