Folder manipulation update
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 29 Nov 1999 00:47:42 +0000 (00:47 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 29 Nov 1999 00:47:42 +0000 (00:47 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@30 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/config.php
src/folders.php

index 99b1fa8..9048b0a 100644 (file)
@@ -33,4 +33,16 @@ $move_to_trash = true;
 $trash_folder = "INBOX.Trash";
 $auto_expunge = true;
 
+/* Special Folders are folders that can't be manipulated like normal user created
+   folders can.  A couple of examples would be "INBOX", "INBOX.Trash".  We have
+   them set to Netscape's default mailboxes, but this obviously can be changed.
+   To add one, just add a new number to the array.
+*/
+$special_folders[0] = "INBOX";
+$special_folders[1] = "INBOX.Trash";
+$special_folders[2] = "INBOX.Sent";
+$special_folders[3] = "INBOX.Drafts";
+$special_folders[4] = "INBOX.Templates";
+
+
 ?>
index a3abbf5..7dc1947 100644 (file)
@@ -1,5 +1,14 @@
 <HTML><BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE">
 <?
+   function getBoxForCreate($mailbox) {
+      if (substr($mailbox, 0, 6) == "INBOX.")
+         $box = substr($mailbox, 6, strlen($mailbox));
+      else
+         $box = $mailbox;
+
+      return $box;
+   }
+
    include("../config/config.php");
    include("../functions/strings.php");
    include("../functions/page_header.php");
 
       // indent the correct number of spaces.
       for ($j = 0;$j < $periodCount;$j++)
-         echo "&nbsp;&nbsp;";
+         $boxes[$i] = "$boxes[$i]&nbsp;&nbsp;&nbsp;";
 
-      $mailboxURL = urlencode($mailbox);
-      echo "<FONT FACE=\"Arial,Helvetica\">\n";
-      echo readShortMailboxName($mailbox, ".");
-      echo "</FONT><BR>\n";
+      $boxes[$i] = $boxes[$i] . readShortMailboxName($mailbox, ".");
+      $long_name_boxes[$i] = $mailbox;
    }
+
+   /** DELETING FOLDERS **/
+   echo "<FORM ACTION=folders_delete.php METHOD=POST>\n";
+   echo "<SELECT NAME=folder_list><FONT FACE=\"Arial,Helvetica\">\n";
+   for ($i = 0; $i < count($str); $i++) {
+      $use_folder = true;
+      for ($p = 0; $p < count($special_folders); $p++) {
+         if ($special_folders[$p] == $long_name_boxes[$i])
+            $use_folder = false;
+      }
+      if ($use_folder == true)
+         echo "   <OPTION>$boxes[$i]\n";
+   }
+   echo "</SELECT>\n";
+   echo "<INPUT TYPE=SUBMIT VALUE=Delete>\n";
+   echo "</FORM><BR>\n";
+
+   /** CREATING FOLDERS **/
+   echo "<FORM ACTION=folders_create.php METHOD=POST>\n";
+   echo "<INPUT TYPE=TEXT SIZE=25 NAME=folder_name>\n";
+   echo "&nbsp;&nbsp;as a subfolder of&nbsp;&nbsp;";
+   echo "<SELECT NAME=subfolder><FONT FACE=\"Arial,Helvetica\">\n";
+   for ($i = 0;$i < count($str); $i++) {
+      $thisbox = Chop($str[$i]);
+      $thisbox = findMailboxName($thisbox);
+      $thisbox = getBoxForCreate($thisbox);
+      echo "<OPTION>$thisbox\n";
+   }
+   echo "</SELECT>\n";
+   echo "<INPUT TYPE=SUBMIT VALUE=Create>\n";
+   echo "</FORM><BR>\n";
+
+   /** RENAMING FOLDERS **/
+   echo "<FORM ACTION=folders_rename.php METHOD=POST>\n";
+   echo "<SELECT NAME=folder_list><FONT FACE=\"Arial,Helvetica\">\n";
+   for ($i = 0; $i < count($str); $i++) {
+      $use_folder = true;
+      for ($p = 0; $p < count($special_folders); $p++) {
+         if ($special_folders[$p] == $long_name_boxes[$i])
+            $use_folder = false;
+      }
+      if ($use_folder == true)
+         echo "   <OPTION>$boxes[$i]\n";
+   }
+   echo "</SELECT>\n";
+   echo "<INPUT TYPE=TEXT SIZE=25 NAME=new_folder_name>\n";
+   echo "<INPUT TYPE=SUBMIT VALUE=Rename>\n";
+   echo "</FORM><BR>\n";
+
 ?>
 </BODY></HTML>
\ No newline at end of file