- beautified index order options page
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 26 Nov 2000 20:57:55 +0000 (20:57 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 26 Nov 2000 20:57:55 +0000 (20:57 +0000)
- 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
src/load_prefs.php
src/options.php
src/options_order.php
src/read_body.php
src/right_main.php

index 0473e70bcc970469e8578268b9cfe79263c7aea3..5823fc580810865f7fce73cdd51c27d16d05bcb9 100644 (file)
--- 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 <pre> tags for viewing message body instead of <tt> and &nbsp;
index 1c91e573ad2e392772dbc1b158953a2e40d0e3b8..7c9857f9753c1f2d42fddee3e372c4f0c2709171 100644 (file)
    $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) {
index 5710f0d06aa11363695305e13fc5acb8c4dcc9aa..7c684247c8fcfe66411ef8fc5452a5bd2e1fca5d 100644 (file)
     
       do_hook("options_display_save");
 
-      echo "<center><table width=90% cellpadding=2 cellspacing=0 border=0 bgcolor=\"$color[2]\"><tr><td>";
-      ecHO "<table width=100% cellpadding=5 cellspacing=0 border=0 bgcolor=\"$color[4]\"><tr><td>";
       echo "<br><center><b>"._("Successfully saved display preferences!")."</b><br>";
-      echo "<a href=\"webmail.php?right_frame=options.php\" target=_top>"._("Refresh Page")."</a></center><br>";
-      echo "</td></tr></table>";
-      echo "</td></tr></table></center>";
+      echo "<a href=\"../src/webmail.php\" target=_top>" . _("Refresh Page") . "</a></center><br>";
    } else if ($submit_folder) { 
       # Save folder preferences
       if ($trash != "none") {
       setPref($data_dir, $username, "unseen_notify", $unseennotify);
       setPref($data_dir, $username, "unseen_type", $unseentype);
       do_hook("options_folders_save");
-      echo "<center><table width=90% cellpadding=2 cellspacing=0 border=0 bgcolor=\"$color[2]\"><tr><td>";
-      ecHO "<table width=100% cellpadding=5 cellspacing=0 border=0 bgcolor=\"$color[4]\"><tr><td>";
       echo "<br><center><b>"._("Successfully saved folder preferences!")."</b><br>";
-      echo "<a href=\"left_main.php\" target=left>"._("Refresh Folders")."</a></center><br>";
-      echo "</td></tr></table>";
-      echo "</td></tr></table></center>";
+      echo "<a href=\"../src/left_main.php\" target=left>" . _("Refresh Folder List") . "</a></center><br>";
    } else {
       do_hook("options_save");
    }
index 8a16d239c896cf77e0ebfa9ed6110b42eb0edea3..8088d7982cb71c1c72d5f0806971e4db4c8c6f8f 100644 (file)
          setPref($data_dir, $username, "order$i", $index_order[$i]);
       }
    }
+   echo "<center>";
+   echo "<table cellspacing=0 cellpadding=0 border=0 width=65%><tr><td>\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 "</td></tr></table></center><br>";
 
    if (count($index_order))
    {
+      echo "<center>";
       echo "<table cellspacing=0 cellpadding=0 border=0>\n";
       for ($i=1; $i <= count($index_order); $i++) {
          $tmp = $index_order[$i];
          echo "<tr>";
-         echo "<td><small><a href=\"options_order.php?method=up&num=$i\">up</a></small></td>\n";
+         echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". _("up") ."</a></small></td>\n";
          echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
-         echo "<td><small><a href=\"options_order.php?method=down&num=$i\">down</a></small></td>\n";
+         echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". _("down") . "</a></small></td>\n";
          echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
          echo "<td>";
          // Always show the subject
          if ($tmp != 4)
-            echo "<small><a href=\"options_order.php?method=remove&num=$i\">remove</a></small>";
+            echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . _("remove") . "</a></small>";
          echo "</td>\n";
          echo "<td><small>&nbsp;-&nbsp;</small></td>\n";
          echo "<td>" . $available[$tmp] . "</td>\n";
          echo "</tr>\n";
       }
       echo "</table>\n";
+      echo "</center>";
    }
    
    if (count($index_order) != count($available)) {
-   echo "<form name=f method=post action=options_order.php>";
+   echo "<center><form name=f method=post action=options_order.php>";
    echo "<select name=add>";
    for ($i=1; $i <= count($available); $i++) {
       $found = false;
    echo "</select>";
    echo "<input type=hidden value=add name=method>";
    echo "<input type=submit value=\""._("Add")."\" name=submit>";
-   echo "</form>";
+   echo "</form></center>";
    }
 
+   echo "<br><center><a href=\"../src/options.php\">" . _("Return to options page") . "</a></center>";
+
 ?>
    </td></tr></table>
 </body></html>
index d49ec3d1780c7dc6c1d038bd4e37c8a02d5a83b6..05462549a88987a26c702247754b207f4e615640 100644 (file)
       }
       echo ""._("View message") . "</a></b></center></td></tr></table>\n";
       echo "<table width=99% cellpadding=2 cellspacing=0 border=0 align=center>\n";
-      echo "<tr><td><pre>";
+      echo "<tr><td>";
+
+      echo "<table width=100% cellpadding=0 cellspacing=0 border=0>";
       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", "<b>$pre</b>", 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 "<tr><td align=right valign=top>";
+         if ($first) echo "<tt><b>$first:</b></tt>";
+         else        echo " ";
+         echo "</td><td valign=top nowrap><tt>$second</tt></td></tr>";
       }
-      echo "</pre></td></tr></table>\n";
+      echo "</table>";
+      echo "</td></tr></table>\n";
       echo "</body></html>";
       sqimap_mailbox_close($imapConnection);
       sqimap_logout($imapConnection);
 
    // 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;
    }
 
index 61d08560f2130b4c63a38249c82449ee85b75fc6..6c1ca9b06cd8268b7aa472e343a5a96f80018ba1 100644 (file)
    /** 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;
    }