| 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, The Roundcube Dev Team | |
|---|
| 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 | list($SECTIONS,) = rcmail_user_prefs($CURR_SECTION); |
|---|
| 28 | |
|---|
| 29 | function rcmail_user_prefs_form($attrib) |
|---|
| 30 | { |
|---|
| 31 | global $RCMAIL, $CURR_SECTION, $SECTIONS; |
|---|
| 32 | |
|---|
| 33 | // add some labels to client |
|---|
| 34 | $RCMAIL->output->add_label('nopagesizewarning'); |
|---|
| 35 | |
|---|
| 36 | unset($attrib['form']); |
|---|
| 37 | |
|---|
| 38 | list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null, |
|---|
| 39 | array('name' => '_section', 'value' => $CURR_SECTION)); |
|---|
| 40 | |
|---|
| 41 | $out = $form_start; |
|---|
| 42 | |
|---|
| 43 | foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $idx => $block) { |
|---|
| 44 | if (!empty($block['options'])) { |
|---|
| 45 | $table = new html_table(array('cols' => 2)); |
|---|
| 46 | |
|---|
| 47 | foreach ($block['options'] as $option) { |
|---|
| 48 | if ($option['advanced']) |
|---|
| 49 | $table->set_row_attribs('advanced'); |
|---|
| 50 | |
|---|
| 51 | $table->add('title', $option['title']); |
|---|
| 52 | $table->add(null, $option['content']); |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $table->show($attrib)); |
|---|
| 56 | } |
|---|
| 57 | else if (!empty($block['content'])) { |
|---|
| 58 | $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $block['content']); |
|---|
| 59 | } |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | return $out . $form_end; |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | function rcmail_prefs_section_name() |
|---|
| 66 | { |
|---|
| 67 | global $SECTIONS, $CURR_SECTION; |
|---|
| 68 | |
|---|
| 69 | return $SECTIONS[$CURR_SECTION]['section']; |
|---|
| 70 | } |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | // register UI objects |
|---|
| 74 | $OUTPUT->add_handlers(array( |
|---|
| 75 | 'userprefs' => 'rcmail_user_prefs_form', |
|---|
| 76 | 'sectionname' => 'rcmail_prefs_section_name', |
|---|
| 77 | )); |
|---|
| 78 | |
|---|
| 79 | $OUTPUT->send('settingsedit'); |
|---|
| 80 | |
|---|
| 81 | |
|---|