f986b91086c183442adbcd8d96d4d0f0c0345f89
[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
53 /* Build a simple array into which we will build options. */
54 $optgrps = array();
55 $optvals = array();
56
57 /******************************************************/
58 /* LOAD EACH GROUP OF OPTIONS INTO THE OPTIONS ARRAY. */
59 /******************************************************/
60 define('SMOPT_GRP_SPCFOLDER', 0);
61 define('SMOPT_GRP_FOLDERLIST', 1);
62
63 /*** Load the General Options into the array ***/
64 $optgrps[SMOPT_GRP_SPCFOLDER] = _("Special Folder Options");
65 $optvals[SMOPT_GRP_SPCFOLDER] = array();
66
67 $special_folder_values = array();
68 foreach ($boxes as $folder) {
69 if (strtolower($folder['unformatted']) != 'inbox') {
70 $real_value = $folder['unformatted-dm'];
71 $disp_value = str_replace(' ', '&nbsp;', $folder['formatted']);
72 $special_folder_values[$real_value] = $disp_value;
73 }
74 }
75
76 $trash_none = array(SMPREF_NONE => _("Do not use Trash"));
77 $trash_folder_values = array_merge($trash_none, $special_folder_values);
78 $optvals[SMOPT_GRP_SPCFOLDER][] = array(
79 'name' => 'trash_folder',
80 'caption' => _("Trash Folder"),
81 'type' => SMOPT_TYPE_STRLIST,
82 'refresh' => SMOPT_REFRESH_FOLDERLIST,
83 'posvals' => $trash_folder_values
84 );
85
86 $sent_none = array(SMPREF_NONE => _("Do not use Sent"));
87 $sent_folder_values = array_merge($sent_none, $special_folder_values);
88 $optvals[SMOPT_GRP_SPCFOLDER][] = array(
89 'name' => 'sent_folder',
90 'caption' => _("Sent Folder"),
91 'type' => SMOPT_TYPE_STRLIST,
92 'refresh' => SMOPT_REFRESH_FOLDERLIST,
93 'posvals' => $sent_folder_values
94 );
95
96 $drafts_none = array(SMPREF_NONE => _("Do not use Drafts"));
97 $draft_folder_values = array_merge($draft_none, $special_folder_values);
98 $optvals[SMOPT_GRP_SPCFOLDER][] = array(
99 'name' => 'draft_folder',
100 'caption' => _("Draft Folder"),
101 'type' => SMOPT_TYPE_STRLIST,
102 'refresh' => SMOPT_REFRESH_FOLDERLIST,
103 'posvals' => $draft_folder_values
104 );
105
106 /*** Load the General Options into the array ***/
107 $optgrps[SMOPT_GRP_FOLDERLIST] = _("Folder List Options");
108 $optvals[SMOPT_GRP_FOLDERLIST] = array();
109
110 $optvals[SMOPT_GRP_FOLDERLIST][] = array(
111 'name' => 'location_of_bar',
112 'caption' => _("Location of Folder List"),
113 'type' => SMOPT_TYPE_STRLIST,
114 'refresh' => SMOPT_REFRESH_ALL,
115 'posvals' => array(SMPREF_LOC_LEFT => _("Left"),
116 SMPREF_LOC_RIGHT => _("Right"))
117 );
118
119 $left_size_values = array();
120 for ($lsv = 100; $lsv <= 300; $lsv += 10) {
121 $left_size_values[$lsv] = "$lsv " . _("pixels");
122 }
123 $optvals[SMOPT_GRP_FOLDERLIST][] = array(
124 'name' => 'left_size',
125 'caption' => _("Width of Folder List"),
126 'type' => SMOPT_TYPE_STRLIST,
127 'refresh' => SMOPT_REFRESH_ALL,
128 'posvals' => $left_size_values
129 );
130
131 $minute_str = _("Minutes");
132 $left_refresh_values = array(SMPREF_NONE => _("Never"));
133 foreach (array(30,60,120,180,300,600) as $lr_val) {
134 if ($lr_val < 60) {
135 $left_refresh_values[$lr_val] = "$lr_val " . _("Seconds");
136 } else if ($lr_val == 60) {
137 $left_refresh_values[$lr_val] = "1 " . _("Minute");
138 } else {
139 $left_refresh_values[$lr_val] = ($lr_val/60) . " $minute_str";
140 }
141 }
142 $optvals[SMOPT_GRP_FOLDERLIST][] = array(
143 'name' => 'left_refresh',
144 'caption' => _("Auto Refresh Folder List"),
145 'type' => SMOPT_TYPE_STRLIST,
146 'refresh' => SMOPT_REFRESH_FOLDERLIST,
147 'posvals' => $left_refresh_values
148 );
149
150 $optvals[SMOPT_GRP_FOLDERLIST][] = array(
151 'name' => 'unseen_notify',
152 'caption' => _("Enable Unseen Message Notification"),
153 'type' => SMOPT_TYPE_STRLIST,
154 'refresh' => SMOPT_REFRESH_FOLDERLIST,
155 'posvals' => array(SMPREF_UNSEEN_NONE => _("No Notification"),
156 SMPREF_UNSEEN_INBOX => _("Only INBOX"),
157 SMPREF_UNSEEN_ALL => _("All Folders"))
158 );
159
160 $optvals[SMOPT_GRP_FOLDERLIST][] = array(
161 'name' => 'unseen_type',
162 'caption' => _("Unseen Message Notification Type"),
163 'type' => SMOPT_TYPE_STRLIST,
164 'refresh' => SMOPT_REFRESH_FOLDERLIST,
165 'posvals' => array(SMPREF_UNSEEN_ONLY => _("Only Unseen"),
166 SMPREF_UNSEEN_TOTAL => _("Unseen and Total"))
167 );
168
169 $optvals[SMOPT_GRP_FOLDERLIST][] = array(
170 'name' => 'collapse_folders',
171 'caption' => _("Enable Collapsable Folders"),
172 'type' => SMOPT_TYPE_BOOLEAN,
173 'refresh' => SMOPT_REFRESH_FOLDERLIST
174 );
175
176 $optvals[SMOPT_GRP_FOLDERLIST][] = array(
177 'name' => 'date_format',
178 'caption' => _("Show Clock on Folders Panel"),
179 'type' => SMOPT_TYPE_STRLIST,
180 'refresh' => SMOPT_REFRESH_FOLDERLIST,
181 'posvals' => array( '1' => 'MM/DD/YY HH:MM',
182 '2' => 'DD/MM/YY HH:MM',
183 '3' => 'DDD, HH:MM',
184 '4' => 'HH:MM:SS',
185 '5' => 'HH:MM',
186 '6' => _("No Clock")),
187 );
188
189 $optvals[SMOPT_GRP_FOLDERLIST][] = array(
190 'name' => 'hour_format',
191 'caption' => _("Hour Format"),
192 'type' => SMOPT_TYPE_STRLIST,
193 'refresh' => SMOPT_REFRESH_FOLDERLIST,
194 'posvals' => array(SMPREF_TIME_12HR => _("12-hour clock"),
195 SMPREF_TIME_24HR => _("24-hour clock"))
196 );
197
198
199 /* Build and output the option groups. */
200 $option_groups = createOptionGroups($optgrps, $optvals);
201 printOptionGroups($option_groups);
202
203 echo '<TR><TD ALIGN="CENTER" VALIGN="MIDDLE" COLSPAN="2" NOWRAP><B>'
204 . _("Plugin Options") . "</B></TD></TR>\n";
205 OptionSubmit( 'submit_folder' );
206 ?>
207
208 </table>
209 </form>
210
211 <?php do_hook('options_folders_bottom'); ?>
212
213 </td></tr>
214 </table>
215
216 </td></tr>
217 </table>
218 </body></html>