More work on options...
[squirrelmail.git] / src / options_folder.php
1 <?php
2 /**
3 ** options_folder.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** Displays all options relating to folders
9 **
10 ** $Id$
11 **/
12
13 require_once('../src/validate.php');
14 require_once('../functions/display_messages.php');
15 require_once('../functions/imap.php');
16 require_once('../functions/array.php');
17 require_once('../functions/plugin.php');
18 require_once('../functions/options.php');
19
20 displayPageHeader($color, 'None');
21
22 $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
23 $boxes = sqimap_mailbox_list($imapConnection);
24 sqimap_logout($imapConnection);
25 ?>
26 <br>
27 <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
28 <tr><td bgcolor="<?php echo $color[0] ?>" align="center">
29
30 <b><?php echo _("Options") . " - " . _("Folder Preferences"); ?></b>
31
32 <table width="100%" border="0" cellpadding="1" cellspacing="1">
33 <tr><td bgcolor="<?php echo $color[4] ?>" align="center">
34
35 <form name="f" action="options.php" method="post"><br>
36
37 <table width="100%" cellpadding="2" cellspacing="0" border="0">
38
39 <?php if ($show_prefix_option == true) { ?>
40 <tr>
41 <td align=right nowrap><?php echo _("Folder Path"); ?>:
42 </td><td>
43 <?php if (isset ($folder_prefix))
44 echo ' <input type="text" name="folderprefix" value="'.$folder_prefix.'" size="35"><br>';
45 else
46 echo ' <input type="text" name="folderprefix" value="'.$default_folder_prefix.'" size="35"><br>';
47 ?>
48 </td>
49 </tr>
50 <?php }
51
52 /* TRASH FOLDER */
53 echo '<tr><td nowrap align="right">';
54 echo _("Trash Folder:");
55 echo '</td><td>';
56 echo "<TT><SELECT NAME=trash>\n";
57 if ($move_to_trash == true) {
58 echo '<option value="none">' . _("Do not use Trash");
59 } else {
60 echo '<option value="none" selected>' . _("Do not use Trash");
61 }
62
63 for ($i = 0; $i < count($boxes); $i++) {
64 $use_folder = true;
65 if (strtolower($boxes[$i]['unformatted']) == 'inbox') {
66 $use_folder = false;
67 }
68 if ($use_folder == true) {
69 $box = $boxes[$i]['unformatted-dm'];
70 $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['formatted']);
71 if (($boxes[$i]['unformatted'] == $trash_folder) && ($move_to_trash == true))
72 echo " <OPTION SELECTED VALUE=\"$box\">$box2\n";
73 else
74 echo " <OPTION VALUE=\"$box\">$box2\n";
75 }
76 }
77 echo "</SELECT></TT>\n";
78 echo '</td></tr>';
79
80
81 /* SENT FOLDER */
82 echo '<tr><td nowrap align="right">';
83 echo _("Sent Folder:");
84 echo '</td><td>';
85 echo '<TT><SELECT NAME="sent">' . "\n";
86 if ($move_to_sent == true)
87 echo '<option value="none">' . _("Do not use Sent");
88 else
89 echo "<option value=\"none\" selected>" . _("Do not use Sent");
90
91 for ($i = 0; $i < count($boxes); $i++) {
92 $use_folder = true;
93 if (strtolower($boxes[$i]['unformatted']) == 'inbox') {
94 $use_folder = false;
95 }
96 if ($use_folder == true) {
97 $box = $boxes[$i]['unformatted-dm'];
98 $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['formatted']);
99 if (($boxes[$i]['unformatted'] == $sent_folder) && ($move_to_sent == true))
100 echo " <OPTION SELECTED VALUE=\"$box\">$box2\n";
101 else
102 echo " <OPTION VALUE=\"$box\">$box2\n";
103 }
104 }
105 echo "</SELECT></TT>\n";
106 echo '</td></tr>';
107
108 /* Drafts Folder. */
109 echo '<tr><td nowrap align="right">';
110 echo _("Drafts Folder:");
111 echo '</td><td>';
112 echo '<TT><SELECT NAME="draft">';
113 if ($save_as_draft == true)
114 echo '<option value="none">' . _("Do not use Drafts");
115 else
116 echo '<option value="none" selected>' . _("Do not use Drafts");
117
118 for ($i = 0; $i < count($boxes); $i++) {
119 $use_folder = true;
120 if (strtolower($boxes[$i]['unformatted']) == 'inbox') {
121 $use_folder = false;
122 }
123 if ($use_folder == true) {
124 $box = $boxes[$i]['unformatted-dm'];
125 $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['formatted']);
126 $select_draft_value = rtrim($boxes[$i]['unformatted']);
127 if (($select_draft_value == $draft_folder) && ($save_as_draft == true)) {
128 echo " <OPTION SELECTED VALUE=\"$box\">$box2\n";
129 } else {
130 echo " <OPTION VALUE=\"$box\">$box2\n";
131 }
132 }
133 }
134 echo "</SELECT></TT>\n";
135 echo '</td></tr>';
136 // if( $unseen_notify == '' )
137 // $unseen_notify = '2';
138 OptionRadio( _("Unseen message notification"),
139 'unseennotify',
140 array( 1 => _("No notification"),
141 2 => _("Only INBOX"),
142 3 => _("All Folders") ),
143 $unseen_notify, '', '',
144 '<br>' );
145 OptionRadio( _("Unseen message notification type"),
146 'unseentype',
147 array( 1 => _("Only unseen"),
148 2 => _("Unseen and Total") ),
149 $unseen_type, '', '',
150 '<br>' );
151 OptionCheck( _("Collapseable folders"),
152 'collapsefolders',
153 $collapse_folders,
154 _("Enable Collapseable Folders") );
155 OptionSelect( '<b>' . _("Show Clock on Folders Panel") . '</b> ' . _("Date format"),
156 'dateformat',
157 array( '1' => 'MM/DD/YY HH:MM',
158 '2' => 'DD/MM/YY HH:MM',
159 '3' => 'DDD, HH:MM',
160 '4' => 'HH:MM:SS',
161 '5' => 'HH:MM',
162 '6' => _("No Clock") ),
163 $date_format );
164 OptionSelect( _("Hour format"),
165 'hourformat',
166 array( '1' => _("24-hour clock"),
167 '2' => _("12-hour clock") ),
168 $hour_format );
169
170 echo '<tr><td colspan=2><hr noshade></td></tr>';
171 do_hook("options_folders_inside");
172 OptionSubmit( 'submit_folder' );
173 ?>
174
175 </table>
176 </form>
177
178 <?php do_hook('options_folders_bottom'); ?>
179
180 </td></tr>
181 </table>
182
183 </td></tr>
184 </table>
185 </body></html>