4 +-----------------------------------------------------------------------+
5 | program/steps/settings/func.inc |
7 | This file is part of the Roundcube Webmail client |
8 | Copyright (C) 2005-2007, The Roundcube Dev Team |
9 | Licensed under the GNU GPL |
12 | Provide functionality for user's settings & preferences |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: func.inc 4875 2011-06-23 17:43:44Z alec $
22 if (!$OUTPUT->ajax_call)
23 $OUTPUT->set_pagetitle(rcube_label('preferences'));
26 // similar function as /steps/settings/identities.inc::rcmail_identity_frame()
27 function rcmail_preferences_frame($attrib)
32 $attrib['id'] = 'rcmprefsframe';
34 $attrib['name'] = $attrib['id'];
36 $OUTPUT->set_env('contentframe', $attrib['name']);
37 $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif');
39 return html::iframe($attrib);
43 function rcmail_sections_list($attrib)
47 // add id to message list table if not specified
48 if (!strlen($attrib['id']))
49 $attrib['id'] = 'rcmsectionslist';
51 list($list, $cols) = rcmail_user_prefs();
54 $out = rcube_table_output($attrib, $list, $cols, 'id');
57 $RCMAIL->output->add_gui_object('sectionslist', $attrib['id']);
58 $RCMAIL->output->include_script('list.js');
64 function rcmail_identities_list($attrib)
66 global $OUTPUT, $USER, $RCMAIL;
68 // add id to message list table if not specified
69 if (!strlen($attrib['id']))
70 $attrib['id'] = 'rcmIdentitiesList';
72 // get identities list and define 'mail' column
73 $list = $USER->list_identities();
74 foreach ($list as $idx => $row)
75 $list[$idx]['mail'] = trim($row['name'] . ' <' . rcube_idn_to_utf8($row['email']) .'>');
77 // get all identites from DB and define list of cols to be displayed
78 $plugin = $RCMAIL->plugins->exec_hook('identities_list', array(
80 'cols' => array('mail')));
82 // @TODO: use <UL> instead of <TABLE> for identities list
84 $out = rcube_table_output($attrib, $plugin['list'], $plugin['cols'], 'identity_id');
87 $OUTPUT->add_gui_object('identitieslist', $attrib['id']);
93 // similar function as in /steps/addressbook/edit.inc
94 function get_form_tags($attrib, $action, $id = null, $hidden = null)
96 global $EDIT_FORM, $RCMAIL;
98 $form_start = $form_end = '';
100 if (empty($EDIT_FORM)) {
101 $request_key = $action . (isset($id) ? '.'.$id : '');
102 $form_start = $RCMAIL->output->request_form(array(
105 'task' => $RCMAIL->task,
107 'request' => $request_key,
111 if (is_array($hidden)) {
112 $hiddenfields = new html_hiddenfield($hidden);
113 $form_start .= $hiddenfields->show();
116 $form_end = !strlen($attrib['form']) ? '</form>' : '';
118 $EDIT_FORM = !empty($attrib['form']) ? $attrib['form'] : 'form';
119 $RCMAIL->output->add_gui_object('editform', $EDIT_FORM);
122 return array($form_start, $form_end);
126 function rcmail_user_prefs($current=null)
130 $sections['general'] = array('id' => 'general', 'section' => rcube_label('uisettings'));
131 $sections['mailbox'] = array('id' => 'mailbox', 'section' => rcube_label('mailboxview'));
132 $sections['compose'] = array('id' => 'compose', 'section' => rcube_label('messagescomposition'));
133 $sections['mailview'] = array('id' => 'mailview','section' => rcube_label('messagesdisplaying'));
134 $sections['addressbook'] = array('id' => 'addressbook','section' => rcube_label('addressbook'));
135 $sections['folders'] = array('id' => 'folders', 'section' => rcube_label('specialfolders'));
136 $sections['server'] = array('id' => 'server', 'section' => rcube_label('serversettings'));
138 // hook + define list cols
139 $plugin = $RCMAIL->plugins->exec_hook('preferences_sections_list',
140 array('list' => $sections, 'cols' => array('section')));
142 $sections = $plugin['list'];
144 $config = $RCMAIL->config->all();
145 $no_override = array_flip($RCMAIL->config->get('dont_override', array()));
147 foreach ($sections as $idx => $sect) {
149 if ($current && $sect['id'] != $current)
154 switch ($sect['id']) {
159 'main' => array('name' => Q(rcube_label('mainoptions'))),
160 'list' => array('name' => Q(rcube_label('listoptions'))),
163 // language selection
164 if (!isset($no_override['language'])) {
165 $a_lang = $RCMAIL->list_languages();
168 $field_id = 'rcmfd_lang';
169 $select_lang = new html_select(array('name' => '_language', 'id' => $field_id));
170 $select_lang->add(array_values($a_lang), array_keys($a_lang));
172 $blocks['main']['options']['language'] = array(
173 'title' => html::label($field_id, Q(rcube_label('language'))),
174 'content' => $select_lang->show($RCMAIL->user->language),
178 // show page size selection
179 if (!isset($no_override['timezone'])) {
180 $field_id = 'rcmfd_timezone';
181 $select_timezone = new html_select(array('name' => '_timezone', 'id' => $field_id, 'onchange' => "document.getElementById('rcmfd_dst').disabled=this.selectedIndex==0"));
182 $select_timezone->add(rcube_label('autodetect'), 'auto');
183 $select_timezone->add('(GMT -11:00) Midway Island, Samoa', '-11');
184 $select_timezone->add('(GMT -10:00) Hawaii', '-10');
185 $select_timezone->add('(GMT -9:30) Marquesas Islands', '-9.5');
186 $select_timezone->add('(GMT -9:00) Alaska', '-9');
187 $select_timezone->add('(GMT -8:00) Pacific Time (US/Canada)', '-8');
188 $select_timezone->add('(GMT -7:00) Mountain Time (US/Canada)', '-7');
189 $select_timezone->add('(GMT -6:00) Central Time (US/Canada), Mexico City', '-6');
190 $select_timezone->add('(GMT -5:00) Eastern Time (US/Canada), Bogota, Lima', '-5');
191 $select_timezone->add('(GMT -4:30) Caracas', '-4.5');
192 $select_timezone->add('(GMT -4:00) Atlantic Time (Canada), La Paz', '-4');
193 $select_timezone->add('(GMT -3:30) Nfld Time (Canada), Nfld, S. Labador', '-3.5');
194 $select_timezone->add('(GMT -3:00) Brazil, Buenos Aires, Georgetown', '-3');
195 $select_timezone->add('(GMT -2:00) Mid-Atlantic', '-2');
196 $select_timezone->add('(GMT -1:00) Azores, Cape Verde Islands', '-1');
197 $select_timezone->add('(GMT) Western Europe, London, Lisbon, Casablanca', '0');
198 $select_timezone->add('(GMT +1:00) Central European Time', '1');
199 $select_timezone->add('(GMT +2:00) EET: Tallinn, Helsinki, Kaliningrad, South Africa', '2');
200 $select_timezone->add('(GMT +3:00) Baghdad, Kuwait, Riyadh, Moscow, Nairobi', '3');
201 $select_timezone->add('(GMT +3:30) Tehran', '3.5');
202 $select_timezone->add('(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi', '4');
203 $select_timezone->add('(GMT +4:30) Kabul', '4.5');
204 $select_timezone->add('(GMT +5:00) Ekaterinburg, Islamabad, Karachi', '5');
205 $select_timezone->add('(GMT +5:30) Chennai, Kolkata, Mumbai, New Delhi', '5.5');
206 $select_timezone->add('(GMT +5:45) Kathmandu', '5.75');
207 $select_timezone->add('(GMT +6:00) Almaty, Dhaka, Colombo', '6');
208 $select_timezone->add('(GMT +6:30) Cocos Islands, Myanmar', '6.5');
209 $select_timezone->add('(GMT +7:00) Bangkok, Hanoi, Jakarta', '7');
210 $select_timezone->add('(GMT +8:00) Beijing, Perth, Singapore, Taipei', '8');
211 $select_timezone->add('(GMT +8:45) Caiguna, Eucla, Border Village', '8.75');
212 $select_timezone->add('(GMT +9:00) Tokyo, Seoul, Yakutsk', '9');
213 $select_timezone->add('(GMT +9:30) Adelaide, Darwin', '9.5');
214 $select_timezone->add('(GMT +10:00) EAST/AEST: Sydney, Guam, Vladivostok', '10');
215 $select_timezone->add('(GMT +10:30) New South Wales', '10.5');
216 $select_timezone->add('(GMT +11:00) Magadan, Solomon Islands', '11');
217 $select_timezone->add('(GMT +11:30) Norfolk Island', '11.5');
218 $select_timezone->add('(GMT +12:00) Auckland, Wellington, Kamchatka', '12');
219 $select_timezone->add('(GMT +12:45) Chatham Islands', '12.75');
220 $select_timezone->add('(GMT +13:00) Tonga, Pheonix Islands', '13');
221 $select_timezone->add('(GMT +14:00) Kiribati', '14');
223 $blocks['main']['options']['timezone'] = array(
224 'title' => html::label($field_id, Q(rcube_label('timezone'))),
225 'content' => $select_timezone->show((string)$config['timezone']),
230 if (!isset($no_override['dst_active'])) {
231 $field_id = 'rcmfd_dst';
232 $input_dst = new html_checkbox(array('name' => '_dst_active', 'id' => $field_id, 'value' => 1, 'disabled' => ($config['timezone'] === 'auto')));
234 $blocks['main']['options']['dstactive'] = array(
235 'title' => html::label($field_id, Q(rcube_label('dstactive'))),
236 'content' => $input_dst->show($config['dst_active']),
240 // MM: Show checkbox for toggling 'pretty dates'
241 if (!isset($no_override['prettydate'])) {
242 $field_id = 'rcmfd_prettydate';
243 $input_prettydate = new html_checkbox(array('name' => '_pretty_date', 'id' => $field_id, 'value' => 1));
245 $blocks['main']['options']['prettydate'] = array(
246 'title' => html::label($field_id, Q(rcube_label('prettydate'))),
247 'content' => $input_prettydate->show($config['prettydate']?1:0),
251 // show page size selection
252 if (!isset($no_override['pagesize'])) {
253 $field_id = 'rcmfd_pgsize';
254 $input_pagesize = new html_inputfield(array('name' => '_pagesize', 'id' => $field_id, 'size' => 5));
256 $blocks['list']['options']['pagesize'] = array(
257 'title' => html::label($field_id, Q(rcube_label('pagesize'))),
258 'content' => $input_pagesize->show($config['pagesize']),
262 // show drop-down for available skins
263 if (!isset($no_override['skin'])) {
264 $skins = rcmail_get_skins();
266 if (count($skins) > 1) {
267 $field_id = 'rcmfd_skin';
268 $input_skin = new html_select(array('name'=>'_skin', 'id'=>$field_id));
270 foreach($skins as $skin)
271 $input_skin->add($skin, $skin);
273 $blocks['main']['options']['skin'] = array(
274 'title' => html::label($field_id, Q(rcube_label('skin'))),
275 'content' => $input_skin->show($config['skin']),
282 // Mailbox view (mail screen)
286 'main' => array('name' => Q(rcube_label('mainoptions'))),
287 'new_message' => array('name' => Q(rcube_label('newmessage'))),
290 // show config parameter for preview pane
291 if (!isset($no_override['preview_pane'])) {
292 $field_id = 'rcmfd_preview';
293 $input_preview = new html_checkbox(array('name' => '_preview_pane', 'id' => $field_id, 'value' => 1,
294 'onchange' => JS_OBJECT_NAME.'.toggle_preview_pane(this)'));
296 $blocks['main']['options']['preview_pane'] = array(
297 'title' => html::label($field_id, Q(rcube_label('previewpane'))),
298 'content' => $input_preview->show($config['preview_pane']?1:0),
302 // show config parameter for preview pane auto mark as read delay
303 if (!isset($no_override['preview_pane_mark_read'])) {
304 // apply default if config option is not set at all
305 $config['preview_pane_mark_read'] = $RCMAIL->config->get('preview_pane_mark_read', 0);
307 $field_id = 'rcmfd_preview_pane_mark_read';
308 $select_delay = new html_select(array('name' => '_preview_pane_mark_read', 'id' => $field_id,
309 'disabled' => $config['preview_pane']?0:1));
311 $select_delay->add(rcube_label('never'), '-1');
312 $select_delay->add(rcube_label('immediately'), 0);
313 foreach(array(5, 10, 20, 30) as $sec)
314 $select_delay->add(rcube_label(array('name' => 'afternseconds', 'vars' => array('n' => $sec))), $sec);
316 $blocks['main']['options']['preview_pane_mark_read'] = array(
317 'title' => html::label($field_id, Q(rcube_label('previewpanemarkread'))),
318 'content' => $select_delay->show(intval($config['preview_pane_mark_read'])),
322 if (!isset($no_override['mdn_requests'])) {
323 $field_id = 'rcmfd_mdn_requests';
324 $select_mdn_requests = new html_select(array('name' => '_mdn_requests', 'id' => $field_id));
325 $select_mdn_requests->add(rcube_label('askuser'), 0);
326 $select_mdn_requests->add(rcube_label('autosend'), 1);
327 $select_mdn_requests->add(rcube_label('autosendknown'), 3);
328 $select_mdn_requests->add(rcube_label('autosendknownignore'), 4);
329 $select_mdn_requests->add(rcube_label('ignore'), 2);
331 $blocks['main']['options']['mdn_requests'] = array(
332 'title' => html::label($field_id, Q(rcube_label('mdnrequests'))),
333 'content' => $select_mdn_requests->show($config['mdn_requests']),
337 $RCMAIL->imap_connect();
338 $threading_supported = $RCMAIL->imap->get_capability('THREAD');
340 if (!isset($no_override['autoexpand_threads']) && $threading_supported) {
341 $field_id = 'rcmfd_autoexpand_threads';
342 $select_autoexpand_threads = new html_select(array('name' => '_autoexpand_threads', 'id' => $field_id));
343 $select_autoexpand_threads->add(rcube_label('never'), 0);
344 $select_autoexpand_threads->add(rcube_label('do_expand'), 1);
345 $select_autoexpand_threads->add(rcube_label('expand_only_unread'), 2);
347 $blocks['main']['options']['autoexpand_threads'] = array(
348 'title' => html::label($field_id, Q(rcube_label('autoexpand_threads'))),
349 'content' => $select_autoexpand_threads->show($config['autoexpand_threads']),
353 if (!isset($no_override['keep_alive'])) {
354 $field_id = 'rcmfd_keep_alive';
355 $select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id));
357 foreach(array(1, 3, 5, 10, 15, 30, 60) as $min)
358 if((!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60)
359 && (!$config['session_lifetime'] || $config['session_lifetime'] > $min)) {
360 $select_keep_alive->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min);
363 $blocks['new_message']['options']['keep_alive'] = array(
364 'title' => html::label($field_id, Q(rcube_label('keepalive'))),
365 'content' => $select_keep_alive->show($config['keep_alive']/60),
369 if (!isset($no_override['check_all_folders'])) {
370 $field_id = 'rcmfd_check_all_folders';
371 $input_check_all = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1));
373 $blocks['new_message']['options']['check_all_folders'] = array(
374 'title' => html::label($field_id, Q(rcube_label('checkallfolders'))),
375 'content' => $input_check_all->show($config['check_all_folders']?1:0),
385 'main' => array('name' => Q(rcube_label('mainoptions'))),
388 // show checkbox for HTML/plaintext messages
389 if (!isset($no_override['prefer_html'])) {
390 $field_id = 'rcmfd_htmlmsg';
391 $input_preferhtml = new html_checkbox(array('name' => '_prefer_html', 'id' => $field_id, 'value' => 1,
392 'onchange' => JS_OBJECT_NAME.'.toggle_prefer_html(this)'));
394 $blocks['main']['options']['prefer_html'] = array(
395 'title' => html::label($field_id, Q(rcube_label('preferhtml'))),
396 'content' => $input_preferhtml->show($config['prefer_html']?1:0),
400 if (!isset($no_override['default_charset'])) {
401 $field_id = 'rcmfd_default_charset';
403 $blocks['main']['options']['default_charset'] = array(
404 'title' => html::label($field_id, Q(rcube_label('defaultcharset'))),
405 'content' => $RCMAIL->output->charset_selector(array(
406 'name' => '_default_charset', 'selected' => $config['default_charset']
411 if (!isset($no_override['show_images'])) {
412 $field_id = 'rcmfd_show_images';
413 $input_show_images = new html_select(array('name' => '_show_images', 'id' => $field_id));
414 $input_show_images->add(rcube_label('never'), 0);
415 $input_show_images->add(rcube_label('fromknownsenders'), 1);
416 $input_show_images->add(rcube_label('always'), 2);
418 $blocks['main']['options']['show_images'] = array(
419 'title' => html::label($field_id, Q(rcube_label('showremoteimages'))),
420 'content' => $input_show_images->show($config['show_images']),
424 if (!isset($no_override['inline_images'])) {
425 $field_id = 'rcmfd_inline_images';
426 $input_inline_images = new html_checkbox(array('name' => '_inline_images', 'id' => $field_id, 'value' => 1));
428 $blocks['main']['options']['inline_images'] = array(
429 'title' => html::label($field_id, Q(rcube_label('showinlineimages'))),
430 'content' => $input_inline_images->show($config['inline_images']?1:0),
434 // "display after delete" checkbox
435 if (!isset($no_override['display_next'])) {
436 $field_id = 'rcmfd_displaynext';
437 $input_displaynext = new html_checkbox(array('name' => '_display_next', 'id' => $field_id, 'value' => 1));
439 $blocks['main']['options']['display_next'] = array(
440 'title' => html::label($field_id, Q(rcube_label('displaynext'))),
441 'content' => $input_displaynext->show($config['display_next']?1:0),
451 'main' => array('name' => Q(rcube_label('mainoptions'))),
452 'sig' => array('name' => Q(rcube_label('signatureoptions'))),
455 // Show checkbox for HTML Editor
456 if (!isset($no_override['htmleditor'])) {
457 $field_id = 'rcmfd_htmleditor';
458 $select_htmleditor = new html_select(array('name' => '_htmleditor', 'id' => $field_id));
459 $select_htmleditor->add(rcube_label('never'), 0);
460 $select_htmleditor->add(rcube_label('always'), 1);
461 $select_htmleditor->add(rcube_label('htmlonreply'), 2);
463 $blocks['main']['options']['htmleditor'] = array(
464 'title' => html::label($field_id, Q(rcube_label('htmleditor'))),
465 'content' => $select_htmleditor->show(intval($config['htmleditor'])),
469 if (!isset($no_override['draft_autosave'])) {
470 $field_id = 'rcmfd_autosave';
471 $select_autosave = new html_select(array('name' => '_draft_autosave', 'id' => $field_id, 'disabled' => empty($config['drafts_mbox'])));
472 $select_autosave->add(rcube_label('never'), 0);
473 foreach (array(1, 3, 5, 10) as $i => $min)
474 $select_autosave->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min*60);
476 $blocks['main']['options']['draft_autosave'] = array(
477 'title' => html::label($field_id, Q(rcube_label('autosavedraft'))),
478 'content' => $select_autosave->show($config['draft_autosave']),
482 if (!isset($no_override['mime_param_folding'])) {
483 $field_id = 'rcmfd_param_folding';
484 $select_param_folding = new html_select(array('name' => '_mime_param_folding', 'id' => $field_id));
485 $select_param_folding->add(rcube_label('2231folding'), 0);
486 $select_param_folding->add(rcube_label('miscfolding'), 1);
487 $select_param_folding->add(rcube_label('2047folding'), 2);
489 $blocks['main']['options']['mime_param_folding'] = array(
491 'title' => html::label($field_id, Q(rcube_label('mimeparamfolding'))),
492 'content' => $select_param_folding->show($config['mime_param_folding']),
496 if (!isset($no_override['force_7bit'])) {
497 $field_id = 'rcmfd_force_7bit';
498 $input_7bit = new html_checkbox(array('name' => '_force_7bit', 'id' => $field_id, 'value' => 1));
500 $blocks['main']['options']['force_7bit'] = array(
501 'title' => html::label($field_id, Q(rcube_label('force7bit'))),
502 'content' => $input_7bit->show($config['force_7bit']?1:0),
506 if (!isset($no_override['mdn_default'])) {
507 $field_id = 'rcmfd_mdn_default';
508 $input_mdn = new html_checkbox(array('name' => '_mdn_default', 'id' => $field_id, 'value' => 1));
510 $blocks['main']['options']['mdn_default'] = array(
511 'title' => html::label($field_id, Q(rcube_label('reqmdn'))),
512 'content' => $input_mdn->show($config['mdn_default']?1:0),
516 if (!isset($no_override['dsn_default'])) {
517 $field_id = 'rcmfd_dsn_default';
518 $input_dsn = new html_checkbox(array('name' => '_dsn_default', 'id' => $field_id, 'value' => 1));
520 $blocks['main']['options']['dsn_default'] = array(
521 'title' => html::label($field_id, Q(rcube_label('reqdsn'))),
522 'content' => $input_dsn->show($config['dsn_default']?1:0),
526 if (!isset($no_override['reply_same_folder'])) {
527 $field_id = 'rcmfd_reply_same_folder';
528 $input_reply_same_folder = new html_checkbox(array('name' => '_reply_same_folder', 'id' => $field_id, 'value' => 1));
530 $blocks['main']['options']['reply_same_folder'] = array(
531 'title' => html::label($field_id, Q(rcube_label('replysamefolder'))),
532 'content' => $input_reply_same_folder->show($config['reply_same_folder']?1:0),
536 if (!isset($no_override['top_posting'])) {
537 $field_id = 'rcmfd_top_posting';
538 $select_replymode = new html_select(array('name' => '_top_posting', 'id' => $field_id, 'onchange' => "\$('#rcmfd_sig_above').attr('disabled',this.selectedIndex==0)"));
539 $select_replymode->add(rcube_label('replybottomposting'), 0);
540 $select_replymode->add(rcube_label('replytopposting'), 1);
542 $blocks['main']['options']['top_posting'] = array(
543 'title' => html::label($field_id, Q(rcube_label('whenreplying'))),
544 'content' => $select_replymode->show($config['top_posting']?1:0),
548 if (!isset($no_override['spellcheck_before_send']) && $config['enable_spellcheck']) {
549 $field_id = 'rcmfd_spellcheck_before_send';
550 $input_spellcheck = new html_checkbox(array('name' => '_spellcheck_before_send', 'id' => $field_id, 'value' => 1));
552 $blocks['main']['options']['spellcheck_before_send'] = array(
553 'title' => html::label($field_id, Q(rcube_label('spellcheckbeforesend'))),
554 'content' => $input_spellcheck->show($config['spellcheck_before_send']?1:0),
558 if (!isset($no_override['show_sig'])) {
559 $field_id = 'rcmfd_show_sig';
560 $select_show_sig = new html_select(array('name' => '_show_sig', 'id' => $field_id));
561 $select_show_sig->add(rcube_label('never'), 0);
562 $select_show_sig->add(rcube_label('always'), 1);
563 $select_show_sig->add(rcube_label('newmessageonly'), 2);
564 $select_show_sig->add(rcube_label('replyandforwardonly'), 3);
566 $blocks['sig']['options']['show_sig'] = array(
567 'title' => html::label($field_id, Q(rcube_label('autoaddsignature'))),
568 'content' => $select_show_sig->show($RCMAIL->config->get('show_sig', 1)),
572 if (!isset($no_override['sig_above'])) {
573 $field_id = 'rcmfd_sig_above';
574 $select_sigabove = new html_select(array('name' => '_sig_above', 'id' => $field_id, 'disabled' => !$config['top_posting']));
575 $select_sigabove->add(rcube_label('belowquote'), 0);
576 $select_sigabove->add(rcube_label('abovequote'), 1);
578 $blocks['sig']['options']['sig_above'] = array(
579 'title' => html::label($field_id, Q(rcube_label('replysignaturepos'))),
580 'content' => $select_sigabove->show($config['sig_above']?1:0),
584 if (!isset($no_override['strip_existing_sig'])) {
585 $field_id = 'rcmfd_strip_existing_sig';
586 $input_stripexistingsig = new html_checkbox(array('name' => '_strip_existing_sig', 'id' => $field_id, 'value' => 1));
588 $blocks['sig']['options']['strip_existing_sig'] = array(
589 'title' => html::label($field_id, Q(rcube_label('replyremovesignature'))),
590 'content' => $input_stripexistingsig->show($config['strip_existing_sig']?1:0),
597 // Addressbook config
601 'main' => array('name' => Q(rcube_label('mainoptions'))),
604 if (!isset($no_override['default_addressbook'])
605 && ($books = $RCMAIL->get_address_sources(true))
607 $field_id = 'rcmfd_default_addressbook';
608 $select_abook = new html_select(array('name' => '_default_addressbook', 'id' => $field_id));
610 foreach ($books as $book) {
611 $select_abook->add($book['name'], $book['id']);
614 $blocks['main']['options']['default_addressbook'] = array(
615 'title' => html::label($field_id, Q(rcube_label('defaultaddressbook'))),
616 'content' => $select_abook->show($config['default_addressbook']),
622 // Special IMAP folders
626 'main' => array('name' => Q(rcube_label('mainoptions'))),
629 // Configure special folders
630 if (!isset($no_override['default_imap_folders'])) {
632 $RCMAIL->imap_connect();
634 // load folders list only when needed
636 $select = rcmail_mailbox_select(array('noselection' => '---', 'realnames' => true,
637 'maxlength' => 30, 'exceptions' => array('INBOX')));
640 $select = new html_select();
642 if (!isset($no_override['drafts_mbox']))
643 $blocks['main']['options']['drafts_mbox'] = array(
644 'title' => Q(rcube_label('drafts')),
645 'content' => $select->show($config['drafts_mbox'], array('name' => "_drafts_mbox")),
648 if (!isset($no_override['sent_mbox']))
649 $blocks['main']['options']['sent_mbox'] = array(
650 'title' => Q(rcube_label('sent')),
651 'content' => $select->show($config['sent_mbox'], array('name' => "_sent_mbox")),
654 if (!isset($no_override['junk_mbox']))
655 $blocks['main']['options']['junk_mbox'] = array(
656 'title' => Q(rcube_label('junk')),
657 'content' => $select->show($config['junk_mbox'], array('name' => "_junk_mbox")),
660 if (!isset($no_override['trash_mbox']))
661 $blocks['main']['options']['trash_mbox'] = array(
662 'title' => Q(rcube_label('trash')),
663 'content' => $select->show($config['trash_mbox'], array('name' => "_trash_mbox")),
673 'main' => array('name' => Q(rcube_label('mainoptions'))),
674 'maintenance' => array('name' => Q(rcube_label('maintenance'))),
677 if (!isset($no_override['read_when_deleted'])) {
678 $field_id = 'rcmfd_read_deleted';
679 $input_readdeleted = new html_checkbox(array('name' => '_read_when_deleted', 'id' => $field_id, 'value' => 1));
681 $blocks['main']['options']['read_when_deleted'] = array(
682 'title' => html::label($field_id, Q(rcube_label('readwhendeleted'))),
683 'content' => $input_readdeleted->show($config['read_when_deleted']?1:0),
687 if (!isset($no_override['flag_for_deletion'])) {
688 $field_id = 'rcmfd_flag_for_deletion';
689 $input_flagfordeletion = new html_checkbox(array('name' => '_flag_for_deletion', 'id' => $field_id, 'value' => 1));
691 $blocks['main']['options']['flag_for_deletion'] = array(
692 'title' => html::label($field_id, Q(rcube_label('flagfordeletion'))),
693 'content' => $input_flagfordeletion->show($config['flag_for_deletion']?1:0),
697 // don't show deleted messages
698 if (!isset($no_override['skip_deleted'])) {
699 $field_id = 'rcmfd_skip_deleted';
700 $input_purge = new html_checkbox(array('name' => '_skip_deleted', 'id' => $field_id, 'value' => 1));
702 $blocks['main']['options']['skip_deleted'] = array(
703 'title' => html::label($field_id, Q(rcube_label('skipdeleted'))),
704 'content' => $input_purge->show($config['skip_deleted']?1:0),
708 if (!isset($no_override['delete_always'])) {
709 $field_id = 'rcmfd_delete_always';
710 $input_delete_always = new html_checkbox(array('name' => '_delete_always', 'id' => $field_id, 'value' => 1));
712 $blocks['main']['options']['delete_always'] = array(
713 'title' => html::label($field_id, Q(rcube_label('deletealways'))),
714 'content' => $input_delete_always->show($config['delete_always']?1:0),
718 // Trash purging on logout
719 if (!isset($no_override['logout_purge'])) {
720 $field_id = 'rcmfd_logout_purge';
721 $input_purge = new html_checkbox(array('name' => '_logout_purge', 'id' => $field_id, 'value' => 1));
723 $blocks['maintenance']['options']['logout_purge'] = array(
724 'title' => html::label($field_id, Q(rcube_label('logoutclear'))),
725 'content' => $input_purge->show($config['logout_purge']?1:0),
729 // INBOX compacting on logout
730 if (!isset($no_override['logout_expunge'])) {
731 $field_id = 'rcmfd_logout_expunge';
732 $input_expunge = new html_checkbox(array('name' => '_logout_expunge', 'id' => $field_id, 'value' => 1));
734 $blocks['maintenance']['options']['logout_expunge'] = array(
735 'title' => html::label($field_id, Q(rcube_label('logoutcompact'))),
736 'content' => $input_expunge->show($config['logout_expunge']?1:0),
743 $data = $RCMAIL->plugins->exec_hook('preferences_list', array('section' => $sect['id'], 'blocks' => $blocks));
747 foreach ($data['blocks'] as $block) {
748 if (!empty($block['content']) || !empty($block['options'])) {
755 unset($sections[$idx]);
757 $sections[$idx]['blocks'] = $data['blocks'];
760 return array($sections, $plugin['cols']);
764 function rcmail_get_skins()
769 $dir = opendir($path);
774 while (($file = readdir($dir)) !== false)
776 $filename = $path.'/'.$file;
777 if (!preg_match('/^\./', $file) && is_dir($filename) && is_readable($filename))
787 function rcmail_folder_options($mailbox)
791 $options = $RCMAIL->imap->mailbox_info($mailbox);
792 $options['protected'] = $options['is_root'] || ($options['special'] && $RCMAIL->config->get('protect_default_folders'));
798 * Updates (or creates) folder row in the subscriptions table
800 * @param string $name Folder name
801 * @param string $oldname Old folder name (for update)
802 * @param bool $subscribe Checks subscription checkbox
803 * @param string $class CSS class name for folder row
805 function rcmail_update_folder_row($name, $oldname=null, $subscribe=false, $class_name=null)
807 global $IMAP, $CONFIG, $OUTPUT;
809 $delimiter = $IMAP->get_hierarchy_delimiter();
810 $name_utf8 = rcube_charset_convert($name, 'UTF7-IMAP');
811 $protected = ($CONFIG['protect_default_folders'] == true && in_array($name, $CONFIG['default_imap_folders']));
813 $foldersplit = explode($delimiter, $IMAP->mod_mailbox($name));
814 $level = count($foldersplit) - 1;
815 $display_name = str_repeat(' ', $level)
816 . Q($protected ? rcmail_localize_foldername($name) : rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP'));
818 if ($oldname === null)
819 $OUTPUT->command('add_folder_row', $name_utf8, $display_name, $protected, $subscribe,
822 $OUTPUT->command('replace_folder_row', rcube_charset_convert($oldname, 'UTF7-IMAP'),
823 $name_utf8, $display_name, $protected, $class_name);
827 // register UI objects
828 $OUTPUT->add_handlers(array(
829 'prefsframe' => 'rcmail_preferences_frame',
830 'sectionslist' => 'rcmail_sections_list',
831 'identitieslist' => 'rcmail_identities_list',
834 // register action aliases
835 $RCMAIL->register_action_map(array(
836 'folders' => 'folders.inc',
837 'rename-folder' => 'folders.inc',
838 'delete-folder' => 'folders.inc',
839 'subscribe' => 'folders.inc',
840 'unsubscribe' => 'folders.inc',
841 'purge' => 'folders.inc',
842 'folder-size' => 'folders.inc',
843 'add-identity' => 'edit_identity.inc',