|
+-----------------------------------------------------------------------+
$Id$
*/
if ($USER->ID)
$OUTPUT->set_pagetitle(rcube_label('settingsfor') . " ". $USER->get_username());
function rcmail_user_prefs_form($attrib)
{
global $RCMAIL;
$config = $RCMAIL->config->all();
$no_override = is_array($config['dont_override']) ? array_flip($config['dont_override']) : array();
// add some labels to client
rcube_add_label('nopagesizewarning');
list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs');
unset($attrib['form']);
// allow the following attributes to be added to the
tag
$attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary'));
// return the complete edit form as tables
$out = "$form_start\n$form_end";
return $out;
}
function rcmail_identities_list($attrib)
{
global $OUTPUT, $USER;
// add id to message list table if not specified
if (!strlen($attrib['id']))
$attrib['id'] = 'rcmIdentitiesList';
// define list of cols to be displayed
$a_show_cols = array('name', 'email', 'organization', 'reply-to');
// create XHTML table
$out = rcube_table_output($attrib, $USER->list_identities(), $a_show_cols, 'identity_id');
// set client env
$OUTPUT->add_gui_object('identitieslist', $attrib['id']);
return $out;
}
// similar function as in /steps/addressbook/edit.inc
function get_form_tags($attrib, $action, $add_hidden=array())
{
global $EDIT_FORM, $RCMAIL;
$form_start = '';
if (!strlen($EDIT_FORM))
{
$hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $RCMAIL->task));
$hiddenfields->add(array('name' => '_action', 'value' => $action));
if ($add_hidden)
$hiddenfields->add($add_hidden);
$form_start = !strlen($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : '';
$form_start .= $hiddenfields->show();
}
$form_end = (!strlen($EDIT_FORM) && !strlen($attrib['form'])) ? '' : '';
$form_name = strlen($attrib['form']) ? $attrib['form'] : 'form';
if (!strlen($EDIT_FORM))
$RCMAIL->output->add_gui_object('editform', $form_name);
$EDIT_FORM = $form_name;
return array($form_start, $form_end);
}
// register UI objects
$OUTPUT->add_handlers(array(
'userprefs' => 'rcmail_user_prefs_form',
'identitieslist' => 'rcmail_identities_list',
'itentitieslist' => 'rcmail_identities_list' // keep this for backward compatibility
));
?>