commit | author | age
|
f05834
|
1 |
<?php |
A |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/settings/edit_prefs.inc | |
|
6 |
| | |
e019f2
|
7 |
| This file is part of the Roundcube Webmail client | |
A |
8 |
| Copyright (C) 2005-2007, Roundcube Dev. - Switzerland | |
f05834
|
9 |
| Licensed under the GNU GPL | |
A |
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); |
49771b
|
27 |
list($SECTIONS,) = rcmail_user_prefs($CURR_SECTION); |
f05834
|
28 |
|
A |
29 |
function rcmail_user_prefs_form($attrib) |
|
30 |
{ |
49771b
|
31 |
global $RCMAIL, $CURR_SECTION, $SECTIONS; |
f05834
|
32 |
|
A |
33 |
// add some labels to client |
|
34 |
$RCMAIL->output->add_label('nopagesizewarning'); |
|
35 |
|
|
36 |
unset($attrib['form']); |
f8e8af
|
37 |
|
f05834
|
38 |
list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null, |
A |
39 |
array('name' => '_section', 'value' => $CURR_SECTION)); |
|
40 |
|
|
41 |
$out = $form_start; |
|
42 |
|
49771b
|
43 |
foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $idx => $block) { |
f8e8af
|
44 |
if (!empty($block['options'])) { |
f05834
|
45 |
$table = new html_table(array('cols' => 2)); |
A |
46 |
|
|
47 |
foreach ($block['options'] as $option) { |
49771b
|
48 |
if ($option['advanced']) |
f8e8af
|
49 |
$table->set_row_attribs('advanced'); |
A |
50 |
|
f05834
|
51 |
$table->add('title', $option['title']); |
f8e8af
|
52 |
$table->add(null, $option['content']); |
49771b
|
53 |
} |
f8e8af
|
54 |
|
A |
55 |
$out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $table->show($attrib)); |
f05834
|
56 |
} |
f8e8af
|
57 |
else if (!empty($block['content'])) { |
A |
58 |
$out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $block['content']); |
|
59 |
} |
|
60 |
} |
b25dfd
|
61 |
|
49771b
|
62 |
return $out . $form_end; |
f05834
|
63 |
} |
A |
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 |
|
b25dfd
|
81 |
|