You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

edit_prefs.inc 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. +-----------------------------------------------------------------------+
  4. | program/steps/settings/edit_prefs.inc |
  5. | |
  6. | This file is part of the Roundcube Webmail client |
  7. | Copyright (C) 2005-2013, The Roundcube Dev Team |
  8. | |
  9. | Licensed under the GNU General Public License version 3 or |
  10. | any later version with exceptions for skins & plugins. |
  11. | See the README file for a full license statement. |
  12. | |
  13. | PURPOSE: |
  14. | Provide functionality for user's settings & preferences |
  15. | |
  16. +-----------------------------------------------------------------------+
  17. | Author: Thomas Bruederli <roundcube@gmail.com> |
  18. +-----------------------------------------------------------------------+
  19. */
  20. if (!$OUTPUT->ajax_call) {
  21. $OUTPUT->set_pagetitle($RCMAIL->gettext('preferences'));
  22. }
  23. $CURR_SECTION = rcube_utils::get_input_value('_section', rcube_utils::INPUT_GPC);
  24. list($SECTIONS,) = rcmail_user_prefs($CURR_SECTION);
  25. // register UI objects
  26. $OUTPUT->add_handlers(array(
  27. 'userprefs' => 'rcmail_user_prefs_form',
  28. 'sectionname' => 'rcmail_prefs_section_name',
  29. ));
  30. $OUTPUT->send('settingsedit');
  31. function rcmail_user_prefs_form($attrib)
  32. {
  33. global $RCMAIL, $CURR_SECTION, $SECTIONS;
  34. // add some labels to client
  35. $RCMAIL->output->add_label('nopagesizewarning');
  36. unset($attrib['form']);
  37. list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null,
  38. array('name' => '_section', 'value' => $CURR_SECTION));
  39. $out = $form_start;
  40. if(!empty($SECTIONS[$CURR_SECTION]['header'])) {
  41. $out .= html::div(array('id' => 'preferences-header', 'class' =>'boxcontent'), $SECTIONS[$CURR_SECTION]['header']);
  42. }
  43. foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $class => $block) {
  44. if (!empty($block['options'])) {
  45. $table = new html_table(array('cols' => 2));
  46. foreach ($block['options'] as $option) {
  47. if (isset($option['title'])) {
  48. $table->add('title', $option['title']);
  49. $table->add(null, $option['content']);
  50. }
  51. else {
  52. $table->add(array('colspan' => 2), $option['content']);
  53. }
  54. }
  55. $out .= html::tag('fieldset', $class, 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. return $out . $form_end;
  62. }
  63. function rcmail_prefs_section_name()
  64. {
  65. global $SECTIONS, $CURR_SECTION;
  66. return $SECTIONS[$CURR_SECTION]['section'];
  67. }