Преглед изворни кода

patch #539958 Remember selection of target mailbox in move message option.

jmunro пре 23 година
родитељ
комит
a17f4ce601
2 измењених фајлова са 20 додато и 3 уклоњено
  1. 10 2
      functions/mailbox_display.php
  2. 10 1
      src/move_messages.php

+ 10 - 2
functions/mailbox_display.php

@@ -626,6 +626,7 @@ function displayMessageArray($imapConnection, $num_msgs, $start_msg,
  * $Message is a message that is centered on top of the list
  * $More is a second line that is left aligned
  */
+ 
 function mail_message_listing_beginning ($imapConnection, $moveURL, 
 					 $mailbox = '', $sort = -1,
 					 $msg_cnt_str = '', 
@@ -633,7 +634,9 @@ function mail_message_listing_beginning ($imapConnection, $moveURL,
 					 $start_msg = 1) {
   global $color, $index_order, $auto_expunge, $move_to_trash, $base_uri,
     $checkall, $sent_folder, $draft_folder, $thread_sort_messages, 
-    $allow_thread_sort, $allow_server_sort, $server_sort_order;
+    $allow_thread_sort, $allow_server_sort, $server_sort_order,
+    $lastTargetMailbox;
+
   $urlMailbox = urlencode($mailbox);
 
   /*
@@ -674,7 +677,12 @@ function mail_message_listing_beginning ($imapConnection, $moveURL,
       if( $box2 == 'INBOX' ) {
 	$box2 = _("INBOX");
       }
-      echo "         <OPTION VALUE=\"$box\">$box2</option>\n";
+      if ($lastTargetMailbox == $box) {
+        echo "       <OPTION VALUE=\"$box\" SELECTED>$box2</OPTION>\n";
+      }
+      else {
+        echo "         <OPTION VALUE=\"$box\">$box2</OPTION>\n";
+      }
     }
   }
   echo '         </SELECT></TT>&nbsp;'

+ 10 - 1
src/move_messages.php

@@ -43,7 +43,7 @@ function putSelectedMessagesIntoString($msg) {
 
 function attachSelectedMessages($msg, $imapConnection) {
 
-    global $mailbox, $username, $attachment_dir, $attachments, $identity, $data_dir, $composesession;
+    global $mailbox, $username, $attachment_dir, $attachments, $identity, $data_dir, $composesession, $lastTargetMailbox;
 
 
     if (!isset($attachments)) {
@@ -125,6 +125,15 @@ function attachSelectedMessages($msg, $imapConnection) {
 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 sqimap_mailbox_select($imapConnection, $mailbox);
 
+/* remember changes to mailbox setting */
+if (!isset($lastTargetMailbox)) {
+    $lastTargetMailbox = 'INBOX';
+}
+if ($targetMailbox != $lastTargetMailbox) {
+    $lastTargetMailbox = $targetMailbox;
+    session_register('lastTargetMailbox');
+}
+
 // expunge-on-demand if user isn't using move_to_trash or auto_expunge
 if(isset($expungeButton)) {
     sqimap_mailbox_expunge($imapConnection, $mailbox, true);