|
+-----------------------------------------------------------------------+
$Id: func.inc,v 1.5 2005/10/07 14:37:06 roundcube Exp $
*/
// get user record
$sql_result = $DB->query(sprintf("SELECT username, mail_host FROM %s
WHERE user_id=%d",
get_table_name('users'),
$_SESSION['user_id']));
if ($USER_DATA = $DB->fetch_assoc($sql_result))
$PAGE_TITLE = sprintf('%s %s@%s', rcube_label('settingsfor'), $USER_DATA['username'], $USER_DATA['mail_host']);
function rcmail_user_prefs_form($attrib)
{
global $DB, $CONFIG, $sess_user_lang;
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 table
$out = "$form_start
$form_end";
return $out;
}
function rcmail_identities_list($attrib)
{
global $DB, $CONFIG, $OUTPUT, $JS_OBJECT_NAME;
// get contacts from DB
$sql_result = $DB->query(sprintf("SELECT * FROM %s
WHERE del!='1'
AND user_id=%d
ORDER BY \"default\" DESC, name ASC",
get_table_name('identities'),
$_SESSION['user_id']));
// 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, $sql_result, $a_show_cols, 'identity_id');
// set client env
$javascript = sprintf("%s.gui_object('identitieslist', '%s');\n", $JS_OBJECT_NAME, $attrib['id']);
$OUTPUT->add_script($javascript);
return $out;
}
// similar function as in /steps/addressbook/edit.inc
function get_form_tags($attrib, $action, $add_hidden=array())
{
global $OUTPUT, $JS_OBJECT_NAME, $EDIT_FORM, $SESS_HIDDEN_FIELD;
$form_start = '';
if (!strlen($EDIT_FORM))
{
$hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task']));
$hiddenfields->add(array('name' => '_action', 'value' => $action));
if ($add_hidden)
$hiddenfields->add($add_hidden);
if ($_GET['_framed'] || $_POST['_framed'])
$hiddenfields->add(array('name' => '_framed', 'value' => 1));
$form_start = !strlen($attrib['form']) ? '' : '';
$form_name = strlen($attrib['form']) ? $attrib['form'] : 'form';
if (!strlen($EDIT_FORM))
$OUTPUT->add_script("$JS_OBJECT_NAME.gui_object('editform', '$form_name');");
$EDIT_FORM = $form_name;
return array($form_start, $form_end);
}
?>