From 0d455368cd13208c40f1915e82ee2f9f3a63b811 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Sat, 11 Nov 2000 23:47:49 +0000 Subject: [PATCH] added option to have no sorting (click on icon beside date) git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@844 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + functions/mailbox_display.php | 142 +++++++++++++++++++++++----------- src/right_main.php | 2 +- 3 files changed, 98 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55304614..d300d276 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ Version 1.0pre1 -- DEVELOPMENT ------------------------------ +- Added sorting option for NO sorting.. 10000 times faster! - Using
 tags for viewing message body instead of  and  
 - Added redirection from subdirectories to login page
 - Attachments are shown in message index (shown as a "+")
diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php
index c448cc4a..e93a9e00 100644
--- a/functions/mailbox_display.php
+++ b/functions/mailbox_display.php
@@ -16,7 +16,7 @@
       global $message_highlight_list;
       global $index_order;
 
-		$msg = $msgs[$key];
+      $msg = $msgs[$key];
 
       $senderName = sqimap_find_displayable_name($msg["FROM"]);
       $urlMailbox = urlencode($mailbox);
@@ -28,7 +28,7 @@
       
       if ($msg["FLAG_FLAGGED"] == true) { $flag = ""; $flag_end = ""; }
       if ($msg["FLAG_SEEN"] == false) { $bold = ""; $bold_end = ""; }
