From 6c9d496fcc44a1d36299fb1d107d49e53858104c Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sun, 30 May 2010 03:48:15 -0400
Subject: [PATCH] - 'threads' column made movable

---
 program/steps/mail/func.inc |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index b07e3a6..384074b 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -171,6 +171,10 @@
       && (($f = array_search('from', $a_show_cols)) !== false) && array_search('to', $a_show_cols) === false)
     $a_show_cols[$f] = 'to';
 
+  // make sure 'threads' column is present 
+  if (!in_array('threads', $a_show_cols))
+    array_unshift($a_show_cols, 'threads');
+
   $skin_path = $_SESSION['skin_path'] = $CONFIG['skin_path'];
 
   // set client env
@@ -238,6 +242,10 @@
       && (($f = array_search('from', $a_show_cols)) !== false) && array_search('to', $a_show_cols) === false)
     $a_show_cols[$f] = 'to';
 
+  // make sure 'threads' column is present 
+  if (!in_array('threads', $a_show_cols))
+    array_unshift($a_show_cols, 'threads');
+
   $thead = $head_replace ? rcmail_message_list_head($_SESSION['list_attrib'], $a_show_cols) : NULL;
 
   $OUTPUT->command('set_message_coltypes', $a_show_cols, $thead);
@@ -245,10 +253,12 @@
   if (empty($a_headers))
     return;
 
-  // remove 'attachment' and 'flag' columns, we don't need them here
-  if(($key = array_search('attachment', $a_show_cols)) !== FALSE)
+  // remove 'threads', 'attachment', '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)
+  if (($key = array_search('flag', $a_show_cols)) !== FALSE)
+    unset($a_show_cols[$key]);
+  if (($key = array_search('threads', $a_show_cols)) !== FALSE)
     unset($a_show_cols[$key]);
 
   // loop through message headers
@@ -345,7 +355,7 @@
   else
     $list_menu = '';
 
-  $cells = array(array('className' => 'threads', 'html' => $list_menu));
+  $cells = array();
 
   foreach ($a_show_cols as $col) {
     // get column name
@@ -356,6 +366,9 @@
       case 'attachment':
         $col_name = sprintf($image_tag, $skin_path, $attrib['attachmenticon'], '');
         break;
+      case 'threads':
+        $col_name = $list_menu;
+        break;
       default:
         $col_name = Q(rcube_label($col));
     }

--
Gitblit v1.9.1