source: subversion/trunk/roundcubemail/program/steps/settings/edit_prefs.inc @ 5876

Last change on this file since 5876 was 5876, checked in by alec, 16 months ago
  • Added mailto: protocol handler registration link in User Preferences (#1486580)
File size: 2.9 KB
Line 
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 |                                                                       |
10 | Licensed under the GNU General Public License version 3 or            |
11 | any later version with exceptions for skins & plugins.                |
12 | See the README file for a full license statement.                     |
13 |                                                                       |
14 | PURPOSE:                                                              |
15 |   Provide functionality for user's settings & preferences             |
16 |                                                                       |
17 +-----------------------------------------------------------------------+
18 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
19 +-----------------------------------------------------------------------+
20
21 $Id: func.inc 2822 2009-07-31 09:07:54Z alec $
22
23*/
24
25if (!$OUTPUT->ajax_call)
26  $OUTPUT->set_pagetitle(rcube_label('preferences'));
27
28
29$CURR_SECTION = get_input_value('_section', RCUBE_INPUT_GPC);
30list($SECTIONS,) = rcmail_user_prefs($CURR_SECTION);
31
32function rcmail_user_prefs_form($attrib)
33{
34  global $RCMAIL, $CURR_SECTION, $SECTIONS;
35
36  // add some labels to client
37  $RCMAIL->output->add_label('nopagesizewarning');
38
39  unset($attrib['form']);
40
41  list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null,
42    array('name' => '_section', 'value' => $CURR_SECTION));
43
44  $out = $form_start;
45
46  foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $idx => $block) {
47    if (!empty($block['options'])) {
48      $table = new html_table(array('cols' => 2));
49
50      foreach ($block['options'] as $option) {
51        if ($option['advanced'])
52              $table->set_row_attribs('advanced');
53
54        if (isset($option['title'])) {
55          $table->add('title', $option['title']);
56              $table->add(null, $option['content']);
57        }
58        else {
59          $table->add(array('colspan' => 2), $option['content']);
60        }
61      }
62
63      $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $table->show($attrib));
64    }
65    else if (!empty($block['content'])) {
66      $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $block['content']);
67    }
68  }
69
70  return $out . $form_end;
71}
72
73function rcmail_prefs_section_name()
74{
75  global $SECTIONS, $CURR_SECTION;
76 
77  return $SECTIONS[$CURR_SECTION]['section'];
78}
79
80
81// register UI objects
82$OUTPUT->add_handlers(array(
83  'userprefs' => 'rcmail_user_prefs_form',
84  'sectionname' => 'rcmail_prefs_section_name',
85));
86
87$OUTPUT->send('settingsedit');
88
89
Note: See TracBrowser for help on using the repository browser.