-		if ($mailbox == $sent_folder) { $italic = ""; $italic_end = ""; }
+      if ($mailbox == $sent_folder) { $italic = ""; $italic_end = ""; }
       
       for ($i=0; $i < count($message_highlight_list); $i++) {
          if (trim($message_highlight_list[$i]["value"]) != "") {
@@ -107,37 +107,75 @@
       global $message_highlight_list;
       global $auto_expunge;
 
-      if ($auto_expunge) {
-         sqimap_mailbox_expunge($imapConnection, $mailbox);
-         sqimap_mailbox_select($imapConnection, $mailbox);
-      }
+      sqimap_mailbox_expunge($imapConnection, $mailbox);
+      sqimap_mailbox_select($imapConnection, $mailbox);
 
       if (!$use_cache) {
+         // if it's sorted
          if ($numMessages >= 1) {
-            for ($q = 0; $q < $numMessages; $q++) {
-               if($mailbox == $sent_folder)
-                  $hdr = sqimap_get_small_header ($imapConnection, $q+1, true);
-               else
-                  $hdr = sqimap_get_small_header ($imapConnection, $q+1, false);
-         	     	
-						
- 	       $from[$q] = $hdr->from;
-	       $date[$q] = $hdr->date;
-	       $subject[$q] = $hdr->subject;
-               $to[$q] = $hdr->to;
-               $priority[$q] = $hdr->priority;
-               $cc[$q] = $hdr->cc;
-               $size[$q] = $hdr->size;
-               $type[$q] = $hdr->type0;
-               $flags[$q] = sqimap_get_flags ($imapConnection, $q+1);
-            }
+            if ($sort < 6) {
+               for ($q = 0; $q < $numMessages; $q++) {
+                  if($mailbox == $sent_folder)
+                     $hdr = sqimap_get_small_header ($imapConnection, $q+1, true);
+                  else
+                     $hdr = sqimap_get_small_header ($imapConnection, $q+1, false);
+                       
+                  $from[$q] = $hdr->from;
+                  $date[$q] = $hdr->date;
+                  $subject[$q] = $hdr->subject;
+                  $to[$q] = $hdr->to;
+                  $priority[$q] = $hdr->priority;
+                  $cc[$q] = $hdr->cc;
+                  $size[$q] = $hdr->size;
+                  $type[$q] = $hdr->type0;
+                  $flags[$q] = sqimap_get_flags ($imapConnection, $q+1);
+               }
+            } else {
+               // if it's not sorted
+               if ($startMessage + ($show_num - 1) < $numMessages) {
+                  $endMessage = $startMessage + ($show_num-1);
+               } else {
+                  $endMessage = $numMessages;
+               }
+               
+               if ($endMessage < $startMessage) {
+                  $startMessage = $startMessage - $show_num;
+                  if ($startMessage < 1)
+                     $startMessage = 1;
+               }
+
+               $j = $startMessage - 1;;
+               echo $startMessage . " - " . $endMessage . "
"; + for ($q = $startMessage; $q <= $endMessage; $q++) { + if($mailbox == $sent_folder) + $hdr = sqimap_get_small_header ($imapConnection, $q, true); + else + $hdr = sqimap_get_small_header ($imapConnection, $q, false); + + $from[$j] = $hdr->from; + $date[$j] = $hdr->date; + $subject[$j] = $hdr->subject; + $to[$j] = $hdr->to; + $priority[$j] = $hdr->priority; + $cc[$j] = $hdr->cc; + $size[$j] = $hdr->size; + $type[$j] = $hdr->type0; + $flags[$j] = sqimap_get_flags ($imapConnection, $q); + $j++; + } + } } $j = 0; - while ($j < $numMessages) { + if ($sort == 6) { + $end = $startMessage + $show_num - 1; + } else { + $end = $numMessages; + } + while ($j < $end) { $date[$j] = ereg_replace(" ", " ", $date[$j]); $tmpdate = explode(" ", trim($date[$j])); - + $messages[$j]["TIME_STAMP"] = getTimeStamp($tmpdate); $messages[$j]["DATE_STRING"] = getDateString($messages[$j]["TIME_STAMP"]); $messages[$j]["ID"] = $j+1; @@ -146,18 +184,17 @@ $messages[$j]["SUBJECT"] = decodeHeader($subject[$j]); $messages[$j]["SUBJECT-SORT"] = strtolower(decodeHeader($subject[$j])); $messages[$j]["TO"] = decodeHeader($to[$j]); - $messages[$j]["PRIORITY"] = $priority[$j]; + $messages[$j]["PRIORITY"] = $priority[$j]; $messages[$j]["CC"] = $cc[$j]; $messages[$j]["SIZE"] = $size[$j]; $messages[$j]["TYPE0"] = $type[$j]; # fix SUBJECT-SORT to remove Re: - $re_abbr = # Add more here! - "vedr|sv|" . # Danish - "re|aw"; # English - if (eregi("^($re_abbr):[ ]*(.*)$", - $messages[$j]['SUBJECT-SORT'], $regs)) - $messages[$j]['SUBJECT-SORT'] = $regs[2]; + $re_abbr = # Add more here! + "vedr|sv|" . # Danish + "re|aw"; # English + if (eregi("^($re_abbr):[ ]*(.*)$", $messages[$j]['SUBJECT-SORT'], $regs)) + $messages[$j]['SUBJECT-SORT'] = $regs[2]; $num = 0; while ($num < count($flags[$j])) { @@ -180,7 +217,7 @@ /* Only ignore messages flagged as deleted if we are using a * trash folder or auto_expunge */ - if ($move_to_trash || $auto_expunge) + if (($move_to_trash || $auto_expunge) && $sort != 6) { /** Find and remove the ones that are deleted */ $i = 0; @@ -196,6 +233,8 @@ $j++; } $numMessages = $i; + } else { + $msgs = $messages; } } @@ -213,11 +252,15 @@ $msort = array_cleave ($msgs, "FROM-SORT"); if (($sort == 4) || ($sort == 5)) $msort = array_cleave ($msgs, "SUBJECT-SORT"); - - if($sort % 2) { - asort($msort); - } else { - arsort($msort); + if ($sort == 6) + $msort = $msgs; + + if ($sort < 6) { + if($sort % 2) { + asort($msort); + } else { + arsort($msort); + } } session_register("msort"); } @@ -264,17 +307,22 @@ } $More = ''; + if ($sort == 6) { + $use = 0; + } else { + $use = 1; + } if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) { - $More = "". _("Previous") ." | \n"; - $More .= "". _("Next") ."\n"; + $More = "". _("Previous") ." | \n"; + $More .= "". _("Next") ."\n"; } elseif (($nextGroup > $numMessages) && ($prevGroup >= 0)) { - $More = "". _("Previous") ." | \n"; + $More = "". _("Previous") ." | \n"; $More .= ""._("Next")."\n"; } elseif (($nextGroup <= $numMessages) && ($prevGroup < 0)) { $More = ""._("Previous")." | \n"; - $More .= "". _("Next") ."\n"; + $More .= "". _("Next") ."\n"; } mail_message_listing_beginning($imapConnection, @@ -305,7 +353,7 @@ $k++; } while (isset ($key) && ($k < $i)); - do { + do { printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage, 0, 0); $key = key($msort); $t++; @@ -370,7 +418,7 @@ $box = $boxes[$i]["unformatted"]; $box2 = replace_spaces($boxes[$i]["formatted"]); echo " \n"; - } + } } echo "
"; echo " \n"; @@ -405,7 +453,7 @@ if ($mailbox == $sent_folder) echo " ". _("To") .""; else - echo " ". _("From") .""; + echo " ". _("From") .""; if ($sort == 2) echo " \n"; @@ -420,7 +468,9 @@ if ($sort == 0) echo " \n"; elseif ($sort == 1) - echo " \n"; + echo " \n"; + elseif ($sort == 6) + echo " \n"; elseif ($sort != -1) echo " \n"; break; diff --git a/src/right_main.php b/src/right_main.php index 16306ce3..61d08560 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -71,7 +71,7 @@ // send them to the inbox if (!isset($mailbox)) { $mailbox = "INBOX"; - $sort = $newsort = 0; + $sort = $newsort = 6; $startMessage = 1; } -- 2.25.1