| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /* |
|---|
| 4 | +-----------------------------------------------------------------------+ |
|---|
| 5 | | program/steps/settings/edit_prefs.inc | |
|---|
| 6 | | | |
|---|
| 7 | | This file is part of the RoundCube Webmail client | |
|---|
| 8 | | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | |
|---|
| 9 | | Licensed under the GNU GPL | |
|---|
| 10 | | | |
|---|
| 11 | | PURPOSE: | |
|---|
| 12 | | Provide functionality for user's settings & preferences | |
|---|
| 13 | | | |
|---|
| 14 | +-----------------------------------------------------------------------+ |
|---|
| 15 | | Author: Thomas Bruederli <roundcube@gmail.com> | |
|---|
| 16 | +-----------------------------------------------------------------------+ |
|---|
| 17 | |
|---|
| 18 | $Id: func.inc 2822 2009-07-31 09:07:54Z alec $ |
|---|
| 19 | |
|---|
| 20 | */ |
|---|
| 21 | |
|---|
| 22 | if (!$OUTPUT->ajax_call) |
|---|
| 23 | $OUTPUT->set_pagetitle(rcube_label('preferences')); |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | $CURR_SECTION = get_input_value('_section', RCUBE_INPUT_GPC); |
|---|
| 27 | |
|---|
| 28 | function rcmail_user_prefs_form($attrib) |
|---|
| 29 | { |
|---|
| 30 | global $RCMAIL, $CURR_SECTION; |
|---|
| 31 | |
|---|
| 32 | // add some labels to client |
|---|
| 33 | $RCMAIL->output->add_label('nopagesizewarning'); |
|---|
| 34 | |
|---|
| 35 | unset($attrib['form']); |
|---|
| 36 | |
|---|
| 37 | list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null, |
|---|
| 38 | array('name' => '_section', 'value' => $CURR_SECTION)); |
|---|
| 39 | |
|---|
| 40 | $out = $form_start; |
|---|
| 41 | |
|---|
| 42 | $out .= rcmail_user_prefs_block($CURR_SECTION, $attrib); |
|---|
| 43 | |
|---|
| 44 | return $out . $form_end; |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | function rcmail_user_prefs_block($part, $attrib) |
|---|
| 48 | { |
|---|
| 49 | global $RCMAIL; |
|---|
| 50 | |
|---|
| 51 | $config = $RCMAIL->config->all(); |
|---|
| 52 | $no_override = array_flip($RCMAIL->config->get('dont_override', array())); |
|---|
| 53 | |
|---|
| 54 | $blocks = array(); |
|---|
| 55 | |
|---|
| 56 | switch ($part) |
|---|
| 57 | { |
|---|
| 58 | // General UI settings |
|---|
| 59 | case 'general': |
|---|
| 60 | |
|---|
| 61 | $blocks = array( |
|---|
| 62 | 'main' => array('name' => Q(rcube_label('mainoptions'))), |
|---|
| 63 | 'list' => array('name' => Q(rcube_label('listoptions'))), |
|---|
| 64 | ); |
|---|
| 65 | |
|---|
| 66 | // language selection |
|---|
| 67 | if (!isset($no_override['language'])) { |
|---|
| 68 | $a_lang = $RCMAIL->list_languages(); |
|---|
| 69 | asort($a_lang); |
|---|
| 70 | |
|---|
| 71 | $field_id = 'rcmfd_lang'; |
|---|
| 72 | $select_lang = new html_select(array('name' => '_language', 'id' => $field_id)); |
|---|
| 73 | $select_lang->add(array_values($a_lang), array_keys($a_lang)); |
|---|
| 74 | |
|---|
| 75 | $blocks['main']['options']['language'] = array( |
|---|
| 76 | 'title' => html::label($field_id, Q(rcube_label('language'))), |
|---|
| 77 | 'content' => $select_lang->show($RCMAIL->user->language), |
|---|
| 78 | ); |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | // show page size selection |
|---|
| 82 | if (!isset($no_override['timezone'])) { |
|---|
| 83 | $field_id = 'rcmfd_timezone'; |
|---|
| 84 | $select_timezone = new html_select(array('name' => '_timezone', 'id' => $field_id, 'onchange' => "document.getElementById('rcmfd_dst').disabled=this.selectedIndex==0")); |
|---|
| 85 | $select_timezone->add(rcube_label('autodetect'), 'auto'); |
|---|
| 86 | $select_timezone->add('(GMT -11:00) Midway Island, Samoa', '-11'); |
|---|
| 87 | $select_timezone->add('(GMT -10:00) Hawaii', '-10'); |
|---|
| 88 | $select_timezone->add('(GMT -9:30) Marquesas Islands', '-9.5'); |
|---|
| 89 | $select_timezone->add('(GMT -9:00) Alaska', '-9'); |
|---|
| 90 | $select_timezone->add('(GMT -8:00) Pacific Time (US/Canada)', '-8'); |
|---|
| 91 | $select_timezone->add('(GMT -7:00) Mountain Time (US/Canada)', '-7'); |
|---|
| 92 | $select_timezone->add('(GMT -6:00) Central Time (US/Canada), Mexico City', '-6'); |
|---|
| 93 | $select_timezone->add('(GMT -5:00) Eastern Time (US/Canada), Bogota, Lima', '-5'); |
|---|
| 94 | $select_timezone->add('(GMT -4:30) Caracas', '-4.5'); |
|---|
| 95 | $select_timezone->add('(GMT -4:00) Atlantic Time (Canada), La Paz', '-4'); |
|---|
| 96 | $select_timezone->add('(GMT -3:30) Nfld Time (Canada), Nfld, S. Labador', '-3.5'); |
|---|
| 97 | $select_timezone->add('(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-3'); |
|---|
| 98 | $select_timezone->add('(GMT -2:00) Mid-Atlantic', '-2'); |
|---|
| 99 | $select_timezone->add('(GMT -1:00) Azores, Cape Verde Islands', '-1'); |
|---|
| 100 | $select_timezone->add('(GMT) Western Europe, London, Lisbon, Casablanca', '0'); |
|---|
| 101 | $select_timezone->add('(GMT +1:00) Central European Time', '1'); |
|---|
| 102 | $select_timezone->add('(GMT +2:00) EET: Tallinn, Helsinki, Kaliningrad, South Africa', '2'); |
|---|
| 103 | $select_timezone->add('(GMT +3:00) Baghdad, Kuwait, Riyadh, Moscow, Nairobi', '3'); |
|---|
| 104 | $select_timezone->add('(GMT +3:30) Tehran', '3.5'); |
|---|
| 105 | $select_timezone->add('(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '4'); |
|---|
| 106 | $select_timezone->add('(GMT +4:30) Kabul', '4.5'); |
|---|
| 107 | $select_timezone->add('(GMT +5:00) Ekaterinburg, Islamabad, Karachi', '5'); |
|---|
| 108 | $select_timezone->add('(GMT +5:30) Chennai, Kolkata, Mumbai, New Delhi', '5.5'); |
|---|
| 109 | $select_timezone->add('(GMT +5:45) Kathmandu', '5.75'); |
|---|
| 110 | $select_timezone->add('(GMT +6:00) Almaty, Dhaka, Colombo', '6'); |
|---|
| 111 | $select_timezone->add('(GMT +6:30) Cocos Islands, Myanmar', '6.5'); |
|---|
| 112 | $select_timezone->add('(GMT +7:00) Bangkok, Hanoi, Jakarta', '7'); |
|---|
| 113 | $select_timezone->add('(GMT +8:00) Beijing, Perth, Singapore, Taipei', '8'); |
|---|
| 114 | $select_timezone->add('(GMT +8:45) Caiguna, Eucla, Border Village', '8.75'); |
|---|
| 115 | $select_timezone->add('(GMT +9:00) Tokyo, Seoul, Yakutsk', '9'); |
|---|
| 116 | $select_timezone->add('(GMT +9:30) Adelaide, Darwin', '9.5'); |
|---|
| 117 | $select_timezone->add('(GMT +10:00) EAST/AEST: Sydney, Guam, Vladivostok', '10'); |
|---|
| 118 | $select_timezone->add('(GMT +10:30) New South Wales', '10.5'); |
|---|
| 119 | $select_timezone->add('(GMT +11:00) Magadan, Solomon Islands', '11'); |
|---|
| 120 | $select_timezone->add('(GMT +11:30) Norfolk Island', '11.5'); |
|---|
| 121 | $select_timezone->add('(GMT +12:00) Auckland, Wellington, Kamchatka', '12'); |
|---|
| 122 | $select_timezone->add('(GMT +12:45) Chatham Islands', '12.75'); |
|---|
| 123 | $select_timezone->add('(GMT +13:00) Tonga, Pheonix Islands', '13'); |
|---|
| 124 | $select_timezone->add('(GMT +14:00) Kiribati', '14'); |
|---|
| 125 | |
|---|
| 126 | $blocks['main']['options']['timezone'] = array( |
|---|
| 127 | 'title' => html::label($field_id, Q(rcube_label('timezone'))), |
|---|
| 128 | 'content' => $select_timezone->show((string)$config['timezone']), |
|---|
| 129 | ); |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | // daylight savings |
|---|
| 133 | if (!isset($no_override['dst_active'])) { |
|---|
| 134 | $field_id = 'rcmfd_dst'; |
|---|
| 135 | $input_dst = new html_checkbox(array('name' => '_dst_active', 'id' => $field_id, 'value' => 1, 'disabled' => ($config['timezone'] === 'auto'))); |
|---|
| 136 | |
|---|
| 137 | $blocks['main']['options']['dstactive'] = array( |
|---|
| 138 | 'title' => html::label($field_id, Q(rcube_label('dstactive'))), |
|---|
| 139 | 'content' => $input_dst->show($config['dst_active']), |
|---|
| 140 | ); |
|---|
| 141 | } |
|---|
| 142 | |
|---|
| 143 | // MM: Show checkbox for toggling 'pretty dates' |
|---|
| 144 | if (!isset($no_override['prettydate'])) { |
|---|
| 145 | $field_id = 'rcmfd_prettydate'; |
|---|
| 146 | $input_prettydate = new html_checkbox(array('name' => '_pretty_date', 'id' => $field_id, 'value' => 1)); |
|---|
| 147 | |
|---|
| 148 | $blocks['main']['options']['prettydate'] = array( |
|---|
| 149 | 'title' => html::label($field_id, Q(rcube_label('prettydate'))), |
|---|
| 150 | 'content' => $input_prettydate->show($config['prettydate']?1:0), |
|---|
| 151 | ); |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | // show page size selection |
|---|
| 155 | if (!isset($no_override['pagesize'])) { |
|---|
| 156 | $field_id = 'rcmfd_pgsize'; |
|---|
| 157 | $input_pagesize = new html_inputfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5)); |
|---|
| 158 | |
|---|
| 159 | $blocks['list']['options']['pagesize'] = array( |
|---|
| 160 | 'title' => html::label($field_id, Q(rcube_label('pagesize'))), |
|---|
| 161 | 'content' => $input_pagesize->show($config['pagesize']), |
|---|
| 162 | ); |
|---|
| 163 | } |
|---|
| 164 | |
|---|
| 165 | // show drop-down for available skins |
|---|
| 166 | if (!isset($no_override['skin'])) { |
|---|
| 167 | $skins = rcmail_get_skins(); |
|---|
| 168 | |
|---|
| 169 | if (count($skins) > 1) { |
|---|
| 170 | $field_id = 'rcmfd_skin'; |
|---|
| 171 | $input_skin = new html_select(array('name'=>'_skin', 'id'=>$field_id)); |
|---|
| 172 | |
|---|
| 173 | foreach($skins as $skin) |
|---|
| 174 | $input_skin->add($skin, $skin); |
|---|
| 175 | |
|---|
| 176 | $blocks['main']['options']['skin'] = array( |
|---|
| 177 | 'title' => html::label($field_id, Q(rcube_label('skin'))), |
|---|
| 178 | 'content' => $input_skin->show($config['skin']), |
|---|
| 179 | ); |
|---|
| 180 | } |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | break; |
|---|
| 184 | |
|---|
| 185 | // Mailbox view (mail screen) |
|---|
| 186 | case 'mailbox': |
|---|
| 187 | |
|---|
| 188 | $blocks = array( |
|---|
| 189 | 'main' => array('name' => Q(rcube_label('mainoptions'))), |
|---|
| 190 | 'new_message' => array('name' => Q(rcube_label('newmessage'))), |
|---|
| 191 | ); |
|---|
| 192 | |
|---|
| 193 | // show config parameter for preview pane |
|---|
| 194 | if (!isset($no_override['preview_pane'])) { |
|---|
| 195 | $field_id = 'rcmfd_preview'; |
|---|
| 196 | $input_preview = new html_checkbox(array('name' => '_preview_pane', 'id' => $field_id, 'value' => 1)); |
|---|
| 197 | |
|---|
| 198 | $blocks['main']['options']['preview_pane'] = array( |
|---|
| 199 | 'title' => html::label($field_id, Q(rcube_label('previewpane'))), |
|---|
| 200 | 'content' => $input_preview->show($config['preview_pane']?1:0), |
|---|
| 201 | ); |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | if (!isset($no_override['mdn_requests'])) { |
|---|
| 205 | $field_id = 'rcmfd_mdn_requests'; |
|---|
| 206 | $select_mdn_requests = new html_select(array('name' => '_mdn_requests', 'id' => $field_id)); |
|---|
| 207 | $select_mdn_requests->add(rcube_label('askuser'), 0); |
|---|
| 208 | $select_mdn_requests->add(rcube_label('autosend'), 1); |
|---|
| 209 | $select_mdn_requests->add(rcube_label('ignore'), 2); |
|---|
| 210 | |
|---|
| 211 | $blocks['main']['options']['mdn_requests'] = array( |
|---|
| 212 | 'title' => html::label($field_id, Q(rcube_label('mdnrequests'))), |
|---|
| 213 | 'content' => $select_mdn_requests->show($config['mdn_requests']), |
|---|
| 214 | ); |
|---|
| 215 | } |
|---|
| 216 | |
|---|
| 217 | if (!isset($no_override['focus_on_new_message'])) { |
|---|
| 218 | $field_id = 'rcmfd_focus_on_new_message'; |
|---|
| 219 | $input_focus_on_new_message = new html_checkbox(array('name' => '_focus_on_new_message', 'id' => $field_id, 'value' => 1)); |
|---|
| 220 | |
|---|
| 221 | $blocks['new_message']['options']['focus_on_new_message'] = array( |
|---|
| 222 | 'title' => html::label($field_id, Q(rcube_label('focusonnewmessage'))), |
|---|
| 223 | 'content' => $input_focus_on_new_message->show($config['focus_on_new_message']?1:0), |
|---|
| 224 | ); |
|---|
| 225 | } |
|---|
| 226 | |
|---|
| 227 | if (!isset($no_override['keep_alive'])) { |
|---|
| 228 | $field_id = 'rcmfd_keep_alive'; |
|---|
| 229 | $select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id)); |
|---|
| 230 | |
|---|
| 231 | foreach(array(1, 3, 5, 10, 15, 30, 60) as $min) |
|---|
| 232 | if((!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60) |
|---|
| 233 | && (!$config['session_lifetime'] || $config['session_lifetime'] > $min)) { |
|---|
| 234 | $select_keep_alive->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min); |
|---|
| 235 | } |
|---|
| 236 | |
|---|
| 237 | $blocks['new_message']['options']['keep_alive'] = array( |
|---|
| 238 | 'title' => html::label($field_id, Q(rcube_label('keepalive'))), |
|---|
| 239 | 'content' => $select_keep_alive->show($config['keep_alive']/60), |
|---|
| 240 | ); |
|---|
| 241 | } |
|---|
| 242 | |
|---|
| 243 | if (!isset($no_override['check_all_folders'])) { |
|---|
| 244 | $field_id = 'rcmfd_check_all_folders'; |
|---|
| 245 | $input_check_all = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1)); |
|---|
| 246 | |
|---|
| 247 | $blocks['new_message']['options']['check_all_folders'] = array( |
|---|
| 248 | 'title' => html::label($field_id, Q(rcube_label('checkallfolders'))), |
|---|
| 249 | 'content' => $input_check_all->show($config['check_all_folders']?1:0), |
|---|
| 250 | ); |
|---|
| 251 | } |
|---|
| 252 | |
|---|
| 253 | break; |
|---|
| 254 | |
|---|
| 255 | // Message viewing |
|---|
| 256 | case 'mailview': |
|---|
| 257 | |
|---|
| 258 | $blocks = array( |
|---|
| 259 | 'main' => array('name' => Q(rcube_label('mainoptions'))), |
|---|
| 260 | ); |
|---|
| 261 | |
|---|
| 262 | // show checkbox for HTML/plaintext messages |
|---|
| 263 | if (!isset($no_override['prefer_html'])) { |
|---|
| 264 | $field_id = 'rcmfd_htmlmsg'; |
|---|
| 265 | $input_preferhtml = new html_checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1, |
|---|
| 266 | 'onchange' => JS_OBJECT_NAME.'.toggle_prefer_html(this)')); |
|---|
| 267 | |
|---|
| 268 | $blocks['main']['options']['prefer_html'] = array( |
|---|
| 269 | 'title' => html::label($field_id, Q(rcube_label('preferhtml'))), |
|---|
| 270 | 'content' => $input_preferhtml->show($config['prefer_html']?1:0), |
|---|
| 271 | ); |
|---|
| 272 | } |
|---|
| 273 | |
|---|
| 274 | if (!isset($no_override['show_images'])) { |
|---|
| 275 | $field_id = 'rcmfd_show_images'; |
|---|
| 276 | $input_show_images = new html_select(array('name' => '_show_images', 'id' => $field_id)); |
|---|
| 277 | $input_show_images->add(rcube_label('never'), 0); |
|---|
| 278 | $input_show_images->add(rcube_label('fromknownsenders'), 1); |
|---|
| 279 | $input_show_images->add(rcube_label('always'), 2); |
|---|
| 280 | |
|---|
| 281 | $blocks['main']['options']['show_images'] = array( |
|---|
| 282 | 'title' => html::label($field_id, Q(rcube_label('showremoteimages'))), |
|---|
| 283 | 'content' => $input_show_images->show($config['show_images']), |
|---|
| 284 | ); |
|---|
| 285 | } |
|---|
| 286 | |
|---|
| 287 | if (!isset($no_override['inline_images'])) { |
|---|
| 288 | $field_id = 'rcmfd_inline_images'; |
|---|
| 289 | $input_inline_images = new html_checkbox(array('name' => '_inline_images', 'id' => $field_id, 'value' => 1)); |
|---|
| 290 | |
|---|
| 291 | $blocks['main']['options']['inline_images'] = array( |
|---|
| 292 | 'title' => html::label($field_id, Q(rcube_label('showinlineimages'))), |
|---|
| 293 | 'content' => $input_inline_images->show($config['inline_images']?1:0), |
|---|
| 294 | ); |
|---|
| 295 | } |
|---|
| 296 | |
|---|
| 297 | // "display after delete" checkbox |
|---|
| 298 | if (!isset($no_override['display_next'])) { |
|---|
| 299 | $field_id = 'rcmfd_displaynext'; |
|---|
| 300 | $input_displaynext = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1)); |
|---|
| 301 | |
|---|
| 302 | $blocks['main']['options']['display_next'] = array( |
|---|
| 303 | 'title' => html::label($field_id, Q(rcube_label('displaynext'))), |
|---|
| 304 | 'content' => $input_displaynext->show($config['display_next']?1:0), |
|---|
| 305 | ); |
|---|
| 306 | } |
|---|
| 307 | |
|---|
| 308 | break; |
|---|
| 309 | |
|---|
| 310 | // Mail composition |
|---|
| 311 | case 'compose': |
|---|
| 312 | |
|---|
| 313 | $blocks = array( |
|---|
| 314 | 'main' => array('name' => Q(rcube_label('mainoptions'))), |
|---|
| 315 | ); |
|---|
| 316 | |
|---|
| 317 | // Show checkbox for HTML Editor |
|---|
| 318 | if (!isset($no_override['htmleditor'])) { |
|---|
| 319 | $field_id = 'rcmfd_htmleditor'; |
|---|
| 320 | $input_htmleditor = new html_checkbox(array('name' => '_htmleditor', 'id' => $field_id, 'value' => 1)); |
|---|
| 321 | |
|---|
| 322 | $blocks['main']['options']['htmleditor'] = array( |
|---|
| 323 | 'title' => html::label($field_id, Q(rcube_label('htmleditor'))), |
|---|
| 324 | 'content' => $input_htmleditor->show($config['htmleditor']?1:0), |
|---|
| 325 | ); |
|---|
| 326 | } |
|---|
| 327 | |
|---|
| 328 | if (!isset($no_override['draft_autosave'])) { |
|---|
| 329 | $field_id = 'rcmfd_autosave'; |
|---|
| 330 | $select_autosave = new html_select(array('name' => '_draft_autosave', 'id' => $field_id, 'disabled' => empty($config['drafts_mbox']))); |
|---|
| 331 | $select_autosave->add(rcube_label('never'), 0); |
|---|
| 332 | foreach (array(1, 3, 5, 10) as $i => $min) |
|---|
| 333 | $select_autosave->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min*60); |
|---|
| 334 | |
|---|
| 335 | $blocks['main']['options']['draft_autosave'] = array( |
|---|
| 336 | 'title' => html::label($field_id, Q(rcube_label('autosavedraft'))), |
|---|
| 337 | 'content' => $select_autosave->show($config['draft_autosave']), |
|---|
| 338 | ); |
|---|
| 339 | } |
|---|
| 340 | |
|---|
| 341 | if (!isset($no_override['mime_param_folding'])) { |
|---|
| 342 | $field_id = 'rcmfd_param_folding'; |
|---|
| 343 | $select_param_folding = new html_select(array('name' => '_mime_param_folding', 'id' => $field_id)); |
|---|
| 344 | $select_param_folding->add(rcube_label('2231folding'), 0); |
|---|
| 345 | $select_param_folding->add(rcube_label('miscfolding'), 1); |
|---|
| 346 | $select_param_folding->add(rcube_label('2047folding'), 2); |
|---|
| 347 | |
|---|
| 348 | $blocks['main']['options']['mime_param_folding'] = array( |
|---|
| 349 | 'advanced' => true, |
|---|
| 350 | 'title' => html::label($field_id, Q(rcube_label('mimeparamfolding'))), |
|---|
| 351 | 'content' => $select_param_folding->show($config['mime_param_folding']), |
|---|
| 352 | ); |
|---|
| 353 | } |
|---|
| 354 | |
|---|
| 355 | break; |
|---|
| 356 | |
|---|
| 357 | // Special IMAP folders |
|---|
| 358 | case 'folders': |
|---|
| 359 | |
|---|
| 360 | $blocks = array( |
|---|
| 361 | 'main' => array('name' => Q(rcube_label('mainoptions'))), |
|---|
| 362 | ); |
|---|
| 363 | |
|---|
| 364 | // Configure special folders |
|---|
| 365 | if (!isset($no_override['default_imap_folders'])) { |
|---|
| 366 | $RCMAIL->imap_init(true); |
|---|
| 367 | $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true, 'maxlength' => 30)); |
|---|
| 368 | |
|---|
| 369 | if (!isset($no_override['drafts_mbox'])) |
|---|
| 370 | $blocks['main']['options']['drafts_mbox'] = array( |
|---|
| 371 | 'title' => Q(rcube_label('drafts')), |
|---|
| 372 | 'content' => $select->show($config['drafts_mbox'], array('name' => "_drafts_mbox")), |
|---|
| 373 | ); |
|---|
| 374 | |
|---|
| 375 | if (!isset($no_override['sent_mbox'])) |
|---|
| 376 | $blocks['main']['options']['sent_mbox'] = array( |
|---|
| 377 | 'title' => Q(rcube_label('sent')), |
|---|
| 378 | 'content' => $select->show($config['sent_mbox'], array('name' => "_sent_mbox")), |
|---|
| 379 | ); |
|---|
| 380 | |
|---|
| 381 | if (!isset($no_override['junk_mbox'])) |
|---|
| 382 | $blocks['main']['options']['junk_mbox'] = array( |
|---|
| 383 | 'title' => Q(rcube_label('junk')), |
|---|
| 384 | 'content' => $select->show($config['junk_mbox'], array('name' => "_junk_mbox")), |
|---|
| 385 | ); |
|---|
| 386 | |
|---|
| 387 | if (!isset($no_override['trash_mbox'])) |
|---|
| 388 | $blocks['main']['options']['trash_mbox'] = array( |
|---|
| 389 | 'title' => Q(rcube_label('trash')), |
|---|
| 390 | 'content' => $select->show($config['trash_mbox'], array('name' => "_trash_mbox")), |
|---|
| 391 | ); |
|---|
| 392 | } |
|---|
| 393 | break; |
|---|
| 394 | |
|---|
| 395 | // Server settings |
|---|
| 396 | case 'server': |
|---|
| 397 | |
|---|
| 398 | $blocks = array( |
|---|
| 399 | 'main' => array('name' => Q(rcube_label('mainoptions'))), |
|---|
| 400 | 'maintenance' => array('name' => Q(rcube_label('maintenance'))), |
|---|
| 401 | ); |
|---|
| 402 | |
|---|
| 403 | if (!isset($no_override['read_when_deleted'])) { |
|---|
| 404 | $field_id = 'rcmfd_read_deleted'; |
|---|
| 405 | $input_readdeleted = new html_checkbox(array('name' => '_read_when_deleted', 'id' => $field_id, 'value' => 1)); |
|---|
| 406 | |
|---|
| 407 | $blocks['main']['options']['read_when_deleted'] = array( |
|---|
| 408 | 'title' => html::label($field_id, Q(rcube_label('readwhendeleted'))), |
|---|
| 409 | 'content' => $input_readdeleted->show($config['read_when_deleted']?1:0), |
|---|
| 410 | ); |
|---|
| 411 | } |
|---|
| 412 | |
|---|
| 413 | if (!isset($no_override['flag_for_deletion'])) { |
|---|
| 414 | $field_id = 'rcmfd_flag_for_deletion'; |
|---|
| 415 | $input_flagfordeletion = new html_checkbox(array('name' => '_flag_for_deletion', 'id' => $field_id, 'value' => 1)); |
|---|
| 416 | |
|---|
| 417 | $blocks['main']['options']['flag_for_deletion'] = array( |
|---|
| 418 | 'title' => html::label($field_id, Q(rcube_label('flagfordeletion'))), |
|---|
| 419 | 'content' => $input_flagfordeletion->show($config['flag_for_deletion']?1:0), |
|---|
| 420 | ); |
|---|
| 421 | } |
|---|
| 422 | |
|---|
| 423 | // don't show deleted messages |
|---|
| 424 | if (!isset($no_override['skip_deleted'])) { |
|---|
| 425 | $field_id = 'rcmfd_skip_deleted'; |
|---|
| 426 | $input_purge = new html_checkbox(array('name' => '_skip_deleted', 'id' => $field_id, 'value' => 1)); |
|---|
| 427 | |
|---|
| 428 | $blocks['main']['options']['skip_deleted'] = array( |
|---|
| 429 | 'title' => html::label($field_id, Q(rcube_label('skipdeleted'))), |
|---|
| 430 | 'content' => $input_purge->show($config['skip_deleted']?1:0), |
|---|
| 431 | ); |
|---|
| 432 | } |
|---|
| 433 | |
|---|
| 434 | // Trash purging on logout |
|---|
| 435 | if (!isset($no_override['logout_purge'])) { |
|---|
| 436 | $field_id = 'rcmfd_logout_purge'; |
|---|
| 437 | $input_purge = new html_checkbox(array('name' => '_logout_purge', 'id' => $field_id, 'value' => 1)); |
|---|
| 438 | |
|---|
| 439 | $blocks['maintenance']['options']['logout_purge'] = array( |
|---|
| 440 | 'title' => html::label($field_id, Q(rcube_label('logoutclear'))), |
|---|
| 441 | 'content' => $input_purge->show($config['logout_purge']?1:0), |
|---|
| 442 | ); |
|---|
| 443 | } |
|---|
| 444 | |
|---|
| 445 | // INBOX compacting on logout |
|---|
| 446 | if (!isset($no_override['logout_expunge'])) { |
|---|
| 447 | $field_id = 'rcmfd_logout_expunge'; |
|---|
| 448 | $input_expunge = new html_checkbox(array('name' => '_logout_expunge', 'id' => $field_id, 'value' => 1)); |
|---|
| 449 | |
|---|
| 450 | $blocks['maintenance']['options']['logout_expunge'] = array( |
|---|
| 451 | 'title' => html::label($field_id, Q(rcube_label('logoutcompact'))), |
|---|
| 452 | 'content' => $input_expunge->show($config['logout_expunge']?1:0), |
|---|
| 453 | ); |
|---|
| 454 | } |
|---|
| 455 | |
|---|
| 456 | break; |
|---|
| 457 | } |
|---|
| 458 | |
|---|
| 459 | $data = $RCMAIL->plugins->exec_hook('user_preferences', array('section' => $part, 'blocks' => $blocks)); |
|---|
| 460 | |
|---|
| 461 | // create output |
|---|
| 462 | foreach ($data['blocks'] as $idx => $block) { |
|---|
| 463 | if ($block['options']) { |
|---|
| 464 | $table = new html_table(array('cols' => 2)); |
|---|
| 465 | |
|---|
| 466 | foreach ($block['options'] as $option) { |
|---|
| 467 | if ($option['advanced']) |
|---|
| 468 | $table->set_row_attribs('advanced'); |
|---|
| 469 | |
|---|
| 470 | $table->add('title', $option['title']); |
|---|
| 471 | $table->add(null, $option['content']); |
|---|
| 472 | } |
|---|
| 473 | |
|---|
| 474 | $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $table->show($attrib)); |
|---|
| 475 | } |
|---|
| 476 | } |
|---|
| 477 | |
|---|
| 478 | return $out; |
|---|
| 479 | } |
|---|
| 480 | |
|---|
| 481 | |
|---|
| 482 | function rcmail_get_skins() |
|---|
| 483 | { |
|---|
| 484 | $path = 'skins'; |
|---|
| 485 | $skins = array(); |
|---|
| 486 | |
|---|
| 487 | $dir = opendir($path); |
|---|
| 488 | |
|---|
| 489 | if (!$dir) |
|---|
| 490 | return false; |
|---|
| 491 | |
|---|
| 492 | while (($file = readdir($dir)) !== false) |
|---|
| 493 | { |
|---|
| 494 | $filename = $path.'/'.$file; |
|---|
| 495 | if (is_dir($filename) && is_readable($filename) |
|---|
| 496 | && !in_array($file, array('.', '..', '.svn'))) |
|---|
| 497 | $skins[] = $file; |
|---|
| 498 | } |
|---|
| 499 | |
|---|
| 500 | closedir($dir); |
|---|
| 501 | |
|---|
| 502 | return $skins; |
|---|
| 503 | } |
|---|
| 504 | |
|---|
| 505 | function rcmail_prefs_section_name() |
|---|
| 506 | { |
|---|
| 507 | global $SECTIONS, $CURR_SECTION; |
|---|
| 508 | |
|---|
| 509 | return $SECTIONS[$CURR_SECTION]['section']; |
|---|
| 510 | } |
|---|
| 511 | |
|---|
| 512 | |
|---|
| 513 | // register UI objects |
|---|
| 514 | $OUTPUT->add_handlers(array( |
|---|
| 515 | 'userprefs' => 'rcmail_user_prefs_form', |
|---|
| 516 | 'sectionname' => 'rcmail_prefs_section_name', |
|---|
| 517 | )); |
|---|
| 518 | |
|---|
| 519 | $OUTPUT->send('settingsedit'); |
|---|
| 520 | |
|---|
| 521 | ?> |
|---|