|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Sort by ascending date in message list: display last page by default. Patch attached.Greetings,
Like many people, I like having my messages sorted by ascending date (last received message at the bottom of the list) in my mailbox folders. Alas, and unlike most (all ?) others MUAs, Squirrelmail displays the first page by default regardless of the sort order (meaning the oldest messages are presented first and you must move to the last page manually to see the latest messages). While in all the other sorting cases (sort by recipient, by origine, by subject...) this is indeed the correct behaviour (when you sort by ascending alphetibetical order, you want the "a" page to show first), when you sort by ascending date, it is not as much as to see the date sorted than to have your most recent messages appearing at the bottom of the list (which also makes the "next" and "previous" messages links more meaningful in the reading form: the next message in the list being also the message that you received next). For this reason, I produced a patch which makes SQM display the last page of the mailbox messages list whenever it is sorted by ascending date (either message or received date sorting). Another feature that would be nice to implement (but that I did not find time to implement so far) would be to have every page display the same number of messages, i.e. if you configured SQM to display 20 messages per page, each page should display 20 messages, even if you got 25 messages in total in the mailbox: this would mimic what happens when you have a messages list displayed inside a scroll list, for example, and would minimize the need for the user to switch between pages (also meaning less load for the server...). Regards, Thierry. ____________________________________________________________________________________ Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping diff -urN squirrelmail/functions/mailbox_display.php squirrelmail-patched/functions/mailbox_display.php --- squirrelmail/functions/mailbox_display.php 2008-03-21 09:40:46.000000000 +0100 +++ squirrelmail-patched/functions/mailbox_display.php 2008-03-21 09:53:08.000000000 +0100 @@ -145,16 +145,6 @@ } } /** - * Restore the offset in the paginator if no new offset is provided. - */ - if (isset($aMailbox['UIDSET'][$iSetIndx]) && !isset($aConfig['offset']) && $aCachedMailbox['OFFSET']) { - $aMailbox['OFFSET'] = $aCachedMailbox['OFFSET']; - $aMailbox['PAGEOFFSET'] = $aCachedMailbox['PAGEOFFSET']; - } else { - $aMailbox['OFFSET'] = (isset($aConfig['offset']) && $aConfig['offset']) ? $aConfig['offset'] -1 : 0; - $aMailbox['PAGEOFFSET'] = (isset($aConfig['offset']) && $aConfig['offset']) ? $aConfig['offset'] : 1; - } - /** * Restore the number of messages in the result set */ if (isset($aCachedMailbox['TOTAL'][$iSetIndx]) && $aCachedMailbox['TOTAL'][$iSetIndx]) { @@ -190,6 +180,42 @@ } /** + * Restore the offset in the paginator if no new offset is provided. + */ + if (isset($aMailbox['UIDSET'][$iSetIndx]) && !isset($aConfig['offset']) && $aCachedMailbox['OFFSET']) { + $aMailbox['OFFSET'] = $aCachedMailbox['OFFSET']; + $aMailbox['PAGEOFFSET'] = $aCachedMailbox['PAGEOFFSET']; + } else { + if (isset($aConfig['offset']) && $aConfig['offset'] > 0) { + $aMailbox['OFFSET'] = $aConfig['offset'] - 1; + $aMailbox['PAGEOFFSET'] = $aConfig['offset']; + } else { + $aMailbox['OFFSET'] = 0; + $aMailbox['PAGEOFFSET'] = 1; + $s = $aMailbox['SORT']; + if (($s == SQSORT_DATE_ASC || $s == SQSORT_INT_DATE_ASC) && + $aConfig['offset'] != 0 && !$aMailbox['SHOWALL'][$iSetIndx]) { + // When we sort by ascending date, show the last page by + // default instead: + if (isset($aMailbox['TOTAL'][$iSetIndx])) { + $total = $aMailbox['TOTAL'][$iSetIndx]; + } else { + $total = $aMbxResponse['EXISTS']; + } + $limit = $aMailbox['LIMIT']; + if ($total > $limit && $limit > 0) { + $offset = (int)($total / $limit) * $limit; + if ($offset == $total) { + $offset = $total - $limit; + } + $aMailbox['OFFSET'] = $offset; + $aMailbox['PAGEOFFSET'] = $offset + 1; + } + } + } + } + + /** * Restore the ordered columns to show when no new ordered columns are provided */ if (!isset($aProps[MBX_PREF_COLUMNS]) && isset($aCachedMailbox['COLUMNS'])) { @@ -995,8 +1021,7 @@ $thread_name = _("Thread View"); $newsort = $aMailbox['SORT'] + SQSORT_THREAD; } - $thread_link_uri = $baseurl . '&srt=' . $newsort - . '&startMessage=1'; + $thread_link_uri = $baseurl . '&srt=' . $newsort; } else { $thread_link_uri =''; $thread_name = ''; diff -urN squirrelmail/functions/template/folder_list_util.php squirrelmail-patched/functions/template/folder_list_util.php --- squirrelmail/functions/template/folder_list_util.php 2007-01-08 20:54:19.000000000 +0100 +++ squirrelmail-patched/functions/template/folder_list_util.php 2008-03-21 08:59:15.000000000 +0100 @@ -71,7 +71,7 @@ $box['CummulativeUnreadCount'] = getMessageCount($boxes, 'unseen'); $box['ViewLink'] = array( 'Target' => 'right', - 'URL' => 'right_main.php?PG_SHOWALL=0&startMessage=1&mailbox='.$mailboxURL + 'URL' => 'right_main.php?PG_SHOWALL=0&mailbox='.$mailboxURL ); $box['IsRecent'] = isset($boxes->recent) && $boxes->recent; diff -urN squirrelmail/functions/template/paginator_util.php squirrelmail-patched/functions/template/paginator_util.php --- squirrelmail/functions/template/paginator_util.php 2008-01-06 07:01:10.000000000 +0100 +++ squirrelmail-patched/functions/template/paginator_util.php 2008-03-21 08:52:14.000000000 +0100 @@ -103,7 +103,7 @@ $last_grp = (($tot_pgs - 1) * $iLimit) + 1; } } else { - $pg_str = create_hyperlink("$php_self?showall=0&startMessage=1&mailbox=$box", _("Paginate")); + $pg_str = create_hyperlink("$php_self?showall=0&mailbox=$box", _("Paginate")); } /* Put all the pieces of the paginator string together. */ @@ -115,7 +115,7 @@ if ( $prv_str || $nxt_str ) { /* Compute the 'show all' string. */ - $all_str = create_hyperlink("$php_self?showall=1&startMessage=1&mailbox=$box", _("Show All")); + $all_str = create_hyperlink("$php_self?showall=1&mailbox=$box", _("Show All")); $result .= '[' . get_paginator_link($box, 1, '<<') . ']'; $result .= '[' . $prv_str . ']'; @@ -335,7 +335,7 @@ $last_grp = (($tot_pgs - 1) * $iLimit) + 1; } } else { - $pg_str = create_hyperlink("$php_self?showall=0&startMessage=1&mailbox=$box", _("Paginate")); + $pg_str = create_hyperlink("$php_self?showall=0&mailbox=$box", _("Paginate")); } /* Put all the pieces of the paginator string together. */ @@ -347,7 +347,7 @@ if ( $prv_str || $nxt_str ) { /* Compute the 'show all' string. */ - $all_str = create_hyperlink("$php_self?showall=1&startMessage=1&mailbox=$box", _("Show All")); + $all_str = create_hyperlink("$php_self?showall=1&mailbox=$box", _("Show All")); $result .= '['; $result .= ($prv_str != '' ? $prv_str . $nbsp . $sep . $nbsp : ''); diff -urN squirrelmail/plugins/spamcop/spamcop.php squirrelmail-patched/plugins/spamcop/spamcop.php --- squirrelmail/plugins/spamcop/spamcop.php 2007-08-27 05:19:30.000000000 +0200 +++ squirrelmail-patched/plugins/spamcop/spamcop.php 2008-03-21 09:28:11.000000000 +0100 @@ -32,7 +32,7 @@ sqgetGlobalVar('js_web', $js_web, SQ_GET); if (! sqgetGlobalVar('startMessage', $startMessage, SQ_GET) ) { - $startMessage = 1; + $startMessage = -1; } if (! sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET) ) { $passed_ent_id = 0; diff -urN squirrelmail/src/compose.php squirrelmail-patched/src/compose.php --- squirrelmail/src/compose.php 2008-03-21 09:40:46.000000000 +0100 +++ squirrelmail-patched/src/compose.php 2008-03-21 09:16:21.000000000 +0100 @@ -99,7 +99,7 @@ if ( sqgetGlobalVar('startMessage',$startMessage) ) { $startMessage = (int)$startMessage; } else { - $startMessage = 1; + $startMessage = -1; } @@ -461,12 +461,12 @@ } else { if ( !isset($pageheader_sent) || !$pageheader_sent ) { header("Location: $location/right_main.php?mailbox=" . urlencode($draft_folder) . - "&startMessage=1¬e=".urlencode($draft_message)); + "¬e=".urlencode($draft_message)); } else { //FIXME: DON'T ECHO HTML FROM CORE! echo ' <br><br><div style="text-align: center;"><a href="' . $location . '/right_main.php?mailbox=' . urlencode($draft_folder) - . '&startMessage=1¬e=' . urlencode($draft_message) .'">' + . '¬e=' . urlencode($draft_message) .'">' . _("Return") . '</a></div>'; } exit(); diff -urN squirrelmail/src/read_body.php squirrelmail-patched/src/read_body.php --- squirrelmail/src/read_body.php 2008-03-21 09:40:46.000000000 +0100 +++ squirrelmail-patched/src/read_body.php 2008-03-21 09:26:39.000000000 +0100 @@ -821,7 +821,7 @@ if ( sqgetGlobalVar('startMessage', $temp) ) { $startMessage = (int) $temp; } else { - $startMessage = 1; + $startMessage = -1; } if(sqgetGlobalVar('show_html_default', $temp)) { $show_html_default = (int) $temp; diff -urN squirrelmail/src/right_main.php squirrelmail-patched/src/right_main.php --- squirrelmail/src/right_main.php 2008-03-21 09:40:46.000000000 +0100 +++ squirrelmail-patched/src/right_main.php 2008-03-21 09:57:28.000000000 +0100 @@ -56,7 +56,7 @@ if ( sqGetGlobalVarMultiple('startMessage', $temp, 'paginator_submit') ) { $startMessage = (int) $temp; } else { - $startMessage = 1; + $startMessage = -1; } // sort => srt because of the changed behaviour which can break new behaviour if ( sqgetGlobalVar('srt', $temp, SQ_GET) ) { diff -urN squirrelmail/templates/default/message_list.tpl squirrelmail-patched/templates/default/message_list.tpl --- squirrelmail/templates/default/message_list.tpl 2008-02-13 05:31:04.000000000 +0100 +++ squirrelmail-patched/templates/default/message_list.tpl 2008-03-20 10:00:48.000000000 +0100 @@ -239,7 +239,7 @@ $text_icon = '◻'; // U+25FB WHITE MEDIUM SQUARE } /* Now that we have everything figured out, show the actual button. */ - echo " <a href=\"$baseurl&startMessage=1&srt=$newsort\" style=\"text-decoration:none\">" . + echo " <a href=\"$baseurl&srt=$newsort\" style=\"text-decoration:none\">" . getIcon($icon_theme_path, $img, $text_icon, _("Click here to change the sorting of the message list")) . "\n" . '</a>'; } ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ ----- squirrelmail-devel mailing list Posting guidelines: http://squirrelmail.org/postingguidelines List address: squirrelmail-devel@... List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel |
|
|
Re: Sort by ascending date in message list: display last page by default. Patch attached.Hi Thierry,
I've got the same problem on my 1.4.13 SQM installation, with the difference that I've noticed the ascending date sorting *only* in the search results panel (the oldest mail matching my filter is displayed first). As I'd like to test you patch on which version did you tested it? Do you believe that it addresses the same issue? I'm asking this since I've notice for example that using just the IMAP interface (Courier 4.1.1) and a local client (Thunderbird 2.0.0.1.4) to fetch the emails, I've seen the same behaving. In your opinion it could depend on the IMAP server configuration (the default one in my case) or it's a SQM bug? Best regards, Jeremy
|
| Free Forum Powered by Nabble | Forum Help |