]> git.donarmstrong.com Git - roundcube.git/blob - program/steps/settings/edit_prefs.inc
06ae250b35674016d3c67863c0c96330c2817ec0
[roundcube.git] / program / steps / settings / edit_prefs.inc
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 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 ($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     }
58                                                                       
59   return $out . $form_end;
60 }
61
62 function rcmail_prefs_section_name()
63 {
64   global $SECTIONS, $CURR_SECTION;
65   
66   return $SECTIONS[$CURR_SECTION]['section'];
67 }
68
69
70 // register UI objects
71 $OUTPUT->add_handlers(array(
72   'userprefs' => 'rcmail_user_prefs_form',
73   'sectionname' => 'rcmail_prefs_section_name',
74 ));
75
76 $OUTPUT->send('settingsedit');
77
78 ?>