| 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(' ', ' ', $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 | $optvals[] = array( |
| 95 | 'name' => 'location_of_bar', |
| 96 | 'caption' => _("Location of Folder List"), |
| 97 | 'type' => SMOPT_TYPE_STRLIST, |
| 98 | 'refresh' => SMOPT_REFRESH_ALL, |
| 99 | 'posvals' => array(SMPREF_LOC_LEFT => _("Left"), |
| 100 | SMPREF_LOC_RIGHT => _("Right")) |
| 101 | ); |
| 102 | |
| 103 | $left_size_values = array(); |
| 104 | for ($lsv = 100; $lsv <= 300; $lsv += 10) { |
| 105 | $left_size_values[$lsv] = "$lsv " . _("pixels"); |
| 106 | } |
| 107 | $optvals[] = array( |
| 108 | 'name' => 'left_size', |
| 109 | 'caption' => _("Width of Folder List"), |
| 110 | 'type' => SMOPT_TYPE_STRLIST, |
| 111 | 'refresh' => SMOPT_REFRESH_ALL, |
| 112 | 'posvals' => $left_size_values |
| 113 | ); |
| 114 | |
| 115 | $minute_str = _("Minutes"); |
| 116 | $left_refresh_values = array(SMPREF_NONE => _("Never")); |
| 117 | foreach (array(30,60,120,180,300,600) as $lr_val) { |
| 118 | if ($lr_val < 60) { |
| 119 | $left_refresh_values[$lr_val] = "$lr_val " . _("Seconds"); |
| 120 | } else if ($lr_val == 60) { |
| 121 | $left_refresh_values[$lr_val] = "1 " . _("Minute"); |
| 122 | } else { |
| 123 | $left_refresh_values[$lr_val] = ($lr_val/60) . " $minute_str"; |
| 124 | } |
| 125 | } |
| 126 | $optvals[] = array( |
| 127 | 'name' => 'left_refresh', |
| 128 | 'caption' => _("Auto Refresh Folder List"), |
| 129 | 'type' => SMOPT_TYPE_STRLIST, |
| 130 | 'refresh' => SMOPT_REFRESH_FOLDERLIST, |
| 131 | 'posvals' => $left_refresh_values |
| 132 | ); |
| 133 | |
| 134 | $optvals[] = array( |
| 135 | 'name' => 'unseen_notify', |
| 136 | 'caption' => _("Enable Unseen Message Notification"), |
| 137 | 'type' => SMOPT_TYPE_STRLIST, |
| 138 | 'refresh' => SMOPT_REFRESH_FOLDERLIST, |
| 139 | 'posvals' => array(SMPREF_UNSEEN_NONE => _("No Notification"), |
| 140 | SMPREF_UNSEEN_INBOX => _("Only INBOX"), |
| 141 | SMPREF_UNSEEN_ALL => _("All Folders")) |
| 142 | ); |
| 143 | |
| 144 | $optvals[] = array( |
| 145 | 'name' => 'unseen_type', |
| 146 | 'caption' => _("Unseen Message Notification Type"), |
| 147 | 'type' => SMOPT_TYPE_STRLIST, |
| 148 | 'refresh' => SMOPT_REFRESH_FOLDERLIST, |
| 149 | 'posvals' => array(SMPREF_UNSEEN_ONLY => _("Only Unseen"), |
| 150 | SMPREF_UNSEEN_TOTAL => _("Unseen and Total")) |
| 151 | ); |
| 152 | |
| 153 | $optvals[] = array( |
| 154 | 'name' => 'collapse_folders', |
| 155 | 'caption' => _("Enable Collapsable Folders"), |
| 156 | 'type' => SMOPT_TYPE_BOOLEAN, |
| 157 | 'refresh' => SMOPT_REFRESH_FOLDERLIST |
| 158 | ); |
| 159 | |
| 160 | $optvals[] = array( |
| 161 | 'name' => 'date_format', |
| 162 | 'caption' => _("Show Clock on Folders Panel"), |
| 163 | 'type' => SMOPT_TYPE_STRLIST, |
| 164 | 'refresh' => SMOPT_REFRESH_FOLDERLIST, |
| 165 | 'posvals' => array( '1' => 'MM/DD/YY HH:MM', |
| 166 | '2' => 'DD/MM/YY HH:MM', |
| 167 | '3' => 'DDD, HH:MM', |
| 168 | '4' => 'HH:MM:SS', |
| 169 | '5' => 'HH:MM', |
| 170 | '6' => _("No Clock")), |
| 171 | ); |
| 172 | |
| 173 | $optvals[] = array( |
| 174 | 'name' => 'hour_format', |
| 175 | 'caption' => _("Hour Format"), |
| 176 | 'type' => SMOPT_TYPE_STRLIST, |
| 177 | 'refresh' => SMOPT_REFRESH_FOLDERLIST, |
| 178 | 'posvals' => array(SMPREF_TIME_12HR => _("12-hour clock"), |
| 179 | SMPREF_TIME_24HR => _("24-hour clock")) |
| 180 | ); |
| 181 | |
| 182 | |
| 183 | /* Build all these values into an array of SquirrelOptions objects. */ |
| 184 | $options = createOptionArray($optvals); |
| 185 | |
| 186 | /* Print the row for each option. */ |
| 187 | foreach ($options as $option) { |
| 188 | if ($option->type != SMOPT_TYPE_HIDDEN) { |
| 189 | echo "<TR>\n"; |
| 190 | echo ' <TD ALIGN="RIGHT" VALIGN="MIDDLE" NOWRAP>' |
| 191 | . $option->caption . ":</TD>\n"; |
| 192 | echo ' <TD>' . $option->createHTMLWidget() . "</TD>\n"; |
| 193 | echo "</TR>\n"; |
| 194 | } else { |
| 195 | echo $option->createHTMLWidget(); |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | // if( $unseen_notify == '' ) |
| 200 | // $unseen_notify = '2'; |
| 201 | |
| 202 | |
| 203 | echo '<tr><td colspan=2><hr noshade></td></tr>'; |
| 204 | do_hook("options_folders_inside"); |
| 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> |