From 5c54e435cf4a3ee9ecdaf2305205a2fbc7af4662 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Sun, 26 Nov 2000 20:57:55 +0000 Subject: [PATCH] - beautified index order options page - sort order now saves in prefs every time it is changed - made click order of sort icons smarter and more user friendly (easier to get to "no sort" method) - fixed bug with next/previous when reading a message under "no sort" method git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@855 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + src/load_prefs.php | 4 +++ src/options.php | 12 ++----- src/options_order.php | 18 +++++++--- src/read_body.php | 79 ++++++++++++++++++++++++++++--------------- src/right_main.php | 5 ++- 6 files changed, 75 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0473e70b..5823fc58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ Version 1.0pre1 -- DEVELOPMENT ------------------------------ +- Sort method saving now transparent to user, and saves between sessions - Now replacing all \n with \r\n before sending the message. - Added sorting option for NO sorting.. 10000 times faster! - Using
 tags for viewing message body instead of  and  
diff --git a/src/load_prefs.php b/src/load_prefs.php
index 1c91e573..7c9857f9 100644
--- a/src/load_prefs.php
+++ b/src/load_prefs.php
@@ -131,6 +131,10 @@
    $left_refresh = getPref($data_dir, $username, "left_refresh");
    if ($left_refresh == "")
       $left_refresh = false;
+
+   $sort = getPref($data_dir, $username, "sort");
+   if ($sort == "")
+      $sort = 6;
    
    /** Load up the Signature file **/
    if ($use_signature == true) {
diff --git a/src/options.php b/src/options.php
index 5710f0d0..7c684247 100644
--- a/src/options.php
+++ b/src/options.php
@@ -72,12 +72,8 @@
     
       do_hook("options_display_save");
 
-      echo "
"; - ecHO "
"; echo "
"._("Successfully saved display preferences!")."
"; - echo ""._("Refresh Page")."

"; - echo "
"; - echo "
"; + echo "" . _("Refresh Page") . "
"; } else if ($submit_folder) { # Save folder preferences if ($trash != "none") { @@ -98,12 +94,8 @@ setPref($data_dir, $username, "unseen_notify", $unseennotify); setPref($data_dir, $username, "unseen_type", $unseentype); do_hook("options_folders_save"); - echo "
"; - ecHO "
"; echo "
"._("Successfully saved folder preferences!")."
"; - echo ""._("Refresh Folders")."

"; - echo "
"; - echo "
"; + echo "" . _("Refresh Folder List") . "
"; } else { do_hook("options_save"); } diff --git a/src/options_order.php b/src/options_order.php index 8a16d239..8088d798 100644 --- a/src/options_order.php +++ b/src/options_order.php @@ -85,31 +85,37 @@ setPref($data_dir, $username, "order$i", $index_order[$i]); } } + echo "
"; + echo "
\n"; + echo _("The index order is the order that the columns are arranged in the message index. You can add, remove, and move columns around to customize them to fit your needs."); + echo "

"; if (count($index_order)) { + echo "
"; echo "\n"; for ($i=1; $i <= count($index_order); $i++) { $tmp = $index_order[$i]; echo ""; - echo "\n"; + echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "
up". _("up") ." | down". _("down") . " | "; // Always show the subject if ($tmp != 4) - echo "remove"; + echo "" . _("remove") . ""; echo " - " . $available[$tmp] . "
\n"; + echo "
"; } if (count($index_order) != count($available)) { - echo "
"; + echo "
"; echo ""; echo ""; echo ""; - echo ""; + echo "
"; } + echo "
" . _("Return to options page") . "
"; + ?> diff --git a/src/read_body.php b/src/read_body.php index d49ec3d1..05462549 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -45,19 +45,28 @@ } echo ""._("View message") . "\n"; echo "\n"; - echo "
";
+      echo "
"; + + echo ""; for ($i=1; $i < count($read)-1; $i++) { - $read[$i] = htmlspecialchars($read[$i]); - if (substr($read[$i], 0, 1) != "\t" && - substr($read[$i], 0, 1) != " " && - substr($read[$i], 0, 1) != "&" && - trim($read[$i])) { - $pre = substr($read[$i], 0, strpos($read[$i], ":")); - $read[$i] = str_replace("$pre", "$pre", decodeHeader($read[$i])); + $line = htmlspecialchars($read[$i]); + if (eregi("^[ |\t]", $line)) { + $second = $line; + $first = ""; + } else if (eregi("^([^:|^\s]+):(.+)", $line, $regs)) { + $first = $regs[1]; + $second = $regs[2]; + } else { + $second = trim($line); + $first = ""; } - echo "$read[$i]"; + echo ""; } - echo "
"; + if ($first) echo "$first:"; + else echo " "; + echo "$second
\n"; + echo "
"; + echo "\n"; echo ""; sqimap_mailbox_close($imapConnection); sqimap_logout($imapConnection); @@ -69,29 +78,43 @@ // returns the index of the next valid message from the array function findNextMessage() { - global $msort, $currentArrayIndex, $msgs; - for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) { - if ($currentArrayIndex == $msgs[$key]["ID"]) { - next($msort); - $key = key($msort); - if (isset($key)) - return $msgs[$key]["ID"]; - } - } + global $msort, $currentArrayIndex, $msgs, $sort; + + if ($sort == 6) { + if ($currentArrayIndex != 1) { + return $currentArrayIndex - 1; + } + } else { + for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) { + if ($currentArrayIndex == $msgs[$key]["ID"]) { + next($msort); + $key = key($msort); + if (isset($key)) + return $msgs[$key]["ID"]; + } + } + } return -1; } // returns the index of the previous message from the array function findPreviousMessage() { - global $msort, $currentArrayIndex, $msgs; - for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) { - if ($currentArrayIndex == $msgs[$key]["ID"]) { - prev($msort); - $key = key($msort); - if (isset($key)) - return $msgs[$key]["ID"]; - } - } + global $msort, $currentArrayIndex, $sort, $msgs, $imapConnection, $mailbox; + if ($sort == 6) { + $numMessages = sqimap_get_num_messages($imapConnection, $mailbox); + if ($currentArrayIndex != $numMessages) { + return $currentArrayIndex + 1; + } + } else { + for (reset($msort); ($key = key($msort)), (isset($key)); next($msort)) { + if ($currentArrayIndex == $msgs[$key]["ID"]) { + prev($msort); + $key = key($msort); + if (isset($key)) + return $msgs[$key]["ID"]; + } + } + } return -1; } diff --git a/src/right_main.php b/src/right_main.php index 61d08560..6c1ca9b0 100644 --- a/src/right_main.php +++ b/src/right_main.php @@ -67,11 +67,14 @@ /** If it was a successful login, lets load their preferences **/ include("../src/load_prefs.php"); + if (isset($newsort) && $newsort != $sort) { + setPref($data_dir, $username, "sort", $newsort); + } + // If the page has been loaded without a specific mailbox, // send them to the inbox if (!isset($mailbox)) { $mailbox = "INBOX"; - $sort = $newsort = 6; $startMessage = 1; } -- 2.25.1