This closes my feature request #474658
[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 /* Build a simple array into which we will build options. */
53 $optvals = array();
54
55 $special_folder_values = array();
56 foreach ($boxes as $folder) {
57 if (strtolower($folder['unformatted']) != 'inbox') {
58 $real_value = $folder['unformatted-dm'];
59 $disp_value = str_replace(' ', '&nbsp;', $folder['formatted']);
60 $special_folder_values[$real_value] = $disp_value;
61 }
62 }
63
64 $trash_none = array(SMPREF_NONE => _("Do not use Trash"));
65 $trash_folder_values = array_merge($trash_none, $special_folder_values);
66 $optvals[] = array(
67 'name' => 'trash_folder',
68 'caption' => _("Trash Folder"),
69 'type' => SMOPT_TYPE_STRLIST,
70 'refresh' => SMOPT_REFRESH_FOLDERLIST,
71 'posvals' => $trash_folder_values
72 );
73
74 $sent_none = array(SMPREF_NONE => _("Do not use Sent"));
75 $sent_folder_values = array_merge($sent_none, $special_folder_values);
76 $optvals[] = array(
77 'name' => 'sent_folder',
78 'caption' => _("Sent Folder"),
79 'type' => SMOPT_TYPE_STRLIST,
80 'refresh' => SMOPT_REFRESH_FOLDERLIST,
81 'posvals' => $sent_folder_values
82 );
83
84 $drafts_none = array(SMPREF_NONE => _("Do not use Drafts"));
85 $draft_folder_values = array_merge($draft_none, $special_folder_values);
86 $optvals[] = array(
87 'name' => 'draft_folder',
88 'caption' => _("Draft Folder"),
89 'type' => SMOPT_TYPE_STRLIST,
90 'refresh' => SMOPT_REFRESH_FOLDERLIST,
91 'posvals' => $draft_folder_values
92 );
93
94 /* Build all these values into an array of SquirrelOptions objects. */
95 $options = createOptionArray($optvals);
96
97 /* Print the row for each option. */
98 foreach ($options as $option) {
99 if ($option->type != SMOPT_TYPE_HIDDEN) {
100 echo "<TR>\n";
101 echo ' <TD ALIGN="RIGHT" VALIGN="MIDDLE" NOWRAP>'
102 . $option->caption . ":</TD>\n";
103 echo ' <TD>' . $option->createHTMLWidget() . "</TD>\n";
104 echo "</TR>\n";
105 } else {
106 echo $option->createHTMLWidget();
107 }
108 }
109
110 // if( $unseen_notify == '' )
111 // $unseen_notify = '2';
112 OptionRadio( _("Unseen message notification"),
113 'unseennotify',
114 array( 1 => _("No notification"),
115 2 => _("Only INBOX"),
116 3 => _("All Folders") ),
117 $unseen_notify, '', '',
118 '<br>' );
119 OptionRadio( _("Unseen message notification type"),
120 'unseentype',
121 array( 1 => _("Only unseen"),
122 2 => _("Unseen and Total") ),
123 $unseen_type, '', '',
124 '<br>' );
125 OptionCheck( _("Collapseable folders"),
126 'collapsefolders',
127 $collapse_folders,
128 _("Enable Collapseable Folders") );
129 OptionSelect( '<b>' . _("Show Clock on Folders Panel") . '</b> ' . _("Date format"),
130 'dateformat',
131 array( '1' => 'MM/DD/YY HH:MM',
132 '2' => 'DD/MM/YY HH:MM',
133 '3' => 'DDD, HH:MM',
134 '4' => 'HH:MM:SS',
135 '5' => 'HH:MM',
136 '6' => _("No Clock") ),
137 $date_format );
138 OptionSelect( _("Hour format"),
139 'hourformat',
140 array( '1' => _("24-hour clock"),
141 '2' => _("12-hour clock") ),
142 $hour_format );
143
144 echo '<tr><td colspan=2><hr noshade></td></tr>';
145 do_hook("options_folders_inside");
146 OptionSubmit( 'submit_folder' );
147 ?>
148
149 </table>
150 </form>
151
152 <?php do_hook('options_folders_bottom'); ?>
153
154 </td></tr>
155 </table>
156
157 </td></tr>
158 </table>
159 </body></html>