From 9c83f905fef00de60528b7efcfc4dd3b7c4fa4ee Mon Sep 17 00:00:00 2001 From: gpadgham Date: Wed, 12 Apr 2000 19:02:07 +0000 Subject: [PATCH] Added feature to allow users to customize how many messages are shown at once while indexing a mailbox git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@415 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- TODO | 4 ++-- functions/mailbox_display.php | 15 +++++++-------- src/load_prefs.php | 4 ++++ src/options.php | 13 +++++++++++++ src/options_submit.php | 3 ++- src/read_body.php | 1 - src/right_main.php | 4 ++-- 7 files changed, 30 insertions(+), 14 deletions(-) diff --git a/TODO b/TODO index 0a0e22b9..1495fb97 100644 --- a/TODO +++ b/TODO @@ -18,7 +18,6 @@ initials = taken by that person list for the mail box you were looking at without having to click a link - Spell checking -(glp) Customize how many messages are shown at once while reading a mailbox - Cache the sorted messages in mailbox and use that for navigation inside of mailbox (next 25, prev 25, etc.) - Search mailbox(es) for given criteria @@ -32,5 +31,6 @@ Finished: (pl) (25.3.00) LDAP support for address books (pl) (2.4.00) Personal address book management (nre) (2.4.00) Better handling emptying Trash folder. Some servers don't allow deleting it (Courier) -(lme) (9.4.00 Better email message body parsing +(lme) (9.4.00) Better email message body parsing (lme) (10.4.00) Advanced statuses on messages (Seen, Answered, etc) +(glp) (12.4.00) Customize how many messages are shown at once while reading a mailbox diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index da874a99..9339e3db 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -34,7 +34,7 @@ /** ** This function loops through a group of messages in the mailbox and shows them **/ - function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color) { + function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num) { include ("../config/config.php"); if ($numMessages >= 1) { @@ -148,11 +148,11 @@ // session_register("messages"); // $messages = serialize($msgs); - displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color); + displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color,$show_num); } // generic function to convert the msgs array into an HTML table - function displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color) { + function displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color,$show_num) { // do a check to see if the config stuff has already been included or not if (!isset($imapServerAddress)) include("../config/config.php"); @@ -160,15 +160,14 @@ // if cache isn't already set, do it now // if (!session_is_registered("messages")) // session_register("messages"); - - if ($startMessage + 24 < $numMessages) { - $endMessage = $startMessage + 24; + if ($startMessage + ($show_num - 1) < $numMessages) { + $endMessage = $startMessage + ($show_num-1); } else { $endMessage = $numMessages; } - $nextGroup = $startMessage + 25; - $prevGroup = $startMessage - 25; + $nextGroup = $startMessage + $show_num; + $prevGroup = $startMessage - $show_num; $urlMailbox = urlencode($mailbox); /** This is the beginning of the message list table. It wraps around all messages */ diff --git a/src/load_prefs.php b/src/load_prefs.php index 68d58306..964a6e8c 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -30,6 +30,10 @@ if ($move_to_trash == "") $move_to_trash = $default_move_to_trash; + $show_num = getPref($data_dir, $username, "show_num"); + if ($show_num == "") + $show_num = 25; + $wrap_at = getPref($data_dir, $username, "wrap_at"); if ($wrap_at == "") $wrap_at = 86; diff --git a/src/options.php b/src/options.php index d481864d..1a290b69 100644 --- a/src/options.php +++ b/src/options.php @@ -143,6 +143,19 @@ echo " "; echo " "; + // SHOW_NUM + echo " "; + echo " "; + echo _("Number of Messages to Index:"); + echo " "; + echo " "; + if (isset($wrap_at)) + echo "
"; + else + echo "
"; + echo " "; + echo " "; + // WRAP_AT echo " "; echo " "; diff --git a/src/options_submit.php b/src/options_submit.php index cd93a104..39e2a61c 100644 --- a/src/options_submit.php +++ b/src/options_submit.php @@ -22,6 +22,7 @@ setPref($data_dir, $username, "reply_to", stripslashes($reply_to)); setPref($data_dir, $username, "chosen_theme", $chosentheme); setPref($data_dir, $username, "move_to_trash", $movetotrash); + setPref($data_dir, $username, "show_num", $shownum); setPref($data_dir, $username, "wrap_at", $wrapat); setPref($data_dir, $username, "editor_size", $editorsize); setPref($data_dir, $username, "use_signature", $usesignature); @@ -29,7 +30,7 @@ setPref($data_dir, $username, "language", $language); setPref($data_dir, $username, "left_size", $leftsize); setPref($data_dir, $username, "folder_prefix", $folderprefix); - + setSig($data_dir, $username, stripslashes($signature_edit)); setcookie("squirrelmail_language", $language, time()+2592000); diff --git a/src/read_body.php b/src/read_body.php index dc0d9952..8e3f24a5 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -15,7 +15,6 @@ include("../functions/date.php"); include("../src/load_prefs.php"); - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); sqimap_mailbox_select($imapConnection, $mailbox); diff --git a/src/right_main.php b/src/right_main.php index bc1cc16b..39169be0 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -83,12 +83,12 @@ // if (session_is_registered("messages")) // session_unregister("messages"); - showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color); + showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num); // } else { // echo "
using cache
\n"; // $msgs = unserialize($messages); -// displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color); +// displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color,$show_num); // } // close the connection -- 2.25.1