Hi group,
I just updated the CVS with the latest sorting functions. I modified the patches from Justin and Jasper and added some client side actions to make the sort col visible and to avoid sorting the same col/order again.
The arrow buttons are now configurable within the skin template (mail.html) because we don't want skin image file names within the PHP source. To ensure the correct sorting order when jumping to the next message in view mode, we don't need a special index stored within the session but just pass the sort parameters to the method returning the current message index.
Please make sure, you add the following two lines to your config/main.inc.php when upgrading to the latest CVS version. These are the default settings for sorting:
$rcmail_config['message_sort_col'] = 'date'; $rcmail_config['message_sort_order'] = 'DESC';
For those creating patches, please make sure that your code works with the minimum requirements of RoundCube as is PHP 4.3. For example 'str_ireplace' used in the sorting patch is PHP 5 only!
Thanks again for your work! Thomas
Jasper Slits wrote:
Hi,
The attached patch makes Roundcube's subject sorting behave the same way as Mozilla Thunderbird does. When the mail is sorted by subject, the reply & forward identifiers (Fwd:,Re:,Fw: etc) are ignored.
Old behaviour (sorted by subject): 'Announcement of new release' 'Courier-IMAP problem when opening new mail' 'Mysql 5 final released' 'Re: announcement of new release'
New behaviour (sorted by subject): 'Announcement of new release' 'Re: Announcement of new release' 'Courier-IMAP problem when opening new mail' 'Mysql 5 final released'
Maybe the identifiers should be configured per language?
jasper
--- ../roundcube2/program/lib/imap.inc 2005-10-24 12:13:36.000000000 +0200 +++ program/lib/imap.inc 2005-10-25 15:10:28.731941456 +0200 @@ -1365,8 +1365,15 @@ }
function iil_SortHeaders($a, $field, $flag){
/*
Strip replies & forward identifiers when sorting the subjects
*/
$stripArr = ($field=='subject')? array('Re: ','Fwd: ','Fw: ',"\"") : array("\"");
- if (empty($field)) $field="uid"; $field=strtolower($field); if ($field=="date"||$field=='internaldate') $field="timestamp"; if (empty($flag)) $flag="ASC";
@@ -1385,9 +1392,9 @@ reset($a);
while (list($key, $val)=each($a)){ $data=$a[$key]->$field;
if (is_string($data)) $data=strtoupper(str_replace("\"", "", $data));
} // sort indexif (is_string($data)) $data=strtoupper(str_ireplace($stripArr, "", $data)); $index[$key]=$data;