4 +-----------------------------------------------------------------------+
5 | program/steps/settings/func.inc |
7 | This file is part of the RoundCube Webmail client |
8 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Provide functionality for user's settings & preferences |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: func.inc 2830 2009-08-03 18:27:53Z alec $
22 if (!$OUTPUT->ajax_call)
23 $OUTPUT->set_pagetitle(rcube_label('preferences'));
25 // define sections list
26 $SECTIONS['general'] = array('id' => 'general', 'section' => rcube_label('uisettings'));
27 $SECTIONS['mailbox'] = array('id' => 'mailbox', 'section' => rcube_label('mailboxview'));
28 $SECTIONS['compose'] = array('id' => 'compose', 'section' => rcube_label('messagescomposition'));
29 $SECTIONS['mailview'] = array('id' => 'mailview','section' => rcube_label('messagesdisplaying'));
30 $SECTIONS['folders'] = array('id' => 'folders', 'section' => rcube_label('specialfolders'));
31 $SECTIONS['server'] = array('id' => 'server', 'section' => rcube_label('serversettings'));
34 // similar function as /steps/settings/identities.inc::rcmail_identity_frame()
35 function rcmail_preferences_frame($attrib)
40 $attrib['id'] = 'rcmprefsframe';
42 $attrib['name'] = $attrib['id'];
44 $OUTPUT->set_env('contentframe', $attrib['name']);
45 $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif');
47 return html::iframe($attrib);
51 function rcmail_sections_list($attrib)
53 global $RCMAIL, $SECTIONS;
55 // add id to message list table if not specified
56 if (!strlen($attrib['id']))
57 $attrib['id'] = 'rcmsectionslist';
59 // hook + define list cols
60 $plugin = $RCMAIL->plugins->exec_hook('list_prefs_sections',
61 array('list' => $SECTIONS, 'cols' => array('section')));
64 $out = rcube_table_output($attrib, $plugin['list'], $plugin['cols'], 'id');
67 $RCMAIL->output->add_gui_object('sectionslist', $attrib['id']);
68 $RCMAIL->output->include_script('list.js');
74 function rcmail_identities_list($attrib)
76 global $OUTPUT, $USER, $RCMAIL;
78 // add id to message list table if not specified
79 if (!strlen($attrib['id']))
80 $attrib['id'] = 'rcmIdentitiesList';
82 // get all identites from DB and define list of cols to be displayed
83 $plugin = $RCMAIL->plugins->exec_hook('list_identities', array(
84 'list' => $USER->list_identities(),
85 'cols' => array('name', 'email')));
88 $out = rcube_table_output($attrib, $plugin['list'], $plugin['cols'], 'identity_id');
91 $OUTPUT->add_gui_object('identitieslist', $attrib['id']);
97 // similar function as in /steps/addressbook/edit.inc
98 function get_form_tags($attrib, $action, $id = null, $hidden = null)
100 global $EDIT_FORM, $RCMAIL;
102 $form_start = $form_end = '';
104 if (empty($EDIT_FORM)) {
105 $request_key = $action . (isset($id) ? '.'.$id : '');
106 $form_start = $RCMAIL->output->request_form(array(
107 'name' => 'form', 'method' => 'post',
108 'task' => $RCMAIL->task, 'action' => $action,
109 'request' => $request_key, 'noclose' => true) + $attrib);
111 if (is_array($hidden)) {
112 $hiddenfields = new html_hiddenfield($hidden);
113 $form_start .= $hiddenfields->show();
116 $form_end = !strlen($attrib['form']) ? '</form>' : '';
118 $EDIT_FORM = !empty($attrib['form']) ? $attrib['form'] : 'form';
119 $RCMAIL->output->add_gui_object('editform', $EDIT_FORM);
122 return array($form_start, $form_end);
126 // register UI objects
127 $OUTPUT->add_handlers(array(
128 'prefsframe' => 'rcmail_preferences_frame',
129 'sectionslist' => 'rcmail_sections_list',
130 'identitieslist' => 'rcmail_identities_list',