Browse Source

Added feature to allow users to customize how many messages are shown at once while indexing a mailbox

gpadgham 25 years ago
parent
commit
213578e10b
7 changed files with 30 additions and 14 deletions
  1. 2 2
      TODO
  2. 7 8
      functions/mailbox_display.php
  3. 4 0
      src/load_prefs.php
  4. 13 0
      src/options.php
  5. 2 1
      src/options_submit.php
  6. 0 1
      src/read_body.php
  7. 2 2
      src/right_main.php

+ 2 - 2
TODO

@@ -18,7 +18,6 @@ initials = taken by that person
             list for the mail box you were looking at without having to click
             list for the mail box you were looking at without having to click
             a link
             a link
   -     Spell checking
   -     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
   -     Cache the sorted messages in mailbox and use that for navigation inside
             of mailbox (next 25, prev 25, etc.)
             of mailbox (next 25, prev 25, etc.)
   -     Search mailbox(es) for given criteria
   -     Search mailbox(es) for given criteria
@@ -32,5 +31,6 @@ Finished:
 (pl)  (25.3.00)  LDAP support for address books
 (pl)  (25.3.00)  LDAP support for address books
 (pl)  (2.4.00)   Personal address book management
 (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)
 (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)
 (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

+ 7 - 8
functions/mailbox_display.php

@@ -34,7 +34,7 @@
    /**
    /**
     ** This function loops through a group of messages in the mailbox and shows them
     ** 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");
       include ("../config/config.php");
 
 
       if ($numMessages >= 1) {
       if ($numMessages >= 1) {
@@ -148,11 +148,11 @@
 //      session_register("messages");
 //      session_register("messages");
 //      $messages = serialize($msgs);
 //      $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
    // 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
       // do a check to see if the config stuff has already been included or not
       if (!isset($imapServerAddress))
       if (!isset($imapServerAddress))
          include("../config/config.php");
          include("../config/config.php");
@@ -160,15 +160,14 @@
       // if cache isn't already set, do it now
       // if cache isn't already set, do it now
 //      if (!session_is_registered("messages"))
 //      if (!session_is_registered("messages"))
 //         session_register("messages");
 //         session_register("messages");
-      
-      if ($startMessage + 24 < $numMessages) {
-         $endMessage = $startMessage + 24;
+      if ($startMessage + ($show_num - 1) < $numMessages) {
+         $endMessage = $startMessage + ($show_num-1);
       } else {
       } else {
          $endMessage = $numMessages;
          $endMessage = $numMessages;
       }
       }
 
 
-      $nextGroup = $startMessage + 25;
-      $prevGroup = $startMessage - 25;
+      $nextGroup = $startMessage + $show_num;
+      $prevGroup = $startMessage - $show_num;
       $urlMailbox = urlencode($mailbox);
       $urlMailbox = urlencode($mailbox);
 
 
       /** This is the beginning of the message list table.  It wraps around all messages */
       /** This is the beginning of the message list table.  It wraps around all messages */

+ 4 - 0
src/load_prefs.php

@@ -30,6 +30,10 @@
    if ($move_to_trash == "")
    if ($move_to_trash == "")
       $move_to_trash = $default_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");
    $wrap_at = getPref($data_dir, $username, "wrap_at");
    if ($wrap_at == "")
    if ($wrap_at == "")
       $wrap_at = 86;
       $wrap_at = 86;

+ 13 - 0
src/options.php

@@ -143,6 +143,19 @@
    echo "      </TD>";
    echo "      </TD>";
    echo "   </TR>";
    echo "   </TR>";
 
 
+   // SHOW_NUM
+   echo "   <TR>";
+   echo "      <TD WIDTH=60% ALIGN=RIGHT>";
+   echo           _("Number of Messages to Index:");
+   echo "      </TD>";
+   echo "      <TD WIDTH=40% ALIGN=LEFT>";
+   if (isset($wrap_at))
+      echo "         <TT><INPUT TYPE=TEXT SIZE=5 NAME=shownum VALUE=\"$show_num\"></TT><BR>";
+   else
+      echo "         <TT><INPUT TYPE=TEXT SIZE=5 NAME=shownum VALUE=\"25\"></TT><BR>";
+   echo "      </TD>";
+   echo "   </TR>";
+   
    // WRAP_AT
    // WRAP_AT
    echo "   <TR>";
    echo "   <TR>";
    echo "      <TD WIDTH=60% ALIGN=RIGHT>";
    echo "      <TD WIDTH=60% ALIGN=RIGHT>";

+ 2 - 1
src/options_submit.php

@@ -22,6 +22,7 @@
    setPref($data_dir, $username, "reply_to", stripslashes($reply_to));
    setPref($data_dir, $username, "reply_to", stripslashes($reply_to));
    setPref($data_dir, $username, "chosen_theme", $chosentheme);
    setPref($data_dir, $username, "chosen_theme", $chosentheme);
    setPref($data_dir, $username, "move_to_trash", $movetotrash);
    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, "wrap_at", $wrapat);
    setPref($data_dir, $username, "editor_size", $editorsize);
    setPref($data_dir, $username, "editor_size", $editorsize);
    setPref($data_dir, $username, "use_signature", $usesignature);
    setPref($data_dir, $username, "use_signature", $usesignature);
@@ -29,7 +30,7 @@
    setPref($data_dir, $username, "language", $language);
    setPref($data_dir, $username, "language", $language);
    setPref($data_dir, $username, "left_size", $leftsize);
    setPref($data_dir, $username, "left_size", $leftsize);
    setPref($data_dir, $username, "folder_prefix", $folderprefix);
    setPref($data_dir, $username, "folder_prefix", $folderprefix);
-
+   
    setSig($data_dir, $username, stripslashes($signature_edit));
    setSig($data_dir, $username, stripslashes($signature_edit));
 
 
    setcookie("squirrelmail_language", $language, time()+2592000);
    setcookie("squirrelmail_language", $language, time()+2592000);

+ 0 - 1
src/read_body.php

@@ -15,7 +15,6 @@
       include("../functions/date.php");
       include("../functions/date.php");
 
 
    include("../src/load_prefs.php");
    include("../src/load_prefs.php");
-
    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
    sqimap_mailbox_select($imapConnection, $mailbox);
    sqimap_mailbox_select($imapConnection, $mailbox);
 
 

+ 2 - 2
src/right_main.php

@@ -83,12 +83,12 @@
 //      if (session_is_registered("messages"))
 //      if (session_is_registered("messages"))
 //         session_unregister("messages");
 //         session_unregister("messages");
 
 
-      showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color);
+      showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num);
 //   } else {
 //   } else {
 //      echo "<br>using cache<br>\n";
 //      echo "<br>using cache<br>\n";
 //      $msgs = unserialize($messages);
 //      $msgs = unserialize($messages);
 
 
-//      displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color);
+//      displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $mailbox, $sort, $color,$show_num);
 //   }
 //   }
 
 
    // close the connection
    // close the connection