Make moving folders into Trash optional
authorsimond <simond@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 4 Feb 2002 15:09:59 +0000 (15:09 +0000)
committersimond <simond@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 4 Feb 2002 15:09:59 +0000 (15:09 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2358 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/conf.pl
config/config_default.php
plugins/administrator/defines.php
src/folders_delete.php

index 86d8662da982bc666fe22046826de1fea9639ebb..c1400b4cd4a29fcfa08225018da617d6cd55e907 100755 (executable)
@@ -357,22 +357,23 @@ while (($command ne "q") && ($command ne "Q")) {
       print "R   Return to Main Menu\n";
    } elsif ($menu == 3) {
       print $WHT."Folder Defaults\n".$NRM;
-      print "1.  Default Folder Prefix       : $WHT$default_folder_prefix$NRM\n";
-      print "2.  Show Folder Prefix Option   : $WHT$show_prefix_option$NRM\n";
-      print "3.  Trash Folder                : $WHT$trash_folder$NRM\n";
-      print "4.  Sent Folder                 : $WHT$sent_folder$NRM\n";
-      print "5.  Drafts Folder               : $WHT$draft_folder$NRM\n";
-      print "6.  By default, move to trash   : $WHT$default_move_to_trash$NRM\n";
-      print "7.  By default, move to sent    : $WHT$default_move_to_sent$NRM\n";
-      print "8.  By default, save as draft   : $WHT$default_save_as_draft$NRM\n";
-      print "9.  List Special Folders First  : $WHT$list_special_folders_first$NRM\n";
-      print "10. Show Special Folders Color  : $WHT$use_special_folder_color$NRM\n";
-      print "11. Auto Expunge                : $WHT$auto_expunge$NRM\n";
-      print "12. Default Sub. of INBOX       : $WHT$default_sub_of_inbox$NRM\n";
-      print "13. Show 'Contain Sub.' Option  : $WHT$show_contain_subfolders_option$NRM\n";
-      print "14. Default Unseen Notify       : $WHT$default_unseen_notify$NRM\n";
-      print "15. Default Unseen Type         : $WHT$default_unseen_type$NRM\n";
-      print "16. Auto Create Special Folders : $WHT$auto_create_special$NRM\n";
+      print "1.  Default Folder Prefix         : $WHT$default_folder_prefix$NRM\n";
+      print "2.  Show Folder Prefix Option     : $WHT$show_prefix_option$NRM\n";
+      print "3.  Trash Folder                  : $WHT$trash_folder$NRM\n";
+      print "4.  Sent Folder                   : $WHT$sent_folder$NRM\n";
+      print "5.  Drafts Folder                 : $WHT$draft_folder$NRM\n";
+      print "6.  By default, move to trash     : $WHT$default_move_to_trash$NRM\n";
+      print "7.  By default, move to sent      : $WHT$default_move_to_sent$NRM\n";
+      print "8.  By default, save as draft     : $WHT$default_save_as_draft$NRM\n";
+      print "9.  List Special Folders First    : $WHT$list_special_folders_first$NRM\n";
+      print "10. Show Special Folders Color    : $WHT$use_special_folder_color$NRM\n";
+      print "11. Auto Expunge                  : $WHT$auto_expunge$NRM\n";
+      print "12. Default Sub. of INBOX         : $WHT$default_sub_of_inbox$NRM\n";
+      print "13. Show 'Contain Sub.' Option    : $WHT$show_contain_subfolders_option$NRM\n";
+      print "14. Default Unseen Notify         : $WHT$default_unseen_notify$NRM\n";
+      print "15. Default Unseen Type           : $WHT$default_unseen_type$NRM\n";
+      print "16. Auto Create Special Folders   : $WHT$auto_create_special$NRM\n";
+      print "17. Don't move folders into Trash : $WHT$delete_folder$NRM\n";
       print "\n";
       print "R   Return to Main Menu\n";
    } elsif ($menu == 4) {
@@ -545,6 +546,7 @@ while (($command ne "q") && ($command ne "Q")) {
          elsif ($command == 14) { $default_unseen_notify          = command212(); }
          elsif ($command == 15) { $default_unseen_type            = command213(); }
          elsif ($command == 16) { $auto_create_special            = command214(); }
+         elsif ($command == 17) { $delete_folder                  = command215(); }
       } elsif ($menu == 4) {
          if    ($command == 1) { $default_charset          = command31 (); }
          elsif ($command == 2) { $data_dir                 = command33a (); }
@@ -1316,6 +1318,28 @@ sub command214 {
    return $auto_create_special;
 }
 
+# Auto create special folders
+sub command215 {
+   print "Would you like to automatically completely delete any deleted\n";
+   print "folders? If not then they will be moved to the Trash folder\n";
+   print "and can be deleted from there\n";
+   print "\n";
+
+   if ($delete_folder eq "true") {
+      $default_value = "y";
+   } else {
+      $default_value = "n";
+   }
+   print "Auto delete folders? (y/n) [$WHT$default_value$NRM]: $WHT";
+   $new_delete = <STDIN>;
+   if (($new_delete =~ /^y\n/i) || (($new_delete =~ /^\n/) && ($default_value eq "y"))) {
+      $delete_folder = "true";
+   } else {
+      $delete_folder = "false";
+   }  
+   return $delete_folder;
+}     
+
 
 ############# GENERAL OPTIONS #####################
 
@@ -1976,6 +2000,7 @@ sub save_data {
         print CF "global \$show_contain_subfolders_option;\n";
         print CF "global \$default_unseen_notify;\n";
         print CF "global \$default_unseen_type, \$auto_create_special;\n";
+        print CF "global \$delete_folder;\n";
         print CF "\$default_folder_prefix          = '$default_folder_prefix';\n";
         print CF "\$trash_folder                   = '$trash_folder';\n";
         print CF "\$sent_folder                    = '$sent_folder';\n";
@@ -1992,6 +2017,7 @@ sub save_data {
         print CF "\$default_unseen_notify          = $default_unseen_notify;\n";
         print CF "\$default_unseen_type            = $default_unseen_type;\n";
         print CF "\$auto_create_special            = $auto_create_special;\n";
+        print CF "\$delete_folder                  = $delete_folder;\n";
         print CF "\n";
      
         print CF "global \$default_charset;\n";
index e4c761cb537b9d9d408aa1ebddddace9236c5970..61316827d826f1c7a41fdb92ffee9c94249b7520 100644 (file)
@@ -139,9 +139,13 @@ $show_prefix_option = false;
  *      marked 'Deleted'.
  *   $sent_folder
  *      This is the path to where Sent messages will be stored.
+ *   $delete_folder
+ *      If this is true, when a folder is deleted then it will
+ *      not get moved into the Trash folder.
  */
 global $default_move_to_trash, $default_move_to_sent, $default_save_as_draft;
 global $trash_folder, $sent_folder, $draft_folder, $auto_expunge;
+global $delete_folder;
 $default_move_to_trash = true;
 $default_move_to_sent  = true;
 $default_save_as_draft = true;
@@ -149,6 +153,7 @@ $trash_folder = 'INBOX.Trash';
 $sent_folder  = 'INBOX.Sent';
 $draft_folder = 'INBOX.Drafts';
 $auto_expunge = true;
+$delete_folder = false;
 
 /**
  * Should I create the Sent and Trash folders automatically for
index 241b6de706005eddeed54fe680ca0e7bdb8a18f0..e25a0f17c4225e89f67d662ad4107d92388853b5 100644 (file)
@@ -160,6 +160,8 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"),
                                                   'type' => SMOPT_TYPE_BOOLEAN ),
                  '$default_use_javascript_addr_book' => array( 'name' => _("Default Javascript Adrressbook"),
                                                   'type' => SMOPT_TYPE_BOOLEAN ),
+                 '$delete_folder' => array( 'name' => _("Auto delete folders"),
+                                            'type' => SMOPT_TYPE_BOOLEAN ),
                  /* --------------------------------------------------------*/
                  'Group4' => array( 'name' => _("General Options"),
                                     'type' => SMOPT_TYPE_TITLE ),
index 4ae96f809e27711ac90dd66de11f27c6590981e7..40c2ca2feb976d13e0f95e05f676abfc812c649b 100644 (file)
@@ -25,7 +25,7 @@ require_once('../functions/tree.php');
 
 $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
 $boxes = sqimap_mailbox_list ($imap_stream);
-global $delimiter;
+global $delimiter, $delete_folder;
 
 if (substr($mailbox, -1) == $delimiter)
     $mailbox_no_dm = substr($mailbox, 0, strlen($mailbox) - 1);
@@ -40,6 +40,11 @@ if (strtolower($imap_server_type) == "courier") {
     $can_move_to_trash = false;
 }
 
+// If global options say we can't move it into Trash
+else if(isset($delete_folder) && $delete_folder == true) {
+    $can_move_to_trash = false;
+}
+
 // If it's already a subfolder of trash, we'll have to delete it
 else if(eregi("^".$trash_folder.".+", $mailbox)) {